reactive-md 0.9.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +34 -0
- package/CHANGELOG.md +34 -0
- package/README-ch.md +7 -7
- package/README-en.md +7 -7
- package/README.md +7 -7
- package/THIRD_PARTY_NOTICES.md +0 -57
- package/cli/help.mjs +6 -4
- package/cli/init.mjs +1 -1
- package/cli/migrate.mjs +1 -1
- package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
- package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
- package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
- package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
- package/dist-library/authoring-Bwu_zCWs.js +768 -0
- package/dist-library/choice-values-BItGjPD2.js +58 -0
- package/dist-library/compile-B35rfzKr.js +1742 -0
- package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
- package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
- package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
- package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
- package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
- package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
- package/dist-library/conditional-branches-CIhJXasR.js +17 -0
- package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
- package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
- package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
- package/dist-library/data-table-CSAkm1eU.js +290 -0
- package/dist-library/data-table-model-DruztQFt.js +391 -0
- package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
- package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
- package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
- package/dist-library/default-options-By16CVw1.js +131 -0
- package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
- package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
- package/dist-library/display-Bb6hAG5T.js +2065 -0
- package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
- package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
- package/dist-library/font-aliases-CKYjwn4o.js +4 -0
- package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
- package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
- package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
- package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
- package/dist-library/layout-CPQggKxk.js +592 -0
- package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
- package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
- package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
- package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
- package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
- package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
- package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
- package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
- package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
- package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
- package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
- package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
- package/dist-library/reactive-md-authoring.js +277 -269
- package/dist-library/reactive-md-build.js +327 -33
- package/dist-library/reactive-md-compiler-session.js +3 -3
- package/dist-library/reactive-md-compiler-standard.js +10 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-contracts.js +4 -4
- package/dist-library/reactive-md-default-packs.js +4 -3
- package/dist-library/reactive-md-default-preset.js +3 -3
- package/dist-library/reactive-md-export.js +6 -6
- package/dist-library/reactive-md-minimal-preset.js +3 -2
- package/dist-library/reactive-md-minimal-react-preset.js +18 -17
- package/dist-library/reactive-md-minimal.css +1 -1
- package/dist-library/reactive-md-observability.js +2 -2
- package/dist-library/reactive-md-pack-style-manifest.js +8 -0
- package/dist-library/reactive-md-plugin-chart.js +13 -9
- 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 +5 -5
- package/dist-library/reactive-md-plugin-gallery.js +3 -3
- package/dist-library/reactive-md-plugin-navigation.js +10 -10
- package/dist-library/reactive-md-plugin-network.js +5 -5
- package/dist-library/reactive-md-plugin-plot.js +4 -4
- package/dist-library/reactive-md-react-component-accordion.js +3 -3
- package/dist-library/reactive-md-react-component-alert.js +3 -3
- package/dist-library/reactive-md-react-component-anchor.js +3 -3
- package/dist-library/reactive-md-react-component-badge.js +3 -3
- package/dist-library/reactive-md-react-component-card.js +3 -3
- package/dist-library/reactive-md-react-component-chart.js +2 -2
- package/dist-library/reactive-md-react-component-checkbox.js +2 -2
- package/dist-library/reactive-md-react-component-checklist.js +2 -2
- package/dist-library/reactive-md-react-component-choices.js +2 -2
- package/dist-library/reactive-md-react-component-column.js +1 -1
- package/dist-library/reactive-md-react-component-coordinate.js +2 -2
- package/dist-library/reactive-md-react-component-counter.js +2 -2
- package/dist-library/reactive-md-react-component-data-table.js +2 -2
- package/dist-library/reactive-md-react-component-date.js +2 -2
- package/dist-library/reactive-md-react-component-diagram.js +2 -2
- package/dist-library/reactive-md-react-component-disclosure.js +3 -3
- package/dist-library/reactive-md-react-component-edge.js +1 -1
- package/dist-library/reactive-md-react-component-else.js +10 -0
- package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
- package/dist-library/reactive-md-react-component-gallery.js +2 -2
- package/dist-library/reactive-md-react-component-grid.js +3 -3
- package/dist-library/reactive-md-react-component-if.js +3 -3
- package/dist-library/reactive-md-react-component-input.js +2 -2
- package/dist-library/reactive-md-react-component-jump.js +3 -3
- package/dist-library/reactive-md-react-component-multi-select.js +2 -2
- package/dist-library/reactive-md-react-component-node.js +2 -2
- package/dist-library/reactive-md-react-component-number.js +2 -2
- package/dist-library/reactive-md-react-component-option.js +1 -1
- package/dist-library/reactive-md-react-component-panel.js +3 -3
- package/dist-library/reactive-md-react-component-plot.js +2 -2
- package/dist-library/reactive-md-react-component-progress.js +2 -2
- package/dist-library/reactive-md-react-component-quiz.js +2 -2
- package/dist-library/reactive-md-react-component-radio-group.js +2 -2
- package/dist-library/reactive-md-react-component-range-slider.js +2 -2
- package/dist-library/reactive-md-react-component-section.js +3 -3
- package/dist-library/reactive-md-react-component-select.js +2 -2
- package/dist-library/reactive-md-react-component-slider.js +2 -2
- package/dist-library/reactive-md-react-component-step.js +3 -3
- package/dist-library/reactive-md-react-component-steps.js +3 -3
- package/dist-library/reactive-md-react-component-tab.js +3 -3
- package/dist-library/reactive-md-react-component-table.js +2 -2
- package/dist-library/reactive-md-react-component-tabs.js +3 -3
- package/dist-library/reactive-md-react-component-text.js +3 -3
- package/dist-library/reactive-md-react-component-textarea.js +2 -2
- package/dist-library/reactive-md-react-component-timeline.js +2 -2
- package/dist-library/reactive-md-react-component-timer.js +2 -2
- package/dist-library/reactive-md-react-component-toggle.js +2 -2
- package/dist-library/reactive-md-react-component-tooltip.js +3 -3
- package/dist-library/reactive-md-react-component-validation.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-pack-controls.js +4 -4
- package/dist-library/reactive-md-react-pack-data.js +3 -3
- package/dist-library/reactive-md-react-pack-layout.js +25 -24
- package/dist-library/reactive-md-react-pack-visuals.js +2 -2
- package/dist-library/reactive-md-react-packed.js +6 -6
- package/dist-library/reactive-md-react-server.js +37 -36
- package/dist-library/reactive-md-react-static-server.js +2 -2
- package/dist-library/reactive-md-react-static.js +1 -1
- package/dist-library/reactive-md-react-unstyled.js +12 -12
- package/dist-library/reactive-md-react.js +12 -12
- package/dist-library/reactive-md-scan.js +1 -1
- package/dist-library/reactive-md-sdk.js +23 -9
- 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 +6 -6
- package/dist-library/reactive-md-vite.js +25 -9
- package/dist-library/reactive-md-worker-pool.js +3 -3
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +52 -43
- package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
- package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
- package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
- package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
- package/dist-library/rmd-pack-layout.css +9 -0
- package/dist-library/rmd-pack-resource-layout.css +9 -0
- package/dist-library/runtime-BHeuLOv_.js +1369 -0
- package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
- package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
- package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
- package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
- package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
- package/dist-library/shareable-CHCDnl6j.js +844 -0
- package/dist-library/types/authoring/catalog.d.ts +3 -1
- package/dist-library/types/authoring/index.d.ts +1 -1
- package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
- package/dist-library/types/components/chart/default-chart.d.ts +7 -0
- package/dist-library/types/components/entries/else.d.ts +3 -0
- package/dist-library/types/components/layout/layout.d.ts +5 -0
- package/dist-library/types/components/shared/visuals.d.ts +1 -1
- package/dist-library/types/components/table/data-table-model.d.ts +95 -2
- package/dist-library/types/components/table/data-table.d.ts +2 -2
- package/dist-library/types/contracts/component-kernel.d.ts +5 -0
- package/dist-library/types/contracts/font-aliases.d.ts +18 -0
- package/dist-library/types/contracts/number-literal.d.ts +2 -0
- package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
- package/dist-library/types/export/index.d.ts +4 -1
- package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
- package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
- package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
- package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
- package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
- package/dist-library/types/local/evaluation/computations.d.ts +13 -5
- package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
- package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
- package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
- package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
- package/dist-library/types/local/evaluation/validation.d.ts +8 -6
- package/dist-library/types/local/index.d.ts +4 -3
- package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
- package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
- package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
- package/dist-library/types/local/runtime/runtime.d.ts +3 -1
- package/dist-library/types/local/runtime/state.d.ts +30 -15
- package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
- package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
- package/dist-library/types/local/source/authoring.d.ts +10 -0
- package/dist-library/types/local/source/source-migration.d.ts +1 -0
- package/dist-library/types/local/types.d.ts +33 -2
- package/dist-library/types/react/component-api.d.ts +21 -2
- package/dist-library/types/react/component-utils.d.ts +11 -0
- package/dist-library/types/react/font-aliases.d.ts +2 -0
- package/dist-library/types/react/package-core.d.ts +3 -0
- package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
- package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
- package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
- package/dist-library/types/react/sdk-core.d.ts +3 -1
- package/dist-library/types/sdk/assembly.d.ts +3 -0
- package/dist-library/types/sdk/font.d.ts +13 -0
- package/dist-library/types/sdk/index.d.ts +1 -0
- package/dist-library/types/sdk/theme.d.ts +5 -0
- package/dist-library/types/sdk/types.d.ts +6 -0
- package/dist-library/types/sdk/version.d.ts +1 -1
- package/dist-library/types/shareable.d.ts +15 -3
- package/dist-library/types/standalone/prepare.d.ts +4 -2
- package/dist-library/types/standalone/session-core.d.ts +4 -1
- package/dist-library/types/vite/index.d.ts +3 -0
- package/dist-library/types/vite/registration.d.ts +1 -0
- package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
- package/dist-library/types-FYhRWRn9.js +3 -0
- package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
- package/dist-library/validation-DRuW0Wl9.js +433 -0
- package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
- package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
- package/dist-library/visuals-7xzoL9ql.js +49340 -0
- package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +128 -368
- package/docs/README-ch.md +3 -1
- package/docs/README.md +3 -1
- package/docs/compatibility/api-stability-ch.md +1 -1
- package/docs/compatibility/api-stability-en.md +1 -1
- package/docs/compatibility/compatibility-ch.md +15 -15
- package/docs/compatibility/compatibility-en.md +15 -15
- package/docs/compatibility/compatibility-manifest.schema.json +3 -2
- package/docs/compatibility/deprecation-ch.md +2 -2
- package/docs/compatibility/deprecation-en.md +2 -2
- package/docs/compatibility/source-versioning-ch.md +22 -14
- package/docs/compatibility/source-versioning-en.md +22 -13
- package/docs/compatibility/support-matrix-ch.md +4 -3
- package/docs/compatibility/support-matrix-en.md +4 -3
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-protocol-ch.md +18 -18
- package/docs/development/component-protocol-en.md +14 -14
- package/docs/guides/local-guide-ch.md +109 -20
- package/docs/guides/local-guide-en.md +109 -20
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +29 -3
- package/docs/integration/extension-sdk-en.md +29 -3
- package/docs/integration/local-integration-ch.md +3 -3
- package/docs/integration/local-integration-en.md +3 -3
- package/docs/integration/pdf-export-ch.md +42 -0
- package/docs/integration/pdf-export-en.md +42 -0
- package/docs/integration/shareable-export-ch.md +11 -19
- package/docs/integration/shareable-export-en.md +11 -19
- package/docs/reference/diagnostics-counting-ch.md +24 -1
- package/docs/reference/diagnostics-counting-en.md +24 -1
- package/docs/reference/local-interaction-syntax-ch.md +222 -33
- package/docs/reference/local-interaction-syntax-en.md +220 -31
- package/docs/reference/public-api-ch.md +24 -18
- package/docs/reference/public-api-en.md +24 -18
- package/docs/reference/theme-protocol-ch.md +1 -1
- package/docs/reference/theme-protocol-en.md +1 -1
- package/docs/releases/release-0.10.0-ch.md +45 -0
- package/docs/releases/release-0.10.0-en.md +45 -0
- package/examples/conformance/README-ch.md +3 -3
- package/examples/conformance/README.md +3 -3
- package/examples/conformance/local-draft-4.json +441 -0
- package/examples/integration/README-ch.md +3 -3
- package/examples/integration/README.md +3 -3
- package/examples/integration/chat-session/package.json +1 -1
- package/examples/local/README-ch.md +1 -1
- package/examples/local/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
- package/dist-library/authoring-B14SsOXZ.js +0 -893
- package/dist-library/compile-D50B5_Ww.js +0 -1249
- package/dist-library/computations-CffoW7Ff.js +0 -340
- package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
- package/dist-library/default-options-DU5dxuU6.js +0 -125
- package/dist-library/layout-BfUzzO2b.js +0 -553
- package/dist-library/runtime-CuJndKqK.js +0 -1289
- package/dist-library/shareable-C6mUerpQ.js +0 -817
- package/dist-library/types-daDo2c_w.js +0 -3
- package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
- package/dist-library/visuals-CoVSjVD8.js +0 -49159
|
@@ -1,817 +0,0 @@
|
|
|
1
|
-
import { f as e } from "./limits-CFERRrlC.js";
|
|
2
|
-
import { v as t } from "./document-theme-DBAfnk7y.js";
|
|
3
|
-
import { t as n } from "./types-daDo2c_w.js";
|
|
4
|
-
import { A as r, O as i, P as a } from "./preset-core-BW3NWZJ9.js";
|
|
5
|
-
import { h as o, l as s, m as c } from "./version-B0G1699c.js";
|
|
6
|
-
import { f as l, l as u, u as d } from "./config-validation-Cpol91_M.js";
|
|
7
|
-
import { a as f, n as p } from "./dist-Cueh1Psp.js";
|
|
8
|
-
import { i as m, s as h } from "./default-config-DIrRpuQz.js";
|
|
9
|
-
import { r as g } from "./default-options-DU5dxuU6.js";
|
|
10
|
-
import { u as _ } from "./component-state-CwKX_SN5.js";
|
|
11
|
-
import { n as v } from "./runtime-CuJndKqK.js";
|
|
12
|
-
import { a as ee, i as y } from "./identity-BUx0Q_-d.js";
|
|
13
|
-
import { r as te } from "./requirements-DhIkxAbl.js";
|
|
14
|
-
import { t as b } from "./resources-B_nbROgj.js";
|
|
15
|
-
// src/local/runtime/state.ts
|
|
16
|
-
var x = "reactive-md-state/v1", S = 1048576, C = /^fnv1a32:[0-9a-f]{8}$/, w = /* @__PURE__ */ new Set([
|
|
17
|
-
"format",
|
|
18
|
-
"syntax",
|
|
19
|
-
"sourceDigest",
|
|
20
|
-
"parameters",
|
|
21
|
-
"generator"
|
|
22
|
-
]), ne = /* @__PURE__ */ new Set(["name", "version"]), re = new TextEncoder();
|
|
23
|
-
function T(n, r) {
|
|
24
|
-
return {
|
|
25
|
-
code: n,
|
|
26
|
-
message: r.length > 2e3 ? `${t(r, e - 1)}…` : r,
|
|
27
|
-
severity: "error",
|
|
28
|
-
range: {
|
|
29
|
-
start: 0,
|
|
30
|
-
end: 0
|
|
31
|
-
},
|
|
32
|
-
line: 1,
|
|
33
|
-
column: 1
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function E(e, t, n) {
|
|
37
|
-
e.length < 100 && e.push(T(t, n));
|
|
38
|
-
}
|
|
39
|
-
function D(e) {
|
|
40
|
-
return e instanceof Error ? e.message : String(e);
|
|
41
|
-
}
|
|
42
|
-
function O(e) {
|
|
43
|
-
for (let t = 0; t < e.length; t += 1) {
|
|
44
|
-
let n = e.charCodeAt(t);
|
|
45
|
-
if (n >= 55296 && n <= 56319) {
|
|
46
|
-
let n = e.charCodeAt(t + 1);
|
|
47
|
-
if (n >= 56320 && n <= 57343) {
|
|
48
|
-
t += 1;
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
return !1;
|
|
52
|
-
}
|
|
53
|
-
if (n >= 56320 && n <= 57343) return !1;
|
|
54
|
-
}
|
|
55
|
-
return !0;
|
|
56
|
-
}
|
|
57
|
-
function k(e) {
|
|
58
|
-
if (typeof e == "string") return O(e) ? {
|
|
59
|
-
ok: !0,
|
|
60
|
-
value: e
|
|
61
|
-
} : {
|
|
62
|
-
ok: !1,
|
|
63
|
-
message: "contains malformed Unicode."
|
|
64
|
-
};
|
|
65
|
-
if (typeof e == "number") return Number.isFinite(e) ? {
|
|
66
|
-
ok: !0,
|
|
67
|
-
value: e
|
|
68
|
-
} : {
|
|
69
|
-
ok: !1,
|
|
70
|
-
message: "must be a finite number."
|
|
71
|
-
};
|
|
72
|
-
if (typeof e == "boolean" || e === null) return {
|
|
73
|
-
ok: !0,
|
|
74
|
-
value: e
|
|
75
|
-
};
|
|
76
|
-
if (Array.isArray(e)) {
|
|
77
|
-
let t = [], n = e.length === 0 ? "string" : typeof e[0];
|
|
78
|
-
for (let r = 0; r < e.length; r += 1) {
|
|
79
|
-
let i = e[r];
|
|
80
|
-
if (n === "string" && typeof i == "string") {
|
|
81
|
-
if (!O(i)) return {
|
|
82
|
-
ok: !1,
|
|
83
|
-
message: "contains malformed Unicode."
|
|
84
|
-
};
|
|
85
|
-
t.push(i);
|
|
86
|
-
} else if (n === "number" && typeof i == "number" && Number.isFinite(i)) t.push(i);
|
|
87
|
-
else return {
|
|
88
|
-
ok: !1,
|
|
89
|
-
message: "must be an array of strings or finite numbers of one kind."
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
ok: !0,
|
|
94
|
-
value: Object.freeze(t)
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
ok: !1,
|
|
99
|
-
message: "must be a string, finite number, boolean, null or homogeneous primitive array."
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function A(e) {
|
|
103
|
-
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
104
|
-
let t = Object.getPrototypeOf(e);
|
|
105
|
-
return t === Object.prototype || t === null;
|
|
106
|
-
}
|
|
107
|
-
function j(e) {
|
|
108
|
-
return Object.freeze(e.parameters), e.generator && Object.freeze(e.generator), Object.freeze(e);
|
|
109
|
-
}
|
|
110
|
-
function M(e) {
|
|
111
|
-
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("generator must be an object with string name and version.");
|
|
112
|
-
if (typeof e.name != "string" || typeof e.version != "string") throw TypeError("generator must have string name and version.");
|
|
113
|
-
if (!O(e.name) || !O(e.version)) throw TypeError("generator name and version must be well-formed Unicode strings.");
|
|
114
|
-
return Object.freeze({
|
|
115
|
-
name: e.name,
|
|
116
|
-
version: e.version
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function N(e) {
|
|
120
|
-
return typeof e == "string" ? `"${e.length > 48 ? `${t(e, 48)}…` : e}"` : e === null ? "null" : Array.isArray(e) ? "an array" : typeof e;
|
|
121
|
-
}
|
|
122
|
-
function P(e, t) {
|
|
123
|
-
return e.length > t ? e.length : re.encode(e).byteLength;
|
|
124
|
-
}
|
|
125
|
-
function ie(e, t) {
|
|
126
|
-
let n;
|
|
127
|
-
try {
|
|
128
|
-
let t = JSON.stringify(e);
|
|
129
|
-
if (typeof t != "string") return null;
|
|
130
|
-
n = t;
|
|
131
|
-
} catch {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
return P(n, t);
|
|
135
|
-
}
|
|
136
|
-
function ae(e) {
|
|
137
|
-
if (e === void 0) return S;
|
|
138
|
-
if (typeof e != "object" || !e) throw TypeError("parseLocalState options must be an object.");
|
|
139
|
-
let { maxLength: t } = e;
|
|
140
|
-
if (t === void 0) return S;
|
|
141
|
-
if (typeof t != "number" || !Number.isSafeInteger(t) || t <= 0) throw RangeError("maxLength must be a finite positive integer.");
|
|
142
|
-
return t;
|
|
143
|
-
}
|
|
144
|
-
function F(e, t, r) {
|
|
145
|
-
if (!e || e.syntax !== "local" || typeof e.source != "string") throw TypeError("createLocalStateFile requires a compiled local document.");
|
|
146
|
-
if (!t || typeof t != "object" || Array.isArray(t)) throw TypeError("createLocalStateFile requires a state object.");
|
|
147
|
-
let i = Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort(), a = new Set(i), o = /* @__PURE__ */ new Map();
|
|
148
|
-
for (let n of Object.keys(t)) {
|
|
149
|
-
if (Object.hasOwn(e.computations ?? {}, n)) continue;
|
|
150
|
-
if (n.startsWith("@")) {
|
|
151
|
-
if (!Object.hasOwn(e.bindings, n)) throw Error(`Cannot persist parameter "${n}": it is not a binding of this document.`);
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
if (!a.has(n)) throw Error(`Cannot persist parameter "${n}": it is not a public binding of this document.`);
|
|
155
|
-
let r = k(t[n]);
|
|
156
|
-
if (!r.ok) throw TypeError(`Cannot persist parameter "${n}": the value ${r.message}`);
|
|
157
|
-
o.set(n, r.value);
|
|
158
|
-
}
|
|
159
|
-
let s = {};
|
|
160
|
-
for (let e of i) {
|
|
161
|
-
if (!o.has(e)) throw Error(`Cannot persist the document: parameter "${e}" is missing from the supplied state.`);
|
|
162
|
-
s[e] = o.get(e);
|
|
163
|
-
}
|
|
164
|
-
let c = {
|
|
165
|
-
format: x,
|
|
166
|
-
syntax: n,
|
|
167
|
-
sourceDigest: y(e.source),
|
|
168
|
-
parameters: s
|
|
169
|
-
};
|
|
170
|
-
return r !== void 0 && (c.generator = M(r)), j(c);
|
|
171
|
-
}
|
|
172
|
-
function oe(e, t) {
|
|
173
|
-
let r = [], i = (e, t) => E(r, e, t), a = e;
|
|
174
|
-
if (typeof e == "string") {
|
|
175
|
-
if (P(e, t) > t) return {
|
|
176
|
-
ok: !1,
|
|
177
|
-
diagnostics: [T("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
178
|
-
};
|
|
179
|
-
if (!O(e)) return {
|
|
180
|
-
ok: !1,
|
|
181
|
-
diagnostics: [T("local.state.utf", "The state payload contains malformed Unicode.")]
|
|
182
|
-
};
|
|
183
|
-
try {
|
|
184
|
-
a = JSON.parse(e);
|
|
185
|
-
} catch (e) {
|
|
186
|
-
return {
|
|
187
|
-
ok: !1,
|
|
188
|
-
diagnostics: [T("local.state.json", `The state payload is not valid JSON: ${D(e)}`)]
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
} else {
|
|
192
|
-
let n = ie(e, t);
|
|
193
|
-
if (n === null) return {
|
|
194
|
-
ok: !1,
|
|
195
|
-
diagnostics: [T("local.state.shape", "The state payload must be a JSON object.")]
|
|
196
|
-
};
|
|
197
|
-
if (n > t) return {
|
|
198
|
-
ok: !1,
|
|
199
|
-
diagnostics: [T("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
if (!A(a)) return {
|
|
203
|
-
ok: !1,
|
|
204
|
-
diagnostics: [T("local.state.shape", "The state payload must be a JSON object.")]
|
|
205
|
-
};
|
|
206
|
-
Object.getOwnPropertySymbols(a).length > 0 && i("local.state.shape", "The state payload cannot use symbol keys.");
|
|
207
|
-
for (let e of Object.keys(a)) w.has(e) || i("local.state.key", `Unknown top-level state key "${e}".`);
|
|
208
|
-
let o = a.format;
|
|
209
|
-
o !== "reactive-md-state/v1" && i("local.state.format", `Unsupported state format ${N(o)}; expected "${x}".`);
|
|
210
|
-
let s = a.syntax;
|
|
211
|
-
s !== "local-draft-3" && i("local.state.syntax", `Unsupported state syntax ${N(s)}; expected "${n}".`);
|
|
212
|
-
let c = a.sourceDigest;
|
|
213
|
-
typeof c == "string" && C.test(c) || i("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
|
|
214
|
-
let l = {}, u = a.parameters;
|
|
215
|
-
if (!A(u)) i("local.state.parameters", "parameters must be a JSON object of public binding values.");
|
|
216
|
-
else for (let e of Object.keys(u).sort()) {
|
|
217
|
-
if (e === "__proto__") {
|
|
218
|
-
i("local.state.parameter.prototype", "Parameter names cannot be \"__proto__\".");
|
|
219
|
-
continue;
|
|
220
|
-
}
|
|
221
|
-
if (e.startsWith("@")) {
|
|
222
|
-
i("local.state.parameter.internal", `Internal parameter "${e}" cannot be persisted.`);
|
|
223
|
-
continue;
|
|
224
|
-
}
|
|
225
|
-
let t = k(u[e]);
|
|
226
|
-
t.ok ? l[e] = t.value : i("local.state.parameter.value", `Parameter "${e}" ${t.message}`);
|
|
227
|
-
}
|
|
228
|
-
let d;
|
|
229
|
-
if (Object.hasOwn(a, "generator")) {
|
|
230
|
-
let e = a.generator;
|
|
231
|
-
if (!A(e)) i("local.state.generator", "generator must be an object with string name and version.");
|
|
232
|
-
else {
|
|
233
|
-
for (let t of Object.keys(e)) ne.has(t) || i("local.state.generator", `generator has unknown key "${t}".`);
|
|
234
|
-
typeof e.name != "string" || typeof e.version != "string" ? i("local.state.generator", "generator must have string name and version.") : !O(e.name) || !O(e.version) ? i("local.state.utf", "generator contains malformed Unicode.") : d = Object.freeze({
|
|
235
|
-
name: e.name,
|
|
236
|
-
version: e.version
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
if (r.length) return {
|
|
241
|
-
ok: !1,
|
|
242
|
-
diagnostics: r
|
|
243
|
-
};
|
|
244
|
-
let f = {
|
|
245
|
-
format: x,
|
|
246
|
-
syntax: n,
|
|
247
|
-
sourceDigest: c,
|
|
248
|
-
parameters: l
|
|
249
|
-
};
|
|
250
|
-
return d && (f.generator = d), {
|
|
251
|
-
ok: !0,
|
|
252
|
-
file: j(f)
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
function I(e, t) {
|
|
256
|
-
let n = ae(t);
|
|
257
|
-
try {
|
|
258
|
-
return oe(e, n);
|
|
259
|
-
} catch (e) {
|
|
260
|
-
return {
|
|
261
|
-
ok: !1,
|
|
262
|
-
diagnostics: [T("local.state.invalid", `Cannot read the local state: ${D(e)}`)]
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
function se(e) {
|
|
267
|
-
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
268
|
-
for (let r of e) t.set(r.id, r), r.children && n(r.children);
|
|
269
|
-
};
|
|
270
|
-
return n(e.nodes), t;
|
|
271
|
-
}
|
|
272
|
-
function ce(e) {
|
|
273
|
-
let t = se(e), n = /* @__PURE__ */ new Map(), r = [];
|
|
274
|
-
for (let [i, a] of Object.entries(e.bindingSlots ?? {})) {
|
|
275
|
-
let e = t.get(i);
|
|
276
|
-
if (!e) continue;
|
|
277
|
-
let o = {
|
|
278
|
-
node: e,
|
|
279
|
-
slots: []
|
|
280
|
-
};
|
|
281
|
-
for (let [t, r] of Object.entries(a)) o.slots.push({
|
|
282
|
-
slot: t,
|
|
283
|
-
key: r
|
|
284
|
-
}), r.startsWith("@") || n.set(r, {
|
|
285
|
-
node: e,
|
|
286
|
-
slot: t
|
|
287
|
-
});
|
|
288
|
-
o.slots.length && r.push(o);
|
|
289
|
-
}
|
|
290
|
-
let i = [];
|
|
291
|
-
for (let [r, a] of Object.entries(e.bindings)) {
|
|
292
|
-
if (r.startsWith("@")) continue;
|
|
293
|
-
let e = n.get(r);
|
|
294
|
-
if (e) {
|
|
295
|
-
i.push({
|
|
296
|
-
key: r,
|
|
297
|
-
binding: a,
|
|
298
|
-
node: e.node,
|
|
299
|
-
slot: e.slot
|
|
300
|
-
});
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
let o = a.owner && t.has(a.owner) ? a.owner : a.nodeIds.find((e) => t.has(e));
|
|
304
|
-
i.push({
|
|
305
|
-
key: r,
|
|
306
|
-
binding: a,
|
|
307
|
-
node: o ? t.get(o) : void 0
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
return {
|
|
311
|
-
plans: i,
|
|
312
|
-
groups: r
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
function L(e, t, n) {
|
|
316
|
-
let r = [], i = Object.create(null);
|
|
317
|
-
for (let a of t.plans) a.slot === void 0 && Object.hasOwn(n, a.key) && (a.node ? Object.is(e.get(a.node), n[a.key]) || (i[a.key] = n[a.key]) : r.push(T("local.state.document", `The document has no component for parameter "${a.key}".`)));
|
|
318
|
-
if (r.length) return r;
|
|
319
|
-
r.push(...e.setParameters(i));
|
|
320
|
-
for (let i of t.groups) {
|
|
321
|
-
let t = {}, a = !1;
|
|
322
|
-
for (let { slot: e, key: r } of i.slots) Object.hasOwn(n, r) && (t[e] = n[r], a = !0);
|
|
323
|
-
a && r.push(...e.setMany(i.node, t));
|
|
324
|
-
}
|
|
325
|
-
return r;
|
|
326
|
-
}
|
|
327
|
-
function le(e, t) {
|
|
328
|
-
let n = e.snapshot(), r = {};
|
|
329
|
-
for (let e of t) {
|
|
330
|
-
let t = n.state[e];
|
|
331
|
-
r[e] = Array.isArray(t) ? Object.freeze([...t]) : t;
|
|
332
|
-
}
|
|
333
|
-
return Object.freeze(r);
|
|
334
|
-
}
|
|
335
|
-
function R(e, t, r, i) {
|
|
336
|
-
let a = I(t, i);
|
|
337
|
-
if (!a.ok) return a;
|
|
338
|
-
if (!e || e.syntax !== "local" || typeof e.source != "string" || !Array.isArray(e.nodes) || !e.bindings) return {
|
|
339
|
-
ok: !1,
|
|
340
|
-
diagnostics: [T("local.state.document", "resolveLocalState requires a compiled local document.")]
|
|
341
|
-
};
|
|
342
|
-
if (a.file.syntax !== "local-draft-3") return {
|
|
343
|
-
ok: !1,
|
|
344
|
-
diagnostics: [T("local.state.syntax", `This state file uses syntax "${a.file.syntax}", but this build accepts "${n}".`)]
|
|
345
|
-
};
|
|
346
|
-
if (a.file.sourceDigest !== y(e.source)) return {
|
|
347
|
-
ok: !1,
|
|
348
|
-
diagnostics: [T("local.state.source", "This state file was created for a different document (source digest mismatch).")]
|
|
349
|
-
};
|
|
350
|
-
let o = ce(e), s = new Set(o.plans.map((e) => e.key)), c = [];
|
|
351
|
-
for (let e of Object.keys(a.file.parameters)) s.has(e) || E(c, "local.state.parameter.unknown", `The state contains unknown parameter "${e}" for this document.`);
|
|
352
|
-
for (let e of s) Object.hasOwn(a.file.parameters, e) || E(c, "local.state.parameter.missing", `The state is missing parameter "${e}".`);
|
|
353
|
-
if (c.length) return {
|
|
354
|
-
ok: !1,
|
|
355
|
-
diagnostics: c
|
|
356
|
-
};
|
|
357
|
-
let l;
|
|
358
|
-
try {
|
|
359
|
-
l = v(e);
|
|
360
|
-
} catch (e) {
|
|
361
|
-
return {
|
|
362
|
-
ok: !1,
|
|
363
|
-
diagnostics: [T("local.state.document", `Cannot validate this document: ${D(e)}`)]
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
try {
|
|
367
|
-
if (r) {
|
|
368
|
-
let e = L(l, o, r);
|
|
369
|
-
if (e.length) return {
|
|
370
|
-
ok: !1,
|
|
371
|
-
diagnostics: e
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
let e = L(l, o, a.file.parameters);
|
|
375
|
-
if (e.length) return {
|
|
376
|
-
ok: !1,
|
|
377
|
-
diagnostics: e
|
|
378
|
-
};
|
|
379
|
-
let t = [...s].sort();
|
|
380
|
-
return {
|
|
381
|
-
ok: !0,
|
|
382
|
-
file: a.file,
|
|
383
|
-
state: le(l, t)
|
|
384
|
-
};
|
|
385
|
-
} finally {
|
|
386
|
-
l.dispose();
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
function z(e, t, n) {
|
|
390
|
-
try {
|
|
391
|
-
return R(e, t, void 0, n);
|
|
392
|
-
} catch (e) {
|
|
393
|
-
return {
|
|
394
|
-
ok: !1,
|
|
395
|
-
diagnostics: [T("local.state.invalid", `Cannot resolve the local state: ${D(e)}`)]
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
function B(e, t, n) {
|
|
400
|
-
let r;
|
|
401
|
-
try {
|
|
402
|
-
r = R(e.document, t, e.snapshot().state, n);
|
|
403
|
-
} catch (e) {
|
|
404
|
-
return [T("local.state.invalid", `Cannot apply the local state: ${D(e)}`)];
|
|
405
|
-
}
|
|
406
|
-
if (!r.ok) return r.diagnostics;
|
|
407
|
-
let i = ce(e.document);
|
|
408
|
-
try {
|
|
409
|
-
return L(e, i, r.state);
|
|
410
|
-
} catch (e) {
|
|
411
|
-
return [T("local.state.invalid", `Cannot apply the local state: ${D(e)}`)];
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
function ue(e, t) {
|
|
415
|
-
return F(e.document, e.getParameters(), t);
|
|
416
|
-
}
|
|
417
|
-
function de(e, t, n) {
|
|
418
|
-
let r = I(t, n);
|
|
419
|
-
return r.ok ? B(e, r.file, n) : r.diagnostics;
|
|
420
|
-
}
|
|
421
|
-
function fe(e) {
|
|
422
|
-
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("serializeLocalState requires a state file.");
|
|
423
|
-
if (!e.parameters || typeof e.parameters != "object" || Array.isArray(e.parameters)) throw TypeError("serializeLocalState requires an object of parameters.");
|
|
424
|
-
let t = Object.create(null);
|
|
425
|
-
for (let n of Object.keys(e.parameters).sort()) {
|
|
426
|
-
if (n === "__proto__" || n.startsWith("@")) throw TypeError(`Cannot serialize parameter "${n}".`);
|
|
427
|
-
let r = k(e.parameters[n]);
|
|
428
|
-
if (!r.ok) throw TypeError(`Cannot serialize parameter "${n}": the value ${r.message}`);
|
|
429
|
-
t[n] = r.value;
|
|
430
|
-
}
|
|
431
|
-
let n = {
|
|
432
|
-
format: e.format,
|
|
433
|
-
syntax: e.syntax,
|
|
434
|
-
sourceDigest: e.sourceDigest,
|
|
435
|
-
parameters: t
|
|
436
|
-
};
|
|
437
|
-
if (e.generator !== void 0) {
|
|
438
|
-
let t = M(e.generator);
|
|
439
|
-
n.generator = {
|
|
440
|
-
name: t.name,
|
|
441
|
-
version: t.version
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
return JSON.stringify(n);
|
|
445
|
-
}
|
|
446
|
-
// src/local/configuration/portable-options.ts
|
|
447
|
-
function V(e) {
|
|
448
|
-
if (e === void 0) return;
|
|
449
|
-
let t = g(e);
|
|
450
|
-
if (!t.ok) throw TypeError(`Invalid portable compile options: ${t.message}`);
|
|
451
|
-
return {
|
|
452
|
-
enableCss: t.html.enableCss,
|
|
453
|
-
enableJavaScript: t.html.enableJavaScript,
|
|
454
|
-
enableExtendedHtml: t.html.enableExtendedHtml,
|
|
455
|
-
...Object.hasOwn(e, "strict") && e.strict !== void 0 ? { strict: t.strict } : {},
|
|
456
|
-
...e.markdownBreaks === void 0 ? {} : { markdownBreaks: t.markdownBreaks },
|
|
457
|
-
...e.config === void 0 ? t.hostComponents.length ? { hostComponents: t.hostComponents } : {} : { config: h(e.config) },
|
|
458
|
-
...e.limits === void 0 ? {} : { limits: {
|
|
459
|
-
...e.limits.maxSyntaxNodes === void 0 ? {} : { maxSyntaxNodes: t.maxSyntaxNodes },
|
|
460
|
-
...e.limits.maxParseWork === void 0 ? {} : { maxParseWork: t.maxParseWork },
|
|
461
|
-
...e.limits.maxMarkdownDepth === void 0 ? {} : { maxMarkdownDepth: t.maxMarkdownDepth },
|
|
462
|
-
...e.limits.maxRawBodyChars === void 0 ? {} : { maxRawBodyChars: t.maxRawBodyChars }
|
|
463
|
-
} }
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
// src/export/restoration.ts
|
|
467
|
-
var pe = a;
|
|
468
|
-
function H(e) {
|
|
469
|
-
return a(JSON.stringify([
|
|
470
|
-
e.id,
|
|
471
|
-
e.name,
|
|
472
|
-
e.version,
|
|
473
|
-
e.protocol,
|
|
474
|
-
e.colorSchemes,
|
|
475
|
-
e.css.map(({ id: e, css: t }) => [e, t])
|
|
476
|
-
]));
|
|
477
|
-
}
|
|
478
|
-
function me(e, t) {
|
|
479
|
-
let n = h(t), r = u(n);
|
|
480
|
-
return Object.freeze({
|
|
481
|
-
protocol: "reactive-md-bundle/v1",
|
|
482
|
-
sdkVersion: s,
|
|
483
|
-
configKey: n.key,
|
|
484
|
-
scriptDigest: a(e),
|
|
485
|
-
assembly: r,
|
|
486
|
-
seal: d(n),
|
|
487
|
-
themes: Object.freeze(n.themes.map((e) => Object.freeze({
|
|
488
|
-
id: e.id,
|
|
489
|
-
name: e.name,
|
|
490
|
-
version: e.version,
|
|
491
|
-
digest: H(e)
|
|
492
|
-
})))
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
function U(e, t, n, r = []) {
|
|
496
|
-
let o = h(t), c = /* @__PURE__ */ new Set(), l = [...e.nodes];
|
|
497
|
-
for (; l.length;) {
|
|
498
|
-
let e = l.pop();
|
|
499
|
-
(e.type === "component" || e.type === "hostComponent") && e.name && c.add(e.name), e.children && l.push(...e.children);
|
|
500
|
-
}
|
|
501
|
-
let d = o.registry.filter((e) => c.has(e.name)).map((e) => Object.freeze({
|
|
502
|
-
id: e.id,
|
|
503
|
-
name: e.name,
|
|
504
|
-
version: e.version,
|
|
505
|
-
range: e.version,
|
|
506
|
-
digest: i(e)
|
|
507
|
-
})).sort((e, t) => e.id.localeCompare(t.id)), f = o.themes.filter((t) => t.name === e.theme).map((e) => Object.freeze({
|
|
508
|
-
id: e.id,
|
|
509
|
-
name: e.name,
|
|
510
|
-
version: e.version,
|
|
511
|
-
digest: H(e)
|
|
512
|
-
}));
|
|
513
|
-
return Object.freeze({
|
|
514
|
-
protocol: "reactive-md-restore/v1",
|
|
515
|
-
sdk: `^${s}`,
|
|
516
|
-
configKey: o.key,
|
|
517
|
-
sourceDigest: a(e.source),
|
|
518
|
-
target: n,
|
|
519
|
-
components: Object.freeze(d),
|
|
520
|
-
themes: Object.freeze(f),
|
|
521
|
-
assembly: u(o),
|
|
522
|
-
resources: Object.freeze(r.map((e) => Object.freeze({
|
|
523
|
-
id: e.id,
|
|
524
|
-
digest: a(e.css)
|
|
525
|
-
})))
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
function W(e) {
|
|
529
|
-
return typeof e == "object" && !!e && !Array.isArray(e) && [Object.prototype, null].includes(Object.getPrototypeOf(e));
|
|
530
|
-
}
|
|
531
|
-
function G(e) {
|
|
532
|
-
return typeof e == "string" && e.length > 0 && e.length <= 256;
|
|
533
|
-
}
|
|
534
|
-
function K(e, t) {
|
|
535
|
-
if (e === void 0) return [];
|
|
536
|
-
let n = [], u = (e, t) => n.push({
|
|
537
|
-
code: `local.extension.restore-${e}`,
|
|
538
|
-
message: t,
|
|
539
|
-
severity: "error",
|
|
540
|
-
range: {
|
|
541
|
-
start: 0,
|
|
542
|
-
end: 0
|
|
543
|
-
},
|
|
544
|
-
line: 1,
|
|
545
|
-
column: 1
|
|
546
|
-
});
|
|
547
|
-
try {
|
|
548
|
-
if (!W(e) || r(e) > 262144 || e.protocol !== "reactive-md-restore/v1" || !G(e.sdk) || !G(e.configKey) || !G(e.sourceDigest) || ![
|
|
549
|
-
"static",
|
|
550
|
-
"ssr",
|
|
551
|
-
"offline"
|
|
552
|
-
].includes(e.target) || !Array.isArray(e.components) || e.components.length > 192 || !Array.isArray(e.themes) || e.themes.length > 16 || !Array.isArray(e.resources) || e.resources.length > 128) return u("metadata", "Invalid or oversized restoration requirements."), n;
|
|
553
|
-
let d = /* @__PURE__ */ new Set([
|
|
554
|
-
"protocol",
|
|
555
|
-
"sdk",
|
|
556
|
-
"configKey",
|
|
557
|
-
"sourceDigest",
|
|
558
|
-
"target",
|
|
559
|
-
"components",
|
|
560
|
-
"themes",
|
|
561
|
-
"resources",
|
|
562
|
-
"assembly"
|
|
563
|
-
]);
|
|
564
|
-
Object.keys(e).some((e) => !d.has(e)) && u("metadata", "Unknown restoration requirement field.");
|
|
565
|
-
let f = t.config === void 0 ? m() : h(t.config);
|
|
566
|
-
o(e.sdk) && c("0.7.0", e.sdk) || u("sdk", `SDK ${s} does not satisfy ${e.sdk}.`), l(f, e.configKey) || u("config", "The installed configuration differs from the exported configuration."), e.assembly !== void 0 && (W(e.assembly) && e.assembly.protocol === "reactive-md-assembly-seal/v1" && G(e.assembly.configKey) && l(f, e.assembly.configKey) || u("assembly", "The exported assembly identity is invalid or belongs to another configuration.")), a(t.source) !== e.sourceDigest && u("source", "The source differs from the exported source. Recompile before restoring state.");
|
|
567
|
-
let p = /* @__PURE__ */ new Set();
|
|
568
|
-
for (let t of e.components) {
|
|
569
|
-
if (!W(t) || ![
|
|
570
|
-
"id",
|
|
571
|
-
"name",
|
|
572
|
-
"version",
|
|
573
|
-
"range",
|
|
574
|
-
"digest"
|
|
575
|
-
].every((e) => G(t[e])) || !o(t.range) || p.has(t.id)) {
|
|
576
|
-
u("metadata", "Invalid or duplicate component restoration requirement.");
|
|
577
|
-
continue;
|
|
578
|
-
}
|
|
579
|
-
p.add(t.id);
|
|
580
|
-
let n = f.registry.find((e) => e.id === t.id);
|
|
581
|
-
if (!n) {
|
|
582
|
-
u("component-missing", `Required component ${t.id}@${t.version} is not installed.`);
|
|
583
|
-
continue;
|
|
584
|
-
}
|
|
585
|
-
c(n.version, t.range) || u("version", `Component ${t.id}@${n.version} does not satisfy ${t.range}.`), (n.version !== t.version || n.name !== t.name || i(n) !== t.digest) && u("contract", `Component ${t.id}@${t.version} differs from the installed contract. Recompile and validate state before upgrading.`);
|
|
586
|
-
let r = e.target === "offline" ? [
|
|
587
|
-
"interactive",
|
|
588
|
-
"static",
|
|
589
|
-
"offline"
|
|
590
|
-
] : [e.target];
|
|
591
|
-
for (let e of r) n.capabilities[e] || u("capability", `Component ${t.id} cannot render ${e}.`);
|
|
592
|
-
}
|
|
593
|
-
if (t.document) {
|
|
594
|
-
let n = U(t.document, f, e.target);
|
|
595
|
-
for (let e of n.components) p.has(e.id) || u("component-missing", `Used component ${e.id} is missing from restoration requirements.`);
|
|
596
|
-
}
|
|
597
|
-
p.clear();
|
|
598
|
-
for (let t of e.themes) {
|
|
599
|
-
if (!W(t) || ![
|
|
600
|
-
"id",
|
|
601
|
-
"name",
|
|
602
|
-
"version",
|
|
603
|
-
"digest"
|
|
604
|
-
].every((e) => G(t[e])) || p.has(t.id)) {
|
|
605
|
-
u("metadata", "Invalid or duplicate theme restoration requirement.");
|
|
606
|
-
continue;
|
|
607
|
-
}
|
|
608
|
-
p.add(t.id);
|
|
609
|
-
let e = f.themes.find((e) => e.id === t.id);
|
|
610
|
-
e && e.name === t.name && e.version === t.version && H(e) === t.digest || u("theme", `Required theme ${t.id}@${t.version} does not match the installed theme.`);
|
|
611
|
-
}
|
|
612
|
-
if (t.document) {
|
|
613
|
-
let e = f.themes.find((e) => e.name === t.document.theme);
|
|
614
|
-
e && !p.has(e.id) && u("theme", `Selected theme ${e.id} is missing from restoration requirements.`);
|
|
615
|
-
}
|
|
616
|
-
let g = b(t.resources ?? []);
|
|
617
|
-
n.push(...g.diagnostics);
|
|
618
|
-
let _ = new Map(g.resources.map((e) => [e.id, e.css]));
|
|
619
|
-
p.clear();
|
|
620
|
-
for (let t of e.resources) {
|
|
621
|
-
if (!W(t) || !G(t.id) || !G(t.digest) || p.has(t.id)) {
|
|
622
|
-
u("metadata", "Invalid or duplicate style restoration requirement.");
|
|
623
|
-
continue;
|
|
624
|
-
}
|
|
625
|
-
p.add(t.id);
|
|
626
|
-
let e = _.get(t.id);
|
|
627
|
-
e === void 0 ? u("resource-missing", `Required style resource ${t.id} is missing before state restoration.`) : a(e) !== t.digest && u("resource-digest", `Style resource ${t.id} differs from the exported content.`);
|
|
628
|
-
}
|
|
629
|
-
if (t.document) {
|
|
630
|
-
let n = U(t.document, f, e.target), r = new Set(n.components.map((e) => e.id)), i = f.registry.filter((e) => r.has(e.id)).flatMap((e) => e.styles ?? []);
|
|
631
|
-
i.push(...f.themes.filter((e) => e.name === t.document.theme).flatMap((e) => e.css.map((e) => e.id)));
|
|
632
|
-
for (let e of i) p.has(e) && _.has(e) || u("resource-missing", `Used style resource ${e} is required before state restoration.`);
|
|
633
|
-
}
|
|
634
|
-
} catch (e) {
|
|
635
|
-
u("metadata", e instanceof Error ? e.message : String(e));
|
|
636
|
-
}
|
|
637
|
-
return n;
|
|
638
|
-
}
|
|
639
|
-
// src/shareable.ts
|
|
640
|
-
var q = "reactive-md-html/v1", J = "reactive-md-html/v2", he = /^[A-Za-z][A-Za-z0-9_-]*$/, ge = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/, _e = /^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/, ve = /[\u0000-\u001f\u007f-\u009f]/, Y = 64, ye = 41943040, be = 4096;
|
|
641
|
-
function X(e, t = !1) {
|
|
642
|
-
let n = e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
643
|
-
return t && (n = n.replace(/"/g, """).replace(/'/g, "'")), n;
|
|
644
|
-
}
|
|
645
|
-
function xe(e) {
|
|
646
|
-
return e.replace(/<\/style/gi, "<\\/style");
|
|
647
|
-
}
|
|
648
|
-
function Se(e) {
|
|
649
|
-
return e.replace(/<\/script/gi, "<\\/script").replace(/<!--/g, "<\\!--");
|
|
650
|
-
}
|
|
651
|
-
function Z(e) {
|
|
652
|
-
return X(e, !0);
|
|
653
|
-
}
|
|
654
|
-
function Q(e) {
|
|
655
|
-
let t = JSON.stringify(e);
|
|
656
|
-
if (typeof t != "string") throw TypeError("Cannot serialize a non-JSON value for an inline script.");
|
|
657
|
-
return t.replace(/[<>&\u2028\u2029]/g, (e) => {
|
|
658
|
-
switch (e) {
|
|
659
|
-
case "<": return "\\u003c";
|
|
660
|
-
case ">": return "\\u003e";
|
|
661
|
-
case "&": return "\\u0026";
|
|
662
|
-
case "\u2028": return "\\u2028";
|
|
663
|
-
default: return "\\u2029";
|
|
664
|
-
}
|
|
665
|
-
});
|
|
666
|
-
}
|
|
667
|
-
function $(e) {
|
|
668
|
-
return Array.isArray(e) ? e.slice() : e;
|
|
669
|
-
}
|
|
670
|
-
function Ce(e) {
|
|
671
|
-
try {
|
|
672
|
-
return V(e);
|
|
673
|
-
} catch (e) {
|
|
674
|
-
throw TypeError(`createShareableHtml received invalid compileOptions: ${e instanceof Error ? e.message : String(e)}`);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
function we(e, t) {
|
|
678
|
-
let n = t.enableExtendedHtml ? "frame-src about: data: blob:" : "frame-src 'none'", r = e ? "script-src 'unsafe-inline'" + (t.enableJavaScript ? " 'wasm-unsafe-eval'" : "") : "script-src 'none'", i = e && t.enableJavaScript ? "worker-src blob:" : "worker-src 'none'";
|
|
679
|
-
return `default-src 'none'; img-src data:; style-src 'unsafe-inline'; ${r}; font-src data:; ${e ? "connect-src 'none'; media-src 'none'; " : ""}object-src 'none'; ${n}; ${i}; base-uri 'none'; form-action 'none'`;
|
|
680
|
-
}
|
|
681
|
-
function Te(e, t) {
|
|
682
|
-
if (t.enableCss && t.enableExtendedHtml || !/data-(?:rmd-(?:snapshot|author)-css|extended-html)/i.test(e)) return;
|
|
683
|
-
let n = [...p(e).childNodes];
|
|
684
|
-
for (; n.length;) {
|
|
685
|
-
let e = n.pop();
|
|
686
|
-
if (f.isElementNode(e)) {
|
|
687
|
-
for (let { name: n, value: r } of e.attrs) {
|
|
688
|
-
if (!t.enableCss && (n === "data-rmd-snapshot-css" || e.tagName === "style" && n === "data-rmd-author-css")) throw TypeError("Render staticMarkup with author CSS disabled before exporting with enableCss: false.");
|
|
689
|
-
if (!t.enableExtendedHtml && n === "data-extended-html" && (r === "direct" || r === "sandbox")) throw TypeError("Render staticMarkup with Extended HTML disabled before exporting with enableExtendedHtml: false.");
|
|
690
|
-
}
|
|
691
|
-
for (let t of e.childNodes) n.push(t);
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
function Ee(e) {
|
|
696
|
-
if (e === void 0) return;
|
|
697
|
-
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("images must be an object mapping relative URLs to data: image URLs.");
|
|
698
|
-
let t = Object.entries(e);
|
|
699
|
-
if (t.length > Y) throw RangeError(`images cannot contain more than ${Y} entries.`);
|
|
700
|
-
let n = 0;
|
|
701
|
-
for (let [e, r] of t) {
|
|
702
|
-
if (!e || e.length > be || ve.test(e) || e === "__proto__") throw TypeError("Every image key must be a bounded, control-free URL.");
|
|
703
|
-
if (typeof r != "string" || !_e.test(r)) throw TypeError(`The image map for "${e}" must contain a base64 PNG, JPEG, GIF or WebP data URL.`);
|
|
704
|
-
if (n += r.length, n > ye) throw RangeError("The embedded image map exceeds the 40 MiB budget.");
|
|
705
|
-
}
|
|
706
|
-
return Object.fromEntries(t);
|
|
707
|
-
}
|
|
708
|
-
function De(e, t) {
|
|
709
|
-
let n = z(e, t);
|
|
710
|
-
if (!n.ok) return n;
|
|
711
|
-
let r = {};
|
|
712
|
-
for (let [t, i] of Object.entries(e.bindings)) r[t] = Object.hasOwn(n.state, t) ? {
|
|
713
|
-
...i,
|
|
714
|
-
initial: $(n.state[t])
|
|
715
|
-
} : i;
|
|
716
|
-
let i = { ...e.initialState };
|
|
717
|
-
for (let [e, t] of Object.entries(n.state)) i[e] = $(t);
|
|
718
|
-
return {
|
|
719
|
-
ok: !0,
|
|
720
|
-
baseline: {
|
|
721
|
-
document: {
|
|
722
|
-
...e,
|
|
723
|
-
bindings: r,
|
|
724
|
-
initialState: i
|
|
725
|
-
},
|
|
726
|
-
state: n.state
|
|
727
|
-
}
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
var Oe = "\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";
|
|
731
|
-
function ke(e) {
|
|
732
|
-
let t = e.targetId ?? "reactive-md-document";
|
|
733
|
-
if (!he.test(t)) throw TypeError("targetId must start with a letter and contain only letters, digits, underscores or hyphens.");
|
|
734
|
-
let n = e.mode === "static" ? "static" : "interactive";
|
|
735
|
-
if (!e.staticMarkup.trim()) throw TypeError("createShareableHtml requires rendered document markup.");
|
|
736
|
-
if (!e.css.trim()) throw TypeError("createShareableHtml requires the document stylesheet.");
|
|
737
|
-
if (e.state.sourceDigest !== y(e.source)) throw Error("The state file does not belong to the exported source.");
|
|
738
|
-
if (n === "interactive" && !e.runtimeScript?.trim()) throw TypeError("Interactive HTML requires the standalone runtime script.");
|
|
739
|
-
let r = Ce(e.compileOptions), i = te(e.extensions, r?.config);
|
|
740
|
-
if (i.push(...K(e.restoration, {
|
|
741
|
-
config: r?.config,
|
|
742
|
-
source: e.source,
|
|
743
|
-
resources: e.resources
|
|
744
|
-
})), i.length) throw TypeError(i.map((e) => e.message).join(" "));
|
|
745
|
-
let a = g(r);
|
|
746
|
-
if (!a.ok) throw TypeError(`createShareableHtml received invalid compileOptions: ${a.message}`);
|
|
747
|
-
Te(e.staticMarkup, a.html);
|
|
748
|
-
let o = e.documentId === void 0 ? void 0 : ee(e.documentId);
|
|
749
|
-
if (e.documentId !== void 0 && o === void 0) throw TypeError("createShareableHtml received an invalid documentId.");
|
|
750
|
-
let s;
|
|
751
|
-
if (e.randomSeed !== void 0) {
|
|
752
|
-
if (!Number.isInteger(e.randomSeed) || e.randomSeed < 0 || e.randomSeed > 4294967295) throw TypeError("createShareableHtml received an invalid randomSeed; expected a 32-bit unsigned integer.");
|
|
753
|
-
s = e.randomSeed;
|
|
754
|
-
}
|
|
755
|
-
let c;
|
|
756
|
-
if (e.componentState !== void 0) {
|
|
757
|
-
let t = _(e.componentState);
|
|
758
|
-
if (!t.ok || t.diagnostics.length > 0) {
|
|
759
|
-
let e = t.diagnostics.map((e) => e.message).join(" ");
|
|
760
|
-
throw TypeError(`createShareableHtml received an invalid component state${e ? `: ${e}` : "."}`);
|
|
761
|
-
}
|
|
762
|
-
c = t.document;
|
|
763
|
-
}
|
|
764
|
-
let l = e.locale === "zh" ? "zh" : "en", u = l === "zh" ? "zh-CN" : "en", d = e.colorScheme === "light" || e.colorScheme === "dark" ? e.colorScheme : "auto", f = e.assets === "omit" ? "omit" : "inline", p = e.generator ?? {
|
|
765
|
-
name: "reactive-md",
|
|
766
|
-
version: "unknown"
|
|
767
|
-
}, m = Ee(e.images), h = Number.isSafeInteger(e.imageCount) && (e.imageCount ?? 0) > 0 ? String(e.imageCount) : String(Object.keys(m ?? {}).length), v = n === "interactive", b = {
|
|
768
|
-
version: e.restoration ? 2 : 1,
|
|
769
|
-
sourceSemantics: "mixed-rmd-v1",
|
|
770
|
-
target: t,
|
|
771
|
-
source: e.source,
|
|
772
|
-
state: e.state,
|
|
773
|
-
locale: l,
|
|
774
|
-
colorScheme: d,
|
|
775
|
-
hydrate: !0,
|
|
776
|
-
compileOptions: {
|
|
777
|
-
...r,
|
|
778
|
-
...a.html
|
|
779
|
-
},
|
|
780
|
-
...e.extensions === void 0 ? {} : { extensions: e.extensions },
|
|
781
|
-
...e.restoration === void 0 ? {} : {
|
|
782
|
-
restoration: e.restoration,
|
|
783
|
-
resources: e.resources ?? []
|
|
784
|
-
},
|
|
785
|
-
...m ? { images: m } : {},
|
|
786
|
-
...o === void 0 ? {} : { documentId: o },
|
|
787
|
-
...s === void 0 ? {} : { randomSeed: s },
|
|
788
|
-
...c === void 0 ? {} : { componentState: c }
|
|
789
|
-
}, x = we(v, a.html), S = v ? `<script type="application/reactive-md+json" data-reactive-md-auto>${Q(b)}<\/script>
|
|
790
|
-
<script>${Se(e.runtimeScript)}<\/script>` : "", C = e.notices?.trim() ? `<template id="reactive-md-notices"><pre>${X(e.notices)}</pre></template>` : "", w = !v && e.extensions ? `<template id="reactive-md-extensions">${X(JSON.stringify(e.extensions))}</template>` : "";
|
|
791
|
-
return `<!doctype html>
|
|
792
|
-
<html lang="${X(ge.test(u) ? u : "en", !0)}">
|
|
793
|
-
<head>
|
|
794
|
-
<meta charset="utf-8">
|
|
795
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
796
|
-
<meta name="referrer" content="no-referrer">
|
|
797
|
-
<meta http-equiv="Content-Security-Policy" content="${Z(x)}">
|
|
798
|
-
<meta name="generator" content="${Z(`${p.name} ${p.version}`)}">
|
|
799
|
-
<meta name="reactive-md-html-format" content="${e.restoration ? J : q}">
|
|
800
|
-
<meta name="reactive-md-syntax" content="${Z(e.state.syntax)}">
|
|
801
|
-
<meta name="reactive-md-output" content="${n}">
|
|
802
|
-
<meta name="reactive-md-state" content="${Z(e.state.sourceDigest)}">
|
|
803
|
-
<meta name="reactive-md-images" content="${f}">
|
|
804
|
-
<meta name="reactive-md-image-count" content="${h}">
|
|
805
|
-
<title>${X(e.title || "Reactive MD document")}</title>
|
|
806
|
-
<style>${xe(e.css)}${Oe}</style>
|
|
807
|
-
</head>
|
|
808
|
-
<body class="reactive-md-export">
|
|
809
|
-
<div id="${t}" class="reactive-md-export-root">${e.staticMarkup}</div>
|
|
810
|
-
${S}
|
|
811
|
-
${w}
|
|
812
|
-
${C}
|
|
813
|
-
</body>
|
|
814
|
-
</html>
|
|
815
|
-
`;
|
|
816
|
-
}
|
|
817
|
-
export { I as _, Q as a, pe as c, V as d, x as f, de as g, ue as h, De as i, H as l, F as m, J as n, me as o, B as p, ke as r, U as s, q as t, K as u, z as v, fe as y };
|