@notectl/core 2.3.6 → 2.4.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/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs +2 -0
- package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +1 -0
- package/dist/chunks/{AttrRegistry-CtNhf2EF.mjs → AttrRegistry-Di936wMv.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-CtNhf2EF.mjs.map → AttrRegistry-Di936wMv.mjs.map} +1 -1
- package/dist/chunks/{AttributedMarkCommands-B3MQdob_.mjs → AttributedMarkCommands-DKHuhZA7.mjs} +2 -2
- package/dist/chunks/{AttributedMarkCommands-B3MQdob_.mjs.map → AttributedMarkCommands-DKHuhZA7.mjs.map} +1 -1
- package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs +2 -0
- package/dist/chunks/{BidiIsolationPlugin-cOLlL3Y9.mjs.map → BidiIsolationPlugin-GWukKdgJ.mjs.map} +1 -1
- package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs +2 -0
- package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -0
- package/dist/chunks/{BlockInsertion-O5pAFKid.mjs → BlockInsertion-CxKdCKJd.mjs} +2 -2
- package/dist/chunks/{BlockInsertion-O5pAFKid.mjs.map → BlockInsertion-CxKdCKJd.mjs.map} +1 -1
- package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs +2 -0
- package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +1 -0
- package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs +2 -0
- package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -0
- package/dist/chunks/{CaretNavigationPlugin-DEZU09LJ.mjs → CaretNavigationPlugin-BxWjR7SN.mjs} +2 -2
- package/dist/chunks/{CaretNavigationPlugin-DEZU09LJ.mjs.map → CaretNavigationPlugin-BxWjR7SN.mjs.map} +1 -1
- package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs +2 -0
- package/dist/chunks/{CodeBlockPlugin-BandNM3t.mjs.map → CodeBlockPlugin-BIrkK4ER.mjs.map} +1 -1
- package/dist/chunks/{ColorGrid-D0vLHsG6.mjs → ColorGrid-DAs0--ty.mjs} +2 -2
- package/dist/chunks/{ColorGrid-D0vLHsG6.mjs.map → ColorGrid-DAs0--ty.mjs.map} +1 -1
- package/dist/chunks/ColorPickerPopup-B6340f3p.mjs +2 -0
- package/dist/chunks/{ColorPickerPopup-_C5JZhki.mjs.map → ColorPickerPopup-B6340f3p.mjs.map} +1 -1
- package/dist/chunks/{ColorValidation-B9d_umnf.mjs → ColorValidation-ZBKZ_gTr.mjs} +2 -2
- package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -0
- package/dist/chunks/Commands-DBBCAYBn.mjs +2 -0
- package/dist/chunks/Commands-DBBCAYBn.mjs.map +1 -0
- package/dist/chunks/{ContentModel-Bzmzeqwg.mjs → ContentModel-BLC3Tez8.mjs} +2 -2
- package/dist/chunks/{ContentModel-Bzmzeqwg.mjs.map → ContentModel-BLC3Tez8.mjs.map} +1 -1
- package/dist/chunks/{CursorMarks-dx51OGBf.mjs → CursorMarks-CqHLzGNI.mjs} +2 -2
- package/dist/chunks/{CursorMarks-dx51OGBf.mjs.map → CursorMarks-CqHLzGNI.mjs.map} +1 -1
- package/dist/chunks/{Decoration-BwhoA4MU.mjs → Decoration-BoFcdSXk.mjs} +2 -2
- package/dist/chunks/{Decoration-BwhoA4MU.mjs.map → Decoration-BoFcdSXk.mjs.map} +1 -1
- package/dist/chunks/{DirectionDetection-ZrkMhyaL.mjs → DirectionDetection-a-1iksmh.mjs} +2 -2
- package/dist/chunks/{DirectionDetection-ZrkMhyaL.mjs.map → DirectionDetection-a-1iksmh.mjs.map} +1 -1
- package/dist/chunks/{Document-D_2cIBJG.mjs → Document-ssR6hBzG.mjs} +2 -2
- package/dist/chunks/{Document-D_2cIBJG.mjs.map → Document-ssR6hBzG.mjs.map} +1 -1
- package/dist/chunks/DocumentParser-BKUrtgw1.mjs +2 -0
- package/dist/chunks/DocumentParser-BKUrtgw1.mjs.map +1 -0
- package/dist/chunks/FontPlugin-BcXNFqqO.mjs +2 -0
- package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +1 -0
- package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs +2 -0
- package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs.map +1 -0
- package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs +2 -0
- package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs.map +1 -0
- package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs +2 -0
- package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +1 -0
- package/dist/chunks/HTMLUtils-DTpsjZyK.mjs +2 -0
- package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -0
- package/dist/chunks/{HardBreakPlugin-CC4rntSX.mjs → HardBreakPlugin-svNnJ9Xj.mjs} +2 -2
- package/dist/chunks/{HardBreakPlugin-CC4rntSX.mjs.map → HardBreakPlugin-svNnJ9Xj.mjs.map} +1 -1
- package/dist/chunks/HeadingPlugin-B7EfynaH.mjs +2 -0
- package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +1 -0
- package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs +2 -0
- package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +1 -0
- package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs +2 -0
- package/dist/chunks/{HorizontalRulePlugin-CxmUMM34.mjs.map → HorizontalRulePlugin-CQ5NT2Mo.mjs.map} +1 -1
- package/dist/chunks/ImagePlugin-BzLvPXGo.mjs +2 -0
- package/dist/chunks/ImagePlugin-BzLvPXGo.mjs.map +1 -0
- package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs +2 -0
- package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +1 -0
- package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs +2 -0
- package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -0
- package/dist/chunks/{LinkPlugin-BwXDGHPe.mjs → LinkPlugin-BuzrXo2c.mjs} +2 -2
- package/dist/chunks/{LinkPlugin-BwXDGHPe.mjs.map → LinkPlugin-BuzrXo2c.mjs.map} +1 -1
- package/dist/chunks/ListPlugin-DTgpvBEt.mjs +2 -0
- package/dist/chunks/{ListPlugin-DSFPSWQC.mjs.map → ListPlugin-DTgpvBEt.mjs.map} +1 -1
- package/dist/chunks/MarkCommands-C0ps9h0z.mjs +2 -0
- package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -0
- package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs +2 -0
- package/dist/chunks/{MarkdownHTMLRegistry-CISsC0lH.mjs.map → MarkdownHTMLRegistry-BunUDiza.mjs.map} +1 -1
- package/dist/chunks/{MarkdownParser-D1d9zB0R.mjs → MarkdownParser-CvYOvU3d.mjs} +2 -2
- package/dist/chunks/{MarkdownParser-D1d9zB0R.mjs.map → MarkdownParser-CvYOvU3d.mjs.map} +1 -1
- package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs +2 -0
- package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs.map +1 -0
- package/dist/chunks/NavigationQueries-CaKfccu7.mjs +2 -0
- package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -0
- package/dist/chunks/NodeResolver-F4RtpoEd.mjs +2 -0
- package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -0
- package/dist/chunks/{NodeSelectionCommands-DK3iEh18.mjs → NodeSelectionCommands-B0Sb4ux4.mjs} +2 -2
- package/dist/chunks/{NodeSelectionCommands-DK3iEh18.mjs.map → NodeSelectionCommands-B0Sb4ux4.mjs.map} +1 -1
- package/dist/chunks/PluginHelpers-B3gk3VB3.mjs +2 -0
- package/dist/chunks/{PluginHelpers-WG1Lzzh3.mjs.map → PluginHelpers-B3gk3VB3.mjs.map} +1 -1
- package/dist/chunks/{PrintPlugin-BQ7LWbEB.mjs → PrintPlugin-BxNlFk2c.mjs} +2 -2
- package/dist/chunks/{PrintPlugin-BQ7LWbEB.mjs.map → PrintPlugin-BxNlFk2c.mjs.map} +1 -1
- package/dist/chunks/{RangeIterator-DDOxTQIf.mjs → RangeIterator-sJ_c9MNr.mjs} +2 -2
- package/dist/chunks/{RangeIterator-DDOxTQIf.mjs.map → RangeIterator-sJ_c9MNr.mjs.map} +1 -1
- package/dist/chunks/Schema-BSM4YLNT.mjs +2 -0
- package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -0
- package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs +2 -0
- package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +1 -0
- package/dist/chunks/SelectionSync-BkjCwGp-.mjs +2 -0
- package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +1 -0
- package/dist/chunks/{SelectionTransactions-DNCzsl_b.mjs → SelectionTransactions-mQ1NfMEg.mjs} +2 -2
- package/dist/chunks/{SelectionTransactions-DNCzsl_b.mjs.map → SelectionTransactions-mQ1NfMEg.mjs.map} +1 -1
- package/dist/chunks/SimpleMark-D6vz3Nfd.mjs +2 -0
- package/dist/chunks/{SimpleMark-CTDtEIMV.mjs.map → SimpleMark-D6vz3Nfd.mjs.map} +1 -1
- package/dist/chunks/{SmartPastePlugin-CjExbE9Q.mjs → SmartPastePlugin-C3SVKkWK.mjs} +2 -2
- package/dist/chunks/{SmartPastePlugin-CjExbE9Q.mjs.map → SmartPastePlugin-C3SVKkWK.mjs.map} +1 -1
- package/dist/chunks/{StrikethroughPlugin-d-EW2YYx.mjs → StrikethroughPlugin-v-VJZzUZ.mjs} +2 -2
- package/dist/chunks/{StrikethroughPlugin-d-EW2YYx.mjs.map → StrikethroughPlugin-v-VJZzUZ.mjs.map} +1 -1
- package/dist/chunks/StyleClassNames-BsAx7k5T.mjs +2 -0
- package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -0
- package/dist/chunks/{SuperSubPlugin-C-kvFQyx.mjs → SuperSubPlugin-x1iPnZyt.mjs} +2 -2
- package/dist/chunks/{SuperSubPlugin-C-kvFQyx.mjs.map → SuperSubPlugin-x1iPnZyt.mjs.map} +1 -1
- package/dist/chunks/TableDimensions-BSEOEox2.mjs +2 -0
- package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +1 -0
- package/dist/chunks/TablePlugin-WPwp902E.mjs +2 -0
- package/dist/chunks/TablePlugin-WPwp902E.mjs.map +1 -0
- package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs +2 -0
- package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +1 -0
- package/dist/chunks/{TextDirectionAutoPlugin-LVDkKdDX.mjs → TextDirectionAutoPlugin-DOH5cfyy.mjs} +2 -2
- package/dist/chunks/{TextDirectionAutoPlugin-LVDkKdDX.mjs.map → TextDirectionAutoPlugin-DOH5cfyy.mjs.map} +1 -1
- package/dist/chunks/{TextDirectionPlugin-CtGwof7i.mjs → TextDirectionPlugin-JwlR-R-b.mjs} +2 -2
- package/dist/chunks/{TextDirectionPlugin-CtGwof7i.mjs.map → TextDirectionPlugin-JwlR-R-b.mjs.map} +1 -1
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs +2 -0
- package/dist/chunks/{TextDirectionService-OFOU6r_s.mjs.map → TextDirectionService-BcX07mw2.mjs.map} +1 -1
- package/dist/chunks/{TextFormattingPlugin-DlS0SeW7.mjs → TextFormattingPlugin-Kc_UNoOz.mjs} +2 -2
- package/dist/chunks/{TextFormattingPlugin-DlS0SeW7.mjs.map → TextFormattingPlugin-Kc_UNoOz.mjs.map} +1 -1
- package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs +2 -0
- package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs.map +1 -0
- package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs +2 -0
- package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs.map +1 -0
- package/dist/chunks/color-picker-D6HrTsDM.mjs +2 -0
- package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -0
- package/dist/chunks/full-BiQ93ERr.mjs +2 -0
- package/dist/chunks/{full-Cshz7aTP.mjs.map → full-BiQ93ERr.mjs.map} +1 -1
- package/dist/chunks/minimal-DO7LiFTa.mjs +2 -0
- package/dist/chunks/{minimal-7XqMY9kC.mjs.map → minimal-DO7LiFTa.mjs.map} +1 -1
- package/dist/chunks/register-Cb1YTAN4.mjs +3 -0
- package/dist/chunks/register-Cb1YTAN4.mjs.map +1 -0
- package/dist/commands/Commands.d.ts.map +1 -1
- package/dist/commands/CompositionCommands.d.ts +47 -0
- package/dist/commands/CompositionCommands.d.ts.map +1 -0
- package/dist/commands/CompositionRebase.d.ts +24 -0
- package/dist/commands/CompositionRebase.d.ts.map +1 -0
- package/dist/commands/PasteCommand.d.ts.map +1 -1
- package/dist/commands/SelectionDeletion.d.ts +15 -5
- package/dist/commands/SelectionDeletion.d.ts.map +1 -1
- package/dist/fonts/math.mjs +1 -1
- package/dist/fonts.mjs +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/input/CompositionController.d.ts +78 -0
- package/dist/input/CompositionController.d.ts.map +1 -0
- package/dist/input/HTMLParser.d.ts +15 -2
- package/dist/input/HTMLParser.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +34 -1
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +3 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/model/BlockAlignment.d.ts +6 -0
- package/dist/model/BlockAlignment.d.ts.map +1 -1
- package/dist/model/BlockOffsetText.d.ts +11 -0
- package/dist/model/BlockOffsetText.d.ts.map +1 -0
- package/dist/model/CompositionState.d.ts +14 -0
- package/dist/model/CompositionState.d.ts.map +1 -1
- package/dist/model/HTMLUtils.d.ts +16 -3
- package/dist/model/HTMLUtils.d.ts.map +1 -1
- package/dist/model/MarkSpec.d.ts +5 -3
- package/dist/model/MarkSpec.d.ts.map +1 -1
- package/dist/model/NodeResolver.d.ts +2 -0
- package/dist/model/NodeResolver.d.ts.map +1 -1
- package/dist/model/NodeSpec.d.ts +2 -1
- package/dist/model/NodeSpec.d.ts.map +1 -1
- package/dist/model/Schema.d.ts +2 -0
- package/dist/model/Schema.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts +26 -1
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/StyleClass.d.ts +45 -0
- package/dist/model/StyleClass.d.ts.map +1 -0
- package/dist/model/StyleClassRegistry.d.ts +28 -0
- package/dist/model/StyleClassRegistry.d.ts.map +1 -0
- package/dist/model/TextChange.d.ts +40 -0
- package/dist/model/TextChange.d.ts.map +1 -0
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/Plugin.d.ts +11 -0
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +2 -0
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
- package/dist/plugins/RegistrationTracker.d.ts.map +1 -1
- package/dist/plugins/alignment/AlignmentPlugin.d.ts +17 -0
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/bidi-isolation.mjs +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font/FontPlugin.d.ts +13 -0
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizeOperations.d.ts +2 -0
- package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePlugin.d.ts +11 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula/FormulaPlugin.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LatexParser.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LatexSymbols.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LookupOwn.d.ts +6 -0
- package/dist/plugins/formula/latex/LookupOwn.d.ts.map +1 -0
- package/dist/plugins/formula/latex/handlers/Accents.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Delimiters.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Environments.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Fonts.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Spacing.d.ts.map +1 -1
- package/dist/plugins/formula.mjs +1 -1
- package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +1 -1
- package/dist/plugins/gap-cursor.mjs +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight/HighlightPlugin.d.ts +11 -0
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/inline-code/InlineCodePlugin.d.ts.map +1 -1
- package/dist/plugins/inline-code.mjs +1 -1
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list/ListPlugin.d.ts +2 -1
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared/ColorGrid.d.ts.map +1 -1
- package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -1
- package/dist/plugins/shared/ColorValidation.d.ts +12 -4
- package/dist/plugins/shared/ColorValidation.d.ts.map +1 -1
- package/dist/plugins/shared/InlineStyleMarkSpec.d.ts +10 -0
- package/dist/plugins/shared/InlineStyleMarkSpec.d.ts.map +1 -1
- package/dist/plugins/shared/StyleClassNames.d.ts +10 -0
- package/dist/plugins/shared/StyleClassNames.d.ts.map +1 -0
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/smart-paste.mjs +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- package/dist/plugins/table/TableBorderColor.d.ts.map +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-color/TextColorPlugin.d.ts +11 -0
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/text-direction-auto.mjs +1 -1
- package/dist/plugins/text-direction.mjs +1 -1
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/plugins/video.mjs +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/register.mjs +1 -1
- package/dist/serialization/AlignmentHTML.d.ts +43 -0
- package/dist/serialization/AlignmentHTML.d.ts.map +1 -0
- package/dist/serialization/CSSClassCollector.d.ts +20 -17
- package/dist/serialization/CSSClassCollector.d.ts.map +1 -1
- package/dist/serialization/CSSValueEquivalence.d.ts +24 -0
- package/dist/serialization/CSSValueEquivalence.d.ts.map +1 -0
- package/dist/serialization/DocumentParser.d.ts +2 -1
- package/dist/serialization/DocumentParser.d.ts.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts +0 -4
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/serialization/FirstTagAttributes.d.ts +16 -0
- package/dist/serialization/FirstTagAttributes.d.ts.map +1 -0
- package/dist/serialization/HTMLParseRules.d.ts +32 -0
- package/dist/serialization/HTMLParseRules.d.ts.map +1 -0
- package/dist/serialization/HTMLParseSession.d.ts +21 -0
- package/dist/serialization/HTMLParseSession.d.ts.map +1 -0
- package/dist/serialization/MarkSerializer.d.ts.map +1 -1
- package/dist/serialization/StyleClassHTML.d.ts +37 -0
- package/dist/serialization/StyleClassHTML.d.ts.map +1 -0
- package/dist/serialization/StyleRehydration.d.ts +16 -0
- package/dist/serialization/StyleRehydration.d.ts.map +1 -0
- package/dist/serialization/TableDimensions.d.ts.map +1 -1
- package/dist/serialization/index.d.ts +2 -1
- package/dist/serialization/index.d.ts.map +1 -1
- package/dist/serialization/markdown/InlineSerializers.d.ts.map +1 -1
- package/dist/state/EditorState.d.ts.map +1 -1
- package/dist/state/History.d.ts +2 -1
- package/dist/state/History.d.ts.map +1 -1
- package/dist/state/NavigationQueries.d.ts.map +1 -1
- package/dist/state/SelectionValidation.d.ts +12 -0
- package/dist/state/SelectionValidation.d.ts.map +1 -0
- package/dist/state/StepMapping.d.ts.map +1 -1
- package/dist/state/TransactionBuilder.d.ts +7 -1
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/test/PluginTestUtils.d.ts +25 -0
- package/dist/test/PluginTestUtils.d.ts.map +1 -1
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/CursorWrapper.d.ts.map +1 -1
- package/dist/view/EditorView.d.ts +25 -1
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/InlineContentDOM.d.ts +44 -0
- package/dist/view/InlineContentDOM.d.ts.map +1 -0
- package/dist/view/Reconciler.d.ts +20 -1
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/dist/view/RenderedBlockText.d.ts +27 -0
- package/dist/view/RenderedBlockText.d.ts.map +1 -0
- package/dist/view/SelectionSync.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs +0 -2
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs.map +0 -1
- package/dist/chunks/BidiIsolationPlugin-cOLlL3Y9.mjs +0 -2
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs +0 -2
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs.map +0 -1
- package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs +0 -2
- package/dist/chunks/ColorPickerPopup-_C5JZhki.mjs +0 -2
- package/dist/chunks/ColorValidation-B9d_umnf.mjs.map +0 -1
- package/dist/chunks/Commands-D-0UXYvo.mjs +0 -2
- package/dist/chunks/Commands-D-0UXYvo.mjs.map +0 -1
- package/dist/chunks/DocumentParser-i-CreJ48.mjs +0 -2
- package/dist/chunks/DocumentParser-i-CreJ48.mjs.map +0 -1
- package/dist/chunks/FontPlugin-C_ScWZ0P.mjs +0 -2
- package/dist/chunks/FontPlugin-C_ScWZ0P.mjs.map +0 -1
- package/dist/chunks/FontSizePlugin-DB_0njtC.mjs +0 -2
- package/dist/chunks/FontSizePlugin-DB_0njtC.mjs.map +0 -1
- package/dist/chunks/FormulaPlugin-CI0r4X1o.mjs +0 -2
- package/dist/chunks/FormulaPlugin-CI0r4X1o.mjs.map +0 -1
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs +0 -2
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs +0 -2
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs.map +0 -1
- package/dist/chunks/HeadingPlugin-LK8Pg4h0.mjs +0 -2
- package/dist/chunks/HeadingPlugin-LK8Pg4h0.mjs.map +0 -1
- package/dist/chunks/HighlightPlugin-B4WlZawl.mjs +0 -2
- package/dist/chunks/HighlightPlugin-B4WlZawl.mjs.map +0 -1
- package/dist/chunks/HorizontalRulePlugin-CxmUMM34.mjs +0 -2
- package/dist/chunks/ImagePlugin-C5ESNNsA.mjs +0 -2
- package/dist/chunks/ImagePlugin-C5ESNNsA.mjs.map +0 -1
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs +0 -2
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs.map +0 -1
- package/dist/chunks/InlineStyleMarkSpec-Cx3goc3W.mjs +0 -2
- package/dist/chunks/InlineStyleMarkSpec-Cx3goc3W.mjs.map +0 -1
- package/dist/chunks/ListPlugin-DSFPSWQC.mjs +0 -2
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs +0 -2
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs.map +0 -1
- package/dist/chunks/MarkdownHTMLRegistry-CISsC0lH.mjs +0 -2
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs +0 -2
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs.map +0 -1
- package/dist/chunks/NavigationQueries-Bt4zZ17v.mjs +0 -2
- package/dist/chunks/NavigationQueries-Bt4zZ17v.mjs.map +0 -1
- package/dist/chunks/NodeResolver-BtIknXqD.mjs +0 -2
- package/dist/chunks/NodeResolver-BtIknXqD.mjs.map +0 -1
- package/dist/chunks/PluginHelpers-WG1Lzzh3.mjs +0 -2
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs +0 -2
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs.map +0 -1
- package/dist/chunks/SelectionSync-CwOHMMfI.mjs +0 -2
- package/dist/chunks/SelectionSync-CwOHMMfI.mjs.map +0 -1
- package/dist/chunks/SimpleMark-CTDtEIMV.mjs +0 -2
- package/dist/chunks/TableDimensions-BcARMxQB.mjs +0 -2
- package/dist/chunks/TableDimensions-BcARMxQB.mjs.map +0 -1
- package/dist/chunks/TablePlugin-C4WMYGWN.mjs +0 -2
- package/dist/chunks/TablePlugin-C4WMYGWN.mjs.map +0 -1
- package/dist/chunks/TextColorPlugin-D_MhNJT6.mjs +0 -2
- package/dist/chunks/TextColorPlugin-D_MhNJT6.mjs.map +0 -1
- package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +0 -2
- package/dist/chunks/ToolbarPlugin-O7TirXQP.mjs +0 -2
- package/dist/chunks/ToolbarPlugin-O7TirXQP.mjs.map +0 -1
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs +0 -2
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs.map +0 -1
- package/dist/chunks/color-picker-DJ05ey9o.mjs +0 -2
- package/dist/chunks/color-picker-DJ05ey9o.mjs.map +0 -1
- package/dist/chunks/full-Cshz7aTP.mjs +0 -2
- package/dist/chunks/minimal-7XqMY9kC.mjs +0 -2
- package/dist/chunks/register-BVvV0Vl_.mjs +0 -3
- package/dist/chunks/register-BVvV0Vl_.mjs.map +0 -1
- package/dist/editor/styles/base.d.ts +0 -3
- package/dist/editor/styles/base.d.ts.map +0 -1
- package/dist/editor/styles/color-picker.d.ts +0 -3
- package/dist/editor/styles/color-picker.d.ts.map +0 -1
- package/dist/editor/styles/font-select.d.ts +0 -3
- package/dist/editor/styles/font-select.d.ts.map +0 -1
- package/dist/editor/styles/font-size-select.d.ts +0 -3
- package/dist/editor/styles/font-size-select.d.ts.map +0 -1
- package/dist/editor/styles/heading-select.d.ts +0 -3
- package/dist/editor/styles/heading-select.d.ts.map +0 -1
- package/dist/editor/styles/image.d.ts +0 -3
- package/dist/editor/styles/image.d.ts.map +0 -1
- package/dist/editor/styles/reduced-motion.d.ts +0 -3
- package/dist/editor/styles/reduced-motion.d.ts.map +0 -1
- package/dist/editor/styles/table.d.ts +0 -3
- package/dist/editor/styles/table.d.ts.map +0 -1
- package/dist/editor/styles/toolbar.d.ts +0 -3
- package/dist/editor/styles/toolbar.d.ts.map +0 -1
- package/dist/plugins/blockquote/BlockquoteStyles.d.ts +0 -3
- package/dist/plugins/blockquote/BlockquoteStyles.d.ts.map +0 -1
- package/dist/plugins/formula/FormulaStyles.d.ts +0 -12
- package/dist/plugins/formula/FormulaStyles.d.ts.map +0 -1
- package/dist/plugins/image/ImagePopupStyles.d.ts +0 -3
- package/dist/plugins/image/ImagePopupStyles.d.ts.map +0 -1
- package/dist/plugins/video/VideoPopupStyles.d.ts +0 -3
- package/dist/plugins/video/VideoPopupStyles.d.ts.map +0 -1
- package/dist/plugins/video/VideoStyles.d.ts +0 -3
- package/dist/plugins/video/VideoStyles.d.ts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FontSizePlugin-DB_0njtC.mjs","names":[],"sources":["../../src/editor/styles/font-size-select.ts","../../src/plugins/font-size/FontSizeLocale.ts","../../src/plugins/font-size/FontSizeOperations.ts","../../src/plugins/font-size/FontSizePopup.ts","../../src/plugins/font-size/FontSizePlugin.ts"],"sourcesContent":["/** Font size picker toolbar combobox + popup styles. */\nexport const FONT_SIZE_SELECT_CSS = `\n/* Font Size Select — Width overrides for combobox button */\n.notectl-toolbar-btn--fontSize {\n\tmin-width: 60px;\n\tmax-width: 80px;\n}\n\n/* Font Size Picker Popup */\n.notectl-font-size-picker {\n\tmin-width: 140px;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.notectl-font-size-picker__input-wrapper {\n\tpadding: 8px 8px 4px;\n}\n\n.notectl-font-size-picker__input {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tfont-family: inherit;\n\tcolor: var(--notectl-fg);\n\tbackground: var(--notectl-surface-overlay);\n\toutline: none;\n\tbox-sizing: border-box;\n\t-moz-appearance: textfield;\n}\n\n.notectl-font-size-picker__input::-webkit-inner-spin-button,\n.notectl-font-size-picker__input::-webkit-outer-spin-button {\n\t-webkit-appearance: none;\n\tmargin: 0;\n}\n\n.notectl-font-size-picker__input:focus {\n\tborder-color: var(--notectl-border-focus);\n\tbox-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n.notectl-font-size-picker__list {\n\tmax-height: 280px;\n\toverflow-y: auto;\n\tpadding: 4px 0;\n}\n\n.notectl-font-size-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n\toutline: none;\n}\n\n@media (hover: hover) {\n\t.notectl-font-size-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-font-size-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-accent-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-font-size-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-font-size-picker__item--focused {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: -2px;\n}\n\n.notectl-font-size-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-accent-fg);\n}\n\n.notectl-font-size-picker__label {\n\tflex: 1;\n}\n`;\n","/** Locale interface and default English locale for the FontSizePlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface FontSizeLocale {\n\treadonly label: string;\n\treadonly tooltip: string;\n\treadonly customFontSizeAria: string;\n\treadonly fontSizesAria: string;\n}\n\n// --- Default English Locale ---\n\nexport const FONT_SIZE_LOCALE_EN: FontSizeLocale = {\n\tlabel: 'Font Size',\n\ttooltip: 'Font Size',\n\tcustomFontSizeAria: 'Custom font size',\n\tfontSizesAria: 'Font sizes',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<FontSizeLocale> = import.meta.glob<{\n\tdefault: FontSizeLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadFontSizeLocale(lang: string): Promise<FontSizeLocale> {\n\treturn loadLocaleModule(localeModules, lang, FONT_SIZE_LOCALE_EN);\n}\n","/**\n * Pure business logic for font-size state queries and transaction builders.\n * All functions are DOM-free and operate on EditorState / PluginContext.\n *\n * Delegates to the generic AttributedMarkCommands helpers for the\n * collapsed-vs-range branching logic.\n */\n\nimport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport type { BlockAttrs, BlockNode, InlineNode, Mark } from '../../model/Document.js';\nimport {\n\tgetBlockLength,\n\tgetInlineChildren,\n\tisInlineNode,\n\tisTextNode,\n\twalkInlineContent,\n} from '../../model/Document.js';\nimport {\n\tisCollapsed,\n\tisNodeSelection,\n\tisTextSelection,\n\tselectionRange,\n} from '../../model/Selection.js';\nimport { type BlockId, type MarkTypeName, markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { dispatchIfPresent } from '../shared/PluginHelpers.js';\n\n// --- Node-level font sizing ---\n//\n// Marks only apply to text, so they cannot size atomic nodes such as a formula\n// (an inline node carries no marks; a display formula is a void block). Instead,\n// a node opts into font sizing by declaring a `fontSize` attribute in its schema\n// spec; the font-size controls then read/write that attribute. This stays generic\n// (no formula-specific coupling) — any node or inline node can opt in the same way.\n\ntype InlineNodeAttrs = Readonly<Record<string, string | number | boolean>>;\n\ntype NodeFontSizeTarget =\n\t| { readonly kind: 'block'; readonly path: readonly BlockId[]; readonly attrs: BlockAttrs }\n\t| {\n\t\t\treadonly kind: 'inline';\n\t\t\treadonly blockId: BlockId;\n\t\t\treadonly offset: number;\n\t\t\treadonly attrs: InlineNodeAttrs;\n\t };\n\nfunction specDeclaresFontSize(\n\tspec: { readonly attrs?: Readonly<Record<string, unknown>> } | undefined,\n): boolean {\n\treturn spec?.attrs?.fontSize !== undefined;\n}\n\n/**\n * Resolves the node the current selection targets for font sizing, when that\n * node's schema spec declares a `fontSize` attribute: a void/selectable block\n * under a NodeSelection, or a single atomic inline node under a width-1 text\n * selection. Returns null for ordinary text (which uses the fontSize mark).\n */\nfunction nodeFontSizeTarget(state: EditorState): NodeFontSizeTarget | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel)) {\n\t\tconst block = state.getBlock(sel.nodeId);\n\t\tif (!block || !specDeclaresFontSize(state.schema.getNodeSpec?.(block.type))) return null;\n\t\tconst path: readonly BlockId[] = state.getNodePath(sel.nodeId) ?? [sel.nodeId];\n\t\treturn { kind: 'block', path, attrs: block.attrs ?? {} };\n\t}\n\tconst inline = singleSelectedInlineNode(state);\n\tif (inline && specDeclaresFontSize(state.schema.getInlineNodeSpec?.(inline.node.inlineType))) {\n\t\treturn {\n\t\t\tkind: 'inline',\n\t\t\tblockId: inline.blockId,\n\t\t\toffset: inline.offset,\n\t\t\tattrs: inline.node.attrs,\n\t\t};\n\t}\n\treturn null;\n}\n\n/** Returns the single inline node a width-1 text selection covers, if any. */\nfunction singleSelectedInlineNode(\n\tstate: EditorState,\n): { readonly node: InlineNode; readonly blockId: BlockId; readonly offset: number } | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel) || isCollapsed(sel)) return null;\n\tif (sel.anchor.blockId !== sel.head.blockId) return null;\n\tconst from: number = Math.min(sel.anchor.offset, sel.head.offset);\n\tconst to: number = Math.max(sel.anchor.offset, sel.head.offset);\n\tif (to - from !== 1) return null;\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\tfor (const { child, from: childFrom } of walkInlineContent(getInlineChildren(block))) {\n\t\tif (childFrom === from && isInlineNode(child)) {\n\t\t\treturn { node: child, blockId: sel.anchor.blockId, offset: from };\n\t\t}\n\t}\n\treturn null;\n}\n\n/** Reads a fontSize attr value from raw attrs, or null when unset. */\nfunction readFontSize(attrs: BlockAttrs | InlineNodeAttrs | undefined): string | null {\n\tconst fontSize = attrs?.fontSize;\n\treturn typeof fontSize === 'string' && fontSize.length > 0 ? fontSize : null;\n}\n\n/** Merges a fontSize value ('' clears it) into existing attrs, preserving the rest. */\nfunction mergeFontSize(\n\tattrs: InlineNodeAttrs | undefined,\n\tsize: string,\n): Record<string, string | number | boolean>;\nfunction mergeFontSize(attrs: BlockAttrs | undefined, size: string): BlockAttrs;\nfunction mergeFontSize(attrs: BlockAttrs | InlineNodeAttrs | undefined, size: string): BlockAttrs {\n\treturn { ...(attrs ?? {}), fontSize: size };\n}\n\n/** The node's current fontSize value, or null when unset. */\nfunction nodeFontSizeValue(target: NodeFontSizeTarget): string | null {\n\treturn readFontSize(target.attrs);\n}\n\n/** Writes `size` (or '' to clear) onto a single target node's fontSize attr. */\nfunction dispatchNodeFontSize(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\ttarget: NodeFontSizeTarget,\n\tsize: string,\n): boolean {\n\tconst builder = state.transaction('command');\n\tif (target.kind === 'block') {\n\t\tbuilder.setNodeAttr(target.path, mergeFontSize(target.attrs, size));\n\t} else {\n\t\tbuilder.setInlineNodeAttr(target.blockId, target.offset, mergeFontSize(target.attrs, size));\n\t}\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Range carriers (text marks + font-size-aware nodes) ---\n//\n// A font-size operation over a selection range touches every \"carrier\" it spans:\n// text runs (which take the fontSize mark) and atomic font-size-aware nodes such\n// as formulas (which take the fontSize attr). This is what lets a select-all that\n// includes a formula resize the formula alongside the surrounding text.\n\nconst FONT_SIZE_TYPE: MarkTypeName = markType('fontSize');\n\ntype FontSizeCarrier =\n\t| {\n\t\t\treadonly kind: 'text';\n\t\t\treadonly blockId: BlockId;\n\t\t\treadonly from: number;\n\t\t\treadonly to: number;\n\t\t\treadonly mark: Mark | undefined;\n\t }\n\t| { readonly kind: 'blockNode'; readonly path: readonly BlockId[]; readonly attrs: BlockAttrs }\n\t| {\n\t\t\treadonly kind: 'inlineNode';\n\t\t\treadonly blockId: BlockId;\n\t\t\treadonly offset: number;\n\t\t\treadonly attrs: InlineNodeAttrs;\n\t };\n\n/** Enumerates the font-size carriers within the current (non-collapsed) text range. */\nfunction rangeCarriers(state: EditorState): FontSizeCarrier[] {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return [];\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst range = selectionRange(sel, blockOrder);\n\tconst fromIdx: number = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx: number = blockOrder.indexOf(range.to.blockId);\n\tconst carriers: FontSizeCarrier[] = [];\n\n\tfor (let i = fromIdx; i <= toIdx; i++) {\n\t\tconst blockId = blockOrder[i];\n\t\tif (!blockId) continue;\n\t\tconst block = state.getBlock(blockId);\n\t\tif (!block) continue;\n\t\tconst from: number = i === fromIdx ? range.from.offset : 0;\n\t\tconst to: number = i === toIdx ? range.to.offset : getBlockLength(block);\n\n\t\t// Atomic, font-size-aware block (e.g. a display formula): size the whole node.\n\t\tif (specDeclaresFontSize(state.schema.getNodeSpec?.(block.type))) {\n\t\t\tcarriers.push({\n\t\t\t\tkind: 'blockNode',\n\t\t\t\tpath: state.getNodePath(blockId) ?? [blockId],\n\t\t\t\tattrs: block.attrs ?? {},\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (from === to) continue;\n\t\tcollectInlineCarriers(state, block, blockId, from, to, carriers);\n\t}\n\treturn carriers;\n}\n\n/** Adds a text carrier (when the slice holds text) plus any font-size-aware inline nodes. */\nfunction collectInlineCarriers(\n\tstate: EditorState,\n\tblock: BlockNode,\n\tblockId: BlockId,\n\tfrom: number,\n\tto: number,\n\tcarriers: FontSizeCarrier[],\n): void {\n\tlet pos = 0;\n\tlet hasText = false;\n\tlet textMark: Mark | undefined;\n\tfor (const child of getInlineChildren(block)) {\n\t\tif (isTextNode(child)) {\n\t\t\tconst end: number = pos + child.text.length;\n\t\t\tif (child.text.length > 0 && end > from && pos < to) {\n\t\t\t\thasText = true;\n\t\t\t\tif (!textMark) textMark = child.marks.find((m) => m.type === FONT_SIZE_TYPE);\n\t\t\t}\n\t\t\tpos = end;\n\t\t} else {\n\t\t\tif (\n\t\t\t\tpos >= from &&\n\t\t\t\tpos < to &&\n\t\t\t\tspecDeclaresFontSize(state.schema.getInlineNodeSpec?.(child.inlineType))\n\t\t\t) {\n\t\t\t\tcarriers.push({ kind: 'inlineNode', blockId, offset: pos, attrs: child.attrs });\n\t\t\t}\n\t\t\tpos += 1;\n\t\t}\n\t}\n\tif (hasText) carriers.push({ kind: 'text', blockId, from, to, mark: textMark });\n}\n\n/** Sizes every carrier in the range ('' clears). Returns false when nothing changed. */\nfunction dispatchRangeFontSize(context: PluginContext, state: EditorState, size: string): boolean {\n\tconst carriers: FontSizeCarrier[] = rangeCarriers(state);\n\tif (carriers.length === 0) return false;\n\tconst builder = state.transaction('command');\n\tlet changed = false;\n\n\tfor (const carrier of carriers) {\n\t\tif (carrier.kind === 'text') {\n\t\t\tif (size === '') {\n\t\t\t\tif (carrier.mark) {\n\t\t\t\t\tbuilder.removeMark(carrier.blockId, carrier.from, carrier.to, carrier.mark);\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (carrier.mark)\n\t\t\t\t\tbuilder.removeMark(carrier.blockId, carrier.from, carrier.to, carrier.mark);\n\t\t\t\tbuilder.addMark(carrier.blockId, carrier.from, carrier.to, {\n\t\t\t\t\ttype: FONT_SIZE_TYPE,\n\t\t\t\t\tattrs: { size },\n\t\t\t\t});\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst current: string | null = readFontSize(carrier.attrs);\n\t\tif (size === current || (size === '' && current === null)) continue;\n\t\tif (carrier.kind === 'blockNode') {\n\t\t\tbuilder.setNodeAttr(carrier.path, mergeFontSize(carrier.attrs, size));\n\t\t} else {\n\t\t\tbuilder.setInlineNodeAttr(\n\t\t\t\tcarrier.blockId,\n\t\t\t\tcarrier.offset,\n\t\t\t\tmergeFontSize(carrier.attrs, size),\n\t\t\t);\n\t\t}\n\t\tchanged = true;\n\t}\n\n\tif (!changed) return false;\n\tbuilder.setSelection(state.selection);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** The set of fontSize values carried by font-size-aware nodes in the range, or null when none. */\nfunction rangeNodeSizes(state: EditorState): Set<string> | null {\n\tconst nodeAttrs: (BlockAttrs | InlineNodeAttrs)[] = rangeCarriers(state)\n\t\t.filter((carrier) => carrier.kind !== 'text')\n\t\t.map((carrier) => carrier.attrs);\n\tif (nodeAttrs.length === 0) return null;\n\treturn new Set(nodeAttrs.map((attrs) => readFontSize(attrs) ?? ''));\n}\n\n// --- State Queries ---\n\n/** Returns the raw fontSize CSS value at the current selection, or null. */\nexport function getActiveSize(state: EditorState): string | null {\n\tconst target = nodeFontSizeTarget(state);\n\tif (target) return nodeFontSizeValue(target);\n\t// Additive: when a range spans font-size-aware nodes (e.g. a formula) that all\n\t// share one explicit size, report it; otherwise read the text mark as before.\n\tconst sizes = rangeNodeSizes(state);\n\tif (sizes && sizes.size === 1) {\n\t\tconst [only] = sizes;\n\t\tif (only) return only;\n\t}\n\treturn getMarkAttrAtSelection(state, 'fontSize', (m) => m.attrs.size ?? null);\n}\n\n/** Returns the active font size as a number, falling back to defaultSize. */\nexport function getActiveSizeNumeric(state: EditorState, defaultSize: number): number {\n\tconst raw: string | null = getActiveSize(state);\n\tif (!raw) return defaultSize;\n\tconst parsed: number = Number.parseInt(raw, 10);\n\treturn Number.isNaN(parsed) ? defaultSize : parsed;\n}\n\n/** Returns true when the selection carries a fontSize (mark or node attribute). */\nexport function isFontSizeActive(state: EditorState): boolean {\n\tconst target = nodeFontSizeTarget(state);\n\tif (target) return nodeFontSizeValue(target) !== null;\n\tconst sizes = rangeNodeSizes(state);\n\tif (sizes && [...sizes].some((size) => size.length > 0)) return true;\n\treturn isAttributedMarkActive(state, 'fontSize');\n}\n\n// --- Commands ---\n\n/**\n * Applies the given CSS size to the selection: as a node `fontSize` attribute\n * when a font-size-aware node is selected (e.g. a formula), otherwise as a\n * fontSize mark on the selected text.\n */\nexport function applyFontSize(context: PluginContext, state: EditorState, size: string): boolean {\n\tconst target = nodeFontSizeTarget(state);\n\tif (target) return dispatchNodeFontSize(context, state, target, size);\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tif (isCollapsed(sel)) {\n\t\tconst mark = { type: markType('fontSize'), attrs: { size } };\n\t\treturn dispatchIfPresent(context, applyAttributedMark(state, mark));\n\t}\n\treturn dispatchRangeFontSize(context, state, size);\n}\n\n/** Removes the fontSize (node attribute or mark) from the current selection. */\nexport function removeFontSize(context: PluginContext, state: EditorState): boolean {\n\tconst target = nodeFontSizeTarget(state);\n\tif (target) {\n\t\tif (nodeFontSizeValue(target) === null) return false;\n\t\treturn dispatchNodeFontSize(context, state, target, '');\n\t}\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tif (isCollapsed(sel)) {\n\t\treturn dispatchIfPresent(context, removeAttributedMark(state, markType('fontSize')));\n\t}\n\treturn dispatchRangeFontSize(context, state, '');\n}\n\n/** Steps the font size up or down through the preset list. */\nexport function stepFontSize(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tdirection: 'up' | 'down',\n\tsizes: readonly number[],\n\tdefaultSize: number,\n): boolean {\n\tconst current: number = getActiveSizeNumeric(state, defaultSize);\n\tconst next: number | null = getNextPresetSize(current, direction, sizes);\n\tif (next === null) return false;\n\n\tif (next === defaultSize) {\n\t\treturn removeFontSize(context, state);\n\t}\n\treturn applyFontSize(context, state, `${next}px`);\n}\n\n/**\n * Selects a specific font size: removes the mark when size equals the\n * default, otherwise applies the new size.\n */\nexport function selectSize(context: PluginContext, size: number, defaultSize: number): void {\n\tif (size === defaultSize) {\n\t\tcontext.executeCommand('removeFontSize');\n\t} else {\n\t\tapplyFontSize(context, context.getState(), `${size}px`);\n\t}\n}\n\n// --- Helpers ---\n\n/** Finds the next preset size in the given direction, or null at boundaries. */\nexport function getNextPresetSize(\n\tcurrent: number,\n\tdirection: 'up' | 'down',\n\tsizes: readonly number[],\n): number | null {\n\tif (direction === 'up') {\n\t\tfor (const size of sizes) {\n\t\t\tif (size > current) return size;\n\t\t}\n\t\treturn null;\n\t}\n\tfor (let i: number = sizes.length - 1; i >= 0; i--) {\n\t\tconst size: number | undefined = sizes[i];\n\t\tif (size !== undefined && size < current) return size;\n\t}\n\treturn null;\n}\n","/**\n * Renders the font-size picker popup with a custom numeric input\n * and an accessible preset list with keyboard navigation.\n */\n\nimport type { PluginContext } from '../Plugin.js';\nimport type { PopupCloseOptions } from '../shared/PopupManager.js';\nimport type { FontSizeLocale } from './FontSizeLocale.js';\nimport { getActiveSizeNumeric, selectSize } from './FontSizeOperations.js';\n\n// --- Constants ---\n\nconst MIN_CUSTOM_SIZE = 1;\nconst MAX_CUSTOM_SIZE = 400;\n\n// --- Config ---\n\nexport interface FontSizePopupConfig {\n\treadonly sizes: readonly number[];\n\treadonly defaultSize: number;\n\treadonly onClose: (options?: PopupCloseOptions) => void;\n\treadonly contentElement: HTMLElement;\n\treadonly locale: FontSizeLocale;\n}\n\n// --- Public Entry Point ---\n\n/** Builds the font-size picker DOM inside the given container. */\nexport function renderFontSizePopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): void {\n\tcontainer.classList.add('notectl-font-size-picker');\n\n\tconst currentSize: number = getActiveSizeNumeric(context.getState(), config.defaultSize);\n\n\tconst input: HTMLInputElement = buildCustomInput(currentSize, config);\n\tappendInputWrapper(container, input);\n\n\tconst { list, items } = buildSizeList(config.sizes, currentSize, context, config);\n\tcontainer.appendChild(list);\n\n\tscrollActiveIntoView(items, config.sizes, currentSize, list);\n\tattachKeyboardNavigation(input, list, items, context, config);\n}\n\n// --- Custom Input ---\n\nfunction buildCustomInput(currentSize: number, config: FontSizePopupConfig): HTMLInputElement {\n\tconst input: HTMLInputElement = document.createElement('input');\n\tinput.type = 'number';\n\tinput.className = 'notectl-font-size-picker__input';\n\tinput.min = String(MIN_CUSTOM_SIZE);\n\tinput.max = String(MAX_CUSTOM_SIZE);\n\tinput.value = String(currentSize);\n\tinput.setAttribute('aria-label', config.locale.customFontSizeAria);\n\treturn input;\n}\n\nfunction appendInputWrapper(container: HTMLElement, input: HTMLInputElement): void {\n\tconst wrapper: HTMLDivElement = document.createElement('div');\n\twrapper.className = 'notectl-font-size-picker__input-wrapper';\n\twrapper.appendChild(input);\n\tcontainer.appendChild(wrapper);\n}\n\n// --- Size List ---\n\ninterface SizeListResult {\n\treadonly list: HTMLDivElement;\n\treadonly items: HTMLButtonElement[];\n}\n\nfunction buildSizeList(\n\tsizes: readonly number[],\n\tcurrentSize: number,\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): SizeListResult {\n\tconst list: HTMLDivElement = document.createElement('div');\n\tlist.className = 'notectl-font-size-picker__list';\n\tlist.setAttribute('role', 'listbox');\n\tlist.setAttribute('aria-label', config.locale.fontSizesAria);\n\n\tconst items: HTMLButtonElement[] = [];\n\n\tfor (const size of sizes) {\n\t\tconst isActive: boolean = size === currentSize;\n\t\tconst item: HTMLButtonElement = buildSizeItem(size, isActive);\n\n\t\titem.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tselectSize(context, size, config.defaultSize);\n\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t});\n\n\t\titems.push(item);\n\t\tlist.appendChild(item);\n\t}\n\n\treturn { list, items };\n}\n\nfunction buildSizeItem(size: number, isActive: boolean): HTMLButtonElement {\n\tconst item: HTMLButtonElement = document.createElement('button');\n\titem.type = 'button';\n\titem.id = `notectl-font-size-option-${size}`;\n\titem.className = 'notectl-font-size-picker__item';\n\titem.setAttribute('role', 'option');\n\titem.setAttribute('aria-selected', String(isActive));\n\n\tif (isActive) {\n\t\titem.classList.add('notectl-font-size-picker__item--active');\n\t}\n\n\tconst check: HTMLSpanElement = document.createElement('span');\n\tcheck.className = 'notectl-font-size-picker__check';\n\tcheck.textContent = isActive ? '\\u2713' : '';\n\titem.appendChild(check);\n\n\tconst label: HTMLSpanElement = document.createElement('span');\n\tlabel.className = 'notectl-font-size-picker__label';\n\tlabel.textContent = String(size);\n\titem.appendChild(label);\n\n\treturn item;\n}\n\n// --- Scroll ---\n\nfunction scrollActiveIntoView(\n\titems: HTMLButtonElement[],\n\tsizes: readonly number[],\n\tcurrentSize: number,\n\tlist: HTMLDivElement,\n): void {\n\tconst activeIdx: number = sizes.indexOf(currentSize);\n\tif (activeIdx < 0) return;\n\n\tconst activeItem: HTMLButtonElement | undefined = items[activeIdx];\n\tif (!activeItem) return;\n\n\trequestAnimationFrame(() => {\n\t\tactiveItem.scrollIntoView({ block: 'nearest' });\n\t});\n\tlist.setAttribute('aria-activedescendant', activeItem.id);\n}\n\n// --- Keyboard Navigation ---\n\nfunction attachKeyboardNavigation(\n\tinput: HTMLInputElement,\n\tlist: HTMLDivElement,\n\titems: HTMLButtonElement[],\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): void {\n\tlet focusedIndex = -1;\n\n\tconst setFocused = (idx: number): void => {\n\t\tif (focusedIndex >= 0 && focusedIndex < items.length) {\n\t\t\titems[focusedIndex]?.classList.remove('notectl-font-size-picker__item--focused');\n\t\t}\n\t\tfocusedIndex = idx;\n\t\tconst el: HTMLButtonElement | undefined = items[focusedIndex];\n\t\tif (focusedIndex >= 0 && focusedIndex < items.length && el) {\n\t\t\tel.classList.add('notectl-font-size-picker__item--focused');\n\t\t\tel.scrollIntoView({ block: 'nearest' });\n\t\t\tlist.setAttribute('aria-activedescendant', el.id);\n\t\t}\n\t};\n\n\t// As an editable combobox (input + listbox), this popup owns its keyboard\n\t// model. `consume` claims a handled key so the toolbar's generic popup\n\t// handler does not also act on it and advance focus a second time (#144).\n\tconst consume = (e: KeyboardEvent): void => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t};\n\n\tinput.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Enter') {\n\t\t\tconsume(e);\n\t\t\tconst val: number = Number.parseInt(input.value, 10);\n\t\t\tif (!Number.isNaN(val) && val >= MIN_CUSTOM_SIZE && val <= MAX_CUSTOM_SIZE) {\n\t\t\t\tselectSize(context, val, config.defaultSize);\n\t\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t\t}\n\t\t} else if (e.key === 'ArrowDown') {\n\t\t\tconsume(e);\n\t\t\tsetFocused(0);\n\t\t\titems[0]?.focus();\n\t\t} else if (e.key === 'Escape') {\n\t\t\tconsume(e);\n\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t}\n\t});\n\n\tlist.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'ArrowDown') {\n\t\t\tconsume(e);\n\t\t\tif (focusedIndex < items.length - 1) {\n\t\t\t\tsetFocused(focusedIndex + 1);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t}\n\t\t} else if (e.key === 'ArrowUp') {\n\t\t\tconsume(e);\n\t\t\tif (focusedIndex > 0) {\n\t\t\t\tsetFocused(focusedIndex - 1);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t} else {\n\t\t\t\tsetFocused(-1);\n\t\t\t\tinput.focus();\n\t\t\t}\n\t\t} else if (e.key === 'Enter') {\n\t\t\tconsume(e);\n\t\t\tconst selectedSize: number | undefined = config.sizes[focusedIndex];\n\t\t\tif (focusedIndex >= 0 && focusedIndex < config.sizes.length && selectedSize !== undefined) {\n\t\t\t\tselectSize(context, selectedSize, config.defaultSize);\n\t\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t\t}\n\t\t} else if (e.key === 'Escape') {\n\t\t\tconsume(e);\n\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t}\n\t});\n}\n","/**\n * FontSizePlugin: registers a fontSize mark with attrs, a combobox-style\n * toolbar selector with WCAG-accessible popup, and commands for\n * increasing / decreasing font size.\n */\n\nimport { FONT_SIZE_SELECT_CSS } from '../../editor/styles/font-size-select.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { isValidCSSFontSize } from '../shared/ColorValidation.js';\nimport { createInlineStyleMarkSpec } from '../shared/InlineStyleMarkSpec.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { FONT_SIZE_LOCALE_EN, type FontSizeLocale, loadFontSizeLocale } from './FontSizeLocale.js';\nimport {\n\tgetActiveSizeNumeric,\n\tisFontSizeActive,\n\tremoveFontSize,\n\tstepFontSize,\n} from './FontSizeOperations.js';\nimport { renderFontSizePopup } from './FontSizePopup.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tfontSize: { size: string };\n\t}\n}\n\n// --- Constants ---\n\n/** Default preset sizes shown in the font size dropdown. */\nexport const DEFAULT_FONT_SIZES: readonly number[] = [\n\t8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96,\n];\n\nconst DEFAULT_FONT_SIZE = 16;\n\n// --- Configuration ---\n\nexport interface FontSizeConfig {\n\t/**\n\t * Preset sizes shown in the font size dropdown.\n\t * Must contain positive integers. Values are sorted and deduplicated automatically.\n\t * Defaults to {@link DEFAULT_FONT_SIZES} when omitted or empty.\n\t */\n\treadonly sizes?: readonly number[];\n\t/**\n\t * The base font size that text has when no fontSize mark is applied.\n\t * Shown as the initial value in the toolbar combo and used as the\n\t * \"neutral\" size — selecting it removes the mark instead of applying one.\n\t * Defaults to 16.\n\t */\n\treadonly defaultSize?: number;\n\treadonly locale?: FontSizeLocale;\n}\n\n// --- Plugin ---\n\nexport class FontSizePlugin implements Plugin {\n\treadonly id = 'fontSize';\n\treadonly name = 'Font Size';\n\treadonly priority = 21;\n\n\tprivate readonly config: FontSizeConfig;\n\tprivate readonly sizes: readonly number[];\n\tprivate readonly defaultSize: number;\n\tprivate locale!: FontSizeLocale;\n\n\tconstructor(config?: Partial<FontSizeConfig>) {\n\t\tthis.config = { ...config };\n\t\tthis.sizes = resolveSizes(config?.sizes);\n\t\tthis.defaultSize = resolveDefaultSize(config?.defaultSize);\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tFONT_SIZE_LOCALE_EN,\n\t\t\tloadFontSizeLocale,\n\t\t);\n\n\t\tcontext.registerStyleSheet(FONT_SIZE_SELECT_CSS);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerToolbarItem(context);\n\t\tthis.applyDefaultSizeToContainer(context);\n\t}\n\n\tdestroy(): void {\n\t\t// no-op: nothing to clean up\n\t}\n\n\t// --- Schema ---\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec(\n\t\t\tcreateInlineStyleMarkSpec({\n\t\t\t\ttype: 'fontSize',\n\t\t\t\trank: 4,\n\t\t\t\tvalueAttr: 'size',\n\t\t\t\tdomStyleProperty: 'fontSize',\n\t\t\t\tcssProperty: 'font-size',\n\t\t\t\tvalidate: isValidCSSFontSize,\n\t\t\t}),\n\t\t);\n\t}\n\n\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('removeFontSize', () => {\n\t\t\treturn removeFontSize(context, context.getState());\n\t\t});\n\n\t\tcontext.registerCommand('setFontSize', () => {\n\t\t\treturn false;\n\t\t});\n\n\t\tcontext.registerCommand('increaseFontSize', () => {\n\t\t\treturn stepFontSize(context, context.getState(), 'up', this.sizes, this.defaultSize);\n\t\t});\n\n\t\tcontext.registerCommand('decreaseFontSize', () => {\n\t\t\treturn stepFontSize(context, context.getState(), 'down', this.sizes, this.defaultSize);\n\t\t});\n\t}\n\n\t// --- Keymaps ---\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-+': () => {\n\t\t\t\treturn stepFontSize(context, context.getState(), 'up', this.sizes, this.defaultSize);\n\t\t\t},\n\t\t\t'Mod-Shift-_': () => {\n\t\t\t\treturn stepFontSize(context, context.getState(), 'down', this.sizes, this.defaultSize);\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'fontSize',\n\t\t\tgroup: 'format',\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip,\n\t\t\tcommand: 'removeFontSize',\n\t\t\tpopupType: 'combobox',\n\t\t\tgetLabel: (state: EditorState): string =>\n\t\t\t\tString(getActiveSizeNumeric(state, this.defaultSize)),\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\trenderFontSizePopup(container, ctx, {\n\t\t\t\t\tsizes: this.sizes,\n\t\t\t\t\tdefaultSize: this.defaultSize,\n\t\t\t\t\tonClose,\n\t\t\t\t\tcontentElement: ctx.getContainer(),\n\t\t\t\t\tlocale: this.locale,\n\t\t\t\t});\n\t\t\t},\n\t\t\tisActive: (state) => isFontSizeActive(state),\n\t\t});\n\t}\n\n\t/**\n\t * Sets the configured default font size on the editor content container\n\t * so that unformatted text renders at the correct size instead of the\n\t * browser default (16px).\n\t */\n\tprivate applyDefaultSizeToContainer(context: PluginContext): void {\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tsetStyleProperty(container, 'fontSize', `${this.defaultSize}px`);\n\t}\n}\n\n// --- Helpers ---\n\nfunction resolveSizes(sizes: readonly number[] | undefined): readonly number[] {\n\tif (!sizes || sizes.length === 0) return DEFAULT_FONT_SIZES;\n\tconst unique: number[] = [...new Set(sizes)].filter((n) => Number.isInteger(n) && n > 0);\n\tunique.sort((a, b) => a - b);\n\treturn unique.length > 0 ? unique : DEFAULT_FONT_SIZES;\n}\n\nfunction resolveDefaultSize(size: number | undefined): number {\n\tif (size === undefined) return DEFAULT_FONT_SIZE;\n\treturn Number.isInteger(size) && size > 0 ? size : DEFAULT_FONT_SIZE;\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{J as t,P as e,g as n,p as i,z as a}from"./Document-D_2cIBJG.mjs";import{c as r,d as o,f as l,i as s,n as c}from"./Selection-DC6AOGgF.mjs";import{a as p,r as u}from"./TypeBrands-Ch9856Gb.mjs";import{c as d,w as m}from"./BlockInsertion-O5pAFKid.mjs";import{t as h}from"./Commands-D-0UXYvo.mjs";import{n as f}from"./HTMLSanitization-Ce9dVT1q.mjs";import{c as b,i as g,o as v}from"./PluginHelpers-WG1Lzzh3.mjs";import{n as x}from"./DomUtils-Bf7JLFlx.mjs";import{t as y}from"./SelectionSync-CwOHMMfI.mjs";import{a as w}from"./PopupPositioning-CIqgpqlW.mjs";import{r as L}from"./ColorValidation-B9d_umnf.mjs";var k={"&":"&","<":"<",">":">"},S={"&":"&","<":"<",">":">",'"':"""};function C(t){return t.replace(/[&<>]/g,t=>k[t]??t)}function $(t){return t.replace(/[&<>"]/g,t=>S[t]??t)}function A(t){if(!t)return"";let e="";for(const[n,i]of Object.entries(t))!1!==i&&null!=i&&(e+=!0!==i?` ${n}="${$(String(i))}"`:` ${n}="true"`);return e}function z(t,e,n){return`<${t}${A(n)}>${e}</${t}>`}function _(t,e){return z("mi",C(t),e)}function E(t,e){return z("mn",C(t),e)}function B(t,e){return z("mo",C(t),e)}function I(t,e){return z("mtext",C(t),e)}function P(t){return function(t,e){return`<${t}${A(e)}></${t}>`}("mspace",t)}function D(t,e){return z("mrow",t,e)}function N(t){return 0===t.length?"":1===t.length?t[0]??"":D(t.join(""))}function F(t,e,n){return z("mfrac",`${t}${e}`,n)}function q(t,e,n){return z("mover",`${t}${e}`,n)}function R(t,e,n){return z("munder",`${t}${e}`,n)}function O(t){return z("mtd",t)}function T(t){return z("mtr",t.map(O).join(""))}var M={"&":"&","<":"<",">":">",""":'"',"'":"'","'":"'"};function j(t){const e=t.display?"block":"inline",n=t.alt?` alttext="${$(t.alt)}"`:"",i=void 0!==t.latex&&""!==t.latex,a=`<annotation encoding="application/x-tex">${C(t.latex??"")}</annotation>`;return`<math display="${e}"${n}>${i?`<semantics>${t.presentation}${a}</semantics>`:t.presentation}</math>`}function H(t){const e=t.match(/<annotation\b[^>]*\bencoding=["']application\/x-tex["'][^>]*>([\s\S]*?)<\/annotation>/i);var n;if(e&&void 0!==e[1])return(n=e[1],n.replace(/&(?:amp|lt|gt|quot|apos|#39);/g,t=>M[t]??t)).trim()}function G(t){return t.replace(/^(<math\b[^>]*?)\s+mathsize=(?:"[^"]*"|'[^']*')/i,"$1")}var U=/<math[\s>]/i;function K(t){return U.test(t.mathml)?function(t,e){const n=t.replace(/^(<math\b[^>]*?)\s+alttext=["'][^"']*["']/i,"$1");return e?n.replace(/^<math\b/i,`<math alttext="${$(e)}"`):n}(t.mathml,t.alt):""}function W(t,e){const n=K(e);n?t.innerHTML=n:t.textContent=e.latex||e.alt||"⊡"}function V(t,e){const n="string"==typeof e?.fontSize?e.fontSize:"";t.style.fontSize=n}function Z(t){return{mathml:"string"==typeof t?.mathml?t.mathml:"",latex:"string"==typeof t?.latex?t.latex:"",alt:"string"==typeof t?.alt?t.alt:"",fontSize:"string"==typeof t?.fontSize?t.fontSize:""}}function X(t){const e=K(t);return e?function(t,e){const n=G(t);return e?n.replace(/^<math\b/i,`<math mathsize="${$(e)}"`):n}(e,L(t.fontSize)?t.fontSize:""):e}function Q(t){const e=t.getAttribute("mathsize")??"";return L(e)?e:""}function J(t,e){if("block"===t.getAttribute("display")!==e)return!1;const n=G(function(t){return t.replace(/^(<math\b[^>]*?)\s+data-block-id=(?:"[^"]*"|'[^']*')/i,"$1")}(t.outerHTML));return{mathml:n,latex:H(n)??"",alt:t.getAttribute("alttext")??"",fontSize:Q(t)}}var Y="math_inline",tt="math_display",et={insertInline:"Mod-Shift-E",insertDisplay:"Mod-Shift-M"},nt=[12,16,20,24,32,40,48,64,96],it={},at=["math","semantics","annotation","mrow","mi","mn","mo","mtext","ms","mspace","mfrac","msqrt","mroot","msup","msub","msubsup","mover","munder","munderover","mmultiscripts","mprescripts","none","mtable","mtr","mlabeledtr","mtd","mpadded","mphantom","mstyle","merror","menclose","mfenced","maction"],rt=["display","encoding","mathvariant","mathsize","mathcolor","mathbackground","displaystyle","scriptlevel","scriptminsize","scriptsizemultiplier","stretchy","symmetric","largeop","movablelimits","accent","accentunder","form","fence","separator","lspace","rspace","voffset","minsize","maxsize","linethickness","columnalign","rowalign","columnspacing","rowspacing","columnlines","rowlines","columnspan","rowspan","align","open","close","separators","notation","alttext","depth","width","height"];function ot(t){const e=t.selection;if(!o(e))return null;const n=t.getBlock(e.nodeId);return n&&"math_display"===n.type?e.nodeId:null}function lt(t){return{mathml:t.mathml,latex:t.latex,alt:t.alt,fontSize:t.fontSize}}function st(t,e){const i=t.selection;if(0===e.length||!l(i))return null;const a=t.transaction("command"),o=r(i)?void 0:h(t,a);let s,p;if(o)s=o,p=0;else{const e=m(i,t.getBlockOrder());s=e.blockId,p=e.offset}for(const r of e)a.insertInlineNode(s,p,n(u(Y),lt(r))),p+=1;return a.setSelection(c(s,p)),a.build()}function ct(t,e){const n=g(t);if(0===e.length||!n)return null;const a=e.map(t=>i(p(tt),[],void 0,lt(t))),r=t.transaction("command");if(!d(t,r,n,a))return null;const o=a[a.length-1];return o?(r.setSelection(s(o.id,[])),r.build()):null}function pt(t){return{mathml:t.mathml,latex:t.latex,alt:t.alt,fontSize:t.fontSize}}function ut(t,e,n){const i=pt(n);n.display?function(t,e){const n=function(t,e){return ct(t,[e])}(t.getState(),e);!!n&&t.dispatch(n)}(t,i):function(t,e){const n=function(t,e){return st(t,[e])}(t.getState(),e);!!n&&t.dispatch(n)}(t,i),t.announce(e.inserted)}function dt(t,e){return void 0===e?{node:t}:{node:t,kind:e}}function mt(t,e,n=!1){return{node:t,kind:e,bigOp:!0,intLike:n}}var ht=/* @__PURE__ */function(t){return t.Ordinary="ordinary",t.Binary="binary",t.Relation="relation",t.Arrow="arrow",t.Open="open",t.Close="close",t.Function="function",t.BigOp="bigop",t.Punct="punct",t}({});function ft(t,e){return{char:t,kind:e}}var bt="ordinary",gt="binary",vt="relation",xt="arrow",yt="function",wt="bigop",Lt="punct",kt={alpha:ft("α",bt),beta:ft("β",bt),gamma:ft("γ",bt),delta:ft("δ",bt),epsilon:ft("ϵ",bt),varepsilon:ft("ε",bt),zeta:ft("ζ",bt),eta:ft("η",bt),theta:ft("θ",bt),vartheta:ft("ϑ",bt),iota:ft("ι",bt),kappa:ft("κ",bt),lambda:ft("λ",bt),mu:ft("μ",bt),nu:ft("ν",bt),xi:ft("ξ",bt),omicron:ft("ο",bt),pi:ft("π",bt),varpi:ft("ϖ",bt),rho:ft("ρ",bt),varrho:ft("ϱ",bt),sigma:ft("σ",bt),varsigma:ft("ς",bt),tau:ft("τ",bt),upsilon:ft("υ",bt),phi:ft("ϕ",bt),varphi:ft("φ",bt),chi:ft("χ",bt),psi:ft("ψ",bt),omega:ft("ω",bt),Gamma:ft("Γ",bt),Delta:ft("Δ",bt),Theta:ft("Θ",bt),Lambda:ft("Λ",bt),Xi:ft("Ξ",bt),Pi:ft("Π",bt),Sigma:ft("Σ",bt),Upsilon:ft("Υ",bt),Phi:ft("Φ",bt),Psi:ft("Ψ",bt),Omega:ft("Ω",bt)},St={sin:ft("sin",yt),cos:ft("cos",yt),tan:ft("tan",yt),cot:ft("cot",yt),sec:ft("sec",yt),csc:ft("csc",yt),sinh:ft("sinh",yt),cosh:ft("cosh",yt),tanh:ft("tanh",yt),coth:ft("coth",yt),arcsin:ft("arcsin",yt),arccos:ft("arccos",yt),arctan:ft("arctan",yt),log:ft("log",yt),ln:ft("ln",yt),lg:ft("lg",yt),exp:ft("exp",yt),deg:ft("deg",yt),det:ft("det",yt),dim:ft("dim",yt),hom:ft("hom",yt),ker:ft("ker",yt),arg:ft("arg",yt),Pr:ft("Pr",yt)},Ct={sum:ft("∑",wt),prod:ft("∏",wt),coprod:ft("∐",wt),int:ft("∫",wt),iint:ft("∬",wt),iiint:ft("∭",wt),oint:ft("∮",wt),bigcup:ft("⋃",wt),bigcap:ft("⋂",wt),bigsqcup:ft("⨆",wt),bigvee:ft("⋁",wt),bigwedge:ft("⋀",wt),bigoplus:ft("⨁",wt),bigotimes:ft("⨂",wt),bigodot:ft("⨀",wt),biguplus:ft("⨄",wt),lim:ft("lim",wt),limsup:ft("lim sup",wt),liminf:ft("lim inf",wt),injlim:ft("inj lim",wt),projlim:ft("proj lim",wt),max:ft("max",wt),min:ft("min",wt),sup:ft("sup",wt),inf:ft("inf",wt),gcd:ft("gcd",wt)},$t={times:ft("×",gt),div:ft("÷",gt),pm:ft("±",gt),mp:ft("∓",gt),cdot:ft("⋅",gt),ast:ft("∗",gt),star:ft("⋆",gt),circ:ft("∘",gt),bullet:ft("∙",gt),oplus:ft("⊕",gt),ominus:ft("⊖",gt),otimes:ft("⊗",gt),oslash:ft("⊘",gt),odot:ft("⊙",gt),cap:ft("∩",gt),cup:ft("∪",gt),uplus:ft("⊎",gt),sqcap:ft("⊓",gt),sqcup:ft("⊔",gt),wedge:ft("∧",gt),land:ft("∧",gt),vee:ft("∨",gt),lor:ft("∨",gt),setminus:ft("∖",gt),wr:ft("≀",gt),diamond:ft("⋄",gt),bigtriangleup:ft("△",gt),bigtriangledown:ft("▽",gt),triangleleft:ft("◁",gt),triangleright:ft("▷",gt),amalg:ft("⨿",gt),dagger:ft("†",gt),ddagger:ft("‡",gt)},At={leq:ft("≤",vt),le:ft("≤",vt),geq:ft("≥",vt),ge:ft("≥",vt),neq:ft("≠",vt),ne:ft("≠",vt),equiv:ft("≡",vt),sim:ft("∼",vt),simeq:ft("≃",vt),cong:ft("≅",vt),approx:ft("≈",vt),propto:ft("∝",vt),prec:ft("≺",vt),succ:ft("≻",vt),preceq:ft("⪯",vt),succeq:ft("⪰",vt),ll:ft("≪",vt),gg:ft("≫",vt),lll:ft("⋘",vt),ggg:ft("⋙",vt),subset:ft("⊂",vt),supset:ft("⊃",vt),subseteq:ft("⊆",vt),supseteq:ft("⊇",vt),subsetneq:ft("⊊",vt),supsetneq:ft("⊋",vt),sqsubseteq:ft("⊑",vt),sqsupseteq:ft("⊒",vt),in:ft("∈",vt),ni:ft("∋",vt),notin:ft("∉",vt),mid:ft("∣",vt),parallel:ft("∥",vt),perp:ft("⊥",vt),models:ft("⊨",vt),vdash:ft("⊢",vt),dashv:ft("⊣",vt),doteq:ft("≐",vt),asymp:ft("≍",vt),bowtie:ft("⋈",vt),smile:ft("⌣",vt),frown:ft("⌢",vt)},zt={leftarrow:ft("←",xt),gets:ft("←",xt),rightarrow:ft("→",xt),to:ft("→",xt),leftrightarrow:ft("↔",xt),Leftarrow:ft("⇐",xt),Rightarrow:ft("⇒",xt),Leftrightarrow:ft("⇔",xt),mapsto:ft("↦",xt),longrightarrow:ft("⟶",xt),longleftarrow:ft("⟵",xt),longleftrightarrow:ft("⟷",xt),Longrightarrow:ft("⟹",xt),Longleftarrow:ft("⟸",xt),Longleftrightarrow:ft("⟺",xt),implies:ft("⟹",xt),iff:ft("⟺",xt),uparrow:ft("↑",xt),downarrow:ft("↓",xt),updownarrow:ft("↕",xt),nearrow:ft("↗",xt),searrow:ft("↘",xt),swarrow:ft("↙",xt),nwarrow:ft("↖",xt),hookleftarrow:ft("↩",xt),hookrightarrow:ft("↪",xt),rightharpoonup:ft("⇀",xt),rightharpoondown:ft("⇁",xt),leftharpoonup:ft("↼",xt),leftharpoondown:ft("↽",xt),nleftarrow:ft("↚",xt),nrightarrow:ft("↛",xt)},_t={langle:ft("⟨","open"),rangle:ft("⟩","close"),lceil:ft("⌈","open"),rceil:ft("⌉","close"),lfloor:ft("⌊","open"),rfloor:ft("⌋","close"),lbrace:ft("{","open"),rbrace:ft("}","close"),lbrack:ft("[","open"),rbrack:ft("]","close"),lvert:ft("|","open"),rvert:ft("|","close"),lVert:ft("‖","open"),rVert:ft("‖","close"),vert:ft("|","relation"),Vert:ft("‖","relation"),backslash:ft("\\",bt)},Et={infty:ft("∞",bt),partial:ft("∂",bt),nabla:ft("∇",bt),forall:ft("∀",bt),exists:ft("∃",bt),nexists:ft("∄",bt),emptyset:ft("∅",bt),varnothing:ft("∅",bt),aleph:ft("ℵ",bt),beth:ft("ℶ",bt),hbar:ft("ℏ",bt),ell:ft("ℓ",bt),Re:ft("ℜ",bt),Im:ft("ℑ",bt),wp:ft("℘",bt),prime:ft("′",bt),angle:ft("∠",bt),measuredangle:ft("∡",bt),triangle:ft("△",bt),neg:ft("¬",bt),lnot:ft("¬",bt),top:ft("⊤",bt),bot:ft("⊥",bt),flat:ft("♭",bt),natural:ft("♮",bt),sharp:ft("♯",bt),clubsuit:ft("♣",bt),diamondsuit:ft("♢",bt),heartsuit:ft("♡",bt),spadesuit:ft("♠",bt),surd:ft("√",bt),complement:ft("∁",bt),square:ft("□",bt),blacksquare:ft("■",bt),bigstar:ft("★",bt),checkmark:ft("✓",bt),degree:ft("°",bt),cdots:ft("⋯",bt),ldots:ft("…",bt),dots:ft("…",bt),dotsb:ft("⋯",bt),vdots:ft("⋮",bt),ddots:ft("⋱",bt)},Bt={colon:ft(":",Lt),cdotp:ft("·",Lt),ldotp:ft(".",Lt)},It={...kt,...St,...Ct,...$t,...At,...zt,..._t,...Et,...Bt},Pt={"(":ft("(","open"),")":ft(")","close"),"[":ft("[","open"),"]":ft("]","close"),"|":ft("|","relation"),"/":ft("/",bt)};function Dt(t){if("."===t)return ft("",bt);if(t.startsWith("\\")){const e=t.slice(1);return"{"===e?ft("{","open"):"}"===e?ft("}","close"):"|"===e?ft("‖","relation"):"\\"===e?ft("\\",bt):_t[e]}return Pt[t]}var Nt=/* @__PURE__ */function(t){return t.Command="command",t.GroupOpen="groupOpen",t.GroupClose="groupClose",t.Superscript="superscript",t.Subscript="subscript",t.Prime="prime",t.Ampersand="ampersand",t.RowBreak="rowBreak",t.NbSpace="nbSpace",t.Number="number",t.Char="char",t}({}),Ft=/* @__PURE__ */new Set(["{","}","%","$","#","&","_",",",":",";","!"," ","|","\\",".","/","'","~","^"]);function qt(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}function Rt(t){return t>="0"&&t<="9"}function Ot(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function Tt(t,e,n){return{type:t,value:e,position:n}}function Mt(t,e){const n=t[e+1];if(void 0!==n&&!qt(n))return"\\"===n?Tt("rowBreak","\\",e):Tt("command",n,e);let i=e+1;for(;i<t.length;){const e=t[i];if(void 0===e||!qt(e))break;i+=1}return Tt("command",t.slice(e+1,i),e)}function jt(t,e){let n=e;for(;n<t.length;){const e=t[n];if(void 0===e||!Rt(e))break;n+=1}if("."===t[n]&&void 0!==t[n+1]&&Rt(t[n+1]??""))for(n+=1;n<t.length;){const e=t[n];if(void 0===e||!Rt(e))break;n+=1}return Tt("number",t.slice(e,n),e)}function Ht(t,e){switch(t){case"{":return Tt("groupOpen",t,e);case"}":return Tt("groupClose",t,e);case"^":return Tt("superscript",t,e);case"_":return Tt("subscript",t,e);case"'":return Tt("prime",t,e);case"&":return Tt("ampersand",t,e);case"~":return Tt("nbSpace",t,e);default:return Tt("char",t,e)}}function Gt(t,e){return{glyph:t,under:!1,stretchy:e}}function Ut(t,e){return{glyph:t,under:!0,stretchy:e}}var Kt={hat:Gt("^",!1),widehat:Gt("^",!0),check:Gt("ˇ",!1),tilde:Gt("~",!1),widetilde:Gt("~",!0),bar:Gt("‾",!1),overline:Gt("‾",!0),vec:Gt("→",!1),overrightarrow:Gt("→",!0),overleftarrow:Gt("←",!0),overleftrightarrow:Gt("↔",!0),dot:Gt("˙",!1),ddot:Gt("¨",!1),dddot:Gt("⃛",!1),acute:Gt("´",!1),grave:Gt("`",!1),breve:Gt("˘",!1),mathring:Gt("˚",!1),overbrace:Gt("⏞",!0),underline:Ut("_",!0),underbrace:Ut("⏟",!0),underrightarrow:Ut("→",!0),underleftarrow:Ut("←",!0)},Wt={matrix:{open:"",close:""},pmatrix:{open:"(",close:")"},bmatrix:{open:"[",close:"]"},Bmatrix:{open:"{",close:"}"},vmatrix:{open:"|",close:"|"},Vmatrix:{open:"‖",close:"‖"},cases:{open:"{",close:"",columnalign:"left"},aligned:{open:"",close:"",columnalign:"right left"},align:{open:"",close:"",columnalign:"right left"},gathered:{open:"",close:"",columnalign:"center"},smallmatrix:{open:"",close:""}};function Vt(t){return t.type===Nt.Command&&"end"===t.value}function Zt(t){return t.type===Nt.Ampersand||t.type===Nt.RowBreak||t.type===Nt.Command&&"end"===t.value}var Xt={",":"0.167em",":":"0.222em",";":"0.278em","!":"-0.167em"," ":"0.25em",quad:"1em",qquad:"2em",thinspace:"0.167em",medspace:"0.222em",thickspace:"0.278em",negthinspace:"-0.167em",negmedspace:"-0.222em",negthickspace:"-0.278em",enspace:"0.5em"};function Qt(t){return t in Xt}function Jt(t){const e=Xt[t];if(void 0!==e)return P({width:e})}function Yt(){return P({width:"0.25em"})}function te(t){const e=t.parseRawArgument();return(n=e)in Wt||"array"===n?function(t,e){"array"===t&&(e.parseOptionalArgument(),e.parseRawArgument());const n=function(t,e){const n=[];let i=[],a=[];const r=()=>{i.push(D(a.join(""))),a=[]},o=()=>{r(),n.push(i),i=[]};for(;;){const n=e.peek();if(void 0===n){e.error({message:`Unterminated environment \\begin{${t}}`});break}if(Vt(n)){e.next(),e.parseRawArgument();break}if(n.type===Nt.Ampersand){e.next(),r();continue}if(n.type===Nt.RowBreak){e.next(),o();continue}if(n.type===Nt.GroupClose){e.next(),e.error({message:"Unmatched brace",position:n.position});continue}const i=e.parseAtomsUntil(Zt);a.push(...i.map(t=>t.node))}return(a.length>0||i.length>0)&&o(),0===n.length&&n.push([""]),n}(t,e).map(t=>t.map(t=>t)),i=Wt[t]??{open:"",close:""},a=(r=i.columnalign?{columnalign:i.columnalign}:void 0,z("mtable",n.map(T).join(""),r));var r;return i.open||i.close?dt(D(`${i.open?B(i.open,{stretchy:!0,fence:!0}):""}${a}${i.close?B(i.close,{stretchy:!0,fence:!0}):""}`)):dt(a)}(e,t):(t.error({message:"Unknown environment",command:e}),dt(z("merror",I(e))));var n}function ee(t){return t.type===Nt.Command&&"right"===t.value}function ne(t){const e=t.next();return void 0===e?".":e.type===Nt.Command?`\\${e.value}`:e.value}function ie(t){return t&&""!==t.char?B(t.char,{fence:!0,stretchy:!0}):""}var ae={},re={"double-struck":{upperBase:120120,lowerBase:120146,digitBase:120792,holes:{C:8450,H:8461,N:8469,P:8473,Q:8474,R:8477,Z:8484}},script:{upperBase:119964,lowerBase:119990,holes:{B:8492,E:8496,F:8497,H:8459,I:8464,L:8466,M:8499,R:8475,e:8495,g:8458,o:8500}},fraktur:{upperBase:120068,lowerBase:120094,holes:{C:8493,H:8460,I:8465,R:8476,Z:8488}},bold:{upperBase:119808,lowerBase:119834,digitBase:120782,holes:ae},italic:{upperBase:119860,lowerBase:119886,holes:{h:8462}},"sans-serif":{upperBase:120224,lowerBase:120250,digitBase:120802,holes:ae},monospace:{upperBase:120432,lowerBase:120458,digitBase:120822,holes:ae}};function oe(t,e){if(1!==t.length)return null;const n=re[e],i=n.holes[t];return void 0!==i?String.fromCodePoint(i):function(t){return t>="A"&&t<="Z"}(t)?String.fromCodePoint(n.upperBase+(t.charCodeAt(0)-65)):function(t){return t>="a"&&t<="z"}(t)?String.fromCodePoint(n.lowerBase+(t.charCodeAt(0)-97)):function(t){return t>="0"&&t<="9"}(t)&&void 0!==n.digitBase?String.fromCodePoint(n.digitBase+(t.charCodeAt(0)-48)):null}var le=/<(mi|mn)>([^<]*)<\/\1>/g,se=/<mi>([^<]*)<\/mi>/g;var ce={mathbb:"double-struck",mathcal:"script",mathscr:"script",mathfrak:"fraktur",mathbf:"bold",mathit:"italic",mathsf:"sans-serif",mathtt:"monospace"},pe={boldsymbol:"bold-italic",bm:"bold-italic"},ue={text:void 0,textnormal:"normal",textrm:"normal",textbf:"bold",textit:"italic",textsf:"sans-serif",texttt:"monospace",mbox:void 0};function de(t,e){if("operatorname"===t)return dt(_(e.parseRawArgument(),{mathvariant:"normal"}));if(t in ue){const n=ue[t],i=e.parseRawArgument();return dt(n?I(i,{mathvariant:n}):I(i))}const n=ce[t];if(void 0!==n)return dt((i=e.parseArgument(),a=n,i.replace(le,(t,e,n)=>{const i=function(t,e){let n="";for(const i of t)n+=oe(i,e)??i;return n}(n,a);return"mn"===e?E(i):_(i)})));var i,a;if("mathrm"===t)return dt(e.parseArgument().replace(se,(t,e)=>_(e,{mathvariant:"normal"})));const r=pe[t],o=e.parseArgument();return dt(void 0===r?o:z("mstyle",o,{mathvariant:r}))}var me=/* @__PURE__ */new Set(["frac","dfrac","tfrac","cfrac"]),he=/* @__PURE__ */new Set(["binom","dbinom","tbinom","choose"]),fe=/* @__PURE__ */new Set(["overset","underset","stackrel"]);var be=/* @__PURE__ */new Set(["∫","∬","∭","∮"]);var ge=class{source;tokens;pos=0;depth=0;depthExceeded=!1;errors=[];display;constructor(t,e,n){this.source=t,this.tokens=e,this.display=n}get collectedErrors(){return this.errors}peek(){return this.tokens[this.pos]}next(){const t=this.tokens[this.pos];return void 0!==t&&(this.pos+=1),t}error(t){this.errors.push(t)}parseTopLevel(){const t=[];for(;;){const e=this.peek();if(void 0===e)break;if(e.type===Nt.GroupClose){this.next(),this.error({message:"Unmatched brace",position:e.position});continue}const n=this.parseAtomWithScripts();void 0!==n&&t.push(n)}return t}parseExpression(t){const e=[];for(;;){const n=this.peek();if(void 0===n||t(n))break;if(n.type===Nt.GroupClose)break;const i=this.parseAtomWithScripts();void 0!==i&&e.push(i)}return e}parseAtomsUntil(t){return this.parseExpression(t)}parseAtomWithScripts(){const t=this.parseBaseAtom();if(void 0!==t)return this.attachScripts(t)}attachScripts(t){let e,n,i,a="";for(;;){const t=this.peek();if(void 0===t)break;if(t.type!==Nt.Prime)if(t.type!==Nt.Command||"limits"!==t.value)if(t.type!==Nt.Command||"nolimits"!==t.value)if(t.type!==Nt.Superscript){if(t.type!==Nt.Subscript)break;this.next(),e=this.combineSub(e,this.parseArgument())}else this.next(),n=this.combineSup(n,this.parseArgument());else this.next(),i="nolimits";else this.next(),i="limits";else this.next(),a+="′"}return a&&(n=void 0===n?B(a):D(`${B(a)}${n}`)),void 0===e&&void 0===n?t:dt(this.buildScripts(t,e,n,i))}combineSup(t,e){return void 0===t?e:(this.error({message:"Double superscript"}),D(`${t}${e}`))}combineSub(t,e){return void 0===t?e:(this.error({message:"Double subscript"}),D(`${t}${e}`))}buildScripts(t,e,n,i){const a=!0===t.bigOp&&!0!==t.intLike&&this.display;if("limits"===i||"nolimits"!==i&&a){if(void 0!==e&&void 0!==n)return function(t,e,n){return z("munderover",`${t}${e}${n}`)}(t.node,e,n);if(void 0!==e)return R(t.node,e);if(void 0!==n)return q(t.node,n)}return void 0!==e&&void 0!==n?function(t,e,n){return z("msubsup",`${t}${e}${n}`)}(t.node,e,n):void 0!==e?function(t,e){return z("msub",`${t}${e}`)}(t.node,e):void 0!==n?function(t,e){return z("msup",`${t}${e}`)}(t.node,n):t.node}parseBaseAtom(){if(this.depth>=256)return this.bailDeepNesting();this.depth+=1;try{return this.parseBaseAtomInner()}finally{this.depth-=1}}bailDeepNesting(){const t=this.next();if(void 0!==t&&!this.depthExceeded)return this.depthExceeded=!0,this.error({message:"Maximum nesting depth exceeded",position:t.position}),dt(z("merror",I("⋯")))}parseBaseAtomInner(){const t=this.next();if(void 0!==t)switch(t.type){case Nt.Number:return dt(E(t.value));case Nt.Char:return this.parseChar(t.value);case Nt.GroupOpen:return this.parseGroup();case Nt.NbSpace:return dt(Yt());case Nt.Command:return this.parseCommand(t);case Nt.Superscript:case Nt.Subscript:case Nt.Prime:return this.pos-=1,this.attachScripts(dt(D("")));case Nt.Ampersand:case Nt.RowBreak:case Nt.GroupClose:default:return}}parseGroup(){const t=this.parseExpression(()=>!1);return this.expect(Nt.GroupClose),dt(N(t.map(t=>t.node)))}parseChar(t){const e=Dt(t);return!e||e.kind!==ht.Open&&e.kind!==ht.Close?dt("+"===t||"-"===t||"*"===t||"="===t||"/"===t||"|"===t||","===t||";"===t||"."===t||":"===t||"!"===t||"?"===t||"<"===t||">"===t?B(t):_(t)):dt(B(t,{fence:!0}),e.kind)}parseCommand(t){const e=t.value,n=function(t){return It[t]}(e);if(n)return this.symbolAtom(n);if(1===(i=e).length&&Ft.has(i))return this.controlSymbolAtom(e);var i;const a=this.dispatchStructural(e);if(void 0!==a)return a;const r=this.dispatchSpecial(e,t);return void 0!==r?r:(this.error({message:"Unknown command",command:`\\${e}`,position:t.position}),dt(z("merror",I(`\\${e}`))))}dispatchStructural(t){if(function(t){return me.has(t)}(t))return dt(F((e=this).parseArgument(),e.parseArgument()));var e;if(function(t){return he.has(t)}(t))return function(t){const e=F(t.parseArgument(),t.parseArgument(),{linethickness:0});return dt(D(`${B("(",{fence:!0})}${e}${B(")",{fence:!0})}`))}(this);if("sqrt"===t)return function(t){const e=t.parseOptionalArgument(),n=t.parseArgument();return dt(void 0===e||""===e?function(t){return z("msqrt",t)}(n):function(t,e){return z("mroot",`${t}${e}`)}(n,e))}(this);if(function(t){return fe.has(t)}(t))return function(t,e){const n=e.parseArgument(),i=e.parseArgument();return dt("underset"===t?R(i,n):q(i,n))}(t,this);if(function(t){return t in Kt}(t))return function(t,e){const n=Kt[t];if(!n)return dt("");const i=e.parseArgument(),a=B(n.glyph,{stretchy:n.stretchy}),r=n.under?{accentunder:!0}:{accent:!0};return dt(n.under?R(i,a,r):q(i,a,r))}(t,this);if(function(t){return t in ce||t in pe||t in ue||"mathrm"===t||"operatorname"===t}(t))return de(t,this);if(Qt(t)){const e=Jt(t);return void 0===e?void 0:dt(e)}}dispatchSpecial(t,e){return"left"===t?function(t){const e=Dt(ne(t)),n=t.parseAtomsUntil(ee),i=t.peek();let a=".";void 0!==i&&ee(i)?(t.next(),a=ne(t)):t.error({message:"Unmatched \\left"});const r=Dt(a),o=ie(e),l=ie(r);return dt(N([o,...n.map(t=>t.node),l]))}(this):"begin"===t?te(this):"pmod"===t?function(t){const e=t.parseArgument(),n=B("(",{fence:!0}),i=B(")",{fence:!0});return dt(D(`${n}${I("mod")}${Yt()}${e}${i}`))}(this):"bmod"===t||"mod"===t?dt(B("mod",{lspace:"0.222em",rspace:"0.222em"})):"substack"===t?function(t){!function(t){const e=t.peek();void 0!==e&&e.type===Nt.GroupOpen&&t.next()}(t);const e=[];let n=[];for(;;){const i=t.peek();if(void 0===i||i.type===Nt.GroupClose)break;if(i.type===Nt.RowBreak){t.next(),e.push(N(n)),n=[];continue}const a=t.parseAtomsUntil(t=>t.type===Nt.RowBreak);n.push(...a.map(t=>t.node))}!function(t){const e=t.peek();void 0!==e&&e.type===Nt.GroupClose&&t.next()}(t),e.push(N(n));const i=e.map(t=>z("mtr",z("mtd",t))).join("");return dt(z("mtable",i))}(this):"right"===t?(n=e.position,ne(this),this.error({message:"Unmatched \\right",position:n}),dt(N([]))):void 0;var n}symbolAtom(t){switch(t.kind){case ht.Ordinary:return dt(_(t.char),t.kind);case ht.Function:return dt(_(t.char,{mathvariant:"normal"}),t.kind);case ht.BigOp:return this.bigOperator(t);case ht.Open:case ht.Close:return dt(B(t.char,{fence:!0}),t.kind);default:return dt(B(t.char),t.kind)}}bigOperator(t){if(/[a-z]/i.test(t.char))return mt(B(t.char,{movablelimits:!0}),t.kind);const e=be.has(t.char);return mt(B(t.char,{movablelimits:!0,largeop:!0}),t.kind,e)}controlSymbolAtom(t){if(Qt(t)){const e=Jt(t);return void 0===e?void 0:dt(e)}return"{"===t?dt(B("{",{fence:!0}),ht.Open):"}"===t?dt(B("}",{fence:!0}),ht.Close):dt("|"===t?B("‖"):"\\"===t?B("\\"):"/"===t?B("/"):"'"===t?B("′"):"."===t?B("."):I(t))}parseArgument(){return""===(t=this.parseArgumentRaw())?D(""):t;var t}parseArgumentRaw(){const t=this.peek();if(void 0===t)return"";if(t.type===Nt.GroupOpen){this.next();const t=this.parseExpression(()=>!1);return this.expect(Nt.GroupClose),N(t.map(t=>t.node))}return this.parseBaseAtom()?.node??""}parseOptionalArgument(){const t=this.peek();if(void 0===t||t.type!==Nt.Char||"["!==t.value)return;this.next();const e=this.parseExpression(t=>t.type===Nt.Char&&"]"===t.value),n=this.peek();return void 0!==n&&n.type===Nt.Char&&"]"===n.value&&this.next(),N(e.map(t=>t.node))}parseRawArgument(){const t=this.peek();if(void 0===t)return"";if(t.type!==Nt.GroupOpen)return this.next(),t.value;const e=t.position;this.next();let n=1,i=this.source.length;for(;;){const t=this.next();if(void 0===t)break;if(t.type===Nt.GroupOpen)n+=1;else if(t.type===Nt.GroupClose&&(n-=1,0===n)){i=t.position;break}}return this.source.slice(e+1,i)}expect(t){const e=this.peek();void 0===e||e.type!==t?t===Nt.GroupClose&&this.error({message:"Unmatched brace"}):this.next()}},ve="<mrow></mrow>";function xe(t,e){const n=e?.display??!1;if(""===t.trim())return{presentation:ve,errors:[]};const{atoms:i,errors:a}=function(t,e){const n=new ge(t,function(t){const e=[];let n=0;for(;n<t.length;){const i=t[n]??"";if("\\"===i){const i=Mt(t,n);if(e.push(i),n+="rowBreak"===i.type?2:Math.max(1,i.value.length)+1,"command"===i.type&&qt(i.value[0]??""))for(;n<t.length&&Ot(t[n]??"");)n+=1;continue}if(Rt(i)){const i=jt(t,n);e.push(i),n+=i.value.length;continue}if(Ot(i)){n+=1;continue}const a=Ht(i,n);a&&e.push(a),n+=1}return e}(t),e);return{atoms:n.parseTopLevel(),errors:n.collectedErrors}}(t,n);return{presentation:ye(i),errors:a}}function ye(t){if(0===t.length)return ve;if(1===t.length){const e=t[0];return e?e.node:ve}return D(t.map(t=>t.node).join(""))}var we=/(?<!\$)\$([^$\n\uFFFC]+)\$$/,Le=/\$\$([^$\n\uFFFC]+)\$\$$/;function ke(t,e){const n=t.getBlock(e);return void 0!==n&&"code_block"!==n.type}function Se(t,e){const n=t-e;return n<0?null:{from:n,to:t}}var Ce={insertInline:"Insert formula",insertInlineTooltip:"Insert inline formula",editFormula:"Edit formula",latexLabel:"LaTeX",latexPlaceholder:"e.g. \\frac{a}{b} + \\sqrt{x}",previewLabel:"Preview",insertButton:"Insert",updateButton:"Update",cancelButton:"Cancel",displayToggle:"Display (block) equation",sizeLabel:"Size",sizeDefault:"Default",altLabel:"Description",altPlaceholder:"Spoken description (optional)",paletteLabel:"Symbols and structures",emptyPreview:"Nothing to preview yet.",inserted:"Formula inserted.",updated:"Formula updated.",editing:"Editing formula.",selected:"Formula selected. Press Enter to edit.",unknownCommand:t=>`Unknown LaTeX command: ${t}`,groupFractions:"Fractions",groupScripts:"Scripts",groupRoots:"Roots",groupAccents:"Accents",groupOperators:"Operators",groupFunctions:"Functions",groupGreek:"Greek letters",groupRelations:"Relations",groupSets:"Sets",groupLogic:"Logic",groupArrows:"Arrows",groupDelimiters:"Brackets",groupDots:"Dots",groupMatrices:"Matrices"},$e=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-D1jFXqLJ.mjs"),"./locales/de.ts":()=>import("./de-DY3obIAF.mjs"),"./locales/es.ts":()=>import("./es-CtOtKQCP.mjs"),"./locales/fr.ts":()=>import("./fr-DjMZ-3K5.mjs"),"./locales/hi.ts":()=>import("./hi-4CiAKVjT.mjs"),"./locales/pt.ts":()=>import("./pt-BkpVtod-.mjs"),"./locales/ru.ts":()=>import("./ru-BotG0MFT.mjs"),"./locales/zh.ts":()=>import("./zh-CWGAPVei.mjs")});async function Ae(t){return b($e,t,Ce)}var ze=/^\s*\$\$([^\n]+?)\$\$\s*$/;function _e(t,e){const{presentation:n}=xe(t,{display:e});return{mathml:j({presentation:n,latex:t,display:e}),latex:t,alt:"",fontSize:""}}var Ee=class{root;buttons=[];activeIndex=0;constructor(t,e,n){this.root=document.createElement("div"),this.root.className="notectl-math-palette",this.root.setAttribute("role","toolbar"),this.root.setAttribute("aria-label",e);for(const i of t)this.root.appendChild(this.buildGroup(i,n));this.root.addEventListener("keydown",t=>this.onKeydown(t)),this.setActive(0)}focus(){this.buttons[this.activeIndex]?.focus()}activeButton(){return this.buttons[this.activeIndex]}buildGroup(t,e){const n=document.createElement("div");n.className="notectl-math-palette__group",n.setAttribute("role","group"),n.setAttribute("aria-label",t.label);for(const i of t.items){const t=document.createElement("button");t.type="button",t.className="notectl-math-palette__btn",t.textContent=i.label,t.setAttribute("aria-label",i.ariaLabel),t.tabIndex=-1,t.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),t.addEventListener("click",()=>e(i.snippet)),this.buttons.push(t),n.appendChild(t)}return n}onKeydown(t){if("Enter"===t.key||" "===t.key)return t.preventDefault(),t.stopPropagation(),void this.buttons[this.activeIndex]?.click();const e=this.buttons.length-1;let n=this.activeIndex;switch(t.key){case"ArrowRight":case"ArrowDown":n=this.activeIndex>=e?0:this.activeIndex+1;break;case"ArrowLeft":case"ArrowUp":n=this.activeIndex<=0?e:this.activeIndex-1;break;case"Home":n=0;break;case"End":n=e;break;default:return}t.preventDefault(),t.stopPropagation(),this.setActive(n),this.buttons[n]?.focus()}setActive(t){const e=this.buttons[this.activeIndex];e&&(e.tabIndex=-1);const n=this.buttons[t];n&&(n.tabIndex=0),this.activeIndex=t}},Be=0,Ie=class{root;options;textarea;preview;previewEmpty;errorsList;altInput;commitBtn;palette=null;displayCheckbox=null;cancelBtn=null;fontSizeSelect=null;display;lastErrorKey="";constructor(t){this.options=t,this.display=t.initialDisplay??!1;const e=++Be;this.root=document.createElement("div"),this.root.className="notectl-formula-editor",this.root.setAttribute("role","group"),this.root.setAttribute("aria-label",t.locale.latexLabel),t.palette&&t.palette.length>0&&(this.palette=new Ee(t.palette,t.locale.paletteLabel,t=>this.insertSnippet(t)),this.root.appendChild(this.palette.root)),this.textarea=this.buildLatexField(e),this.preview=document.createElement("div"),this.previewEmpty=document.createElement("div"),this.errorsList=document.createElement("ul"),this.altInput=this.buildAltField(e),this.commitBtn=document.createElement("button"),this.root.appendChild(this.buildPreview()),this.root.appendChild(this.errorsList),this.root.appendChild(this.altInput.parentElement),t.fontSizes&&t.fontSizes.length>0&&this.root.appendChild(this.buildSizeField(e)),"insert"===t.mode&&this.root.appendChild(this.buildDisplayToggle(e)),this.root.appendChild(this.buildActions()),this.errorsList.className="notectl-formula-editor__errors",this.errorsList.id=`notectl-formula-errors-${e}`,this.errorsList.setAttribute("aria-live","polite"),this.textarea.setAttribute("aria-describedby",this.errorsList.id),this.root.addEventListener("keydown",t=>this.onRootKeydown(t)),this.update()}focus(){this.textarea.focus(),this.textarea.setSelectionRange(this.textarea.value.length,this.textarea.value.length)}onRootKeydown(t){if("Escape"===t.key)return t.preventDefault(),t.stopPropagation(),void this.options.onCancel();"Tab"===t.key&&(t.preventDefault(),t.stopPropagation(),this.moveFocus(!t.shiftKey))}focusStops(){const t=[],e=this.palette?.activeButton();return e&&t.push(e),t.push(this.textarea,this.altInput),this.fontSizeSelect&&t.push(this.fontSizeSelect),this.displayCheckbox&&t.push(this.displayCheckbox),this.cancelBtn&&t.push(this.cancelBtn),t.push(this.commitBtn),t}moveFocus(t){const e=this.focusStops();if(0===e.length)return;const n=this.activeElement();let i=e.findIndex(t=>t===n);-1===i&&n&&this.palette?.root.contains(n)&&(i=0),-1===i&&(i=t?e.length-1:0),e[(i+(t?1:-1)+e.length)%e.length]?.focus()}activeElement(){let t=this.root.getRootNode().activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}getResult(){const t=this.textarea.value.trim(),e=this.altInput.value.trim(),{presentation:n}=xe(t,{display:this.display});return{latex:t,mathml:j({presentation:n,latex:t,display:this.display,alt:e||void 0}),alt:e,display:this.display,fontSize:this.fontSizeSelect?.value??""}}insertSnippet(t){const e=this.textarea.selectionStart??this.textarea.value.length,n=this.textarea.selectionEnd??e,i=t.indexOf("$0"),a=i>=0?t.replace("$0",""):t,r=i>=0?i:a.length,o=this.textarea.value;this.textarea.value=o.slice(0,e)+a+o.slice(n);const l=e+r;this.textarea.focus(),this.textarea.setSelectionRange(l,l),this.update()}buildLatexField(t){const e=document.createElement("div");e.className="notectl-formula-editor__field";const n=document.createElement("label");n.className="notectl-formula-editor__label",n.htmlFor=`notectl-formula-latex-${t}`,n.textContent=this.options.locale.latexLabel;const i=document.createElement("textarea");return i.id=`notectl-formula-latex-${t}`,i.className="notectl-formula-editor__input",i.placeholder=this.options.locale.latexPlaceholder,i.rows=2,i.spellcheck=!1,i.value=this.options.initialLatex??"",i.addEventListener("input",()=>this.update()),i.addEventListener("keydown",t=>this.onTextareaKeydown(t)),e.appendChild(n),e.appendChild(i),this.root.appendChild(e),i}buildPreview(){const t=document.createElement("div");t.className="notectl-formula-editor__field";const e=document.createElement("span");return e.className="notectl-formula-editor__label",e.textContent=this.options.locale.previewLabel,this.preview.className="notectl-formula-editor__preview",this.previewEmpty.className="notectl-formula-editor__preview-empty",this.previewEmpty.textContent=this.options.locale.emptyPreview,t.appendChild(e),t.appendChild(this.previewEmpty),t.appendChild(this.preview),t}buildAltField(t){const e=document.createElement("div");e.className="notectl-formula-editor__field";const n=document.createElement("label");n.className="notectl-formula-editor__label",n.htmlFor=`notectl-formula-alt-${t}`,n.textContent=this.options.locale.altLabel;const i=document.createElement("input");return i.id=`notectl-formula-alt-${t}`,i.type="text",i.className="notectl-formula-editor__alt",i.placeholder=this.options.locale.altPlaceholder,i.value=this.options.initialAlt??"",e.appendChild(n),e.appendChild(i),i}buildSizeField(t){const e=document.createElement("div");e.className="notectl-formula-editor__field";const n=document.createElement("label");n.className="notectl-formula-editor__label",n.htmlFor=`notectl-formula-size-${t}`,n.textContent=this.options.locale.sizeLabel;const i=document.createElement("select");i.id=`notectl-formula-size-${t}`,i.className="notectl-formula-editor__size";const a=this.options.initialFontSize??"";i.appendChild(this.buildSizeOption("",this.options.locale.sizeDefault));for(const r of this.options.fontSizes??[])i.appendChild(this.buildSizeOption(`${r}px`,String(r)));return a&&!Array.from(i.options).some(t=>t.value===a)&&i.appendChild(this.buildSizeOption(a,a.replace("px",""))),i.value=a,i.addEventListener("change",()=>this.applyPreviewFontSize()),this.fontSizeSelect=i,e.appendChild(n),e.appendChild(i),e}buildSizeOption(t,e){const n=document.createElement("option");return n.value=t,n.textContent=e,n}applyPreviewFontSize(){this.preview.style.fontSize=this.fontSizeSelect?.value||""}buildDisplayToggle(t){const e=document.createElement("label");e.className="notectl-formula-editor__toggle",e.htmlFor=`notectl-formula-display-${t}`;const n=document.createElement("input");n.id=`notectl-formula-display-${t}`,n.type="checkbox",n.checked=this.display,n.addEventListener("change",()=>{this.display=n.checked,this.update()}),this.displayCheckbox=n;const i=document.createElement("span");return i.textContent=this.options.locale.displayToggle,e.appendChild(n),e.appendChild(i),e}buildActions(){const t=document.createElement("div");t.className="notectl-formula-editor__actions";const e=document.createElement("button");return e.type="button",e.className="notectl-formula-editor__btn",e.textContent=this.options.locale.cancel,e.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),e.addEventListener("click",()=>this.options.onCancel()),this.cancelBtn=e,this.commitBtn.type="button",this.commitBtn.className="notectl-formula-editor__btn notectl-formula-editor__btn--primary",this.commitBtn.textContent="edit"===this.options.mode?this.options.locale.commitUpdate:this.options.locale.commitInsert,this.commitBtn.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),this.commitBtn.addEventListener("click",()=>this.commit()),t.appendChild(e),t.appendChild(this.commitBtn),t}onTextareaKeydown(t){"Enter"!==t.key||t.shiftKey||(t.preventDefault(),this.commit())}commit(){const t=this.getResult();t.latex?this.options.onCommit(t):this.options.onCancel()}update(){this.applyPreviewFontSize();const t=this.textarea.value.trim();if(!t)return this.preview.innerHTML="",this.previewEmpty.hidden=!1,void this.renderErrors([]);this.previewEmpty.hidden=!0;const{presentation:e,errors:n}=xe(t,{display:this.display});this.preview.innerHTML=j({presentation:e,display:this.display}),this.renderErrors(n.map(t=>t.command??t.message))}renderErrors(t){const e=t.join("");if(e!==this.lastErrorKey){this.lastErrorKey=e,this.errorsList.replaceChildren();for(const e of t){const t=document.createElement("li");t.textContent=e.startsWith("\\")?this.options.locale.unknownCommand(e):e,this.errorsList.appendChild(t)}}}};function Pe(t){return[{id:"fractions",label:(e={fractions:t.groupFractions,scripts:t.groupScripts,roots:t.groupRoots,accents:t.groupAccents,operators:t.groupOperators,functions:t.groupFunctions,greek:t.groupGreek,relations:t.groupRelations,sets:t.groupSets,logic:t.groupLogic,arrows:t.groupArrows,delimiters:t.groupDelimiters,dots:t.groupDots,matrices:t.groupMatrices}).fractions,items:[{label:"a╱b",ariaLabel:"Fraction",snippet:"\\frac{$0}{}"},{label:"⒞",ariaLabel:"Binomial coefficient",snippet:"\\binom{$0}{}"}]},{id:"scripts",label:e.scripts,items:[{label:"xⁿ",ariaLabel:"Superscript",snippet:"^{$0}"},{label:"xₙ",ariaLabel:"Subscript",snippet:"_{$0}"},{label:"xⁿₘ",ariaLabel:"Subscript and superscript",snippet:"_{$0}^{}"}]},{id:"roots",label:e.roots,items:[{label:"√",ariaLabel:"Square root",snippet:"\\sqrt{$0}"},{label:"ⁿ√",ariaLabel:"N-th root",snippet:"\\sqrt[$0]{}"}]},{id:"accents",label:e.accents,items:[{label:"→",ariaLabel:"Vector",snippet:"\\vec{$0}"},{label:"â",ariaLabel:"Hat",snippet:"\\hat{$0}"},{label:"ā",ariaLabel:"Overline",snippet:"\\overline{$0}"},{label:"ȧ",ariaLabel:"Dot above",snippet:"\\dot{$0}"},{label:"ã",ariaLabel:"Tilde",snippet:"\\tilde{$0}"}]},{id:"operators",label:e.operators,items:[{label:"∑",ariaLabel:"Sum with limits",snippet:"\\sum_{$0}^{}"},{label:"∏",ariaLabel:"Product with limits",snippet:"\\prod_{$0}^{}"},{label:"∫",ariaLabel:"Integral with limits",snippet:"\\int_{$0}^{}"},{label:"∬",ariaLabel:"Double integral",snippet:"\\iint "},{label:"∮",ariaLabel:"Contour integral",snippet:"\\oint "},{label:"lim",ariaLabel:"Limit",snippet:"\\lim_{$0}"},{label:"∂",ariaLabel:"Partial derivative",snippet:"\\partial "},{label:"∇",ariaLabel:"Nabla (del)",snippet:"\\nabla "},{label:"×",ariaLabel:"Times",snippet:"\\times "},{label:"·",ariaLabel:"Dot product",snippet:"\\cdot "},{label:"±",ariaLabel:"Plus or minus",snippet:"\\pm "},{label:"÷",ariaLabel:"Division",snippet:"\\div "},{label:"∞",ariaLabel:"Infinity",snippet:"\\infty "}]},{id:"functions",label:e.functions,items:[{label:"sin",ariaLabel:"Sine",snippet:"\\sin "},{label:"cos",ariaLabel:"Cosine",snippet:"\\cos "},{label:"tan",ariaLabel:"Tangent",snippet:"\\tan "},{label:"log",ariaLabel:"Logarithm",snippet:"\\log "},{label:"ln",ariaLabel:"Natural logarithm",snippet:"\\ln "},{label:"exp",ariaLabel:"Exponential function",snippet:"\\exp "}]},{id:"greek",label:e.greek,items:[{label:"α",ariaLabel:"Alpha",snippet:"\\alpha "},{label:"β",ariaLabel:"Beta",snippet:"\\beta "},{label:"γ",ariaLabel:"Gamma",snippet:"\\gamma "},{label:"δ",ariaLabel:"Delta",snippet:"\\delta "},{label:"ε",ariaLabel:"Epsilon",snippet:"\\varepsilon "},{label:"ζ",ariaLabel:"Zeta",snippet:"\\zeta "},{label:"η",ariaLabel:"Eta",snippet:"\\eta "},{label:"θ",ariaLabel:"Theta",snippet:"\\theta "},{label:"κ",ariaLabel:"Kappa",snippet:"\\kappa "},{label:"λ",ariaLabel:"Lambda",snippet:"\\lambda "},{label:"μ",ariaLabel:"Mu",snippet:"\\mu "},{label:"ν",ariaLabel:"Nu",snippet:"\\nu "},{label:"ξ",ariaLabel:"Xi",snippet:"\\xi "},{label:"π",ariaLabel:"Pi",snippet:"\\pi "},{label:"ρ",ariaLabel:"Rho",snippet:"\\rho "},{label:"σ",ariaLabel:"Sigma",snippet:"\\sigma "},{label:"τ",ariaLabel:"Tau",snippet:"\\tau "},{label:"φ",ariaLabel:"Phi",snippet:"\\varphi "},{label:"χ",ariaLabel:"Chi",snippet:"\\chi "},{label:"ψ",ariaLabel:"Psi",snippet:"\\psi "},{label:"ω",ariaLabel:"Omega",snippet:"\\omega "},{label:"Γ",ariaLabel:"Capital gamma",snippet:"\\Gamma "},{label:"Δ",ariaLabel:"Capital delta",snippet:"\\Delta "},{label:"Θ",ariaLabel:"Capital theta",snippet:"\\Theta "},{label:"Λ",ariaLabel:"Capital lambda",snippet:"\\Lambda "},{label:"Π",ariaLabel:"Capital pi",snippet:"\\Pi "},{label:"Σ",ariaLabel:"Capital sigma",snippet:"\\Sigma "},{label:"Φ",ariaLabel:"Capital phi",snippet:"\\Phi "},{label:"Ψ",ariaLabel:"Capital psi",snippet:"\\Psi "},{label:"Ω",ariaLabel:"Capital omega",snippet:"\\Omega "}]},{id:"relations",label:e.relations,items:[{label:"≤",ariaLabel:"Less than or equal to",snippet:"\\leq "},{label:"≥",ariaLabel:"Greater than or equal to",snippet:"\\geq "},{label:"≠",ariaLabel:"Not equal to",snippet:"\\neq "},{label:"≈",ariaLabel:"Approximately equal to",snippet:"\\approx "},{label:"≡",ariaLabel:"Equivalent to",snippet:"\\equiv "},{label:"∼",ariaLabel:"Similar to",snippet:"\\sim "},{label:"≅",ariaLabel:"Congruent to",snippet:"\\cong "},{label:"∝",ariaLabel:"Proportional to",snippet:"\\propto "}]},{id:"sets",label:e.sets,items:[{label:"∈",ariaLabel:"Element of",snippet:"\\in "},{label:"∉",ariaLabel:"Not an element of",snippet:"\\notin "},{label:"⊂",ariaLabel:"Subset of",snippet:"\\subset "},{label:"⊆",ariaLabel:"Subset of or equal to",snippet:"\\subseteq "},{label:"∪",ariaLabel:"Union",snippet:"\\cup "},{label:"∩",ariaLabel:"Intersection",snippet:"\\cap "},{label:"∅",ariaLabel:"Empty set",snippet:"\\emptyset "},{label:"ℝ",ariaLabel:"Real numbers",snippet:"\\mathbb{R}"},{label:"ℕ",ariaLabel:"Natural numbers",snippet:"\\mathbb{N}"},{label:"ℤ",ariaLabel:"Integers",snippet:"\\mathbb{Z}"},{label:"ℚ",ariaLabel:"Rational numbers",snippet:"\\mathbb{Q}"},{label:"ℂ",ariaLabel:"Complex numbers",snippet:"\\mathbb{C}"}]},{id:"logic",label:e.logic,items:[{label:"∀",ariaLabel:"For all",snippet:"\\forall "},{label:"∃",ariaLabel:"There exists",snippet:"\\exists "},{label:"¬",ariaLabel:"Logical not",snippet:"\\neg "},{label:"∧",ariaLabel:"Logical and",snippet:"\\land "},{label:"∨",ariaLabel:"Logical or",snippet:"\\lor "},{label:"⟹",ariaLabel:"Implies",snippet:"\\implies "},{label:"⟺",ariaLabel:"If and only if",snippet:"\\iff "}]},{id:"arrows",label:e.arrows,items:[{label:"→",ariaLabel:"Right arrow",snippet:"\\to "},{label:"⇒",ariaLabel:"Rightwards double arrow",snippet:"\\Rightarrow "},{label:"↔",ariaLabel:"Left-right arrow",snippet:"\\leftrightarrow "},{label:"↦",ariaLabel:"Maps to",snippet:"\\mapsto "}]},{id:"delimiters",label:e.delimiters,items:[{label:"( )",ariaLabel:"Auto-sized parentheses",snippet:"\\left($0\\right)"},{label:"[ ]",ariaLabel:"Auto-sized brackets",snippet:"\\left[$0\\right]"},{label:"{ }",ariaLabel:"Auto-sized braces",snippet:"\\left\\{$0\\right\\}"},{label:"|x|",ariaLabel:"Absolute value",snippet:"\\left|$0\\right|"},{label:"‖x‖",ariaLabel:"Norm",snippet:"\\left\\|$0\\right\\|"},{label:"⌊x⌋",ariaLabel:"Floor",snippet:"\\left\\lfloor $0\\right\\rfloor"},{label:"⌈x⌉",ariaLabel:"Ceiling",snippet:"\\left\\lceil $0\\right\\rceil"}]},{id:"dots",label:e.dots,items:[{label:"⋯",ariaLabel:"Centred ellipsis",snippet:"\\cdots "},{label:"…",ariaLabel:"Baseline ellipsis",snippet:"\\ldots "},{label:"⋮",ariaLabel:"Vertical ellipsis",snippet:"\\vdots "},{label:"⋱",ariaLabel:"Diagonal ellipsis",snippet:"\\ddots "}]},{id:"matrices",label:e.matrices,items:[{label:"[ ]",ariaLabel:"Bracket matrix",snippet:"\\begin{bmatrix} $0 & \\\\ & \\end{bmatrix}"},{label:"( )",ariaLabel:"Parenthesis matrix",snippet:"\\begin{pmatrix} $0 & \\\\ & \\end{pmatrix}"},{label:"{",ariaLabel:"Cases",snippet:"\\begin{cases} $0 & \\\\ & \\end{cases}"}]}];var e}function De(t,e){const n=new Ie({locale:(i=e.locale,{latexLabel:i.latexLabel,latexPlaceholder:i.latexPlaceholder,previewLabel:i.previewLabel,emptyPreview:i.emptyPreview,altLabel:i.altLabel,altPlaceholder:i.altPlaceholder,displayToggle:i.displayToggle,sizeLabel:i.sizeLabel,sizeDefault:i.sizeDefault,commitInsert:i.insertButton,commitUpdate:i.updateButton,cancel:i.cancelButton,paletteLabel:i.paletteLabel,unknownCommand:i.unknownCommand}),mode:e.mode,initialLatex:e.initialLatex,initialAlt:e.initialAlt,initialDisplay:e.initialDisplay,initialFontSize:e.initialFontSize,fontSizes:e.fontSizes,palette:Pe(e.locale),onCommit:e.onCommit,onCancel:e.onClose});var i;return t.appendChild(n.root),requestAnimationFrame(()=>n.focus()),n}var Ne=class{context;locale;fontSizes;panel=null;outsideHandler=null;constructor(t,e,n){this.context=t,this.locale=e,this.fontSizes=n}isOpen(){return null!==this.panel}openInsert(t){if(this.context.isReadOnly())return;const e=Fe();this.open({rect:e,mode:"insert",initialDisplay:t,onCommit:t=>{ut(this.context,this.locale,t),this.close(!0)}})}openEdit(t){this.context.isReadOnly()||(this.context.announce(this.locale.editing),this.open({rect:t.rect??Fe(),mode:"edit",initialLatex:t.latex,initialAlt:t.alt,initialDisplay:"display"===t.kind,initialFontSize:t.fontSize,onCommit:e=>{this.commitEdit(t,e),this.context.announce(this.locale.updated),this.close(!0)}}))}close(t){this.panel&&(this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler,!0),this.outsideHandler=null),this.panel.remove(),this.panel=null,t&&this.context.getContainer().focus())}commitEdit(t,e){const n=pt(e);"inline"===t.kind&&t.blockId&&void 0!==t.offset?function(t,e,n,i){const a=t.getState().transaction("command").setInlineNodeAttr(e,n,lt(i)).build();t.dispatch(a)}(this.context,t.blockId,t.offset,n):"display"===t.kind&&t.path&&function(t,e,n){const i=t.getState().transaction("command").setNodeAttr(e,lt(n)).build();t.dispatch(i)}(this.context,t.path,n)}open(t){this.close(!1);const e=document.createElement("div");e.className="notectl-formula-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-label","edit"===t.mode?this.locale.editFormula:this.locale.insertInline),this.panel=e,De(e,{context:this.context,locale:this.locale,mode:t.mode,initialLatex:t.initialLatex,initialAlt:t.initialAlt,initialDisplay:t.initialDisplay,initialFontSize:t.initialFontSize,fontSizes:this.fontSizes,onCommit:t.onCommit,onClose:()=>this.close(!0)}),this.context.getPluginContainer("top").appendChild(e),w(e),function(t,e){const n=e?e.bottom:window.innerHeight/3,i=e?e.left:window.innerWidth/3,a=t.offsetWidth||360,r=window.innerWidth-a-8,o=Math.max(8,Math.min(i,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(o)}px`,t.style.top=`${Math.round(s)}px`}(e,t.rect),this.installOutsideHandler()}installOutsideHandler(){const t=t=>{this.panel&&!t.composedPath().includes(this.panel)&&this.close(!1)};this.outsideHandler=t,requestAnimationFrame(()=>{this.outsideHandler&&document.addEventListener("mousedown",t,!0)})}};function Fe(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}function qe(t){const e=document.createElement("template");return e.innerHTML=t,e.content}function Re(t){const e=function(t){const e=f(t,{ALLOWED_TAGS:[...at],ALLOWED_ATTR:[...rt]});return/<math[\s>]/i.test(e)?e:null}(t.outerHTML);if(!e)return null;const n=G(e);return{mathml:n,latex:H(n)??"",alt:"",fontSize:Q(t)}}var Oe=class{id="formula";name="Formula";priority=46;config;resolvedKeymap;fontSizes;locale=Ce;overlay=null;context=null;clickHandler=null;constructor(t){this.config={...it,...t},this.resolvedKeymap={...et,...t?.keymap},this.fontSizes=this.config.fontSizes??nt}async init(t){var e;if(this.context=t,this.locale=await v(t,this.config.locale,Ce,Ae),t.registerStyleSheet("\n.notectl-math math {\n\tfont-family: 'Notectl Math', math;\n}\n\n.notectl-math--inline {\n\tdisplay: inline-block;\n\tvertical-align: middle;\n\tpadding: 0 1px;\n\tborder-radius: 3px;\n\tcursor: pointer;\n}\n\n.notectl-math--inline:hover {\n\tbackground: var(--notectl-highlight, rgba(0, 0, 0, 0.06));\n}\n\n.notectl-math--inline:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-math--inline math {\n\tfont-size: 1.15em;\n}\n\n.notectl-math--display {\n\tdisplay: block;\n\tmargin: 12px 0;\n\ttext-align: center;\n\tcursor: pointer;\n\tuser-select: none;\n\t-webkit-user-select: none;\n}\n\n.notectl-math--display math {\n\tfont-size: 1.35em;\n\tdisplay: inline-block;\n}\n\n.notectl-math--display.notectl-math--selected {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 4px;\n\tborder-radius: 6px;\n}\n\n.notectl-math__error,\n.notectl-math merror {\n\tcolor: var(--notectl-danger, #c0392b);\n\tbackground: var(--notectl-danger-bg, rgba(192, 57, 43, 0.1));\n\tborder-radius: 3px;\n\tpadding: 0 2px;\n}\n"),t.registerStyleSheet("\n.notectl-formula-editor {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tpadding: 10px;\n\tmin-width: 320px;\n\tmax-width: 460px;\n\tbox-sizing: border-box;\n}\n\n.notectl-formula-editor__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.notectl-formula-editor__label {\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-fg-muted, #555);\n}\n\n.notectl-formula-editor__input {\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tpadding: 6px 8px;\n\tfont-family: 'SF Mono', 'Fira Code', Menlo, Consolas, monospace;\n\tfont-size: 13px;\n\tline-height: 1.5;\n\tresize: vertical;\n\tmin-height: 56px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay, #fff);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-formula-editor__alt {\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tpadding: 5px 8px;\n\tfont-size: 13px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay, #fff);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-formula-editor__size {\n\tbox-sizing: border-box;\n\tpadding: 5px 8px;\n\tfont-size: 13px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay, #fff);\n\tcolor: var(--notectl-fg);\n\tcursor: pointer;\n}\n\n.notectl-formula-editor__size:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-formula-editor__preview {\n\tmin-height: 44px;\n\tpadding: 8px;\n\tborder: 1px dashed var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised, #fafafa);\n\ttext-align: center;\n\toverflow-x: auto;\n}\n\n.notectl-formula-editor__preview math {\n\tfont-family: 'Notectl Math', math;\n\tfont-size: 1.3em;\n}\n\n.notectl-formula-editor__preview-empty {\n\tcolor: var(--notectl-fg-muted, #888);\n\tfont-size: 13px;\n}\n\n.notectl-formula-editor__errors {\n\tcolor: var(--notectl-danger, #c0392b);\n\tfont-size: 12px;\n\tmargin: 0;\n\tpadding-inline-start: 16px;\n}\n\n.notectl-formula-editor__row {\n\tdisplay: flex;\n\tgap: 8px;\n\talign-items: center;\n}\n\n.notectl-formula-editor__toggle {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-formula-editor__actions {\n\tdisplay: flex;\n\tgap: 8px;\n\tjustify-content: flex-end;\n\tmargin-top: 2px;\n}\n\n.notectl-formula-editor__btn {\n\tpadding: 6px 14px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tcursor: pointer;\n\tfont-size: 13px;\n}\n\n.notectl-formula-editor__btn--primary {\n\tbackground: var(--notectl-primary);\n\tborder-color: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg, #fff);\n}\n\n.notectl-formula-editor__btn:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n.notectl-formula-overlay {\n\tposition: fixed;\n\tz-index: 1000;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay, #fff);\n\tbox-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);\n}\n\n.notectl-math-palette {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tpadding: 2px 2px 8px;\n\tborder-bottom: 1px solid var(--notectl-border);\n\tmargin-bottom: 2px;\n\tmax-height: 216px;\n\toverflow-y: auto;\n}\n\n.notectl-math-palette__group {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 2px;\n}\n\n.notectl-math-palette__group + .notectl-math-palette__group {\n\tborder-inline-start: 1px solid var(--notectl-border);\n\tpadding-inline-start: 6px;\n}\n\n.notectl-math-palette__btn {\n\tmin-width: 30px;\n\theight: 30px;\n\tpadding: 0 6px;\n\tborder: 1px solid transparent;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: var(--notectl-fg);\n\tcursor: pointer;\n\tfont-size: 15px;\n\tline-height: 1;\n}\n\n.notectl-math-palette__btn:hover {\n\tbackground: var(--notectl-surface-raised);\n}\n\n.notectl-math-palette__btn:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n"),this.config.mathFont&&t.registerStyleSheet(function(t){const e=(t.family.split(",")[0]??t.name).trim().replace(/['"]/g,"");return(t.fontFaces??[]).map(t=>{const n=[`font-family: '${e}'`,`src: ${t.src}`];return t.weight&&n.push(`font-weight: ${t.weight}`),t.style&&n.push(`font-style: ${t.style}`),n.push(`font-display: ${t.display??"swap"}`),`@font-face { ${n.join("; ")}; }`}).join("\n")}(this.config.mathFont)),t.registerInlineNodeSpec({type:Y,attrs:{mathml:{default:""},latex:{default:""},alt:{default:""},fontSize:{default:""}},toDOM(t){const e=document.createElement("span");return e.className="notectl-math notectl-math--inline",e.setAttribute("contenteditable","false"),e.setAttribute("data-inline-type",Y),W(e,Z(t.attrs)),V(e,t.attrs),e},toHTMLString:t=>X(Z(t.attrs)),toMarkdown:t=>`$${String(t.attrs.latex??"")}$`,parseHTML:[{tag:"math",getAttrs:t=>J(t,!1)}],sanitize:{tags:[...at],attrs:[...rt]}}),t.registerNodeSpec({type:tt,group:"block",isVoid:!0,selectable:!0,attrs:{mathml:{default:""},latex:{default:""},alt:{default:""},fontSize:{default:""}},toDOM(t){const e=x("div",t.id);return e.className="notectl-math notectl-math--display",e.setAttribute("data-void","true"),e.setAttribute("data-selectable","true"),W(e,Z(t.attrs)),V(e,t.attrs),e},toHTML:t=>X(Z(t.attrs)),toMarkdown:t=>`$$\n${String(t.attrs?.latex??"")}\n$$`,parseHTML:[{tag:"math",getAttrs:t=>J(t,!0)}],sanitize:{tags:[...at],attrs:[...rt]}}),this.overlay=new Ne(t,this.locale,this.fontSizes),t.registerNodeView(tt,(e={onEdit:(t,e)=>this.editDisplay(t,e),onSelect:()=>t.announce(this.locale.selected)},t=>{let n=t.id,i=!1;const a=x("div",t.id);return a.className="notectl-math notectl-math--display",a.setAttribute("data-void","true"),a.setAttribute("data-selectable","true"),W(a,Z(t.attrs)),V(a,t.attrs),a.addEventListener("dblclick",t=>{t.preventDefault(),e.onEdit(n,a.getBoundingClientRect())}),{dom:a,contentDOM:null,update:t=>"math_display"===t.type&&(n=t.id,a.setAttribute("data-block-id",t.id),W(a,Z(t.attrs)),V(a,t.attrs),!0),selectNode(){a.classList.add("notectl-math--selected"),i||(i=!0,e.onSelect())},deselectNode(){a.classList.remove("notectl-math--selected"),i=!1}}})),!1!==this.config.inputRule)for(const a of[{pattern:Le,handler(t,e){const n=t.selection;if(!l(n)||!r(n))return null;const a=(e[1]??"").trim();if(!a)return null;const o=n.anchor.blockId;if(!ke(t,o))return null;const c=Se(n.anchor.offset,e[0].length);if(!c)return null;const u=t.doc.children.findIndex(t=>t.id===o);if(-1===u)return null;const{presentation:d}=xe(a,{display:!0}),m=j({presentation:d,latex:a,display:!0}),h=t.transaction("input").deleteTextAt(o,c.from,c.to);return function(t,e,n){const a=i(p(tt),[],void 0,lt(n)),r=i(p("paragraph"));t.insertNode([],e,a).insertNode([],e+1,r).setSelection(s(a.id,[]))}(h,u+1,{mathml:m,latex:a,alt:"",fontSize:""}),h.build()}},{pattern:we,handler(t,e){const i=t.selection;if(!l(i)||!r(i))return null;const a=(e[1]??"").trim();if(!a)return null;const o=i.anchor.blockId;if(!ke(t,o))return null;const s=Se(i.anchor.offset,e[0].length);if(!s)return null;const{presentation:p}=xe(a,{display:!1}),d=j({presentation:p,latex:a,display:!1}),m=n(u(Y),{mathml:d,latex:a,alt:"",fontSize:""});return t.transaction("input").deleteTextAt(o,s.from,s.to).insertInlineNode(o,s.from,m).setSelection(c(o,s.from+1)).build()}}])t.registerInputRule(a);t.registerMarkdownSyntax({id:"formula",matchInline(t,e){if("$"!==t[e]||"$"===t[e+1])return null;const n=function(t,e){for(let n=e;n<t.length;n++){const e=t[n]??"";if("\n"===e)return-1;if("$"===e)return n}return-1}(t,e+1);if(-1===n)return null;const i=t.slice(e+1,n).trim();return""===i?null:{type:Y,attrs:{..._e(i,!1)},length:n-e+1}},matchBlock(t,e){const n=t[e]??"",i=n.match(ze);if(i?.[1]?.trim())return{type:tt,attrs:{..._e(i[1].trim(),!0)},linesConsumed:1};if("$$"!==n.trim())return null;const a=[];let r=e+1;for(;r<t.length&&"$$"!==(t[r]??"").trim();)a.push(t[r]??""),r++;if(r>=t.length)return null;const o=a.join("\n").trim();return{type:tt,attrs:{..._e(o,!0)},linesConsumed:r-e+1}}}),t.registerPasteInterceptor((t,e,n)=>{if(!function(t){if(!t)return!1;const e=qe(t);if(!e.querySelector("math"))return!1;const n=e.cloneNode(!0);for(const i of Array.from(n.querySelectorAll('math, [aria-hidden="true"]')))i.remove();return""===(n.textContent??"").trim()}(e))return null;const i=function(t){if(!t)return[];const e=qe(t);for(const n of Array.from(e.querySelectorAll('[aria-hidden="true"]')))n.remove();return Array.from(e.querySelectorAll("math"))}(e).map(Re).filter(t=>null!==t);return 0===i.length?null:i.every(t=>{return e=t.mathml,!/<math\b[^>]*\bdisplay=["']block["']/i.test(e);var e})?st(n,i):ct(n,i)},{name:"formula",priority:40}),this.registerCommands(t),this.registerKeymap(t),function(t,e,n){t.registerToolbarItem({id:"formula",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round"><path d="M18 5 H6 L12 12 L6 19 H18"/></svg>',label:e.insertInline,tooltip:e.insertInlineTooltip,command:"insertInlineFormula",popupType:"custom",renderPopup:(t,i,a)=>{De(t,{context:i,locale:e,mode:"insert",fontSizes:n,onClose:a,onCommit:t=>{ut(i,e,t),a(),i.getContainer().focus()}})}})}(t,this.locale,this.fontSizes),this.installClickToEdit(t)}destroy(){this.clickHandler&&this.context&&this.context.getContainer().removeEventListener("click",this.clickHandler),this.clickHandler=null,this.overlay?.close(!1),this.overlay=null,this.context=null}registerCommands(n){n.registerCommand("insertInlineFormula",()=>{const i=function(n){const i=n.selection;if(!l(i)||!r(i))return null;const o=i.anchor.blockId,s=n.getBlock(o);if(!s)return null;const c=i.anchor.offset;for(const{child:r,from:l,to:p}of t(e(s)))if(a(r)&&"math_inline"===r.inlineType&&(p===c||l===c)){const t=Z(r.attrs);return{kind:"inline",blockId:o,offset:l,latex:t.latex,alt:t.alt,fontSize:t.fontSize,rect:null}}return null}(n.getState());return i?(this.overlay?.openEdit(i),!0):(this.overlay?.openInsert(!1),!0)}),n.registerCommand("insertDisplayFormula",()=>{const t=ot(n.getState());return t?(this.editDisplay(t,null),!0):(this.overlay?.openInsert(!0),!0)})}registerKeymap(t){const e={},n=this.resolvedKeymap.insertInline,i=this.resolvedKeymap.insertDisplay;n&&(e[n]=()=>t.executeCommand("insertInlineFormula")),i&&(e[i]=()=>t.executeCommand("insertDisplayFormula")),e.Enter=()=>{const e=ot(t.getState());return!!e&&(this.editDisplay(e,null),!0)},t.registerKeymap(e,{priority:"context"})}installClickToEdit(n){const i=n.getContainer(),r=r=>{if(n.isReadOnly())return;const o=r.target?.closest(".notectl-math--inline");if(!o)return;const l=function(n,i,r){const o=y(n,i,0);if(!o)return null;const l=function(n,i,r){const o=n.getBlock(i);if(!o)return null;for(const{child:l,from:s}of t(e(o)))if(s===r&&a(l)&&"math_inline"===l.inlineType)return Z(l.attrs);return null}(r,o.blockId,o.offset);return l?{kind:"inline",blockId:o.blockId,offset:o.offset,latex:l.latex,alt:l.alt,fontSize:l.fontSize,rect:i.getBoundingClientRect()}:null}(i,o,n.getState());l&&(r.preventDefault(),this.overlay?.openEdit(l))};this.clickHandler=r,i.addEventListener("click",r)}editDisplay(t,e){if(!this.overlay||!this.context)return;const n=function(t,e,n){const i=t.getBlock(e);if(!i||"math_display"!==i.type)return null;const a=Z(i.attrs);return{kind:"display",path:t.getNodePath(e)??[e],latex:a.latex,alt:a.alt,fontSize:a.fontSize,rect:n}}(this.context.getState(),t,e);n&&this.overlay.openEdit(n)}};export{rt as a,j as c,xe as i,Ce as n,at as o,Ae as r,et as s,Oe as t};
|
|
2
|
-
//# sourceMappingURL=FormulaPlugin-CI0r4X1o.mjs.map
|