reactive-md 0.8.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 +54 -4
- package/CHANGELOG.md +55 -4
- package/CONTRIBUTING-ch.md +13 -2
- package/CONTRIBUTING.md +13 -2
- package/README-ch.md +132 -23
- package/README-en.md +130 -21
- package/README.md +128 -21
- package/SECURITY-ch.md +3 -3
- package/SECURITY.md +3 -3
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/cli/args.mjs +51 -1
- package/cli/assets.mjs +6 -1
- package/cli/build.mjs +125 -9
- package/cli/fs-utils.mjs +3 -3
- package/cli/help.mjs +12 -5
- package/cli/init.mjs +1 -1
- package/cli/package.mjs +1 -0
- package/dist-library/LocalDocumentView-sthUP0ct.js +109 -0
- package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
- package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
- package/dist-library/{authoring-BsfSwQRm.js → authoring-Dsune4Hy.js} +240 -218
- package/dist-library/compile-wUv8KEge.js +1249 -0
- package/dist-library/{compiler-core-kPiH-gOV.js → compiler-core-As_m-MNm.js} +5372 -5559
- package/dist-library/compiler-eOfcinZs.js +62 -0
- package/dist-library/component-state-BoLCGee4.js +801 -0
- package/dist-library/{component-state-D_cw_EHe.js → component-state-C52ZFJGl.js} +2 -2
- package/dist-library/{registry-B9Jc3FVe.js → config-BadfhjdP.js} +374 -457
- package/dist-library/{config-validation-DXTynAw7.js → config-validation-F47AcE6o.js} +549 -751
- package/dist-library/controls-CcT6n7k_.js +6740 -0
- package/dist-library/coordinate-CWS9p5q_.js +293 -0
- package/dist-library/data-table-Bgccxd7h.js +296 -0
- package/dist-library/{default-components-Z_YMio5P.js → default-components-BwQf0oP-.js} +344 -334
- package/dist-library/{math-display-BJz4gbFc.js → display-B-VhqVND.js} +1299 -1299
- package/dist-library/export-BqVmTXm8.js +369 -0
- package/dist-library/gallery-CY6mTx8i.js +360 -0
- package/dist-library/html-CNT4KD-2.js +757 -0
- package/dist-library/{math-sample-BGEW49zY.js → incremental-Dv0FSp_U.js} +476 -394
- package/dist-library/latex-1w7aQgD5.js +928 -0
- package/dist-library/layout-C0YlEPGr.js +562 -0
- package/dist-library/mount-preset-KxvtKgJb.js +13 -0
- package/dist-library/options-1aDLK7JY.js +121 -0
- package/dist-library/{react-ByOHunUW.js → package-core-WFK1RhAZ.js} +49 -55
- package/dist-library/{parser-standard-DlCk7sLo.js → parser-standard-Yuf3A_VI.js} +6605 -7097
- package/dist-library/plugin-packs-B1XPWcFs.js +18 -0
- package/dist-library/{identity-MYJXKSkB.js → preset-core-CKc5YXSM.js} +31 -31
- package/dist-library/{props-DGlBk0e5.js → props-sJ8vk0cr.js} +1 -1
- package/dist-library/react-BbyAgeXc.js +6070 -0
- package/dist-library/react-D5iGiUdL.js +7 -0
- package/dist-library/reactive-md-authoring.js +222 -223
- package/dist-library/reactive-md-build.js +126 -72
- package/dist-library/reactive-md-compiler-standard.js +12 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-default-packs.js +2 -2
- package/dist-library/reactive-md-default-preset.js +4 -4
- package/dist-library/reactive-md-export-assets.js +57 -0
- package/dist-library/reactive-md-export.js +5 -111
- package/dist-library/reactive-md-minimal-preset.js +24 -0
- package/dist-library/reactive-md-minimal-react-preset.js +26 -0
- package/dist-library/reactive-md-minimal-styles.js +80 -0
- package/dist-library/reactive-md-minimal.css +2 -0
- package/dist-library/reactive-md-pdf.js +7582 -0
- package/dist-library/reactive-md-plugin-chart.js +13 -0
- package/dist-library/reactive-md-plugin-data.js +17 -0
- package/dist-library/reactive-md-plugin-diagram.js +18 -0
- package/dist-library/reactive-md-plugin-forms.js +18 -0
- package/dist-library/reactive-md-plugin-gallery.js +12 -0
- package/dist-library/reactive-md-plugin-navigation.js +15 -0
- package/dist-library/reactive-md-plugin-network.js +222 -0
- package/dist-library/reactive-md-plugin-plot.js +24 -0
- package/dist-library/reactive-md-print.css +5 -0
- package/dist-library/reactive-md-react-minimal.js +28 -0
- package/dist-library/reactive-md-react-server.js +34 -32
- package/dist-library/reactive-md-react-unstyled.js +14 -9
- package/dist-library/reactive-md-react.js +14 -9
- package/dist-library/reactive-md-runtime-browser.js +847 -15
- package/dist-library/reactive-md-runtime.js +3 -3
- package/dist-library/reactive-md-sdk.js +8 -6
- package/dist-library/reactive-md-standalone-configured.js +16 -0
- package/dist-library/reactive-md-standalone-host.js +9 -438
- package/dist-library/reactive-md-testing-browser.js +5 -4
- package/dist-library/reactive-md-testing-react.js +46 -44
- package/dist-library/reactive-md-testing.js +45 -44
- package/dist-library/reactive-md-vite.js +135 -37
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +590 -498
- package/dist-library/registry-B9NGct4d.js +20 -0
- package/dist-library/registry-core-Bbad9Bm2.js +479 -0
- package/dist-library/{resources-BGt8mpDA.js → resources-D2GDQS0p.js} +45 -45
- package/dist-library/{runtime-Dkq7ldyg.js → runtime-B2fxeveq.js} +1 -1
- package/dist-library/runtime-kcA7bG7G.js +1282 -0
- package/dist-library/sample-bP4zHB3L.js +289 -0
- package/dist-library/{schema-ZFufO8V0.js → schema-BufhKUSM.js} +12 -11
- package/dist-library/sdk-core-BoJT1SIt.js +1166 -0
- package/dist-library/session-core-nmJHuR9c.js +452 -0
- package/dist-library/{shareable-DDVL4Fi9.js → shareable-DpbE-59H.js} +250 -283
- package/dist-library/tooltip-layer-HDLrSWs0.js +28 -0
- package/dist-library/types/authoring/catalog.d.ts +2 -3
- package/dist-library/types/authoring/editor-i18n.d.ts +1 -1
- package/dist-library/types/authoring/index.d.ts +1 -1
- package/dist-library/types/authoring/insert.d.ts +1 -1
- package/dist-library/types/authoring/templates.d.ts +2 -2
- package/dist-library/types/build/diagnostics.d.ts +1 -1
- package/dist-library/types/build/host.d.ts +1 -1
- package/dist-library/types/build/index.d.ts +1 -1
- package/dist-library/types/build/notices.d.ts +1 -1
- package/dist-library/types/build/resources.d.ts +1 -1
- package/dist-library/types/build/vite.d.ts +1 -1
- package/dist-library/types/compiler/index.d.ts +2 -2
- package/dist-library/types/compiler/result.d.ts +1 -1
- package/dist-library/types/compiler/standard.d.ts +2 -2
- package/dist-library/types/compiler/types.d.ts +1 -1
- package/dist-library/types/components/{controls.d.ts → controls/controls.d.ts} +2 -3
- package/dist-library/types/components/{numeric-sliders.d.ts → controls/numeric-sliders.d.ts} +1 -1
- package/dist-library/types/components/{gallery.d.ts → gallery/gallery.d.ts} +1 -1
- package/dist-library/types/components/{layout.d.ts → layout/layout.d.ts} +1 -1
- package/dist-library/types/components/minimal-preset.d.ts +2 -0
- package/dist-library/types/components/mount-preset.d.ts +4 -0
- package/dist-library/types/components/network/submit-button.d.ts +10 -0
- package/dist-library/types/components/plot/coordinate.d.ts +2 -0
- package/dist-library/types/components/plugins/chart.d.ts +2 -0
- package/dist-library/types/components/plugins/data.d.ts +2 -0
- package/dist-library/types/components/plugins/diagram.d.ts +2 -0
- package/dist-library/types/components/plugins/forms.d.ts +2 -0
- package/dist-library/types/components/plugins/gallery.d.ts +2 -0
- package/dist-library/types/components/plugins/navigation.d.ts +2 -0
- package/dist-library/types/components/plugins/network.d.ts +2 -0
- package/dist-library/types/components/plugins/plot.d.ts +2 -0
- package/dist-library/types/components/shared/visual-frame.d.ts +12 -0
- package/dist-library/types/components/{visuals.d.ts → shared/visuals.d.ts} +1 -7
- package/dist-library/types/components/{data-table.d.ts → table/data-table.d.ts} +2 -2
- package/dist-library/types/export/component-state.d.ts +1 -1
- package/dist-library/types/export/index.d.ts +2 -1
- package/dist-library/types/export/print-document.d.ts +18 -0
- package/dist-library/types/export/render-markup.d.ts +23 -0
- package/dist-library/types/export/requirements.d.ts +1 -1
- package/dist-library/types/export/resources.d.ts +1 -1
- package/dist-library/types/export/restoration.d.ts +1 -1
- package/dist-library/types/export-assets/index.d.ts +25 -0
- package/dist-library/types/local/compilation/compiler-attributes.d.ts +8 -0
- package/dist-library/types/local/compilation/compiler-bindings.d.ts +19 -0
- 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-declarations.d.ts +32 -0
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +32 -0
- package/dist-library/types/local/compilation/compiler-services.d.ts +62 -16
- package/dist-library/types/local/compilation/compiler-structure.d.ts +38 -3
- package/dist-library/types/local/compilation/compiler-tables.d.ts +30 -0
- package/dist-library/types/local/compilation/compiler-validation.d.ts +15 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +39 -1
- package/dist-library/types/local/compilation/compiler.d.ts +7 -14
- package/dist-library/types/local/compilation/dependencies.d.ts +1 -1
- package/dist-library/types/local/compilation/session/incremental.d.ts +75 -0
- package/dist-library/types/local/{session → compilation/session}/row-reuse.d.ts +1 -1
- package/dist-library/types/local/{session/compiler-cache.d.ts → compilation/session/semantic-cache.d.ts} +5 -19
- 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/{compilation → configuration}/component-kernel.d.ts +3 -79
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +1104 -1056
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +731 -0
- package/dist-library/types/local/configuration/diagnostics.d.ts +1 -1
- package/dist-library/types/local/configuration/kernel-value-rules.d.ts +66 -0
- package/dist-library/types/local/configuration/official-leaf-syntax.d.ts +24 -0
- package/dist-library/types/local/configuration/options-core.d.ts +5 -4
- package/dist-library/types/local/configuration/options.d.ts +2 -1
- package/dist-library/types/local/configuration/portable-options.d.ts +1 -1
- package/dist-library/types/local/configuration/schema-core.d.ts +1 -1
- package/dist-library/types/local/configuration/schema.d.ts +1 -1
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/evaluation/computations.d.ts +2 -2
- package/dist-library/types/local/evaluation/expression/compile.d.ts +30 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -0
- package/dist-library/types/local/evaluation/expression/inference.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +72 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +56 -0
- package/dist-library/types/local/evaluation/{math-display.d.ts → math/display.d.ts} +2 -2
- package/dist-library/types/local/evaluation/math/evaluation.d.ts +10 -0
- package/dist-library/types/local/evaluation/{math.d.ts → math/latex.d.ts} +58 -17
- package/dist-library/types/local/evaluation/{math-sample.d.ts → math/sample.d.ts} +4 -2
- package/dist-library/types/local/evaluation/math/syntax.d.ts +72 -0
- package/dist-library/types/local/evaluation/validation.d.ts +1 -1
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html-details.d.ts +1 -1
- package/dist-library/types/local/html/html-entities.d.ts +11 -2
- package/dist-library/types/local/html/html-recovery.d.ts +1 -1
- package/dist-library/types/local/html/html-table.d.ts +1 -1
- package/dist-library/types/local/html/html.d.ts +40 -4
- package/dist-library/types/local/index.d.ts +14 -13
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/{markdown → parsing}/fast-markdown.d.ts +1 -1
- package/dist-library/types/local/{markdown → parsing}/footnotes.d.ts +1 -1
- package/dist-library/types/local/{markdown → parsing}/heading-anchors.d.ts +1 -1
- package/dist-library/types/local/parsing/html-attributes.d.ts +14 -0
- package/dist-library/types/local/parsing/parse-budget.d.ts +1 -1
- package/dist-library/types/local/{session → parsing}/parse-session.d.ts +5 -5
- package/dist-library/types/local/parsing/parser-capabilities.d.ts +7 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +26 -0
- package/dist-library/types/local/parsing/parser-core.d.ts +10 -4
- package/dist-library/types/local/parsing/parser-internals.d.ts +54 -0
- package/dist-library/types/local/parsing/parser-region.d.ts +46 -0
- package/dist-library/types/local/parsing/parser-standard.d.ts +3 -0
- package/dist-library/types/local/parsing/parser-tags.d.ts +108 -0
- package/dist-library/types/local/parsing/parser.d.ts +3 -3
- package/dist-library/types/local/{markdown → parsing}/plain-paragraphs.d.ts +1 -1
- package/dist-library/types/local/parsing/rmd-recovery.d.ts +1 -1
- package/dist-library/types/local/parsing/theme-declaration.d.ts +22 -0
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentView.d.ts +5 -0
- package/dist-library/types/local/rendering/{LocalDocumentView.d.ts → document/LocalDocumentViewCore.d.ts} +48 -9
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +6 -0
- package/dist-library/types/local/rendering/document/render-nodes.d.ts +24 -0
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/use-color-scheme.d.ts +10 -0
- package/dist-library/types/local/rendering/document/validation-state.d.ts +31 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +146 -0
- package/dist-library/types/local/rendering/{view-revision.d.ts → document/view-revision.d.ts} +31 -4
- package/dist-library/types/local/rendering/render-types.d.ts +1 -1
- package/dist-library/types/local/{widgets/table-surface.d.ts → rendering/table/data-table.d.ts} +3 -0
- package/dist-library/types/local/rendering/table/table-numeric-columns.d.ts +7 -0
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/runtime/retention.d.ts +1 -1
- package/dist-library/types/local/runtime/runtime-document.d.ts +71 -0
- package/dist-library/types/local/runtime/runtime-migration.d.ts +19 -0
- package/dist-library/types/local/runtime/runtime-values.d.ts +39 -0
- package/dist-library/types/local/runtime/runtime.d.ts +4 -2
- package/dist-library/types/local/runtime/state.d.ts +1 -1
- package/dist-library/types/local/source/authoring-syntax.d.ts +48 -0
- package/dist-library/types/local/source/authoring.d.ts +1 -1
- package/dist-library/types/local/source/source-context.d.ts +23 -0
- package/dist-library/types/local/source/source-migration.d.ts +2 -2
- package/dist-library/types/local/transport/compile-patch.d.ts +1 -1
- package/dist-library/types/local/transport/flat-compiled-data.d.ts +1 -1
- package/dist-library/types/local/transport/shared-data.d.ts +1 -1
- package/dist-library/types/local/transport/worker-handler.d.ts +30 -0
- package/dist-library/types/local/transport/worker-job.d.ts +28 -0
- package/dist-library/types/local/transport/worker.d.ts +32 -46
- package/dist-library/types/local/{contracts/types.d.ts → types.d.ts} +78 -21
- package/dist-library/types/pdf.d.ts +22 -0
- package/dist-library/types/presets/identity.d.ts +1 -0
- package/dist-library/types/presets/minimal.d.ts +2 -0
- package/dist-library/types/presets/plugin-packs.d.ts +1 -0
- package/dist-library/types/react/component-api.d.ts +20 -4
- package/dist-library/types/react/component-primitives.d.ts +10 -10
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/index.d.ts +6 -5
- package/dist-library/types/{local/theme/i18n.d.ts → react/localization.d.ts} +2 -2
- package/dist-library/types/react/minimal.d.ts +13 -0
- package/dist-library/types/react/package-core.d.ts +67 -0
- package/dist-library/types/react/package.d.ts +3 -67
- package/dist-library/types/react/runtime/common.d.ts +1 -1
- package/dist-library/types/react/sdk-core.d.ts +115 -0
- package/dist-library/types/react/sdk.d.ts +4 -110
- package/dist-library/types/react/server.d.ts +2 -2
- package/dist-library/types/react/use-draft-field.d.ts +5 -1
- package/dist-library/types/runtime-services/browser/duplex.d.ts +163 -0
- package/dist-library/types/runtime-services/browser/http-sse.d.ts +117 -0
- package/dist-library/types/runtime-services/browser/index.d.ts +2 -1
- package/dist-library/types/runtime-services/component-state.d.ts +1 -1
- package/dist-library/types/runtime-services/index.d.ts +2 -0
- package/dist-library/types/runtime-services/network.d.ts +86 -0
- package/dist-library/types/runtime-services/runtime.d.ts +1 -1
- package/dist-library/types/sdk/config.d.ts +1 -1
- package/dist-library/types/sdk/index.d.ts +1 -0
- package/dist-library/types/sdk/props.d.ts +1 -1
- package/dist-library/types/sdk/registry-core.d.ts +1 -1
- package/dist-library/types/sdk/theme.d.ts +5 -4
- package/dist-library/types/sdk/types.d.ts +2 -2
- package/dist-library/types/shareable.d.ts +6 -5
- package/dist-library/types/standalone/diagnostics.d.ts +1 -1
- package/dist-library/types/standalone/host.d.ts +5 -0
- package/dist-library/types/standalone/payload.d.ts +1 -1
- package/dist-library/types/standalone/prepare.d.ts +2 -2
- package/dist-library/types/standalone/session-core.d.ts +68 -0
- package/dist-library/types/standalone/session.d.ts +6 -68
- package/dist-library/types/themes/contract.d.ts +7 -0
- package/dist-library/types/{local/theme/theme.d.ts → themes/document-theme.d.ts} +4 -3
- package/dist-library/types/vite/client.d.ts +19 -0
- package/dist-library/types/vite/index.d.ts +18 -3
- package/dist-library/types/vite/registration.d.ts +2 -2
- package/dist-library/{types-BFCrMrg0.js → types-BeNtPqdY.js} +1 -1
- package/dist-library/validation-BEBA_HvS.js +1121 -0
- package/dist-library/visual-frame-CyV1FXzs.js +48 -0
- package/dist-library/visuals-B5KSafVk.js +3 -0
- package/dist-library/visuals-BZbZYA7w.js +72572 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +146 -137
- package/docs/README-ch.md +16 -11
- package/docs/README.md +16 -11
- package/docs/compatibility/compatibility-ch.md +8 -8
- package/docs/compatibility/compatibility-en.md +8 -8
- 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 +4 -4
- package/docs/development/component-development-reference-en.md +4 -4
- package/docs/development/component-protocol-ch.md +14 -14
- package/docs/development/component-protocol-en.md +14 -14
- package/docs/development/extension-tutorial-ch.md +308 -0
- package/docs/development/extension-tutorial-en.md +308 -0
- package/docs/development/local-module-layout-ch.md +10 -50
- package/docs/development/local-module-layout-en.md +9 -49
- package/docs/development/performance-overview-ch.md +174 -154
- package/docs/development/performance-overview-en.md +174 -154
- package/docs/guides/local-guide-ch.md +2 -2
- package/docs/guides/local-guide-en.md +2 -2
- package/docs/integration/author-tools-ch.md +2 -2
- package/docs/integration/author-tools-en.md +2 -2
- package/docs/integration/compiler-ch.md +4 -2
- package/docs/integration/compiler-en.md +4 -2
- package/docs/integration/directory-discovery-ch.md +5 -1
- package/docs/integration/directory-discovery-en.md +5 -1
- package/docs/integration/editor-ch.md +35 -5
- package/docs/integration/editor-en.md +42 -4
- package/docs/integration/extension-sdk-ch.md +6 -4
- package/docs/integration/extension-sdk-en.md +6 -4
- package/docs/integration/local-integration-ch.md +201 -19
- package/docs/integration/local-integration-en.md +194 -18
- package/docs/integration/network-host-ch.md +75 -0
- package/docs/integration/network-host-en.md +75 -0
- package/docs/integration/shareable-export-ch.md +58 -16
- package/docs/integration/shareable-export-en.md +57 -15
- package/docs/reference/html-compatibility-ch.md +20 -67
- package/docs/reference/html-compatibility-en.md +19 -64
- package/docs/reference/local-interaction-syntax-ch.md +199 -26
- package/docs/reference/local-interaction-syntax-en.md +194 -27
- package/docs/reference/public-api-ch.md +416 -0
- package/docs/reference/public-api-en.md +416 -0
- package/docs/reference/theme-protocol-ch.md +27 -8
- package/docs/reference/theme-protocol-en.md +46 -8
- package/docs/releases/release-0.4.0-ch.md +2 -2
- package/docs/releases/release-0.4.0-en.md +2 -2
- package/docs/releases/release-0.8.0-ch.md +19 -3
- package/docs/releases/release-0.8.0-en.md +19 -3
- package/docs/releases/release-0.9.0-ch.md +44 -0
- package/docs/releases/release-0.9.0-en.md +44 -0
- 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/conformance/README-ch.md +3 -3
- package/examples/conformance/README.md +3 -3
- package/examples/game-2048-package/README-ch.md +3 -9
- package/examples/game-2048-package/README.md +8 -12
- 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/local/README-ch.md +3 -3
- package/examples/local/README.md +2 -2
- package/examples/local/minimal-budget.reactive.md +48 -0
- package/examples/minimal-extension/README-ch.md +78 -0
- package/examples/minimal-extension/README.md +78 -0
- package/examples/minimal-extension/index.html +15 -0
- package/examples/minimal-extension/package.json +26 -0
- package/examples/minimal-extension/sample/document.reactive.md +10 -0
- package/examples/minimal-extension/scripts/build.mjs +32 -0
- package/examples/minimal-extension/scripts/export.mjs +72 -0
- package/examples/minimal-extension/scripts/test-node.mjs +75 -0
- package/examples/minimal-extension/src/extension.tsx +90 -0
- package/examples/minimal-extension/src/preview.tsx +12 -0
- package/examples/minimal-extension/src/source.ts +4 -0
- package/examples/minimal-extension/tsconfig.json +14 -0
- package/examples/network-survey/README.md +200 -0
- package/examples/network-survey/index.html +49 -0
- package/examples/network-survey/package.json +26 -0
- package/examples/network-survey/sample/document.reactive.md +51 -0
- package/examples/network-survey/src/components.tsx +325 -0
- package/examples/network-survey/src/host.ts +316 -0
- package/examples/network-survey/src/main.tsx +91 -0
- package/examples/network-survey/src/source.ts +1 -0
- package/examples/network-survey/tsconfig.json +26 -0
- package/examples/network-survey/vite.config.ts +227 -0
- package/examples/sci-fi-theme/README-ch.md +4 -2
- package/examples/sci-fi-theme/README.md +4 -2
- package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -0
- package/examples/sci-fi-theme/demo/demo.css +129 -23
- package/examples/sci-fi-theme/demo/document.reactive.md +27 -6
- package/examples/sci-fi-theme/demo/main.tsx +45 -10
- package/examples/sci-fi-theme/docs/design-system-ch.md +6 -6
- package/examples/sci-fi-theme/package.json +2 -1
- package/examples/sci-fi-theme/src/components.css +1064 -154
- package/examples/sci-fi-theme/src/notch.css +142 -0
- package/examples/sci-fi-theme/src/sci-fi.css +3 -1
- package/examples/sci-fi-theme/src/theme.ts +2 -0
- package/examples/sci-fi-theme/src/tokens.css +512 -408
- package/examples/tetris-package/README-ch.md +4 -4
- package/examples/tetris-package/README.md +4 -4
- package/package.json +70 -3
- package/dist-library/LocalDocumentView-6trX7xJc.js +0 -97920
- package/dist-library/compiler--ea2CKQF.js +0 -61
- package/dist-library/component-state-Cq2K5gkS.js +0 -490
- package/dist-library/options-CX5m5n-J.js +0 -115
- package/dist-library/runtime-C-sbfpOX.js +0 -1157
- package/dist-library/types/local/contracts/locale.d.ts +0 -1
- package/dist-library/types/local/contracts/version.d.ts +0 -2
- package/dist-library/types/local/evaluation/dates.d.ts +0 -2
- package/dist-library/types/local/evaluation/expression.d.ts +0 -47
- package/dist-library/types/local/markdown/markdown-structure.d.ts +0 -3
- package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +0 -36
- package/dist-library/types/local/session/incremental.d.ts +0 -48
- package/dist-library/types/local/source/node-walk.d.ts +0 -3
- package/dist-library/types/local/source/text-length.d.ts +0 -13
- package/dist-library/types/local/theme/theme-name.d.ts +0 -3
- package/dist-library/types/local/widgets/visuals.d.ts +0 -25
- package/dist-library/types/react/default-theme.d.ts +0 -6
- package/dist-library/validation-W-bmny-x.js +0 -2253
- package/docs/development/releasing-ch.md +0 -12
- package/docs/development/releasing-en.md +0 -12
- package/docs/integration/codemirror-ch.md +0 -52
- package/docs/integration/codemirror-en.md +0 -29
- package/docs/integration/repository-split-ch.md +0 -40
- package/docs/integration/repository-split-en.md +0 -23
- package/docs/reference/computations-formatting-ch.md +0 -89
- package/docs/reference/computations-formatting-en.md +0 -89
- package/docs/reference/constraints-collections-ch.md +0 -104
- package/docs/reference/constraints-collections-en.md +0 -104
- package/docs/reference/local-components-v2-ch.md +0 -140
- package/docs/reference/local-components-v2-en.md +0 -106
- package/docs/reference/tolerance-ch.md +0 -64
- package/docs/reference/tolerance-en.md +0 -57
- /package/dist-library/types/components/{chart-motion.d.ts → chart/chart-motion.d.ts} +0 -0
- /package/dist-library/types/components/{default-chart-types.d.ts → chart/default-chart-types.d.ts} +0 -0
- /package/dist-library/types/components/{default-chart.d.ts → chart/default-chart.d.ts} +0 -0
- /package/dist-library/types/components/{diagram-inspector.d.ts → diagram/diagram-inspector.d.ts} +0 -0
- /package/dist-library/types/{local/widgets/diagram-layout.d.ts → components/diagram/layout.d.ts} +0 -0
- /package/dist-library/types/components/{mafs-plot-grid.d.ts → plot/mafs-plot-grid.d.ts} +0 -0
- /package/dist-library/types/components/{mafs-visuals.d.ts → plot/mafs-visuals.d.ts} +0 -0
- /package/dist-library/types/components/{use-hydrated.d.ts → shared/use-hydrated.d.ts} +0 -0
- /package/dist-library/types/local/{theme/colors.d.ts → configuration/color-values.d.ts} +0 -0
- /package/dist-library/types/local/evaluation/{collection-functions.d.ts → expression/collection-functions.d.ts} +0 -0
- /package/dist-library/types/local/evaluation/{data-functions.d.ts → expression/data-functions.d.ts} +0 -0
- /package/dist-library/types/local/evaluation/{formatting.d.ts → expression/formatting.d.ts} +0 -0
- /package/dist-library/types/local/{markdown → parsing}/markdown-blocks.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering/code}/code-block.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering/code}/code-languages.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering/image}/image-view.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering}/math-view.d.ts +0 -0
|
@@ -1,14 +1,205 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { r as e } from "./latex-1w7aQgD5.js";
|
|
2
|
+
import "./preset-core-CKc5YXSM.js";
|
|
3
|
+
import { t } from "./compile-wUv8KEge.js";
|
|
4
|
+
import { d as n, f as r } from "./compiler-core-As_m-MNm.js";
|
|
5
|
+
import { n as i } from "./display-B-VhqVND.js";
|
|
6
|
+
import { i as a, n as o, r as s } from "./parser-standard-Yuf3A_VI.js";
|
|
7
|
+
import { s as c } from "./config-BadfhjdP.js";
|
|
8
|
+
import { r as l, t as u } from "./options-1aDLK7JY.js";
|
|
9
|
+
import { n as d } from "./compiler-eOfcinZs.js";
|
|
10
|
+
import { c as f, r as p } from "./schema-BufhKUSM.js";
|
|
11
|
+
function m(e, t) {
|
|
12
|
+
if (typeof t != "string" || t.length > 1e6) return !0;
|
|
13
|
+
if (e.severity !== "error") return !1;
|
|
14
|
+
let n = e.code, r = (e) => n === e || n.startsWith(`${e}.`);
|
|
15
|
+
return r("local.options") || r("local.budget") || r("local.version") || r("local.html") || r("local.parse") || r("local.security") || r("local.config") || r("local.registry") || r("local.capability");
|
|
16
|
+
}
|
|
17
|
+
function h(e, t) {
|
|
18
|
+
let n = e.filter((e) => !m(e, t)), r = [];
|
|
19
|
+
for (let i of e) m(i, t) && (i.code === "local.html" && n.some((e) => e.range.start === i.range.start && e.range.end === i.range.end) ? n.push(i) : r.push(i));
|
|
20
|
+
return {
|
|
21
|
+
definite: r,
|
|
22
|
+
transient: n
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function g(e) {
|
|
26
|
+
return `${e.code}:${e.range.start}:${e.range.end}`;
|
|
27
|
+
}
|
|
28
|
+
function _(e, t) {
|
|
29
|
+
return e.range.start - t.range.start || e.range.end - t.range.end || e.line - t.line || e.column - t.column || (e.code < t.code ? -1 : +(e.code > t.code));
|
|
30
|
+
}
|
|
31
|
+
function v(e) {
|
|
32
|
+
let t = /* @__PURE__ */ new Map();
|
|
33
|
+
for (let n of e) for (let e of n) {
|
|
34
|
+
let n = g(e);
|
|
35
|
+
t.has(n) || t.set(n, e);
|
|
36
|
+
}
|
|
37
|
+
return [...t.values()].sort(_);
|
|
38
|
+
}
|
|
39
|
+
function y(e, t) {
|
|
40
|
+
let n = t.filter((e) => e.code !== "local.author.unclosed"), r = t.filter((e) => e.code === "local.author.unclosed"), i = new Set(n.map(g));
|
|
41
|
+
return {
|
|
42
|
+
diagnostics: n,
|
|
43
|
+
transientDiagnostics: v([...e, r]).filter((e) => !i.has(g(e)))
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function b(e, t) {
|
|
47
|
+
if (e.length !== t.length) return !1;
|
|
48
|
+
for (let n = 0; n < e.length; n += 1) if (e[n].start !== t[n].start || e[n].end !== t[n].end) return !1;
|
|
49
|
+
return !0;
|
|
50
|
+
}
|
|
51
|
+
function x(e, t) {
|
|
52
|
+
return e.length === 1 && e[0].start === 0 && e[0].end === t;
|
|
53
|
+
}
|
|
54
|
+
function S(e, t, n) {
|
|
55
|
+
for (let r of e) if (r.range.start <= t && r.range.end >= n) return r;
|
|
56
|
+
}
|
|
57
|
+
function C(e, t, n) {
|
|
58
|
+
let r = t.length, i = Math.max(0, Math.min(r, e.range.start)), a = S(n, i, Math.max(i, Math.min(r, e.range.end)));
|
|
59
|
+
if (a) return {
|
|
60
|
+
start: a.range.start,
|
|
61
|
+
end: a.range.end
|
|
62
|
+
};
|
|
63
|
+
let o = i;
|
|
64
|
+
for (; o > 0 && t[o - 1] !== "\n";) --o;
|
|
65
|
+
let s = i;
|
|
66
|
+
for (; s < r && t[s] !== "\n";) s += 1;
|
|
67
|
+
return s < r && (s += 1), s > o ? {
|
|
68
|
+
start: o,
|
|
69
|
+
end: s
|
|
70
|
+
} : {
|
|
71
|
+
start: i,
|
|
72
|
+
end: r
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function w(e, t) {
|
|
76
|
+
let n = t;
|
|
77
|
+
for (let t of e) t.range.start < n && (n = t.range.start);
|
|
78
|
+
return n;
|
|
79
|
+
}
|
|
80
|
+
function T(e, t, n, i, a) {
|
|
81
|
+
let o = [...e];
|
|
82
|
+
for (let e of t) o.push(C(e, i, n?.nodes ?? []));
|
|
83
|
+
let s = r(o, i.length), c = w(t, i.length);
|
|
84
|
+
return a && (s = r([...s, {
|
|
85
|
+
start: c,
|
|
86
|
+
end: i.length
|
|
87
|
+
}], i.length)), b(s, e) && (s = r([...e, {
|
|
88
|
+
start: c,
|
|
89
|
+
end: i.length
|
|
90
|
+
}], i.length)), s;
|
|
91
|
+
}
|
|
92
|
+
function E(e, t) {
|
|
93
|
+
for (let [n, r] of Object.entries(t)) typeof r == "number" && Number.isFinite(r) && (e[n] = (e[n] ?? 0) + r);
|
|
94
|
+
}
|
|
95
|
+
function ee(e, t, n) {
|
|
96
|
+
let r = [], i = [], a = {}, o, s = 0;
|
|
97
|
+
for (let c = 1; c <= 6; c += 1) {
|
|
98
|
+
s = c, o = d(e, t, n, r), E(a, o.timings);
|
|
99
|
+
let l = o.result;
|
|
100
|
+
if (l.ok) {
|
|
101
|
+
let e = y(i, l.diagnostics);
|
|
102
|
+
return {
|
|
103
|
+
result: {
|
|
104
|
+
...l,
|
|
105
|
+
status: "partial",
|
|
106
|
+
...e
|
|
107
|
+
},
|
|
108
|
+
...o.parsed ? { parsed: o.parsed } : {},
|
|
109
|
+
transientDiagnostics: e.transientDiagnostics,
|
|
110
|
+
literalRanges: [...r],
|
|
111
|
+
attempts: s,
|
|
112
|
+
timings: a
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
let { definite: u, transient: f } = h(l.diagnostics, e);
|
|
116
|
+
if (u.length > 0) {
|
|
117
|
+
let e = v([...i, f]);
|
|
118
|
+
return {
|
|
119
|
+
result: {
|
|
120
|
+
ok: !1,
|
|
121
|
+
diagnostics: u,
|
|
122
|
+
...l.recoveries ? { recoveries: [...l.recoveries] } : {},
|
|
123
|
+
status: "failed",
|
|
124
|
+
transientDiagnostics: e
|
|
125
|
+
},
|
|
126
|
+
...o.parsed ? { parsed: o.parsed } : {},
|
|
127
|
+
transientDiagnostics: e,
|
|
128
|
+
literalRanges: [...r],
|
|
129
|
+
attempts: s,
|
|
130
|
+
timings: a
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
if (i.push(f), c === 6) break;
|
|
134
|
+
let p = T(r, f, o.parsed, e, c >= 5);
|
|
135
|
+
if (b(p, r)) break;
|
|
136
|
+
r = p, x(r, e.length);
|
|
137
|
+
}
|
|
138
|
+
if (typeof e == "string" && e.length <= 1e6 && !x(r, e.length)) {
|
|
139
|
+
let o = [{
|
|
140
|
+
start: 0,
|
|
141
|
+
end: e.length
|
|
142
|
+
}], c = d(e, t, n, o);
|
|
143
|
+
if (E(a, c.timings), s += 1, c.result.ok) {
|
|
144
|
+
let e = y(i, c.result.diagnostics);
|
|
145
|
+
return {
|
|
146
|
+
result: {
|
|
147
|
+
...c.result,
|
|
148
|
+
status: "partial",
|
|
149
|
+
...e
|
|
150
|
+
},
|
|
151
|
+
...c.parsed ? { parsed: c.parsed } : {},
|
|
152
|
+
transientDiagnostics: e.transientDiagnostics,
|
|
153
|
+
literalRanges: o,
|
|
154
|
+
attempts: s,
|
|
155
|
+
timings: a
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
let { definite: l, transient: u } = h(c.result.diagnostics, e), f = v([...i, u]);
|
|
159
|
+
if (l.length > 0) return {
|
|
160
|
+
result: {
|
|
161
|
+
ok: !1,
|
|
162
|
+
diagnostics: l,
|
|
163
|
+
...c.result.recoveries ? { recoveries: [...c.result.recoveries] } : {},
|
|
164
|
+
status: "failed",
|
|
165
|
+
transientDiagnostics: f
|
|
166
|
+
},
|
|
167
|
+
...c.parsed ? { parsed: c.parsed } : {},
|
|
168
|
+
transientDiagnostics: f,
|
|
169
|
+
literalRanges: o,
|
|
170
|
+
attempts: s,
|
|
171
|
+
timings: a
|
|
172
|
+
};
|
|
173
|
+
r = o;
|
|
174
|
+
}
|
|
175
|
+
let c = o, l = v(i);
|
|
176
|
+
return {
|
|
177
|
+
result: {
|
|
178
|
+
ok: !1,
|
|
179
|
+
diagnostics: c !== void 0 && c.result.ok === !1 && c.result.diagnostics.length > 0 ? [...c.result.diagnostics] : l.length > 0 ? l : [{
|
|
180
|
+
code: "local.parse",
|
|
181
|
+
message: "The streaming snapshot could not be compiled.",
|
|
182
|
+
severity: "error",
|
|
183
|
+
range: {
|
|
184
|
+
start: 0,
|
|
185
|
+
end: 0
|
|
186
|
+
},
|
|
187
|
+
line: 1,
|
|
188
|
+
column: 1
|
|
189
|
+
}],
|
|
190
|
+
...c?.result.recoveries ? { recoveries: [...c.result.recoveries] } : {},
|
|
191
|
+
status: "failed",
|
|
192
|
+
transientDiagnostics: l
|
|
193
|
+
},
|
|
194
|
+
...c?.parsed ? { parsed: c.parsed } : {},
|
|
195
|
+
transientDiagnostics: l,
|
|
196
|
+
literalRanges: [...r],
|
|
197
|
+
attempts: s,
|
|
198
|
+
timings: a
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
// src/local/compilation/session/semantic-cache.ts
|
|
202
|
+
var D = () => ({
|
|
12
203
|
expressionsCompiled: 0,
|
|
13
204
|
expressionsReused: 0,
|
|
14
205
|
typesInferred: 0,
|
|
@@ -21,18 +212,18 @@ var m = () => ({
|
|
|
21
212
|
formulasReused: 0,
|
|
22
213
|
displaysInspected: 0,
|
|
23
214
|
displaysReused: 0
|
|
24
|
-
}),
|
|
215
|
+
}), te = class {
|
|
25
216
|
capacity;
|
|
26
217
|
maxWeight;
|
|
27
218
|
key;
|
|
28
219
|
values = /* @__PURE__ */ new Map();
|
|
29
220
|
weight = 0;
|
|
30
|
-
counts =
|
|
221
|
+
counts = D();
|
|
31
222
|
constructor(e = 16384, t = 8e6) {
|
|
32
223
|
this.capacity = e, this.maxWeight = t;
|
|
33
224
|
}
|
|
34
225
|
begin(e) {
|
|
35
|
-
this.key !== e && (this.clear(), this.key = e), this.counts =
|
|
226
|
+
this.key !== e && (this.clear(), this.key = e), this.counts = D();
|
|
36
227
|
}
|
|
37
228
|
get stats() {
|
|
38
229
|
return {
|
|
@@ -41,7 +232,7 @@ var m = () => ({
|
|
|
41
232
|
};
|
|
42
233
|
}
|
|
43
234
|
clear() {
|
|
44
|
-
this.values.clear(), this.weight = 0, this.key = void 0, this.counts =
|
|
235
|
+
this.values.clear(), this.weight = 0, this.key = void 0, this.counts = D();
|
|
45
236
|
}
|
|
46
237
|
get(e) {
|
|
47
238
|
let t = this.values.get(e);
|
|
@@ -55,10 +246,10 @@ var m = () => ({
|
|
|
55
246
|
}
|
|
56
247
|
}
|
|
57
248
|
expression(e) {
|
|
58
|
-
let
|
|
59
|
-
if (
|
|
60
|
-
let i =
|
|
61
|
-
return this.counts.expressionsCompiled++, this.put(
|
|
249
|
+
let n = "expression:" + e, r = this.get(n);
|
|
250
|
+
if (r) return this.counts.expressionsReused++, r;
|
|
251
|
+
let i = t(e);
|
|
252
|
+
return this.counts.expressionsCompiled++, this.put(n, i), i;
|
|
62
253
|
}
|
|
63
254
|
infer(e, t) {
|
|
64
255
|
let n = e.dependencies.map((e) => [e, Object.hasOwn(t, e) ? t[e] : null]), r = "type:" + JSON.stringify([e.source, n]), i = this.get(r);
|
|
@@ -83,10 +274,10 @@ var m = () => ({
|
|
|
83
274
|
rememberBinding(e, t) {
|
|
84
275
|
this.put("binding:" + e, t);
|
|
85
276
|
}
|
|
86
|
-
latex(
|
|
87
|
-
let n = "latex:" +
|
|
277
|
+
latex(t) {
|
|
278
|
+
let n = "latex:" + t, r = this.get(n);
|
|
88
279
|
if (r) return this.counts.formulasReused++, r;
|
|
89
|
-
let i = t
|
|
280
|
+
let i = e(t);
|
|
90
281
|
return this.counts.formulasCompiled++, this.put(n, i), i;
|
|
91
282
|
}
|
|
92
283
|
display(e, t) {
|
|
@@ -95,11 +286,11 @@ var m = () => ({
|
|
|
95
286
|
let a = i(e, t);
|
|
96
287
|
return this.counts.displaysInspected++, this.put(n, a), a;
|
|
97
288
|
}
|
|
98
|
-
},
|
|
99
|
-
function
|
|
289
|
+
}, ne = 128, re = 512, ie = 32, ae = 131072, O = (e) => JSON.parse(JSON.stringify(e));
|
|
290
|
+
function oe(e) {
|
|
100
291
|
return typeof e == "object" && !!e && e.strict === !1;
|
|
101
292
|
}
|
|
102
|
-
var
|
|
293
|
+
var k = class {
|
|
103
294
|
limit;
|
|
104
295
|
byteLimit;
|
|
105
296
|
entries = /* @__PURE__ */ new Map();
|
|
@@ -127,13 +318,13 @@ var S = class {
|
|
|
127
318
|
clear() {
|
|
128
319
|
this.entries.clear(), this.bytes = 0;
|
|
129
320
|
}
|
|
130
|
-
},
|
|
321
|
+
}, se = class {
|
|
131
322
|
disposed = !1;
|
|
132
323
|
optionKey;
|
|
133
324
|
recoveryMode;
|
|
134
|
-
plans = new
|
|
135
|
-
inline = new
|
|
136
|
-
trees = new
|
|
325
|
+
plans = new k(ne, 524288);
|
|
326
|
+
inline = new k(re, 262144);
|
|
327
|
+
trees = new k(ie, 524288);
|
|
137
328
|
counts = {
|
|
138
329
|
hits: 0,
|
|
139
330
|
misses: 0,
|
|
@@ -144,10 +335,10 @@ var S = class {
|
|
|
144
335
|
reusedItemNodes: 0,
|
|
145
336
|
reusedAst: 0
|
|
146
337
|
};
|
|
147
|
-
parse(e, t, n, r) {
|
|
338
|
+
parse(e, t, n, r, i) {
|
|
148
339
|
if (this.disposed) throw Error("Local parse session is disposed");
|
|
149
|
-
let
|
|
150
|
-
return (
|
|
340
|
+
let a = u(t), o = oe(t);
|
|
341
|
+
return (a !== this.optionKey || o !== this.recoveryMode) && (this.optionKey = a, this.recoveryMode = o, this.reset()), i && i.length > 0 ? f(e, t, n, void 0, void 0, i) : f(e, t, n, this, r);
|
|
151
342
|
}
|
|
152
343
|
clear() {
|
|
153
344
|
this.optionKey = void 0, this.recoveryMode = void 0, this.reset();
|
|
@@ -192,9 +383,9 @@ var S = class {
|
|
|
192
383
|
return this.lookup(this.inline, e);
|
|
193
384
|
}
|
|
194
385
|
writeInline(e, t) {
|
|
195
|
-
e.length >
|
|
386
|
+
e.length > ae || this.inline.write(O(e), t?.map((e) => ({
|
|
196
387
|
...e,
|
|
197
|
-
value:
|
|
388
|
+
value: O(e.value)
|
|
198
389
|
})));
|
|
199
390
|
}
|
|
200
391
|
notePlanReuse() {
|
|
@@ -216,8 +407,8 @@ var S = class {
|
|
|
216
407
|
let r = e.read(t);
|
|
217
408
|
return r.hit ? (this.counts.hits += 1, n && (this.counts.reusedAst += 1)) : this.counts.misses += 1, r;
|
|
218
409
|
}
|
|
219
|
-
},
|
|
220
|
-
function
|
|
410
|
+
}, A = /* @__PURE__ */ new WeakSet();
|
|
411
|
+
function j(e, t) {
|
|
221
412
|
let n = 0, r = 0, i = /* @__PURE__ */ new WeakMap(), a = [], o = (e, t, n) => {
|
|
222
413
|
e && (Object.defineProperty(e.output, t, {
|
|
223
414
|
value: n,
|
|
@@ -228,7 +419,7 @@ function T(e, t) {
|
|
|
228
419
|
}, s = (e, t, r, o) => {
|
|
229
420
|
if (typeof t != "object" || !t) return t;
|
|
230
421
|
if (e === t) return n++, e;
|
|
231
|
-
if (e === void 0 &&
|
|
422
|
+
if (e === void 0 && A.has(t)) return n++, t;
|
|
232
423
|
if (i.has(t)) return i.get(t);
|
|
233
424
|
let s = Array.isArray(t), c = typeof e == "object" && e && Array.isArray(e) === s ? e : void 0, l = Object.keys(t), u = c ? Object.keys(c) : [], d = s ? Array(t.length) : {};
|
|
234
425
|
i.set(t, d);
|
|
@@ -255,7 +446,7 @@ function T(e, t) {
|
|
|
255
446
|
}
|
|
256
447
|
a.pop();
|
|
257
448
|
let t;
|
|
258
|
-
e.equal ? (t = e.before, n++) : (r++, t = Object.isFrozen(e.after) ? Object.freeze(e.output) : e.output,
|
|
449
|
+
e.equal ? (t = e.before, n++) : (r++, t = Object.isFrozen(e.after) ? Object.freeze(e.output) : e.output, A.add(t)), i.set(e.after, t), e.parent ? o(e.parent, e.key, t) : c = t;
|
|
259
450
|
}
|
|
260
451
|
return {
|
|
261
452
|
value: c,
|
|
@@ -263,7 +454,7 @@ function T(e, t) {
|
|
|
263
454
|
created: r
|
|
264
455
|
};
|
|
265
456
|
}
|
|
266
|
-
function
|
|
457
|
+
function ce(e, t) {
|
|
267
458
|
if (!e?.ok || !t.ok) return 0;
|
|
268
459
|
let n = /* @__PURE__ */ new Set(), r = [...e.document.nodes];
|
|
269
460
|
for (; r.length;) {
|
|
@@ -277,8 +468,8 @@ function ee(e, t) {
|
|
|
277
468
|
}
|
|
278
469
|
return i;
|
|
279
470
|
}
|
|
280
|
-
// src/local/session/row-reuse.ts
|
|
281
|
-
function
|
|
471
|
+
// src/local/compilation/session/row-reuse.ts
|
|
472
|
+
function M(e) {
|
|
282
473
|
if (e.nodes.length !== 1) return;
|
|
283
474
|
let t = e.nodes[0], n, r;
|
|
284
475
|
if (t.type === "list") n = "item", r = "listItem";
|
|
@@ -304,25 +495,25 @@ function E(e) {
|
|
|
304
495
|
rows: a
|
|
305
496
|
};
|
|
306
497
|
}
|
|
307
|
-
function
|
|
498
|
+
function N(e, t) {
|
|
308
499
|
if (e === t) return !0;
|
|
309
500
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
310
501
|
let n = Object.keys(e), r = Object.keys(t);
|
|
311
502
|
if (n.length !== r.length) return !1;
|
|
312
|
-
for (let r of n) if (!Object.hasOwn(t, r) || !
|
|
503
|
+
for (let r of n) if (!Object.hasOwn(t, r) || !N(e[r], t[r])) return !1;
|
|
313
504
|
return !0;
|
|
314
505
|
}
|
|
315
|
-
function
|
|
506
|
+
function P(e, t, n, r) {
|
|
316
507
|
if (e.type !== t.type || e.range.start - n !== t.range.start - r || e.range.end - n !== t.range.end - r) return !1;
|
|
317
508
|
let i = Object.keys(e), a = Object.keys(t);
|
|
318
509
|
if (i.length !== a.length) return !1;
|
|
319
|
-
for (let n of i) if (n !== "id" && n !== "range" && n !== "children" && (!Object.hasOwn(t, n) || !
|
|
510
|
+
for (let n of i) if (n !== "id" && n !== "range" && n !== "children" && (!Object.hasOwn(t, n) || !N(e[n], t[n]))) return !1;
|
|
320
511
|
let o = e.children ?? [], s = t.children ?? [];
|
|
321
512
|
if (o.length !== s.length) return !1;
|
|
322
|
-
for (let e = 0; e < o.length; e++) if (!
|
|
513
|
+
for (let e = 0; e < o.length; e++) if (!P(o[e], s[e], n, r)) return !1;
|
|
323
514
|
return !0;
|
|
324
515
|
}
|
|
325
|
-
function
|
|
516
|
+
function F(e, t) {
|
|
326
517
|
let n = {
|
|
327
518
|
...e,
|
|
328
519
|
range: {
|
|
@@ -330,14 +521,14 @@ function k(e, t) {
|
|
|
330
521
|
end: e.range.end + t
|
|
331
522
|
}
|
|
332
523
|
};
|
|
333
|
-
return e.attrs && (n.attrs = { ...e.attrs }), e.align && (n.align = [...e.align]), e.children && (n.children = e.children.map((e) =>
|
|
524
|
+
return e.attrs && (n.attrs = { ...e.attrs }), e.align && (n.align = [...e.align]), e.children && (n.children = e.children.map((e) => F(e, t))), n;
|
|
334
525
|
}
|
|
335
|
-
function
|
|
336
|
-
if (t.add(e.id), e.children) for (let n of e.children)
|
|
526
|
+
function I(e, t) {
|
|
527
|
+
if (t.add(e.id), e.children) for (let n of e.children) I(n, t);
|
|
337
528
|
}
|
|
338
|
-
function
|
|
529
|
+
function le(e, t) {
|
|
339
530
|
if (!e) return;
|
|
340
|
-
let n =
|
|
531
|
+
let n = M(e), r = M(t);
|
|
341
532
|
if (!n || !r || n.kind !== r.kind) return;
|
|
342
533
|
let i = n.rows, a = r.rows, o = Math.min(i.length, a.length), s = 0;
|
|
343
534
|
for (; s < o && i[s].text === a[s].text;) s += 1;
|
|
@@ -348,9 +539,9 @@ function j(e, t) {
|
|
|
348
539
|
let n;
|
|
349
540
|
if (t < s ? n = t : t >= a.length - c && (n = i.length - (a.length - t)), n === void 0) return e.node;
|
|
350
541
|
let r = i[n];
|
|
351
|
-
if (!
|
|
352
|
-
let o = e.node.range.start - r.node.range.start, d = o === 0 ? r.node :
|
|
353
|
-
return u += 1,
|
|
542
|
+
if (!P(r.node, e.node, r.node.range.start, e.node.range.start)) return e.node;
|
|
543
|
+
let o = e.node.range.start - r.node.range.start, d = o === 0 ? r.node : F(r.node, o);
|
|
544
|
+
return u += 1, I(d, l), d;
|
|
354
545
|
});
|
|
355
546
|
if (!u) return;
|
|
356
547
|
let f = {
|
|
@@ -365,15 +556,43 @@ function j(e, t) {
|
|
|
365
556
|
reusedIds: l
|
|
366
557
|
};
|
|
367
558
|
}
|
|
368
|
-
// src/local/session/incremental.ts
|
|
369
|
-
function
|
|
559
|
+
// src/local/compilation/session/incremental.ts
|
|
560
|
+
function L(e) {
|
|
370
561
|
return typeof e == "object" && !!e && e.strict === !1;
|
|
371
562
|
}
|
|
372
|
-
function
|
|
563
|
+
function R(e) {
|
|
373
564
|
return Object.hasOwn(e, "recoveries") && e.recoveries !== void 0;
|
|
374
565
|
}
|
|
375
|
-
|
|
376
|
-
|
|
566
|
+
function z(e) {
|
|
567
|
+
return e === "streaming" || e === "final" ? e : void 0;
|
|
568
|
+
}
|
|
569
|
+
function ue() {
|
|
570
|
+
return {
|
|
571
|
+
ok: !1,
|
|
572
|
+
status: "failed",
|
|
573
|
+
diagnostics: [{
|
|
574
|
+
code: "local.options.invalid",
|
|
575
|
+
message: "Compile option sourcePhase must be \"streaming\" or \"final\".",
|
|
576
|
+
severity: "error",
|
|
577
|
+
range: {
|
|
578
|
+
start: 0,
|
|
579
|
+
end: 0
|
|
580
|
+
},
|
|
581
|
+
line: 1,
|
|
582
|
+
column: 1,
|
|
583
|
+
messageKey: "local.options.invalid.source-phase"
|
|
584
|
+
}]
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
function de(e) {
|
|
588
|
+
try {
|
|
589
|
+
return typeof e == "object" && e ? z(e.sourcePhase) : void 0;
|
|
590
|
+
} catch {
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
var B = s.configure(o), V = "\n\n<!-- incremental-boundary -->\n\n";
|
|
595
|
+
function H(e) {
|
|
377
596
|
let t = [], n = [...e].reverse();
|
|
378
597
|
for (; n.length;) {
|
|
379
598
|
let e = n.pop();
|
|
@@ -381,7 +600,7 @@ function I(e) {
|
|
|
381
600
|
}
|
|
382
601
|
return t;
|
|
383
602
|
}
|
|
384
|
-
function
|
|
603
|
+
function U(e, t, n) {
|
|
385
604
|
return t === 0 && !n ? e : e.map((e) => ({
|
|
386
605
|
...e,
|
|
387
606
|
id: n?.get(e.id) ?? e.id,
|
|
@@ -391,18 +610,22 @@ function L(e, t, n) {
|
|
|
391
610
|
},
|
|
392
611
|
...e.attrs ? { attrs: { ...e.attrs } } : {},
|
|
393
612
|
...e.align ? { align: [...e.align] } : {},
|
|
394
|
-
...e.children ? { children:
|
|
613
|
+
...e.children ? { children: U(e.children, t, n) } : {}
|
|
395
614
|
}));
|
|
396
615
|
}
|
|
397
|
-
function
|
|
616
|
+
function W(e, t, n) {
|
|
398
617
|
let r = Object.create(null);
|
|
399
|
-
for (let i of
|
|
618
|
+
for (let i of H(e)) r[n?.get(i.id) ?? i.id] = t.dependencies?.[i.id] ?? null;
|
|
400
619
|
return r;
|
|
401
620
|
}
|
|
402
|
-
function
|
|
621
|
+
function G(e) {
|
|
403
622
|
let t = !1;
|
|
404
|
-
for (let n of
|
|
623
|
+
for (let n of H([e])) {
|
|
405
624
|
if ([
|
|
625
|
+
"authorCss",
|
|
626
|
+
"authorJavaScript",
|
|
627
|
+
"extendedHtmlRaw"
|
|
628
|
+
].includes(n.type) || n.attrs && (Object.hasOwn(n.attrs, "css") || Object.hasOwn(n.attrs, "action-id")) || [
|
|
406
629
|
"definition",
|
|
407
630
|
"footnoteDefinition",
|
|
408
631
|
"footnoteReference",
|
|
@@ -417,12 +640,12 @@ function z(e) {
|
|
|
417
640
|
}
|
|
418
641
|
return t ? "context" : "fragment";
|
|
419
642
|
}
|
|
420
|
-
function
|
|
643
|
+
function K(e, t) {
|
|
421
644
|
let n = "", r = 0;
|
|
422
645
|
for (let i of t) n += e.slice(r, i.from) + i.text.replace(/[^\r\n]/g, " "), r = i.to;
|
|
423
646
|
return n + e.slice(r);
|
|
424
647
|
}
|
|
425
|
-
function
|
|
648
|
+
function q(e, t, n) {
|
|
426
649
|
let r = e.cursor();
|
|
427
650
|
do
|
|
428
651
|
if (r.name === "LinkReference") return null;
|
|
@@ -441,7 +664,45 @@ function V(e, t, n) {
|
|
|
441
664
|
}
|
|
442
665
|
return i;
|
|
443
666
|
}
|
|
444
|
-
function
|
|
667
|
+
function J(e) {
|
|
668
|
+
return /\r(?!\n)/.test(e);
|
|
669
|
+
}
|
|
670
|
+
function fe(e, t) {
|
|
671
|
+
for (; t > 0 && e[t - 1] !== "\n" && e[t - 1] !== "\r";) t--;
|
|
672
|
+
return t;
|
|
673
|
+
}
|
|
674
|
+
function Y(e, t) {
|
|
675
|
+
let n = new Set(t.map((e) => e.from));
|
|
676
|
+
for (let r of t) {
|
|
677
|
+
let t = r.to;
|
|
678
|
+
for (; e[t] === " " || e[t] === " ";) t++;
|
|
679
|
+
if (!(t >= e.length)) {
|
|
680
|
+
if (e[t] === "\r" && e[t + 1] === "\n") t += 2;
|
|
681
|
+
else if (e[t] === "\n" || e[t] === "\r") t++;
|
|
682
|
+
else return !0;
|
|
683
|
+
for (; e[t] === " " || e[t] === " ";) t++;
|
|
684
|
+
if (t < e.length && e[t] !== "\n" && e[t] !== "\r" && !n.has(t)) return !0;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return !1;
|
|
688
|
+
}
|
|
689
|
+
function X(e, t, n, r) {
|
|
690
|
+
if (e.type !== n.type || e.range.start + t !== n.range.start + r || e.range.end + t !== n.range.end + r) return !1;
|
|
691
|
+
let i = 0;
|
|
692
|
+
for (let [a, o] of Object.entries(e)) {
|
|
693
|
+
if (o === void 0 || a === "id" || a === "range") continue;
|
|
694
|
+
i++;
|
|
695
|
+
let e = n[a];
|
|
696
|
+
if (a === "children") {
|
|
697
|
+
let n = o, i = e;
|
|
698
|
+
if (!i || n.length !== i.length) return !1;
|
|
699
|
+
for (let e = 0; e < n.length; e++) if (!X(n[e], t, i[e], r)) return !1;
|
|
700
|
+
} else if (o !== e && JSON.stringify(o) !== JSON.stringify(e)) return !1;
|
|
701
|
+
}
|
|
702
|
+
for (let [e, t] of Object.entries(n)) t !== void 0 && e !== "id" && e !== "range" && i--;
|
|
703
|
+
return i === 0;
|
|
704
|
+
}
|
|
705
|
+
function Z(e, t) {
|
|
445
706
|
let n = 0, r = e.length, i = t.length;
|
|
446
707
|
for (; n < r && n < i && e.charCodeAt(n) === t.charCodeAt(n);) n++;
|
|
447
708
|
for (; r > n && i > n && e.charCodeAt(r - 1) === t.charCodeAt(i - 1);) r--, i--;
|
|
@@ -452,19 +713,19 @@ function H(e, t) {
|
|
|
452
713
|
delta: i - r
|
|
453
714
|
};
|
|
454
715
|
}
|
|
455
|
-
function
|
|
716
|
+
function Q(e, t) {
|
|
456
717
|
let n = e.parsed?.plans;
|
|
457
718
|
if (n?.length) {
|
|
458
719
|
for (let e of n) if (e.source === t) return e.rows;
|
|
459
720
|
if (n.length === 1) return n[0].rows;
|
|
460
721
|
}
|
|
461
722
|
}
|
|
462
|
-
var
|
|
723
|
+
var $ = class {
|
|
463
724
|
disposed = !1;
|
|
464
725
|
snapshot = null;
|
|
465
726
|
deferred = null;
|
|
466
|
-
parseSession = new
|
|
467
|
-
semantic = new
|
|
727
|
+
parseSession = new se();
|
|
728
|
+
semantic = new te();
|
|
468
729
|
services = {
|
|
469
730
|
parser: this.parseSession,
|
|
470
731
|
semantic: this.semantic
|
|
@@ -472,6 +733,7 @@ var W = class {
|
|
|
472
733
|
shared = null;
|
|
473
734
|
sharedKey;
|
|
474
735
|
sharedMode;
|
|
736
|
+
streamingCache = null;
|
|
475
737
|
epoch = 0;
|
|
476
738
|
cacheBuilds = 0;
|
|
477
739
|
serial = 0;
|
|
@@ -488,25 +750,64 @@ var W = class {
|
|
|
488
750
|
cacheBuilds: this.cacheBuilds
|
|
489
751
|
};
|
|
490
752
|
}
|
|
491
|
-
compile(e, t) {
|
|
492
|
-
let
|
|
753
|
+
compile(e, t, r) {
|
|
754
|
+
let i = this.compileShared(e, t, r), a = performance.now(), o = n(i);
|
|
493
755
|
return this.lastStats = {
|
|
494
756
|
...this.lastStats,
|
|
495
757
|
stages: {
|
|
496
758
|
...this.lastStats.stages,
|
|
497
|
-
publicSnapshotMs: performance.now() -
|
|
759
|
+
publicSnapshotMs: performance.now() - a
|
|
498
760
|
}
|
|
499
|
-
},
|
|
761
|
+
}, o;
|
|
500
762
|
}
|
|
501
|
-
compileShared(e, t) {
|
|
763
|
+
compileShared(e, t, n) {
|
|
502
764
|
if (this.disposed) throw Error("Local compile session is disposed");
|
|
765
|
+
if (n !== void 0 && z(n) === void 0) return ue();
|
|
766
|
+
let r = z(n) ?? de(t);
|
|
767
|
+
return r === "streaming" ? this.compileStreaming(e, t) : r === "final" ? this.compileFinal(e, t) : this.compileFinalOrLegacy(e, t);
|
|
768
|
+
}
|
|
769
|
+
compileFinal(e, t) {
|
|
770
|
+
let n = this.compileFinalOrLegacy(e, t);
|
|
771
|
+
return n.ok ? {
|
|
772
|
+
...n,
|
|
773
|
+
status: R(n) ? "recovered" : "valid"
|
|
774
|
+
} : {
|
|
775
|
+
...n,
|
|
776
|
+
status: "failed"
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
compileStreaming(e, t) {
|
|
780
|
+
let n = l(t).ok, r = u(t), i = this.streamingCache;
|
|
781
|
+
if (n && i !== null && i.source === e && i.key === r) return this.lastStats = {
|
|
782
|
+
mode: "streaming",
|
|
783
|
+
totalBlocks: i.blocks,
|
|
784
|
+
compiledBlocks: 0,
|
|
785
|
+
reusedBlocks: 0,
|
|
786
|
+
compiledCharacters: 0
|
|
787
|
+
}, i.result;
|
|
788
|
+
let a = ee(e, t, this.services), o = a.parsed?.nodes.length ?? 0;
|
|
789
|
+
return this.lastStats = {
|
|
790
|
+
mode: "streaming",
|
|
791
|
+
totalBlocks: o,
|
|
792
|
+
compiledBlocks: o,
|
|
793
|
+
reusedBlocks: 0,
|
|
794
|
+
compiledCharacters: typeof e == "string" ? e.length : 0,
|
|
795
|
+
stages: a.timings
|
|
796
|
+
}, n && (this.streamingCache = {
|
|
797
|
+
source: e,
|
|
798
|
+
key: r,
|
|
799
|
+
result: a.result,
|
|
800
|
+
blocks: o
|
|
801
|
+
}), a.result;
|
|
802
|
+
}
|
|
803
|
+
compileFinalOrLegacy(e, t) {
|
|
503
804
|
this.epoch++;
|
|
504
|
-
let n = u(t), r =
|
|
805
|
+
let n = u(t), r = L(t);
|
|
505
806
|
(n !== this.sharedKey || r !== this.sharedMode) && (this.shared = null, this.sharedKey = n, this.sharedMode = r);
|
|
506
|
-
let i = this.compileCore(e, t), a = performance.now(), o = this.shared, s =
|
|
807
|
+
let i = this.compileCore(e, t), a = performance.now(), o = this.shared, s = j(o ?? void 0, i).value;
|
|
507
808
|
return this.shared = s, this.lastStats = {
|
|
508
809
|
...this.lastStats,
|
|
509
|
-
sharedNodes:
|
|
810
|
+
sharedNodes: ce(o, s),
|
|
510
811
|
parse: this.parseSession.stats,
|
|
511
812
|
semantic: this.lastStats.semantic ?? this.semantic.stats,
|
|
512
813
|
stages: {
|
|
@@ -518,8 +819,8 @@ var W = class {
|
|
|
518
819
|
compileCore(e, t) {
|
|
519
820
|
if (this.disposed) throw Error("Local compile session is disposed");
|
|
520
821
|
this.cacheBuilds = 0;
|
|
521
|
-
let r = u(t), i = l(t), a =
|
|
522
|
-
if (this.deferred = null, !a && f && f.key === r && i.ok &&
|
|
822
|
+
let r = u(t), i = l(t), a = L(t), o = a ? "recovery-reference" : "initial", s = !1, f = this.deferred;
|
|
823
|
+
if (this.deferred = null, !a && f && f.key === r && i.ok && typeof e == "string" && e.length <= 1e6) {
|
|
523
824
|
if (e === f.source) return this.deferred = f, this.lastStats = {
|
|
524
825
|
mode: "cached",
|
|
525
826
|
totalBlocks: this.lastStats.totalBlocks,
|
|
@@ -528,15 +829,15 @@ var W = class {
|
|
|
528
829
|
compiledCharacters: 0
|
|
529
830
|
}, f.tracked.result;
|
|
530
831
|
s = !0, o = "scope-or-boundary";
|
|
531
|
-
let n =
|
|
532
|
-
if (a && !/[`\\~]/.test(f.source.slice(n.from, n.oldTo) + e.slice(n.from, n.newTo)) && !a.nodes.some((e) => i(e.range) &&
|
|
832
|
+
let n = Z(f.source, e), i = (e) => n.from <= e.end && n.oldTo >= e.start, a = f.tracked.parsed;
|
|
833
|
+
if (a && !/[`\\~]/.test(f.source.slice(n.from, n.oldTo) + e.slice(n.from, n.newTo)) && !a.nodes.some((e) => i(e.range) && G(e) !== "fragment") && ![a.versionDeclaration?.range, a.themeRange].some((e) => e && i(e))) try {
|
|
533
834
|
this.snapshot = this.seed(f.source, r, f.tracked, t);
|
|
534
835
|
} catch {
|
|
535
836
|
this.snapshot = null;
|
|
536
837
|
}
|
|
537
838
|
} else f && (o = a ? "recovery-reference" : "options-or-limits");
|
|
538
839
|
let p = this.snapshot;
|
|
539
|
-
if (!a && p && p.key === r && i.ok &&
|
|
840
|
+
if (!a && p && p.key === r && i.ok && typeof e == "string" && e.length <= 1e6) {
|
|
540
841
|
if (e === p.source) return this.lastStats = {
|
|
541
842
|
mode: "cached",
|
|
542
843
|
totalBlocks: p.blocks.length,
|
|
@@ -562,7 +863,7 @@ var W = class {
|
|
|
562
863
|
fallbackReason: o,
|
|
563
864
|
semantic: m.semantic,
|
|
564
865
|
stages: m.timings
|
|
565
|
-
}, !a && m.result.ok && m.result.diagnostics.length === 0 && !
|
|
866
|
+
}, !a && m.result.ok && !m.result.document.capabilities && m.result.diagnostics.length === 0 && !R(m.result) && i.ok && r !== "invalid") {
|
|
566
867
|
if (s) {
|
|
567
868
|
let i = t === void 0 ? void 0 : n(t), a = i;
|
|
568
869
|
if (i?.config !== void 0) try {
|
|
@@ -587,8 +888,8 @@ var W = class {
|
|
|
587
888
|
return this.snapshot ? this.publish(this.snapshot) : m.result;
|
|
588
889
|
}
|
|
589
890
|
seed(e, t, n, r, i) {
|
|
590
|
-
if (this.cacheBuilds++, !n.result.ok || !n.parsed ||
|
|
591
|
-
let a = n.parsed.nodes, o = a.map(
|
|
891
|
+
if (this.cacheBuilds++, !n.result.ok || !n.parsed || R(n.result) || e.includes("[^") || e.includes("") || J(e)) return null;
|
|
892
|
+
let a = n.parsed.nodes, o = a.map(G), s = a.length === 1 && o[0] === "fragment" && (a[0].type === "list" || a[0].type === "table");
|
|
592
893
|
if (o.includes("unsupported") || !s && o.filter((e) => e === "fragment").length < 2) return null;
|
|
593
894
|
let c = {
|
|
594
895
|
...n.result.document,
|
|
@@ -606,7 +907,7 @@ var W = class {
|
|
|
606
907
|
origin: n.range.start,
|
|
607
908
|
text: e.slice(n.range.start, n.range.end),
|
|
608
909
|
nodes: t,
|
|
609
|
-
dependencies:
|
|
910
|
+
dependencies: W(t, c),
|
|
610
911
|
cost: 0
|
|
611
912
|
});
|
|
612
913
|
}
|
|
@@ -620,10 +921,10 @@ var W = class {
|
|
|
620
921
|
dependencies: {},
|
|
621
922
|
cost: 0
|
|
622
923
|
});
|
|
623
|
-
u.sort((e, t) => e.from - t.from);
|
|
624
|
-
let f =
|
|
924
|
+
if (u.sort((e, t) => e.from - t.from), Y(e, u)) return null;
|
|
925
|
+
let f = K(e, u);
|
|
625
926
|
if (f.includes("<")) return null;
|
|
626
|
-
let p = i ??
|
|
927
|
+
let p = i ?? B.parse(f), m = q(p, u, f);
|
|
627
928
|
if (!m) return null;
|
|
628
929
|
let h = [], g = 0;
|
|
629
930
|
for (let t of m) {
|
|
@@ -634,20 +935,20 @@ var W = class {
|
|
|
634
935
|
r.push(e), g++;
|
|
635
936
|
}
|
|
636
937
|
if (!r.length) return null;
|
|
637
|
-
let i = r.flatMap((e) => l.has(e.id) ? [l.get(e.id)] : []), a =
|
|
938
|
+
let i = r.flatMap((e) => l.has(e.id) ? [l.get(e.id)] : []), a = H(i).length, o = e.slice(t.start, t.end);
|
|
638
939
|
h.push({
|
|
639
940
|
from: t.start,
|
|
640
941
|
to: t.end,
|
|
641
942
|
origin: t.start,
|
|
642
943
|
text: o,
|
|
643
944
|
nodes: i,
|
|
644
|
-
dependencies:
|
|
945
|
+
dependencies: W(i, c),
|
|
645
946
|
cost: a,
|
|
646
|
-
rowPlans:
|
|
947
|
+
rowPlans: Q(n, o)
|
|
647
948
|
});
|
|
648
949
|
}
|
|
649
950
|
if (g !== d.length) return null;
|
|
650
|
-
let _ = u.length ? u.map((e) => e.text).join(
|
|
951
|
+
let _ = u.length ? u.map((e) => e.text).join(V) + V : "", v = _ ? this.parseSession.parse(_, r) : null;
|
|
651
952
|
if (v?.diagnostics.length) return null;
|
|
652
953
|
let y = (n.parsed.syntaxNodes ?? 0) - h.reduce((e, t) => e + t.cost, 0);
|
|
653
954
|
return y < 0 ? null : (c.nodes = [], c.source = "", delete c.dependencies, {
|
|
@@ -663,8 +964,8 @@ var W = class {
|
|
|
663
964
|
});
|
|
664
965
|
}
|
|
665
966
|
update(e, t, n, r) {
|
|
666
|
-
if (t.includes("[^") || t.includes("")) return null;
|
|
667
|
-
let i =
|
|
967
|
+
if (t.includes("[^") || t.includes("") || J(t)) return null;
|
|
968
|
+
let i = Z(e.source, t);
|
|
668
969
|
if (/[`\\~]/.test(e.source.slice(i.from, i.oldTo) + t.slice(i.from, i.newTo))) return null;
|
|
669
970
|
let o = [];
|
|
670
971
|
for (let n of e.context) {
|
|
@@ -677,16 +978,17 @@ var W = class {
|
|
|
677
978
|
if (t.slice(r.from, r.to) !== n.text) return null;
|
|
678
979
|
o.push(r);
|
|
679
980
|
}
|
|
981
|
+
if (Y(t, o)) return null;
|
|
680
982
|
let s = a.applyChanges(a.addTree(e.tree), [{
|
|
681
983
|
fromA: i.from,
|
|
682
984
|
toA: i.oldTo,
|
|
683
985
|
fromB: i.from,
|
|
684
986
|
toB: i.newTo
|
|
685
|
-
}], 0), c =
|
|
987
|
+
}], 0), c = K(t, o);
|
|
686
988
|
if (c.includes("<")) return null;
|
|
687
|
-
let l =
|
|
989
|
+
let l = B.parse(c, s), u = q(l, o, c);
|
|
688
990
|
if (!u) return null;
|
|
689
|
-
let f = new Map(e.blocks.map((e) => [`${e.from}:${e.to}`, e])), p = [], m = /* @__PURE__ */ new Set(), h =
|
|
991
|
+
let f = new Map(e.blocks.map((e) => [`${e.from}:${e.to}`, e])), p = [], m = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), g = 0, _ = 0, v = 0, y = e.contextCost;
|
|
690
992
|
for (let a of u) {
|
|
691
993
|
let o = a.start >= i.newTo ? i.delta : 0, s = a.end <= i.from || a.start >= i.newTo ? f.get(`${a.start - o}:${a.end - o}`) : void 0, c = t.slice(a.start, a.end);
|
|
692
994
|
if (s && s.text === c) {
|
|
@@ -694,8 +996,8 @@ var W = class {
|
|
|
694
996
|
...s,
|
|
695
997
|
from: a.start,
|
|
696
998
|
to: a.end
|
|
697
|
-
}),
|
|
698
|
-
for (let e of
|
|
999
|
+
}), g++, y += s.cost;
|
|
1000
|
+
for (let e of H(s.nodes)) m.add(e.id);
|
|
699
1001
|
} else {
|
|
700
1002
|
let t = e.prefix.length, r = e.blocks.find((e) => {
|
|
701
1003
|
let t = e.from >= i.oldTo ? e.from + i.delta : e.from, n = e.to >= i.oldTo ? e.to + i.delta : e.to;
|
|
@@ -704,52 +1006,53 @@ var W = class {
|
|
|
704
1006
|
...this.services,
|
|
705
1007
|
rowPlans: r.rowPlans
|
|
706
1008
|
} : this.services, s = d(e.prefix + c, n, o);
|
|
707
|
-
if (
|
|
1009
|
+
if (v += t + c.length, _++, !s.result.ok || s.result.diagnostics.length || !s.parsed || R(s.result)) return null;
|
|
708
1010
|
let l = s.parsed.nodes.filter((e) => e.range.start >= t);
|
|
709
|
-
if (!l.length || l.some((e) =>
|
|
710
|
-
let u = s.result.document.nodes.filter((e) => e.range.start >= t), f = new Map(
|
|
1011
|
+
if (!l.length || l.some((e) => G(e) !== "fragment")) return null;
|
|
1012
|
+
let u = s.result.document.nodes.filter((e) => e.range.start >= t), f = new Map(H(u).map((e) => [e.id, `incremental-${++this.serial}-${e.id}`])), g = U(u, 0, f), b = r ? le({
|
|
711
1013
|
text: r.text,
|
|
712
1014
|
origin: r.origin,
|
|
713
1015
|
nodes: r.nodes
|
|
714
1016
|
}, {
|
|
715
1017
|
text: c,
|
|
716
1018
|
origin: t,
|
|
717
|
-
nodes:
|
|
1019
|
+
nodes: g
|
|
718
1020
|
}) : void 0;
|
|
719
|
-
if (
|
|
720
|
-
for (let e of
|
|
721
|
-
|
|
1021
|
+
if (b) {
|
|
1022
|
+
for (let e of b.reusedIds) if (m.has(e)) {
|
|
1023
|
+
b = void 0;
|
|
722
1024
|
break;
|
|
723
1025
|
}
|
|
724
1026
|
}
|
|
725
|
-
let
|
|
726
|
-
if (
|
|
727
|
-
let
|
|
728
|
-
for (let e of
|
|
729
|
-
if (
|
|
730
|
-
let e = r.nodes[0]?.id, t =
|
|
731
|
-
for (let n of
|
|
732
|
-
for (let e = 0; e <
|
|
1027
|
+
let x = b?.nodes ?? g, S = (s.parsed.syntaxNodes ?? 0) - e.prefixCost;
|
|
1028
|
+
if (S < H(x).length) return null;
|
|
1029
|
+
let C = W(u, s.result.document, f), w = Object.create(null);
|
|
1030
|
+
for (let e of H(x)) w[e.id] = C[e.id] ?? null;
|
|
1031
|
+
if (b && r) {
|
|
1032
|
+
let e = r.nodes[0]?.id, t = g[0]?.id;
|
|
1033
|
+
for (let n of b.reusedIds) w[n] = n === e && t !== void 0 ? C[t] ?? null : r.dependencies[n] ?? null, m.add(n);
|
|
1034
|
+
for (let e = 0; e < b.reused; e++) this.parseSession.noteRowReuse(b.kind);
|
|
733
1035
|
}
|
|
734
|
-
|
|
1036
|
+
let T = {
|
|
735
1037
|
from: a.start,
|
|
736
1038
|
to: a.end,
|
|
737
1039
|
origin: t,
|
|
738
1040
|
text: c,
|
|
739
|
-
nodes:
|
|
740
|
-
dependencies:
|
|
741
|
-
cost:
|
|
742
|
-
rowPlans:
|
|
743
|
-
}
|
|
1041
|
+
nodes: x,
|
|
1042
|
+
dependencies: w,
|
|
1043
|
+
cost: S,
|
|
1044
|
+
rowPlans: Q(s, c)
|
|
1045
|
+
};
|
|
1046
|
+
p.push(T), h.add(T), y += S;
|
|
744
1047
|
}
|
|
745
|
-
if (
|
|
1048
|
+
if (y > r) return null;
|
|
746
1049
|
}
|
|
747
|
-
return
|
|
1050
|
+
return y > r || !this.sameBoundaries(t, p, o, h, i, n) ? null : (this.lastStats = {
|
|
748
1051
|
mode: "incremental",
|
|
749
1052
|
totalBlocks: p.length,
|
|
750
|
-
compiledBlocks:
|
|
751
|
-
reusedBlocks:
|
|
752
|
-
compiledCharacters:
|
|
1053
|
+
compiledBlocks: _,
|
|
1054
|
+
reusedBlocks: g,
|
|
1055
|
+
compiledCharacters: v
|
|
753
1056
|
}, {
|
|
754
1057
|
...e,
|
|
755
1058
|
source: t,
|
|
@@ -758,6 +1061,41 @@ var W = class {
|
|
|
758
1061
|
blocks: p
|
|
759
1062
|
});
|
|
760
1063
|
}
|
|
1064
|
+
sameBoundaries(e, t, n, r, i, a) {
|
|
1065
|
+
let o = new Set(n), s = [...t, ...n].sort((e, t) => e.from - t.from), c = (e) => r.has(s[e]) || r.has(s[e + 1]) || i.from <= s[e + 1].from && i.newTo >= s[e].to;
|
|
1066
|
+
for (let t = 0; t + 1 < s.length; t++) {
|
|
1067
|
+
if (!c(t)) continue;
|
|
1068
|
+
let n = t;
|
|
1069
|
+
for (; n + 2 < s.length && c(n + 1);) n++;
|
|
1070
|
+
let r = [];
|
|
1071
|
+
for (let e = t; e <= n + 1; e++) {
|
|
1072
|
+
let i = s[e];
|
|
1073
|
+
if (o.has(i)) {
|
|
1074
|
+
r.push(i);
|
|
1075
|
+
continue;
|
|
1076
|
+
}
|
|
1077
|
+
let a = i.from - i.origin, c = e === t ? i.nodes.slice(-1) : e === n + 1 ? i.nodes.slice(0, 1) : i.nodes;
|
|
1078
|
+
if (!c.length) return !1;
|
|
1079
|
+
for (let e of c) r.push({
|
|
1080
|
+
node: e,
|
|
1081
|
+
delta: a
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
let i = r[0], l = r[r.length - 1], u = "node" in i ? Math.max(s[t].from, fe(e, i.node.range.start + i.delta)) : i.from, d = "node" in l ? l.node.range.end + l.delta : l.to, f = s.slice(t, n + 2).flatMap((e) => e.rowPlans ? [e.rowPlans] : []), p = f.length < 2 ? f[0] : {
|
|
1085
|
+
has: (e) => f.some((t) => t.has(e)),
|
|
1086
|
+
get: (e) => f.find((t) => t.has(e))?.get(e)
|
|
1087
|
+
}, m = this.parseSession.parse(e.slice(u, d), a, void 0, p);
|
|
1088
|
+
if (m.diagnostics.length || m.recoveries?.length || m.nodes.length !== r.length) return !1;
|
|
1089
|
+
for (let e = 0; e < r.length; e++) {
|
|
1090
|
+
let t = r[e], n = m.nodes[e];
|
|
1091
|
+
if ("node" in t) {
|
|
1092
|
+
if (!X(n, u, t.node, t.delta)) return !1;
|
|
1093
|
+
} else if (n.range.start + u !== t.from || n.range.end + u !== t.to) return !1;
|
|
1094
|
+
}
|
|
1095
|
+
t = n;
|
|
1096
|
+
}
|
|
1097
|
+
return !0;
|
|
1098
|
+
}
|
|
761
1099
|
publish(e) {
|
|
762
1100
|
let t = n(e.metadata);
|
|
763
1101
|
t.source = e.source;
|
|
@@ -765,7 +1103,7 @@ var W = class {
|
|
|
765
1103
|
t.nodes = r.flatMap((e) => {
|
|
766
1104
|
let t = e.from - e.origin;
|
|
767
1105
|
if (e.publication?.delta === t) return e.publication.nodes;
|
|
768
|
-
let n =
|
|
1106
|
+
let n = j(e.publication?.nodes ?? e.nodes.map((e) => i.get(e.id)).filter((e) => !!e), U(e.nodes, t)).value;
|
|
769
1107
|
return e.publication = {
|
|
770
1108
|
delta: t,
|
|
771
1109
|
nodes: n
|
|
@@ -819,7 +1157,7 @@ var W = class {
|
|
|
819
1157
|
if (await t(), !i() || !n.tracked.result.ok || !n.tracked.parsed) return !1;
|
|
820
1158
|
let a = [], o = n.tracked.parsed.nodes;
|
|
821
1159
|
for (let e = 0; e < o.length; e++) {
|
|
822
|
-
let r = o[e], s =
|
|
1160
|
+
let r = o[e], s = G(r);
|
|
823
1161
|
if (s === "unsupported" || (s === "context" && a.push({
|
|
824
1162
|
from: r.range.start,
|
|
825
1163
|
to: r.range.end,
|
|
@@ -840,9 +1178,9 @@ var W = class {
|
|
|
840
1178
|
cost: 0
|
|
841
1179
|
});
|
|
842
1180
|
a.sort((e, t) => e.from - t.from);
|
|
843
|
-
let s =
|
|
1181
|
+
let s = K(n.source, a);
|
|
844
1182
|
if (s.includes("<")) return !1;
|
|
845
|
-
let c =
|
|
1183
|
+
let c = B.startParse(s), l = null;
|
|
846
1184
|
for (; !l;) if (l = c.advance(), !l && (await t(), !i())) return !1;
|
|
847
1185
|
if (await t(), !i()) return !1;
|
|
848
1186
|
let u = this.cacheBuilds;
|
|
@@ -856,269 +1194,13 @@ var W = class {
|
|
|
856
1194
|
}
|
|
857
1195
|
}
|
|
858
1196
|
clear() {
|
|
859
|
-
this.epoch++, this.snapshot = null, this.deferred = null, this.serial = 0, this.cacheBuilds = 0, this.shared = null, this.sharedKey = void 0, this.sharedMode = void 0, this.parseSession.clear(), this.semantic.clear();
|
|
1197
|
+
this.epoch++, this.snapshot = null, this.deferred = null, this.serial = 0, this.cacheBuilds = 0, this.shared = null, this.sharedKey = void 0, this.sharedMode = void 0, this.streamingCache = null, this.parseSession.clear(), this.semantic.clear();
|
|
860
1198
|
}
|
|
861
1199
|
dispose() {
|
|
862
1200
|
this.clear(), this.parseSession.dispose(), this.disposed = !0;
|
|
863
1201
|
}
|
|
864
1202
|
};
|
|
865
|
-
function
|
|
866
|
-
return new
|
|
867
|
-
}
|
|
868
|
-
// src/local/evaluation/math-sample.ts
|
|
869
|
-
var K = 2e3, te = 5, q = 1e6;
|
|
870
|
-
function J(t, n, r, i) {
|
|
871
|
-
try {
|
|
872
|
-
return t.evaluate(n, r, i);
|
|
873
|
-
} catch (t) {
|
|
874
|
-
if (t instanceof e) {
|
|
875
|
-
if (t.code === "latex-budget") throw t;
|
|
876
|
-
return null;
|
|
877
|
-
}
|
|
878
|
-
throw t;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
function Y(e) {
|
|
882
|
-
if (e.length === 0) return 0;
|
|
883
|
-
let t = [...e].sort((e, t) => e - t);
|
|
884
|
-
return t[Math.floor(t.length / 2)];
|
|
885
|
-
}
|
|
886
|
-
function ne(e, t, n, r, i, a) {
|
|
887
|
-
let o = n - e;
|
|
888
|
-
if (!(o > 0)) return !1;
|
|
889
|
-
let s = 0, c = 0;
|
|
890
|
-
for (let i = 1; i <= te; i += 1) {
|
|
891
|
-
let l = 1 << i, u = o / l, d = t, f = 0;
|
|
892
|
-
for (let t = 1; t <= l; t += 1) {
|
|
893
|
-
let i = t === l ? n : e + t * u, o = t === l ? r : a(i);
|
|
894
|
-
if (o === null) return !0;
|
|
895
|
-
let s = Math.abs(o - d) / u;
|
|
896
|
-
s > f && (f = s), d = o;
|
|
897
|
-
}
|
|
898
|
-
i === 2 && (s = f), c = f;
|
|
899
|
-
}
|
|
900
|
-
return c > Math.max(s * 6, i * 12, 1e-9);
|
|
901
|
-
}
|
|
902
|
-
function re(t, n, r, i, a = 200, o) {
|
|
903
|
-
if (!Number.isFinite(r) || !Number.isFinite(i)) throw new e("latex-plot-range", "Plot min/max must be finite numbers.", 0);
|
|
904
|
-
if (!(r < i)) throw new e("latex-plot-range", "Plot min must be less than max.", 0);
|
|
905
|
-
if (!Number.isInteger(a) || a < 2 || a > K) throw new e("latex-plot-samples", `Sample count must be an integer between 2 and ${K}.`, 0);
|
|
906
|
-
let s = {
|
|
907
|
-
steps: 0,
|
|
908
|
-
limit: Math.max(q, a * 1024)
|
|
909
|
-
}, c = (e) => {
|
|
910
|
-
let r = s.limit - s.steps, i = o ? Number.isFinite(o.limit) && Number.isFinite(o.steps) ? o.limit - o.steps : 0 : Infinity, a = {
|
|
911
|
-
steps: 0,
|
|
912
|
-
limit: Math.max(0, Math.min(r, i))
|
|
913
|
-
};
|
|
914
|
-
try {
|
|
915
|
-
return J(t, e, n, a);
|
|
916
|
-
} finally {
|
|
917
|
-
s.steps += a.steps, o && (o.steps = Number.isFinite(o.steps) ? o.steps + a.steps : a.steps);
|
|
918
|
-
}
|
|
919
|
-
}, l = (i - r) / (a - 1), u = [];
|
|
920
|
-
for (let e = 0; e < a; e += 1) {
|
|
921
|
-
let t = e === a - 1 ? i : r + e * l;
|
|
922
|
-
u.push({
|
|
923
|
-
x: t,
|
|
924
|
-
y: c(t)
|
|
925
|
-
});
|
|
926
|
-
}
|
|
927
|
-
let d = u.map((e) => e.y).filter((e) => e !== null).map((e) => Math.abs(e)), f = Math.max(1e-9, Y(d) * 8);
|
|
928
|
-
for (let e = 1; e < u.length - 1; e += 1) {
|
|
929
|
-
let t = u[e - 1].y, n = u[e].y, r = u[e + 1].y;
|
|
930
|
-
t !== null && n !== null && r !== null && Math.abs(n) > Math.max(1, Math.abs(t), Math.abs(r)) * 100 && Math.abs(n) > f && (u[e] = {
|
|
931
|
-
x: u[e].x,
|
|
932
|
-
y: null
|
|
933
|
-
});
|
|
934
|
-
}
|
|
935
|
-
let p = u.length - 1, m = u[p].y, h = p > 0 ? u[p - 1].y : null;
|
|
936
|
-
m !== null && h !== null && Math.abs(m) > Math.max(1, Math.abs(h)) * 100 && Math.abs(m) > f && (m = null, u[p] = {
|
|
937
|
-
x: u[p].x,
|
|
938
|
-
y: null
|
|
939
|
-
});
|
|
940
|
-
let g = [], _ = [];
|
|
941
|
-
for (let e = 0; e < u.length - 1; e += 1) {
|
|
942
|
-
let t = u[e], n = u[e + 1];
|
|
943
|
-
if (t.y === null || n.y === null) continue;
|
|
944
|
-
let r = Math.abs(n.y - t.y);
|
|
945
|
-
g.push(r);
|
|
946
|
-
let i = n.x - t.x;
|
|
947
|
-
i > 0 && _.push(r / i);
|
|
948
|
-
}
|
|
949
|
-
let v = Y(g), y = Y(_);
|
|
950
|
-
for (let e = 0; e < u.length - 1; e += 1) {
|
|
951
|
-
let t = u[e], n = u[e + 1], r = t.y, i = n.y;
|
|
952
|
-
if (r === null || i === null) continue;
|
|
953
|
-
let a = () => {
|
|
954
|
-
u[e + 1] = {
|
|
955
|
-
x: n.x,
|
|
956
|
-
y: null
|
|
957
|
-
};
|
|
958
|
-
}, o = c(t.x + (n.x - t.x) / 2);
|
|
959
|
-
if (o === null) {
|
|
960
|
-
a();
|
|
961
|
-
continue;
|
|
962
|
-
}
|
|
963
|
-
let s = Math.abs(i - r);
|
|
964
|
-
(Math.abs(o - (r + i) / 2) > Math.max(s * .25, v * .4, 1e-9) || s > Math.max(v * 16, 1e-9)) && ne(t.x, r, n.x, i, y, (e) => c(e)) && a();
|
|
965
|
-
}
|
|
966
|
-
return {
|
|
967
|
-
points: u,
|
|
968
|
-
endpoint: m
|
|
969
|
-
};
|
|
970
|
-
}
|
|
971
|
-
function X(t, n, r, i) {
|
|
972
|
-
if (!Number.isFinite(t) || !Number.isFinite(n)) throw new e("latex-plot-range", "Plot min/max must be finite numbers.", 0);
|
|
973
|
-
if (!(t < n)) throw new e("latex-plot-range", "Plot min must be less than max.", 0);
|
|
974
|
-
if (!Number.isInteger(r) || r < 2 || r > i) throw new e("latex-plot-samples", `Sample count must be an integer between 2 and ${i}.`, 0);
|
|
975
|
-
}
|
|
976
|
-
function Z(e, t) {
|
|
977
|
-
let n = e.limit - e.steps, r = t ? Number.isFinite(t.limit) && Number.isFinite(t.steps) ? t.limit - t.steps : 0 : Infinity;
|
|
978
|
-
return {
|
|
979
|
-
steps: 0,
|
|
980
|
-
limit: Math.max(0, Math.min(n, r))
|
|
981
|
-
};
|
|
982
|
-
}
|
|
983
|
-
function Q(e, t, n) {
|
|
984
|
-
e.steps += n.steps, t && (t.steps = Number.isFinite(t.steps) ? t.steps + n.steps : n.steps);
|
|
985
|
-
}
|
|
986
|
-
function ie(e, t, n, r, i, a = 200, o) {
|
|
987
|
-
X(r, i, a, K);
|
|
988
|
-
let s = {
|
|
989
|
-
steps: 0,
|
|
990
|
-
limit: Math.max(q, a * 2048)
|
|
991
|
-
}, c = (i - r) / (a - 1), l = [];
|
|
992
|
-
for (let u = 0; u < a; u += 1) {
|
|
993
|
-
let d = u === a - 1 ? i : r + u * c, f = {
|
|
994
|
-
...n,
|
|
995
|
-
t: d
|
|
996
|
-
}, p = Z(s, o), m = null;
|
|
997
|
-
try {
|
|
998
|
-
m = J(e, d, f, p);
|
|
999
|
-
} finally {
|
|
1000
|
-
Q(s, o, p);
|
|
1001
|
-
}
|
|
1002
|
-
let h = Z(s, o), g = null;
|
|
1003
|
-
try {
|
|
1004
|
-
g = m === null ? null : J(t, d, f, h);
|
|
1005
|
-
} finally {
|
|
1006
|
-
Q(s, o, h);
|
|
1007
|
-
}
|
|
1008
|
-
l.push({
|
|
1009
|
-
x: m === null || !Number.isFinite(m) ? NaN : m,
|
|
1010
|
-
y: m === null || g === null || !Number.isFinite(g) ? null : g,
|
|
1011
|
-
t: d
|
|
1012
|
-
});
|
|
1013
|
-
}
|
|
1014
|
-
let u = l[l.length - 1];
|
|
1015
|
-
return {
|
|
1016
|
-
points: l,
|
|
1017
|
-
endpoint: u && u.y !== null ? u.y : null
|
|
1018
|
-
};
|
|
1019
|
-
}
|
|
1020
|
-
function $(e, t, n, r, i, a) {
|
|
1021
|
-
let o = n - a, s = o === 0 ? .5 : Math.max(0, Math.min(1, n / o));
|
|
1022
|
-
return {
|
|
1023
|
-
x: e + (r - e) * s,
|
|
1024
|
-
y: t + (i - t) * s
|
|
1025
|
-
};
|
|
1026
|
-
}
|
|
1027
|
-
function ae(e, t) {
|
|
1028
|
-
switch (e) {
|
|
1029
|
-
case 1: return [[3, 0]];
|
|
1030
|
-
case 2: return [[0, 1]];
|
|
1031
|
-
case 3: return [[3, 1]];
|
|
1032
|
-
case 4: return [[1, 2]];
|
|
1033
|
-
case 5: return t ? [[0, 1], [2, 3]] : [[3, 0], [1, 2]];
|
|
1034
|
-
case 6: return [[0, 2]];
|
|
1035
|
-
case 7: return [[3, 2]];
|
|
1036
|
-
case 8: return [[2, 3]];
|
|
1037
|
-
case 9: return [[0, 2]];
|
|
1038
|
-
case 10: return t ? [[3, 0], [1, 2]] : [[0, 1], [2, 3]];
|
|
1039
|
-
case 11: return [[1, 2]];
|
|
1040
|
-
case 12: return [[3, 1]];
|
|
1041
|
-
case 13: return [[0, 1]];
|
|
1042
|
-
case 14: return [[3, 0]];
|
|
1043
|
-
default: return [];
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
function oe(e, t, n, r, i) {
|
|
1047
|
-
if (e.length === 0) return [];
|
|
1048
|
-
let a = n - t || 1, o = i - r || 1, s = (e) => `${Math.round((e.x - t) / a * 1e7)},${Math.round((e.y - r) / o * 1e7)}`, c = /* @__PURE__ */ new Map(), l = (e, t) => {
|
|
1049
|
-
let n = c.get(e);
|
|
1050
|
-
n ? n.push(t) : c.set(e, [t]);
|
|
1051
|
-
};
|
|
1052
|
-
e.forEach((e, t) => {
|
|
1053
|
-
l(s(e.a), t), l(s(e.b), t);
|
|
1054
|
-
});
|
|
1055
|
-
let u = new Uint8Array(e.length), d = [], f = (t, n) => {
|
|
1056
|
-
let r = c.get(s(n));
|
|
1057
|
-
if (!r) return !1;
|
|
1058
|
-
for (let i of r) {
|
|
1059
|
-
if (u[i]) continue;
|
|
1060
|
-
let r = e[i], a = s(r.a) === s(n) ? r.b : r.a;
|
|
1061
|
-
if (s(a) === s(n)) u[i] = 1;
|
|
1062
|
-
else return u[i] = 1, t.push(a), !0;
|
|
1063
|
-
}
|
|
1064
|
-
return !1;
|
|
1065
|
-
};
|
|
1066
|
-
for (let t = 0; t < e.length; t += 1) {
|
|
1067
|
-
if (u[t]) continue;
|
|
1068
|
-
let n = e[t];
|
|
1069
|
-
if (s(n.a) === s(n.b)) {
|
|
1070
|
-
u[t] = 1;
|
|
1071
|
-
continue;
|
|
1072
|
-
}
|
|
1073
|
-
u[t] = 1;
|
|
1074
|
-
let r = [n.a, n.b], i = 0;
|
|
1075
|
-
for (; i < e.length && f(r, r[r.length - 1]);) i += 1;
|
|
1076
|
-
for (r.reverse(), i = 0; i < e.length && f(r, r[r.length - 1]);) i += 1;
|
|
1077
|
-
r.reverse(), d.push(r);
|
|
1078
|
-
}
|
|
1079
|
-
return d;
|
|
1080
|
-
}
|
|
1081
|
-
function se(t, n, r, i, a, o, s = 100, c) {
|
|
1082
|
-
if (X(r, i, s, 100), !Number.isFinite(a) || !Number.isFinite(o) || !(a < o)) throw new e("latex-plot-range", "The vertical plot range must be finite and increasing.", 0);
|
|
1083
|
-
let l = {
|
|
1084
|
-
steps: 0,
|
|
1085
|
-
limit: Math.max(q, s * s * 2048)
|
|
1086
|
-
}, u = s + 1, d = Array(u * u).fill(null), f = (i - r) / s, p = (o - a) / s;
|
|
1087
|
-
for (let e = 0; e <= s; e += 1) {
|
|
1088
|
-
let m = e === s ? o : a + e * p, h = {
|
|
1089
|
-
...n,
|
|
1090
|
-
y: m
|
|
1091
|
-
};
|
|
1092
|
-
for (let n = 0; n <= s; n += 1) {
|
|
1093
|
-
let a = n === s ? i : r + n * f, o = Z(l, c), p = null;
|
|
1094
|
-
try {
|
|
1095
|
-
p = J(t, a, h, o);
|
|
1096
|
-
} finally {
|
|
1097
|
-
Q(l, c, o);
|
|
1098
|
-
}
|
|
1099
|
-
d[e * u + n] = p !== null && Number.isFinite(p) ? p : null;
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
let m = [], h = (e, t) => d[t * u + e];
|
|
1103
|
-
for (let e = 0; e < s; e += 1) {
|
|
1104
|
-
let t = e + 1 === s, n = t ? o - p : a + e * p, c = t ? o : a + (e + 1) * p;
|
|
1105
|
-
for (let t = 0; t < s; t += 1) {
|
|
1106
|
-
let a = t + 1 === s, o = a ? i - f : r + t * f, l = a ? i : r + (t + 1) * f, u = h(t, e), d = h(t + 1, e), p = h(t + 1, e + 1), g = h(t, e + 1);
|
|
1107
|
-
if (u === null || d === null || p === null || g === null) continue;
|
|
1108
|
-
let _ = u >= 0 | (d >= 0 ? 2 : 0) | (p >= 0 ? 4 : 0) | (g >= 0 ? 8 : 0);
|
|
1109
|
-
if (_ === 0 || _ === 15) continue;
|
|
1110
|
-
let v = [
|
|
1111
|
-
$(o, n, u, l, n, d),
|
|
1112
|
-
$(l, n, d, l, c, p),
|
|
1113
|
-
$(o, c, g, l, c, p),
|
|
1114
|
-
$(o, n, u, o, c, g)
|
|
1115
|
-
], y = (u + d + p + g) / 4;
|
|
1116
|
-
for (let [e, t] of ae(_, y >= 0)) m.push({
|
|
1117
|
-
a: v[e],
|
|
1118
|
-
b: v[t]
|
|
1119
|
-
});
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
return oe(m, r, i, a, o);
|
|
1203
|
+
function pe() {
|
|
1204
|
+
return new $();
|
|
1123
1205
|
}
|
|
1124
|
-
export {
|
|
1206
|
+
export { pe as n, $ as t };
|