oasis-editor 0.0.147 → 0.0.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/{OasisEditorApp-DM9mi2EU.js → OasisEditorApp-CmqlSXEk.js} +875 -168
  2. package/dist/app/controllers/useEditorSurfaceEvents.d.ts +1 -0
  3. package/dist/assets/importDocxWorker-CpQR2fwx.js +12 -0
  4. package/dist/core/commands/builtinCommands.d.ts +1 -1
  5. package/dist/core/commands/publicCommandTypes.d.ts +15 -1
  6. package/dist/core/commands/text.d.ts +1 -1
  7. package/dist/core/commands/textEditing.d.ts +3 -1
  8. package/dist/core/document/clone.d.ts +2 -1
  9. package/dist/core/math/linear.d.ts +5 -0
  10. package/dist/core/model/index.d.ts +3 -1
  11. package/dist/core/model/runKind.d.ts +3 -0
  12. package/dist/core/model/types/layout.d.ts +2 -0
  13. package/dist/core/model/types/math.d.ts +95 -0
  14. package/dist/core/model/types/nodes.d.ts +4 -0
  15. package/dist/export/docx/text/mathXml.d.ts +3 -0
  16. package/dist/i18n/locales/en.d.ts +31 -0
  17. package/dist/i18n/locales/pt-BR.d.ts +31 -0
  18. package/dist/import/docx/math.d.ts +5 -0
  19. package/dist/import/docx/runs/types.d.ts +2 -1
  20. package/dist/{index-CXKg4TC3.js → index-B7V7kbjr.js} +2800 -1691
  21. package/dist/index.d.ts +1 -0
  22. package/dist/oasis-editor.css +1 -1
  23. package/dist/oasis-editor.js +79 -79
  24. package/dist/oasis-editor.umd.cjs +4 -4
  25. package/dist/plugins/internal/essentialsCapabilities.d.ts +7 -1
  26. package/dist/ui/app/EditorDialogsLayer.d.ts +4 -0
  27. package/dist/ui/app/createEditorCommandRuntime.d.ts +11 -0
  28. package/dist/ui/app/createEditorInteractionRuntime.d.ts +1 -0
  29. package/dist/ui/app/essentials/types.d.ts +3 -0
  30. package/dist/ui/app/newDocumentAction.d.ts +7 -0
  31. package/dist/ui/app/useEditorDialogs.d.ts +23 -0
  32. package/dist/ui/app/useEditorInteractionWiring.d.ts +1 -0
  33. package/dist/ui/components/Dialogs/EquationDialog.d.ts +10 -0
  34. package/dist/ui/components/Dialogs/NewDocumentConfirmationDialog.d.ts +8 -0
  35. package/dist/ui/components/Dialogs/SymbolDialog.d.ts +8 -0
  36. package/dist/ui/components/Toolbar/SymbolMenu.d.ts +6 -0
  37. package/dist/ui/components/Toolbar/presets/builtinToolbarIds.d.ts +3 -1
  38. package/dist/ui/components/Toolbar/primitives/Menu.d.ts +1 -0
  39. package/dist/ui/components/Toolbar/recentSymbols.d.ts +4 -0
  40. package/dist/ui/components/Toolbar/ribbon/RibbonTabs.d.ts +2 -1
  41. package/dist/ui/components/Toolbar/ribbon/ribbonModel.d.ts +1 -1
  42. package/dist/ui/components/Toolbar/symbolCatalog.d.ts +16 -0
  43. package/dist/ui/math/mathPainter.d.ts +10 -0
  44. package/package.json +1 -1
  45. package/dist/assets/importDocxWorker-BLm3QMHu.js +0 -12
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
3
3
  var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
4
- import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, q as assertNever, r as cloneRun, s as createSignal, t as createEditorStateFromDocument, u as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, v as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as stylesEqual, A as cloneStyle, B as createEditorStyledRun, C as cloneParagraphList, D as cloneParagraph, G as getParagraphLength, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as setValueStyle, T as setBooleanStyle, U as parseFontSizePtToPx, V as formatFontSizePt, W as setParagraphStyleValue, X as createEditorParagraph, Y as cloneBlocks, Z as resolveDefaultParagraphStyleId, _ as findParagraphTablePathLocation, $ as findParagraphLocation, a0 as resolveTablePath, a1 as buildTableCellLayout, a2 as PT_PER_PX, a3 as createEditorTableCell, a4 as createEditorTableRow, a5 as createEditorTable, a6 as clampPosition, a7 as PX_PER_POINT, a8 as underlineStyleToCssDecorationStyle, a9 as resolveImageSrc, aa as listKindForTag, ab as isParagraphTag, ac as collectInlineRuns, ad as parseParagraphStyle, ae as getRunImage, af as InlineShell, ag as BalloonShell, ah as DocumentShell, ai as findParagraphTableLocation, aj as createMemo, ak as getCaretRectFromSnapshot, al as getParagraphRectFromSnapshot, am as createComponent, an as CaretOverlay, ao as Show, ap as createRenderEffect, aq as style, ar as setStyleProperty, as as setAttribute, at as memo, au as template, av as Button, aw as useI18n, ax as createEffect, ay as TextField, az as Dialog, aA as insert, aB as className, aC as Grid, aD as SelectField, aE as StatusText, aF as ColorField, aG as UNDERLINE_STYLE_OPTIONS, aH as Stack, aI as For, aJ as ToggleChip, aK as FormField, aL as Checkbox, aM as FieldGroup, aN as Tabs, aO as NumberField, aP as parseNumber, aQ as createStore, aR as reconcile, aS as RadioGroup, aT as Radio$1, aU as TextAreaField, aV as Text, aW as SurfaceButton, aX as delegateEvents, aY as onMount, aZ as onCleanup, a_ as CheckIcon, a$ as use, b0 as PluginUiHost, b1 as OasisEditorEditor, b2 as OasisBrandMark, b3 as setPreciseFontPreference, b4 as setWelcomeSeen, b5 as enablePreciseFontMode, b6 as WORD_NS$6, b7 as XMLSerializer, b8 as DOMParser, b9 as WORD14_NS, ba as mergeNestedExtensionMarkup, bb as resolveOpcRelationships, bc as parseOpcRelationships, bd as JSZip, be as normalizeOpcPartPath, bf as OPC_CONTENT_TYPES_PATH, bg as getOpcRelationshipOwnerPath, bh as serializeOpcRelationships, bi as OPC_ROOT_RELATIONSHIPS_PATH, bj as hashDocxPartBytes, bk as parseOpcContentTypes, bl as serializeOpcContentTypes, bm as mergeParagraphPropertiesXmlSource, bn as setEditorRunOoxmlSource, bo as mergeRunOoxmlSourceIntoGeneratedXml, bp as mergeTableCellPropertiesXmlSource, bq as mergeTableRowPropertiesXmlSource, br as mergeTablePropertiesXmlSource, bs as exportEditorDocumentToDocxBlob, bt as exportEditorDocumentToDocx, bu as pxToPt$1, bv as resolveFloatingObjectRect, bw as getTextBoxFloatingGeometry, bx as getPresetPathSegments, by as buildListLabels, bz as lineDashPatternPt, bA as DEFAULT_FONT_SIZE_PX, bB as resolveGradientAxis, bC as isDoubleUnderlineStyle, bD as isWavyUnderlineStyle, bE as underlineStyleLineWidthPx, bF as WAVY_UNDERLINE_WAVELENGTH_PX, bG as WAVY_UNDERLINE_AMPLITUDE_PX, bH as DOUBLE_UNDERLINE_OFFSET_PX, bI as underlineStyleDashArray, bJ as resolveEffectiveParagraphStyle, bK as EMPHASIS_GLYPH, bL as parseHexColorToRgb255, bM as rgb255ToHex, bN as getImageFloatingGeometry, bO as resolveEffectiveTextStyleForParagraph, bP as textStyleToFontSizePt, bQ as resolveTextAlignmentBaselineOffset, bR as TEXT_BASELINE_RATIO, bS as resolveRenderedTextChar, bT as resolveOpenTypeFeatureTags, bU as isLowercaseSmallCapsChar, bV as resolveDecorationLineY, bW as DOUBLE_STRIKE_OFFSET_PX, bX as resolveListLabel, bY as getListLabelInset, bZ as getAlignedListLabelInset, b_ as getParagraphBorderInsets, b$ as buildSegmentTable, c0 as buildCanvasTableLayout, c1 as resolveCanvasTableWidth, c2 as resolveFloatingTableRect, c3 as paragraphBetweenBorderMatches, c4 as normalizeFamily, c5 as ROBOTO_FONT_FILES, c6 as loadFontAsset, c7 as getRemotePdfFontFaces, c8 as OFFICE_COMPAT_FONT_FAMILIES, c9 as BinaryReader, ca as buildSfnt, cb as defaultFontDecoderRegistry, cc as SfntFontProgram, cd as zlibSync, ce as renumberImageCaptionsInDocument, cf as collectPdfFontFamilies, cg as outlineFrom, ch as getPageHeaderZoneTop, ci as getPageColumnRects, cj as findFootnoteReference, ck as resolveImporterForFile, cl as roundTo, cm as getDocumentSectionsCanonical, cn as getDocumentParagraphsCanonical, co as getDocumentParagraphs, cp as getImageCaptionText, cq as isImageCaptionParagraph, cr as updateImageCaptionParagraph, cs as createImageCaptionParagraph, ct as renumberImageCaptionParagraphs, cu as getCaptionSelectionOffset, cv as PX_PER_CM, cw as getDocumentPageSettings, cx as getTableCellContentWidthForParagraph, cy as layoutMetricsEpoch, cz as bumpLayoutMetricsEpoch, cA as createCanvasLayoutSnapshotProvider, cB as on, cC as debounce, cD as unwrap, cE as perfTimer, cF as prepareDocumentFonts, cG as getRunTextBox, cH as EMU_PER_PX, cI as createEditorDocument, cJ as resolveResizedDimensions, cK as axisSignForDirection, cL as clamp$1, cM as MIN_RESIZE_SIZE_PX, cN as resolveTextBoxRenderHeight, cO as getToolbarStyleState, cP as VERTICAL_HIT_WEIGHT, cQ as getCachedCanvasImage, cR as measureParagraphMinContentWidthPx, cS as createSectionBoundaryParagraph, cT as normalizePageSettings, cU as DEFAULT_EDITOR_PAGE_SETTINGS, cV as markStart, cW as markEnd, cX as getParagraphEntries, cY as getParagraphById, cZ as createEditorFootnote, c_ as createFootnoteReferenceRun, c$ as renumberFootnotes, d0 as iterateFootnoteReferenceRuns, d1 as preciseFontModeVersion, d2 as isPreciseFontModeEnabled, d3 as getRunFieldChar, d4 as getRunFieldInstruction, d5 as getHeadingLevel, d6 as createEditorRun, d7 as TWIPS_PER_INCH, d8 as PX_PER_INCH, d9 as togglePreciseFontMode, da as nextFontSizePt, db as previousFontSizePt, dc as fontSizePtToPx, dd as resolveNamedTextStyle, de as resolveNamedTableStyle, df as resolveEffectiveTableStyle, dg as createDefaultToolbarPreset, dh as MenuRegistry, di as createToolbarRegistry, dj as Editor, dk as resolveCommandRef, dl as commandRefName, dm as createOasisEditorClient, dn as createEditorZoom, dp as startLongTaskObserver, dq as installGlobalReport, dr as applyStoredPreciseFontPreference, ds as getWelcomeSeen, dt as isLocalFontAccessSupported, du as EDITOR_SCROLL_PADDING_PX, dv as Toolbar, dw as OasisEditorLoading, dx as I18nProvider, dy as createTranslator, dz as registerDomStatsSurface, dA as createEditorLogger } from "./index-CXKg4TC3.js";
4
+ import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, q as assertNever, r as cloneRun, s as createSignal, t as createEditorStateFromDocument, u as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, v as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as stylesEqual, A as cloneStyle, B as createEditorStyledRun, C as cloneParagraphList, D as cloneParagraph, G as getParagraphLength, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as MATH_OBJECT_REPLACEMENT, T as setValueStyle, U as setBooleanStyle, V as parseFontSizePtToPx, W as formatFontSizePt, X as setParagraphStyleValue, Y as createEditorParagraph, Z as cloneBlocks, _ as resolveDefaultParagraphStyleId, $ as findParagraphTablePathLocation, a0 as findParagraphLocation, a1 as resolveTablePath, a2 as buildTableCellLayout, a3 as PT_PER_PX, a4 as createEditorTableCell, a5 as createEditorTableRow, a6 as createEditorTable, a7 as clampPosition, a8 as PX_PER_POINT, a9 as underlineStyleToCssDecorationStyle, aa as resolveImageSrc, ab as listKindForTag, ac as isParagraphTag, ad as collectInlineRuns, ae as parseParagraphStyle, af as getRunImage, ag as InlineShell, ah as BalloonShell, ai as DocumentShell, aj as findParagraphTableLocation, ak as createMemo, al as getCaretRectFromSnapshot, am as getParagraphRectFromSnapshot, an as createComponent, ao as CaretOverlay, ap as Show, aq as createRenderEffect, ar as style, as as setStyleProperty, at as setAttribute, au as memo, av as template, aw as Button, ax as useI18n, ay as createEffect, az as TextField, aA as Dialog, aB as insert, aC as className, aD as Grid, aE as SelectField, aF as StatusText, aG as ColorField, aH as UNDERLINE_STYLE_OPTIONS, aI as Stack, aJ as For, aK as ToggleChip, aL as FormField, aM as Checkbox, aN as FieldGroup, aO as Tabs, aP as NumberField, aQ as parseNumber, aR as createStore, aS as reconcile, aT as RadioGroup, aU as Radio$1, aV as TextAreaField, aW as COMMON_SYMBOLS, aX as getRecentSymbols, aY as SYMBOL_CATEGORIES, aZ as rememberSymbol, a_ as delegateEvents, a$ as EMPTY_EDITOR_MATH_EXPRESSION, b0 as serializeLinearMath, b1 as parseLinearMath, b2 as Text, b3 as SurfaceButton, b4 as onMount, b5 as onCleanup, b6 as CheckIcon, b7 as use, b8 as PluginUiHost, b9 as OasisEditorEditor, ba as OasisBrandMark, bb as setPreciseFontPreference, bc as setWelcomeSeen, bd as enablePreciseFontMode, be as WORD_NS$6, bf as XMLSerializer, bg as DOMParser, bh as WORD14_NS, bi as mergeNestedExtensionMarkup, bj as resolveOpcRelationships, bk as parseOpcRelationships, bl as JSZip, bm as normalizeOpcPartPath, bn as OPC_CONTENT_TYPES_PATH, bo as getOpcRelationshipOwnerPath, bp as serializeOpcRelationships, bq as OPC_ROOT_RELATIONSHIPS_PATH, br as hashDocxPartBytes, bs as parseOpcContentTypes, bt as serializeOpcContentTypes, bu as mergeParagraphPropertiesXmlSource, bv as setEditorRunOoxmlSource, bw as mergeRunOoxmlSourceIntoGeneratedXml, bx as mergeTableCellPropertiesXmlSource, by as mergeTableRowPropertiesXmlSource, bz as mergeTablePropertiesXmlSource, bA as exportEditorDocumentToDocxBlob, bB as exportEditorDocumentToDocx, bC as pxToPt$1, bD as resolveFloatingObjectRect, bE as getTextBoxFloatingGeometry, bF as getPresetPathSegments, bG as buildListLabels, bH as lineDashPatternPt, bI as DEFAULT_FONT_SIZE_PX, bJ as resolveGradientAxis, bK as isDoubleUnderlineStyle, bL as isWavyUnderlineStyle, bM as underlineStyleLineWidthPx, bN as WAVY_UNDERLINE_WAVELENGTH_PX, bO as WAVY_UNDERLINE_AMPLITUDE_PX, bP as DOUBLE_UNDERLINE_OFFSET_PX, bQ as underlineStyleDashArray, bR as resolveEffectiveParagraphStyle, bS as EMPHASIS_GLYPH, bT as parseHexColorToRgb255, bU as rgb255ToHex, bV as getImageFloatingGeometry, bW as resolveEffectiveTextStyleForParagraph, bX as textStyleToFontSizePt, bY as mathDisplayText, bZ as TEXT_BASELINE_RATIO, b_ as resolveTextAlignmentBaselineOffset, b$ as resolveRenderedTextChar, c0 as resolveOpenTypeFeatureTags, c1 as isLowercaseSmallCapsChar, c2 as resolveDecorationLineY, c3 as DOUBLE_STRIKE_OFFSET_PX, c4 as resolveListLabel, c5 as getListLabelInset, c6 as getAlignedListLabelInset, c7 as getParagraphBorderInsets, c8 as buildSegmentTable, c9 as buildCanvasTableLayout, ca as resolveCanvasTableWidth, cb as resolveFloatingTableRect, cc as paragraphBetweenBorderMatches, cd as normalizeFamily, ce as ROBOTO_FONT_FILES, cf as loadFontAsset, cg as getRemotePdfFontFaces, ch as OFFICE_COMPAT_FONT_FAMILIES, ci as BinaryReader, cj as buildSfnt, ck as defaultFontDecoderRegistry, cl as SfntFontProgram, cm as zlibSync, cn as renumberImageCaptionsInDocument, co as collectPdfFontFamilies, cp as outlineFrom, cq as getPageHeaderZoneTop, cr as getPageColumnRects, cs as findFootnoteReference, ct as resolveImporterForFile, cu as roundTo, cv as getDocumentSectionsCanonical, cw as getDocumentParagraphsCanonical, cx as getDocumentParagraphs, cy as getImageCaptionText, cz as isImageCaptionParagraph, cA as updateImageCaptionParagraph, cB as createImageCaptionParagraph, cC as renumberImageCaptionParagraphs, cD as getCaptionSelectionOffset, cE as PX_PER_CM, cF as getDocumentPageSettings, cG as getTableCellContentWidthForParagraph, cH as layoutMetricsEpoch, cI as bumpLayoutMetricsEpoch, cJ as createCanvasLayoutSnapshotProvider, cK as on, cL as debounce, cM as unwrap, cN as perfTimer, cO as prepareDocumentFonts, cP as getRunTextBox, cQ as EMU_PER_PX, cR as createEditorDocument, cS as resolveResizedDimensions, cT as axisSignForDirection, cU as clamp$1, cV as MIN_RESIZE_SIZE_PX, cW as resolveTextBoxRenderHeight, cX as getToolbarStyleState, cY as VERTICAL_HIT_WEIGHT, cZ as getCachedCanvasImage, c_ as measureParagraphMinContentWidthPx, c$ as createSectionBoundaryParagraph, d0 as normalizePageSettings, d1 as DEFAULT_EDITOR_PAGE_SETTINGS, d2 as markStart, d3 as markEnd, d4 as getParagraphEntries, d5 as getParagraphById, d6 as createEditorFootnote, d7 as createFootnoteReferenceRun, d8 as renumberFootnotes, d9 as iterateFootnoteReferenceRuns, da as preciseFontModeVersion, db as isPreciseFontModeEnabled, dc as getRunFieldChar, dd as getRunFieldInstruction, de as getHeadingLevel, df as createEditorRun, dg as TWIPS_PER_INCH, dh as PX_PER_INCH, di as togglePreciseFontMode, dj as nextFontSizePt, dk as previousFontSizePt, dl as fontSizePtToPx, dm as resolveNamedTextStyle, dn as resolveNamedTableStyle, dp as resolveEffectiveTableStyle, dq as createDefaultToolbarPreset, dr as MenuRegistry, ds as createToolbarRegistry, dt as Editor, du as resolveCommandRef, dv as commandRefName, dw as createOasisEditorClient, dx as createEditorZoom, dy as startLongTaskObserver, dz as installGlobalReport, dA as applyStoredPreciseFontPreference, dB as getWelcomeSeen, dC as isLocalFontAccessSupported, dD as EDITOR_SCROLL_PADDING_PX, dE as Toolbar, dF as OasisEditorLoading, dG as I18nProvider, dH as createTranslator, dI as registerDomStatsSurface, dJ as createEditorLogger } from "./index-B7V7kbjr.js";
5
5
  function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
6
6
  const {
7
7
  pageIndex,
@@ -26997,6 +26997,9 @@ function createEditorFocusController() {
26997
26997
  };
26998
26998
  }
26999
26999
  function createEditorDialogs() {
27000
+ const [newDocumentDialog, setNewDocumentDialog] = createSignal({ isOpen: false });
27001
+ const [symbolDialog, setSymbolDialog] = createSignal({ isOpen: false });
27002
+ const [equationDialog, setEquationDialog] = createSignal({ isOpen: false });
27000
27003
  const [linkDialog, setLinkDialog] = createSignal({
27001
27004
  isOpen: false,
27002
27005
  initialHref: ""
@@ -27126,6 +27129,12 @@ function createEditorDialogs() {
27126
27129
  }
27127
27130
  });
27128
27131
  return {
27132
+ newDocumentDialog,
27133
+ setNewDocumentDialog,
27134
+ symbolDialog,
27135
+ setSymbolDialog,
27136
+ equationDialog,
27137
+ setEquationDialog,
27129
27138
  linkDialog,
27130
27139
  setLinkDialog,
27131
27140
  imageAltDialog,
@@ -28107,6 +28116,48 @@ function insertTextAtSelection(state, text, styleOverride) {
28107
28116
  )
28108
28117
  );
28109
28118
  }
28119
+ function insertMathAtSelection(state, expression) {
28120
+ const collapsedState = isSelectionCollapsed(state.selection) ? state : deleteSelectionRange(state);
28121
+ const { paragraph, index, offset } = getFocusParagraph(collapsedState);
28122
+ const styles = getStyleAtOffset(paragraph, offset);
28123
+ const insertedRun = {
28124
+ id: `run:${Math.random().toString(36).slice(2, 9)}`,
28125
+ text: MATH_OBJECT_REPLACEMENT,
28126
+ styles,
28127
+ kind: "math",
28128
+ math: expression
28129
+ };
28130
+ const nextParagraph = insertRunsAtOffset(paragraph, offset, [insertedRun]);
28131
+ const paragraphs = getParagraphs(collapsedState).map(
28132
+ (candidate, candidateIndex) => candidateIndex === index ? nextParagraph : candidate
28133
+ );
28134
+ return cloneStateWithParagraphs(
28135
+ collapsedState,
28136
+ paragraphs,
28137
+ withSelection(
28138
+ paragraphOffsetToPosition(
28139
+ nextParagraph,
28140
+ offset + MATH_OBJECT_REPLACEMENT.length
28141
+ )
28142
+ )
28143
+ );
28144
+ }
28145
+ function updateMathRun(state, runId, expression) {
28146
+ let changed = false;
28147
+ const paragraphs = getParagraphs(state).map(
28148
+ (paragraph) => {
28149
+ let paragraphChanged = false;
28150
+ const runs = paragraph.runs.map((run) => {
28151
+ if (run.id !== runId || run.kind !== "math") return run;
28152
+ changed = true;
28153
+ paragraphChanged = true;
28154
+ return { ...run, math: expression, text: MATH_OBJECT_REPLACEMENT };
28155
+ });
28156
+ return paragraphChanged ? { ...paragraph, runs } : paragraph;
28157
+ }
28158
+ );
28159
+ return changed ? cloneStateWithParagraphs(state, paragraphs, state.selection) : state;
28160
+ }
28110
28161
  function insertPlainTextAtSelection(state, text, styleOverride) {
28111
28162
  if (text.length === 0) {
28112
28163
  return state;
@@ -29393,7 +29444,10 @@ function updateSelectedSectionStory(section, loc, paragraphId, updateBlocks) {
29393
29444
  };
29394
29445
  }
29395
29446
  if (storyContainsParagraph$2(section.evenPageHeader, paragraphId)) {
29396
- return { ...section, evenPageHeader: updateBlocks(section.evenPageHeader) };
29447
+ return {
29448
+ ...section,
29449
+ evenPageHeader: updateBlocks(section.evenPageHeader)
29450
+ };
29397
29451
  }
29398
29452
  return {
29399
29453
  ...section,
@@ -29408,7 +29462,10 @@ function updateSelectedSectionStory(section, loc, paragraphId, updateBlocks) {
29408
29462
  };
29409
29463
  }
29410
29464
  if (storyContainsParagraph$2(section.evenPageFooter, paragraphId)) {
29411
- return { ...section, evenPageFooter: updateBlocks(section.evenPageFooter) };
29465
+ return {
29466
+ ...section,
29467
+ evenPageFooter: updateBlocks(section.evenPageFooter)
29468
+ };
29412
29469
  }
29413
29470
  return {
29414
29471
  ...section,
@@ -29424,7 +29481,10 @@ function updateActiveTableBlocks(state, updateTable) {
29424
29481
  const paragraphId = state.selection.focus.paragraphId;
29425
29482
  const updateBlocks = (blocks) => updateTableAtPath(blocks, loc.tablePath, updateTable);
29426
29483
  if (loc.zone === "footnote") {
29427
- const paragraphLocation = findParagraphLocation(state.document, paragraphId);
29484
+ const paragraphLocation = findParagraphLocation(
29485
+ state.document,
29486
+ paragraphId
29487
+ );
29428
29488
  const footnoteId = (paragraphLocation == null ? void 0 : paragraphLocation.footnoteId) ?? state.activeFootnoteId;
29429
29489
  const footnotes = state.document.footnotes;
29430
29490
  const footnote = footnoteId ? footnotes == null ? void 0 : footnotes.items[footnoteId] : void 0;
@@ -29437,7 +29497,10 @@ function updateActiveTableBlocks(state, updateTable) {
29437
29497
  ...footnotes,
29438
29498
  items: {
29439
29499
  ...footnotes.items,
29440
- [footnoteId]: { ...footnote, blocks: updateBlocks(footnote.blocks) }
29500
+ [footnoteId]: {
29501
+ ...footnote,
29502
+ blocks: updateBlocks(footnote.blocks)
29503
+ }
29441
29504
  }
29442
29505
  }
29443
29506
  }
@@ -30234,9 +30297,7 @@ function insertTableAtSelection(state, rows, cols) {
30234
30297
  ...state.document,
30235
30298
  sections: nextSections
30236
30299
  },
30237
- selection: withSelection(
30238
- paragraphOffsetToPosition(firstBlock, 0)
30239
- )
30300
+ selection: withSelection(paragraphOffsetToPosition(firstBlock, 0))
30240
30301
  };
30241
30302
  }
30242
30303
  const EMPTY_INITIAL = {
@@ -31741,14 +31802,14 @@ function DropCaret(props) {
31741
31802
  })
31742
31803
  });
31743
31804
  }
31744
- var _tmpl$$f = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-guide>`), _tmpl$2$5 = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-outline>`), _tmpl$3$2 = /* @__PURE__ */ template(`<img class=oasis-editor-image-ghost>`), _tmpl$4$1 = /* @__PURE__ */ template(`<div class=oasis-editor-table-ghost>`);
31805
+ var _tmpl$$i = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-guide>`), _tmpl$2$7 = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-outline>`), _tmpl$3$3 = /* @__PURE__ */ template(`<img class=oasis-editor-image-ghost>`), _tmpl$4$2 = /* @__PURE__ */ template(`<div class=oasis-editor-table-ghost>`);
31745
31806
  function EditorDragLayers(props) {
31746
31807
  return [createComponent(Show, {
31747
31808
  get when() {
31748
31809
  return props.tableResize.resizing();
31749
31810
  },
31750
31811
  children: (resizing) => (() => {
31751
- var _el$ = _tmpl$$f();
31812
+ var _el$ = _tmpl$$i();
31752
31813
  createRenderEffect((_p$) => {
31753
31814
  var _v$ = !!(resizing().type === "column"), _v$2 = !!(resizing().type === "row"), _v$3 = {
31754
31815
  ...resizing().type === "column" ? {
@@ -31779,7 +31840,7 @@ function EditorDragLayers(props) {
31779
31840
  return props.tableCornerResize.previewRect();
31780
31841
  },
31781
31842
  children: (rect) => (() => {
31782
- var _el$2 = _tmpl$2$5();
31843
+ var _el$2 = _tmpl$2$7();
31783
31844
  createRenderEffect((_p$) => {
31784
31845
  var _v$4 = `${rect().left}px`, _v$5 = `${rect().top}px`, _v$6 = `${rect().width}px`, _v$7 = `${rect().height}px`;
31785
31846
  _v$4 !== _p$.e && setStyleProperty(_el$2, "left", _p$.e = _v$4);
@@ -31800,7 +31861,7 @@ function EditorDragLayers(props) {
31800
31861
  return memo(() => !!props.imageOps.dragging())() && props.imageOps.draggedImageInfo();
31801
31862
  },
31802
31863
  children: (info) => (() => {
31803
- var _el$3 = _tmpl$3$2();
31864
+ var _el$3 = _tmpl$3$3();
31804
31865
  createRenderEffect((_p$) => {
31805
31866
  var _v$8 = info().src, _v$9 = `${info().width}px`, _v$0 = `${info().height}px`, _v$1 = `${props.imageOps.mousePos().x - info().offsetX}px`, _v$10 = `${props.imageOps.mousePos().y - info().offsetY}px`;
31806
31867
  _v$8 !== _p$.e && setAttribute(_el$3, "src", _p$.e = _v$8);
@@ -31823,7 +31884,7 @@ function EditorDragLayers(props) {
31823
31884
  return memo(() => !!props.tableDrag.dragging())() && props.tableDrag.draggedTableInfo();
31824
31885
  },
31825
31886
  children: (info) => (() => {
31826
- var _el$4 = _tmpl$4$1();
31887
+ var _el$4 = _tmpl$4$2();
31827
31888
  createRenderEffect((_p$) => {
31828
31889
  var _v$11 = `${info().width}px`, _v$12 = `${info().height}px`, _v$13 = `${props.tableDrag.mousePos().x - info().offsetX}px`, _v$14 = `${props.tableDrag.mousePos().y - info().offsetY}px`;
31829
31890
  _v$11 !== _p$.e && setStyleProperty(_el$4, "width", _p$.e = _v$11);
@@ -32419,11 +32480,11 @@ function useFontDialogController(props) {
32419
32480
  handleApply
32420
32481
  };
32421
32482
  }
32422
- var _tmpl$$e = /* @__PURE__ */ template(`<div>`);
32483
+ var _tmpl$$h = /* @__PURE__ */ template(`<div>`);
32423
32484
  function FontPreview(props) {
32424
32485
  const t = useI18n();
32425
32486
  return (() => {
32426
- var _el$ = _tmpl$$e();
32487
+ var _el$ = _tmpl$$h();
32427
32488
  insert(_el$, () => t("dialog.font.previewText"));
32428
32489
  createRenderEffect((_p$) => {
32429
32490
  var _v$ = props.class ?? "oasis-editor-dialog-preview", _v$2 = props.testId, _v$3 = props.style;
@@ -32439,7 +32500,7 @@ function FontPreview(props) {
32439
32500
  return _el$;
32440
32501
  })();
32441
32502
  }
32442
- var _tmpl$$d = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-font-panel">`);
32503
+ var _tmpl$$g = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-font-panel">`);
32443
32504
  function FontTab(props) {
32444
32505
  const t = useI18n();
32445
32506
  const {
@@ -32529,7 +32590,7 @@ function FontTab(props) {
32529
32590
  onChange: (checked) => ctrl.updateFontTab("hidden", checked)
32530
32591
  }];
32531
32592
  return (() => {
32532
- var _el$ = _tmpl$$d();
32593
+ var _el$ = _tmpl$$g();
32533
32594
  insert(_el$, createComponent(Grid, {
32534
32595
  container: true,
32535
32596
  spacing: 1.5,
@@ -32863,14 +32924,14 @@ function FontTab(props) {
32863
32924
  return _el$;
32864
32925
  })();
32865
32926
  }
32866
- var _tmpl$$c = /* @__PURE__ */ template(`<div class=oasis-editor-font-dialog-kerning-line>`), _tmpl$2$4 = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-advanced-panel">`);
32927
+ var _tmpl$$f = /* @__PURE__ */ template(`<div class=oasis-editor-font-dialog-kerning-line>`), _tmpl$2$6 = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-advanced-panel">`);
32867
32928
  function AdvancedFontTab(props) {
32868
32929
  const t = useI18n();
32869
32930
  const {
32870
32931
  ctrl
32871
32932
  } = props;
32872
32933
  return (() => {
32873
- var _el$ = _tmpl$2$4();
32934
+ var _el$ = _tmpl$2$6();
32874
32935
  insert(_el$, createComponent(FieldGroup, {
32875
32936
  "class": "oasis-editor-font-dialog-fieldset",
32876
32937
  get legend() {
@@ -33021,7 +33082,7 @@ function AdvancedFontTab(props) {
33021
33082
  }), createComponent(Grid, {
33022
33083
  size: 12,
33023
33084
  get children() {
33024
- var _el$2 = _tmpl$$c();
33085
+ var _el$2 = _tmpl$$f();
33025
33086
  insert(_el$2, createComponent(Checkbox, {
33026
33087
  "class": "oasis-editor-font-dialog-kerning-toggle",
33027
33088
  get label() {
@@ -33301,7 +33362,7 @@ function FontDialog(props) {
33301
33362
  }
33302
33363
  });
33303
33364
  }
33304
- var _tmpl$$b = /* @__PURE__ */ template(`<div class=oasis-editor-tab-stops><div class=oasis-editor-tab-stops-actions>`), _tmpl$2$3 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-footer-split><div class=oasis-editor-dialog-footer-start></div><div class=oasis-editor-dialog-footer-end>`);
33365
+ var _tmpl$$e = /* @__PURE__ */ template(`<div class=oasis-editor-tab-stops><div class=oasis-editor-tab-stops-actions>`), _tmpl$2$5 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-footer-split><div class=oasis-editor-dialog-footer-start></div><div class=oasis-editor-dialog-footer-end>`);
33305
33366
  function toDraft(stop) {
33306
33367
  return {
33307
33368
  position: stop.position,
@@ -33385,7 +33446,7 @@ function TabStopsDialog(props) {
33385
33446
  },
33386
33447
  get footer() {
33387
33448
  return (() => {
33388
- var _el$3 = _tmpl$2$3(), _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling;
33449
+ var _el$3 = _tmpl$2$5(), _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling;
33389
33450
  insert(_el$4, createComponent(Button, {
33390
33451
  variant: "secondary",
33391
33452
  onClick: () => {
@@ -33418,7 +33479,7 @@ function TabStopsDialog(props) {
33418
33479
  })();
33419
33480
  },
33420
33481
  get children() {
33421
- var _el$ = _tmpl$$b(), _el$2 = _el$.firstChild;
33482
+ var _el$ = _tmpl$$e(), _el$2 = _el$.firstChild;
33422
33483
  insert(_el$, createComponent(For, {
33423
33484
  get each() {
33424
33485
  return stops();
@@ -33772,7 +33833,7 @@ function useParagraphDialogController(props) {
33772
33833
  handleSetDefault
33773
33834
  };
33774
33835
  }
33775
- var _tmpl$$a = /* @__PURE__ */ template(`<div class=oasis-editor-paragraph-dialog-panel>`), _tmpl$2$2 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-preview data-testid=editor-paragraph-dialog-preview>`), _tmpl$3$1 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-footer-split><div class=oasis-editor-dialog-footer-start></div><div class=oasis-editor-dialog-footer-end>`);
33836
+ var _tmpl$$d = /* @__PURE__ */ template(`<div class=oasis-editor-paragraph-dialog-panel>`), _tmpl$2$4 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-preview data-testid=editor-paragraph-dialog-preview>`), _tmpl$3$2 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-footer-split><div class=oasis-editor-dialog-footer-start></div><div class=oasis-editor-dialog-footer-end>`);
33776
33837
  function ParagraphDialog(props) {
33777
33838
  const t = useI18n();
33778
33839
  const [tabsDialogOpen, setTabsDialogOpen] = createSignal(false);
@@ -33879,7 +33940,7 @@ function ParagraphDialog(props) {
33879
33940
  }
33880
33941
  });
33881
33942
  const indentsAndSpacingPanel = (() => {
33882
- var _el$ = _tmpl$$a();
33943
+ var _el$ = _tmpl$$d();
33883
33944
  insert(_el$, createComponent(FieldGroup, {
33884
33945
  "class": "oasis-editor-dialog-fieldset",
33885
33946
  get legend() {
@@ -34349,7 +34410,7 @@ function ParagraphDialog(props) {
34349
34410
  return _el$;
34350
34411
  })();
34351
34412
  const lineAndPageBreaksPanel = (() => {
34352
- var _el$2 = _tmpl$$a();
34413
+ var _el$2 = _tmpl$$d();
34353
34414
  insert(_el$2, createComponent(FieldGroup, {
34354
34415
  "class": "oasis-editor-dialog-fieldset",
34355
34416
  get legend() {
@@ -34416,7 +34477,7 @@ function ParagraphDialog(props) {
34416
34477
  size: "lg",
34417
34478
  get footer() {
34418
34479
  return (() => {
34419
- var _el$4 = _tmpl$3$1(), _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling;
34480
+ var _el$4 = _tmpl$3$2(), _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling;
34420
34481
  insert(_el$5, createComponent(Button, {
34421
34482
  variant: "secondary",
34422
34483
  onClick: () => {
@@ -34479,7 +34540,7 @@ function ParagraphDialog(props) {
34479
34540
  return t("paragraph.preview");
34480
34541
  },
34481
34542
  get children() {
34482
- var _el$3 = _tmpl$2$2();
34543
+ var _el$3 = _tmpl$2$4();
34483
34544
  insert(_el$3, () => t("paragraph.previewText"));
34484
34545
  createRenderEffect((_$p) => style(_el$3, previewStyle(), _$p));
34485
34546
  return _el$3;
@@ -34702,13 +34763,13 @@ function NumField(label, value, setter, testId, disabled = false, allowNegative
34702
34763
  "data-testid": testId
34703
34764
  });
34704
34765
  }
34705
- var _tmpl$$9 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
34766
+ var _tmpl$$c = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
34706
34767
  function TableTabPanel(props) {
34707
34768
  const t = useI18n();
34708
34769
  const form = () => props.ctrl.form;
34709
34770
  const set = props.ctrl.set;
34710
34771
  return (() => {
34711
- var _el$ = _tmpl$$9();
34772
+ var _el$ = _tmpl$$c();
34712
34773
  insert(_el$, createComponent(FieldGroup, {
34713
34774
  "class": "oasis-editor-font-dialog-fieldset",
34714
34775
  get legend() {
@@ -35014,13 +35075,13 @@ function TableTabPanel(props) {
35014
35075
  return _el$;
35015
35076
  })();
35016
35077
  }
35017
- var _tmpl$$8 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
35078
+ var _tmpl$$b = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
35018
35079
  function RowTabPanel(props) {
35019
35080
  const t = useI18n();
35020
35081
  const form = () => props.ctrl.form;
35021
35082
  const set = props.ctrl.set;
35022
35083
  return (() => {
35023
- var _el$ = _tmpl$$8();
35084
+ var _el$ = _tmpl$$b();
35024
35085
  insert(_el$, createComponent(Grid, {
35025
35086
  container: true,
35026
35087
  spacing: 1.5,
@@ -35103,13 +35164,13 @@ function RowTabPanel(props) {
35103
35164
  return _el$;
35104
35165
  })();
35105
35166
  }
35106
- var _tmpl$$7 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
35167
+ var _tmpl$$a = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
35107
35168
  function ColumnTabPanel(props) {
35108
35169
  const t = useI18n();
35109
35170
  const form = () => props.ctrl.form;
35110
35171
  const set = props.ctrl.set;
35111
35172
  return (() => {
35112
- var _el$ = _tmpl$$7();
35173
+ var _el$ = _tmpl$$a();
35113
35174
  insert(_el$, createComponent(Grid, {
35114
35175
  container: true,
35115
35176
  spacing: 1.5,
@@ -35128,7 +35189,7 @@ function ColumnTabPanel(props) {
35128
35189
  return _el$;
35129
35190
  })();
35130
35191
  }
35131
- var _tmpl$$6 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-cell-preview data-testid=editor-table-properties-cell-preview>`), _tmpl$2$1 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
35192
+ var _tmpl$$9 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-cell-preview data-testid=editor-table-properties-cell-preview>`), _tmpl$2$3 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
35132
35193
  function CellTabPanel(props) {
35133
35194
  const t = useI18n();
35134
35195
  const form = () => props.ctrl.form;
@@ -35146,7 +35207,7 @@ function CellTabPanel(props) {
35146
35207
  });
35147
35208
  const borderDisabled = () => form().borderStyle === "none";
35148
35209
  return (() => {
35149
- var _el$ = _tmpl$2$1();
35210
+ var _el$ = _tmpl$2$3();
35150
35211
  insert(_el$, createComponent(Grid, {
35151
35212
  container: true,
35152
35213
  spacing: 1.5,
@@ -35533,7 +35594,7 @@ function CellTabPanel(props) {
35533
35594
  })];
35534
35595
  }
35535
35596
  }), (() => {
35536
- var _el$2 = _tmpl$$6();
35597
+ var _el$2 = _tmpl$$9();
35537
35598
  createRenderEffect((_$p) => style(_el$2, borderPreview(), _$p));
35538
35599
  return _el$2;
35539
35600
  })()];
@@ -35542,13 +35603,13 @@ function CellTabPanel(props) {
35542
35603
  return _el$;
35543
35604
  })();
35544
35605
  }
35545
- var _tmpl$$5 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
35606
+ var _tmpl$$8 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
35546
35607
  function AltTextTabPanel(props) {
35547
35608
  const t = useI18n();
35548
35609
  const form = () => props.ctrl.form;
35549
35610
  const set = props.ctrl.set;
35550
35611
  return (() => {
35551
- var _el$ = _tmpl$$5();
35612
+ var _el$ = _tmpl$$8();
35552
35613
  insert(_el$, createComponent(TextField, {
35553
35614
  get label() {
35554
35615
  return t("table.altTitle");
@@ -35660,6 +35721,301 @@ function TablePropertiesDialog(props) {
35660
35721
  }
35661
35722
  });
35662
35723
  }
35724
+ var _tmpl$$7 = /* @__PURE__ */ template(`<p data-testid=editor-new-document-message>`);
35725
+ function NewDocumentConfirmationDialog(props) {
35726
+ const t = useI18n();
35727
+ return createComponent(Dialog, {
35728
+ get isOpen() {
35729
+ return props.isOpen;
35730
+ },
35731
+ get title() {
35732
+ return t("dialog.newDocument.title");
35733
+ },
35734
+ get onClose() {
35735
+ return props.onClose;
35736
+ },
35737
+ closeOnOverlayClick: false,
35738
+ size: "sm",
35739
+ get footer() {
35740
+ return createComponent(DialogFooter, {
35741
+ get onCancel() {
35742
+ return props.onClose;
35743
+ },
35744
+ get onConfirm() {
35745
+ return props.onConfirm;
35746
+ },
35747
+ get cancelLabel() {
35748
+ return t("generic.cancel");
35749
+ },
35750
+ get confirmLabel() {
35751
+ return t("dialog.newDocument.discard");
35752
+ },
35753
+ cancelTestId: "editor-new-document-cancel",
35754
+ confirmTestId: "editor-new-document-discard"
35755
+ });
35756
+ },
35757
+ get children() {
35758
+ var _el$ = _tmpl$$7();
35759
+ insert(_el$, () => t("dialog.newDocument.message"));
35760
+ return _el$;
35761
+ }
35762
+ });
35763
+ }
35764
+ var _tmpl$$6 = /* @__PURE__ */ template(`<div class=oasis-editor-symbol-dialog-controls><label class=oasis-editor-symbol-dialog-field><span></span><select data-testid=editor-symbol-dialog-font></select></label><label class=oasis-editor-symbol-dialog-field><span></span><select data-testid=editor-symbol-dialog-category><option value=all>`), _tmpl$2$2 = /* @__PURE__ */ template(`<div class=oasis-editor-symbol-dialog-recent><span></span><div class=oasis-editor-symbol-dialog-recent-list>`), _tmpl$3$1 = /* @__PURE__ */ template(`<div class=oasis-editor-symbol-dialog-layout><div class=oasis-editor-symbol-dialog-grid role=grid></div><aside class=oasis-editor-symbol-dialog-preview><span class=oasis-editor-symbol-dialog-preview-label></span><span class=oasis-editor-symbol-dialog-preview-character data-testid=editor-symbol-dialog-preview></span><label class=oasis-editor-symbol-dialog-field><span></span><input data-testid=editor-symbol-dialog-code></label><p class=oasis-editor-symbol-dialog-help>`), _tmpl$4$1 = /* @__PURE__ */ template(`<option>`), _tmpl$5$1 = /* @__PURE__ */ template(`<button type=button class=oasis-editor-symbol-dialog-tile>`), _tmpl$6$1 = /* @__PURE__ */ template(`<button type=button class=oasis-editor-symbol-dialog-tile role=gridcell>`);
35765
+ const FONT_OPTIONS = ["Segoe UI Symbol", "Arial Unicode MS", "Cambria Math", "Times New Roman"];
35766
+ function SymbolDialog(props) {
35767
+ const t = useI18n();
35768
+ const [category, setCategory] = createSignal("common");
35769
+ const [selected, setSelected] = createSignal(COMMON_SYMBOLS[0]);
35770
+ const [font, setFont] = createSignal(FONT_OPTIONS[0]);
35771
+ const [codeInput, setCodeInput] = createSignal(COMMON_SYMBOLS[0].codePoint);
35772
+ const recentSymbols = createMemo(() => {
35773
+ props.isOpen;
35774
+ return getRecentSymbols();
35775
+ });
35776
+ const visibleEntries = createMemo(() => {
35777
+ var _a;
35778
+ if (category() === "all") {
35779
+ return SYMBOL_CATEGORIES.flatMap((symbolCategory) => symbolCategory.entries);
35780
+ }
35781
+ return ((_a = SYMBOL_CATEGORIES.find((symbolCategory) => symbolCategory.id === category())) == null ? void 0 : _a.entries) ?? COMMON_SYMBOLS;
35782
+ });
35783
+ const selectEntry = (entry) => {
35784
+ setSelected(entry);
35785
+ setCodeInput(entry.codePoint);
35786
+ };
35787
+ const selectCodePoint = (value) => {
35788
+ setCodeInput(value);
35789
+ const normalized = value.trim().toUpperCase().replace(/^U\+/, "");
35790
+ const parsed = Number.parseInt(normalized, 16);
35791
+ if (!Number.isFinite(parsed) || parsed < 0 || parsed > 1114111) return;
35792
+ const character = String.fromCodePoint(parsed);
35793
+ setSelected({
35794
+ character,
35795
+ codePoint: `U+${parsed.toString(16).toUpperCase().padStart(4, "0")}`
35796
+ });
35797
+ };
35798
+ const insertSelected = () => {
35799
+ const character = selected().character;
35800
+ if (!character) return;
35801
+ rememberSymbol(character);
35802
+ props.onInsert(character, font());
35803
+ props.onClose();
35804
+ };
35805
+ return createComponent(Dialog, {
35806
+ get isOpen() {
35807
+ return props.isOpen;
35808
+ },
35809
+ get title() {
35810
+ return t("dialog.symbol.title");
35811
+ },
35812
+ get onClose() {
35813
+ return props.onClose;
35814
+ },
35815
+ "class": "oasis-editor-symbol-dialog",
35816
+ bodyClass: "oasis-editor-symbol-dialog-body",
35817
+ size: "lg",
35818
+ closeOnOverlayClick: false,
35819
+ get footer() {
35820
+ return [createComponent(Button, {
35821
+ variant: "secondary",
35822
+ get onClick() {
35823
+ return props.onClose;
35824
+ },
35825
+ "data-testid": "editor-symbol-dialog-cancel",
35826
+ get children() {
35827
+ return t("generic.cancel");
35828
+ }
35829
+ }), createComponent(Button, {
35830
+ variant: "primary",
35831
+ onClick: insertSelected,
35832
+ "data-testid": "editor-symbol-dialog-insert",
35833
+ get children() {
35834
+ return t("dialog.symbol.insert");
35835
+ }
35836
+ })];
35837
+ },
35838
+ get children() {
35839
+ return [(() => {
35840
+ var _el$ = _tmpl$$6(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$2.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$6.nextSibling, _el$8 = _el$7.firstChild;
35841
+ insert(_el$3, () => t("dialog.symbol.font"));
35842
+ _el$4.addEventListener("change", (event) => {
35843
+ setFont(event.currentTarget.value);
35844
+ });
35845
+ insert(_el$4, createComponent(For, {
35846
+ each: FONT_OPTIONS,
35847
+ children: (option) => (() => {
35848
+ var _el$19 = _tmpl$4$1();
35849
+ _el$19.value = option;
35850
+ insert(_el$19, option);
35851
+ return _el$19;
35852
+ })()
35853
+ }));
35854
+ insert(_el$6, () => t("dialog.symbol.subset"));
35855
+ _el$7.addEventListener("change", (event) => {
35856
+ setCategory(event.currentTarget.value);
35857
+ });
35858
+ insert(_el$8, () => t("symbols.category.all"));
35859
+ insert(_el$7, createComponent(For, {
35860
+ each: SYMBOL_CATEGORIES,
35861
+ children: (symbolCategory) => (() => {
35862
+ var _el$20 = _tmpl$4$1();
35863
+ insert(_el$20, () => t(symbolCategory.labelKey));
35864
+ createRenderEffect(() => _el$20.value = symbolCategory.id);
35865
+ return _el$20;
35866
+ })()
35867
+ }), null);
35868
+ createRenderEffect(() => _el$4.value = font());
35869
+ createRenderEffect(() => _el$7.value = category());
35870
+ return _el$;
35871
+ })(), (() => {
35872
+ var _el$9 = _tmpl$3$1(), _el$0 = _el$9.firstChild, _el$12 = _el$0.nextSibling, _el$13 = _el$12.firstChild, _el$14 = _el$13.nextSibling, _el$15 = _el$14.nextSibling, _el$16 = _el$15.firstChild, _el$17 = _el$16.nextSibling, _el$18 = _el$15.nextSibling;
35873
+ insert(_el$0, createComponent(Show, {
35874
+ get when() {
35875
+ return recentSymbols().length > 0;
35876
+ },
35877
+ get children() {
35878
+ var _el$1 = _tmpl$2$2(), _el$10 = _el$1.firstChild, _el$11 = _el$10.nextSibling;
35879
+ insert(_el$10, () => t("dialog.symbol.recent"));
35880
+ insert(_el$11, createComponent(For, {
35881
+ get each() {
35882
+ return recentSymbols();
35883
+ },
35884
+ children: (entry) => (() => {
35885
+ var _el$21 = _tmpl$5$1();
35886
+ _el$21.$$click = () => selectEntry(entry);
35887
+ insert(_el$21, () => entry.character);
35888
+ createRenderEffect((_p$) => {
35889
+ var _v$3 = `${entry.character} (${entry.codePoint})`, _v$4 = `${entry.character} (${entry.codePoint})`;
35890
+ _v$3 !== _p$.e && setAttribute(_el$21, "title", _p$.e = _v$3);
35891
+ _v$4 !== _p$.t && setAttribute(_el$21, "aria-label", _p$.t = _v$4);
35892
+ return _p$;
35893
+ }, {
35894
+ e: void 0,
35895
+ t: void 0
35896
+ });
35897
+ return _el$21;
35898
+ })()
35899
+ }));
35900
+ return _el$1;
35901
+ }
35902
+ }), null);
35903
+ insert(_el$0, createComponent(For, {
35904
+ get each() {
35905
+ return visibleEntries();
35906
+ },
35907
+ children: (entry) => (() => {
35908
+ var _el$22 = _tmpl$6$1();
35909
+ _el$22.$$dblclick = insertSelected;
35910
+ _el$22.$$click = () => selectEntry(entry);
35911
+ insert(_el$22, () => entry.character);
35912
+ createRenderEffect((_p$) => {
35913
+ var _v$5 = !!(selected().character === entry.character), _v$6 = `${entry.character} (${entry.codePoint})`, _v$7 = `${entry.character} (${entry.codePoint})`, _v$8 = `editor-symbol-dialog-${entry.codePoint.replace(/[^A-Z0-9]/g, "-")}`;
35914
+ _v$5 !== _p$.e && _el$22.classList.toggle("oasis-editor-symbol-dialog-tile-active", _p$.e = _v$5);
35915
+ _v$6 !== _p$.t && setAttribute(_el$22, "title", _p$.t = _v$6);
35916
+ _v$7 !== _p$.a && setAttribute(_el$22, "aria-label", _p$.a = _v$7);
35917
+ _v$8 !== _p$.o && setAttribute(_el$22, "data-testid", _p$.o = _v$8);
35918
+ return _p$;
35919
+ }, {
35920
+ e: void 0,
35921
+ t: void 0,
35922
+ a: void 0,
35923
+ o: void 0
35924
+ });
35925
+ return _el$22;
35926
+ })()
35927
+ }), null);
35928
+ insert(_el$13, () => t("dialog.symbol.preview"));
35929
+ insert(_el$14, () => selected().character);
35930
+ insert(_el$16, () => t("dialog.symbol.code"));
35931
+ _el$17.$$input = (event) => selectCodePoint(event.currentTarget.value);
35932
+ setAttribute(_el$17, "spellcheck", false);
35933
+ insert(_el$18, () => t("dialog.symbol.doubleClickHelp"));
35934
+ createRenderEffect((_p$) => {
35935
+ var _v$ = t("dialog.symbol.title"), _v$2 = font();
35936
+ _v$ !== _p$.e && setAttribute(_el$0, "aria-label", _p$.e = _v$);
35937
+ _v$2 !== _p$.t && setStyleProperty(_el$14, "font-family", _p$.t = _v$2);
35938
+ return _p$;
35939
+ }, {
35940
+ e: void 0,
35941
+ t: void 0
35942
+ });
35943
+ createRenderEffect(() => _el$17.value = codeInput());
35944
+ return _el$9;
35945
+ })()];
35946
+ }
35947
+ });
35948
+ }
35949
+ delegateEvents(["input", "click", "dblclick"]);
35950
+ var _tmpl$$5 = /* @__PURE__ */ template(`<div class=oasis-editor-equation-editor><div class=oasis-editor-equation-palette></div><label class=oasis-editor-equation-linear><span></span><textarea data-testid=editor-equation-linear></textarea></label><div class=oasis-editor-equation-preview aria-live=polite data-testid=editor-equation-preview>`), _tmpl$2$1 = /* @__PURE__ */ template(`<button type=button data-testid=editor-equation-template>`);
35951
+ const TEMPLATES = [["\\frac{□}{□}", "\\frac{a}{b}"], ["\\sqrt{□}", "\\sqrt{x}"], ["x^□", "x^{2}"], ["x_□", "x_{i}"], ["∑", "\\sum_{i=1}^{n} i"], ["∫", "∫ f(x) dx"], ["[ ]", "(a+b)"], ["[a b]", "\\matrix{a & b \\ c & d}"]];
35952
+ function EquationDialog(props) {
35953
+ const t = useI18n();
35954
+ const [linear, setLinear] = createSignal("");
35955
+ const [expression, setExpression] = createSignal(EMPTY_EDITOR_MATH_EXPRESSION);
35956
+ createEffect(() => {
35957
+ if (!props.isOpen) return;
35958
+ const initial = props.initial ?? EMPTY_EDITOR_MATH_EXPRESSION;
35959
+ setExpression(initial);
35960
+ setLinear(serializeLinearMath(initial));
35961
+ });
35962
+ const updateLinear = (value) => {
35963
+ setLinear(value);
35964
+ setExpression(parseLinearMath(value));
35965
+ };
35966
+ return createComponent(Dialog, {
35967
+ get isOpen() {
35968
+ return props.isOpen;
35969
+ },
35970
+ get title() {
35971
+ return t("dialog.equation.title");
35972
+ },
35973
+ get onClose() {
35974
+ return props.onClose;
35975
+ },
35976
+ size: "lg",
35977
+ closeOnOverlayClick: false,
35978
+ "class": "oasis-editor-equation-dialog",
35979
+ get footer() {
35980
+ return [createComponent(Button, {
35981
+ variant: "secondary",
35982
+ get onClick() {
35983
+ return props.onClose;
35984
+ },
35985
+ get children() {
35986
+ return t("generic.cancel");
35987
+ }
35988
+ }), createComponent(Button, {
35989
+ variant: "primary",
35990
+ onClick: () => props.onApply(expression()),
35991
+ "data-testid": "editor-equation-apply",
35992
+ get children() {
35993
+ return t("dialog.equation.insert");
35994
+ }
35995
+ })];
35996
+ },
35997
+ get children() {
35998
+ var _el$ = _tmpl$$5(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling, _el$6 = _el$3.nextSibling;
35999
+ insert(_el$2, createComponent(For, {
36000
+ each: TEMPLATES,
36001
+ children: ([label, value]) => (() => {
36002
+ var _el$7 = _tmpl$2$1();
36003
+ _el$7.$$click = () => updateLinear(value);
36004
+ insert(_el$7, label);
36005
+ return _el$7;
36006
+ })()
36007
+ }));
36008
+ insert(_el$4, () => t("dialog.equation.linear"));
36009
+ _el$5.$$input = (event) => updateLinear(event.currentTarget.value);
36010
+ setAttribute(_el$5, "spellcheck", false);
36011
+ insert(_el$6, () => serializeLinearMath(expression()) || t("dialog.equation.empty"));
36012
+ createRenderEffect(() => setAttribute(_el$2, "aria-label", t("dialog.equation.structures")));
36013
+ createRenderEffect(() => _el$5.value = linear());
36014
+ return _el$;
36015
+ }
36016
+ });
36017
+ }
36018
+ delegateEvents(["input", "click"]);
35663
36019
  var _tmpl$$4 = /* @__PURE__ */ template(`<div class=oasis-editor-find-replace-dialog><div class=oasis-editor-fr-header></div><div class=oasis-editor-fr-body><div class=oasis-editor-fr-input-group><div class=oasis-editor-fr-input-wrapper></div></div><div class=oasis-editor-fr-input-group>`);
35664
36020
  function FindReplaceDialog(props) {
35665
36021
  const t = useI18n();
@@ -35974,9 +36330,66 @@ function EditorDialogsLayer(props) {
35974
36330
  paragraphDialog,
35975
36331
  setParagraphDialog,
35976
36332
  tablePropertiesDialog,
35977
- setTablePropertiesDialog
36333
+ setTablePropertiesDialog,
36334
+ newDocumentDialog,
36335
+ setNewDocumentDialog,
36336
+ symbolDialog,
36337
+ setSymbolDialog,
36338
+ equationDialog,
36339
+ setEquationDialog
35978
36340
  } = props.dialogs;
35979
- return [createComponent(LinkDialog, {
36341
+ return [createComponent(NewDocumentConfirmationDialog, {
36342
+ get isOpen() {
36343
+ return newDocumentDialog().isOpen;
36344
+ },
36345
+ onClose: () => {
36346
+ setNewDocumentDialog({
36347
+ isOpen: false
36348
+ });
36349
+ props.focusInput();
36350
+ },
36351
+ onConfirm: () => {
36352
+ setNewDocumentDialog({
36353
+ isOpen: false
36354
+ });
36355
+ props.confirmNewDocument();
36356
+ }
36357
+ }), createComponent(SymbolDialog, {
36358
+ get isOpen() {
36359
+ return symbolDialog().isOpen;
36360
+ },
36361
+ onClose: () => {
36362
+ setSymbolDialog({
36363
+ isOpen: false
36364
+ });
36365
+ props.focusInput();
36366
+ },
36367
+ onInsert: (symbol, fontFamily) => {
36368
+ setSymbolDialog({
36369
+ isOpen: false
36370
+ });
36371
+ props.insertSymbol(symbol, fontFamily);
36372
+ }
36373
+ }), createComponent(EquationDialog, {
36374
+ get isOpen() {
36375
+ return equationDialog().isOpen;
36376
+ },
36377
+ get initial() {
36378
+ return equationDialog().initial;
36379
+ },
36380
+ onClose: () => {
36381
+ setEquationDialog({
36382
+ isOpen: false
36383
+ });
36384
+ props.focusInput();
36385
+ },
36386
+ onApply: (expression) => {
36387
+ setEquationDialog({
36388
+ isOpen: false
36389
+ });
36390
+ props.applyEquation(expression, equationDialog().targetRunId);
36391
+ }
36392
+ }), createComponent(LinkDialog, {
35980
36393
  get isOpen() {
35981
36394
  return linkDialog().isOpen;
35982
36395
  },
@@ -36397,7 +36810,8 @@ function children$1(node) {
36397
36810
  const result = [];
36398
36811
  for (let index = 0; index < node.childNodes.length; index += 1) {
36399
36812
  const child = node.childNodes[index];
36400
- if ((child == null ? void 0 : child.nodeType) === child.ELEMENT_NODE) result.push(child);
36813
+ if ((child == null ? void 0 : child.nodeType) === child.ELEMENT_NODE)
36814
+ result.push(child);
36401
36815
  }
36402
36816
  return result;
36403
36817
  }
@@ -36419,7 +36833,11 @@ function copyMissingAttributes$8(source, target) {
36419
36833
  const exists = attribute.namespaceURI ? target.hasAttributeNS(attribute.namespaceURI, localName2) : target.hasAttribute(attribute.name);
36420
36834
  if (exists) continue;
36421
36835
  if (attribute.namespaceURI) {
36422
- target.setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
36836
+ target.setAttributeNS(
36837
+ attribute.namespaceURI,
36838
+ attribute.name,
36839
+ attribute.value
36840
+ );
36423
36841
  } else {
36424
36842
  target.setAttribute(attribute.name, attribute.value);
36425
36843
  }
@@ -36468,7 +36886,10 @@ function sourceCommentsXml(sourcePackage) {
36468
36886
  return (part == null ? void 0 : part.kind) === "xml" ? part.data : void 0;
36469
36887
  }
36470
36888
  function replaceBodyChildren(source, target) {
36471
- const generatedParaId = attr$2(commentParagraphs(target)[0] ?? target, "paraId");
36889
+ const generatedParaId = attr$2(
36890
+ commentParagraphs(target)[0] ?? target,
36891
+ "paraId"
36892
+ );
36472
36893
  while (target.firstChild) target.removeChild(target.firstChild);
36473
36894
  for (let index = 0; index < source.childNodes.length; index += 1) {
36474
36895
  const child = source.childNodes[index];
@@ -36490,7 +36911,9 @@ function mergeChangedBodyExtensions(source, target) {
36490
36911
  mergeNestedExtensionMarkup(sourceParagraphs[0], targetParagraphs[0]);
36491
36912
  }
36492
36913
  const targetExtensionKeys = new Set(
36493
- children$1(target).filter((child) => child.namespaceURI !== WORD_NS$6).map((child) => `${child.namespaceURI ?? ""}\0${name$1(child)}`)
36914
+ children$1(target).filter((child) => child.namespaceURI !== WORD_NS$6).map(
36915
+ (child) => `${child.namespaceURI ?? ""}\0${name$1(child)}`
36916
+ )
36494
36917
  );
36495
36918
  for (const child of children$1(source)) {
36496
36919
  if (child.namespaceURI === WORD_NS$6) continue;
@@ -36513,7 +36936,8 @@ function mergeCommentEntriesOoxmlSource(sourceXml, rebuiltXml) {
36513
36936
  }
36514
36937
  let changed = false;
36515
36938
  for (const sourceEntry of children$1(sourceRoot)) {
36516
- if (sourceEntry.namespaceURI !== WORD_NS$6 || name$1(sourceEntry) !== "comment") continue;
36939
+ if (sourceEntry.namespaceURI !== WORD_NS$6 || name$1(sourceEntry) !== "comment")
36940
+ continue;
36517
36941
  const id = attr$2(sourceEntry, "id");
36518
36942
  const target = id !== void 0 ? targetById.get(id) : void 0;
36519
36943
  if (!target) continue;
@@ -36524,7 +36948,8 @@ function mergeCommentEntriesOoxmlSource(sourceXml, rebuiltXml) {
36524
36948
  } else {
36525
36949
  mergeChangedBodyExtensions(sourceEntry, target);
36526
36950
  }
36527
- if (new XMLSerializer().serializeToString(target) !== before) changed = true;
36951
+ if (new XMLSerializer().serializeToString(target) !== before)
36952
+ changed = true;
36528
36953
  }
36529
36954
  return changed ? new XMLSerializer().serializeToString(rebuiltRoot.ownerDocument) : rebuiltXml;
36530
36955
  }
@@ -36760,7 +37185,11 @@ function copyMissingAttributes$6(source, target) {
36760
37185
  continue;
36761
37186
  }
36762
37187
  if (attribute.namespaceURI) {
36763
- target.setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
37188
+ target.setAttributeNS(
37189
+ attribute.namespaceURI,
37190
+ attribute.name,
37191
+ attribute.value
37192
+ );
36764
37193
  } else {
36765
37194
  target.setAttribute(attribute.name, attribute.value);
36766
37195
  }
@@ -36851,7 +37280,10 @@ function mergeWordPartRootExtensionsFromSource(sourceXml, rebuiltXml, expectedRo
36851
37280
  (rebuiltChild) => elementKey$5(rebuiltChild) === elementKey$5(candidate)
36852
37281
  )
36853
37282
  ).find((candidate) => Boolean(candidate));
36854
- rebuiltRoot.insertBefore(sourceChild.cloneNode(true), nextRebuiltAnchor ?? null);
37283
+ rebuiltRoot.insertBefore(
37284
+ sourceChild.cloneNode(true),
37285
+ nextRebuiltAnchor ?? null
37286
+ );
36855
37287
  });
36856
37288
  return new XMLSerializer().serializeToString(rebuiltDocument);
36857
37289
  }
@@ -36953,7 +37385,11 @@ function copyMissingAttributes$5(source, target) {
36953
37385
  continue;
36954
37386
  }
36955
37387
  if (attribute.namespaceURI) {
36956
- target.setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
37388
+ target.setAttributeNS(
37389
+ attribute.namespaceURI,
37390
+ attribute.name,
37391
+ attribute.value
37392
+ );
36957
37393
  } else {
36958
37394
  target.setAttribute(attribute.name, attribute.value);
36959
37395
  }
@@ -36976,7 +37412,10 @@ function bodyAnchorIdentity(element) {
36976
37412
  }
36977
37413
  if (localName2 === "sdt") {
36978
37414
  const properties = directWordChild$4(element, "sdtPr");
36979
- const id = properties ? getAttributeByLocalName$6(directWordChild$4(properties, "id") ?? properties, "val") : void 0;
37415
+ const id = properties ? getAttributeByLocalName$6(
37416
+ directWordChild$4(properties, "id") ?? properties,
37417
+ "val"
37418
+ ) : void 0;
36980
37419
  return id ? `sdt:${id}` : void 0;
36981
37420
  }
36982
37421
  if (localName2 === "sectPr") {
@@ -37221,9 +37660,10 @@ async function patchRebuiltHeaderFooterRootsFromSource(sourcePackage, rebuilt) {
37221
37660
  const sourceReferences = collectReferences(sourceMainPart.data);
37222
37661
  const rebuiltReferences = collectReferences(rebuiltMainXml);
37223
37662
  const sourceReferenceByKey = new Map(
37224
- sourceReferences.map(
37225
- (reference) => [reference.key, reference]
37226
- )
37663
+ sourceReferences.map((reference) => [
37664
+ reference.key,
37665
+ reference
37666
+ ])
37227
37667
  );
37228
37668
  const sourceRelationships = relationshipById(
37229
37669
  sourceMainPart.relationships ?? []
@@ -37423,12 +37863,10 @@ function transformRebuiltRelationships(relationships, sourceRelationships, conve
37423
37863
  function mergeRelationships(source, rebuilt, relationshipPartPathValue) {
37424
37864
  const result = [...rebuilt];
37425
37865
  const rebuiltById = new Map(
37426
- rebuilt.map(
37427
- (relationship) => [
37428
- relationship.id,
37429
- relationship
37430
- ]
37431
- )
37866
+ rebuilt.map((relationship) => [
37867
+ relationship.id,
37868
+ relationship
37869
+ ])
37432
37870
  );
37433
37871
  for (const relationship of source) {
37434
37872
  const rebuiltWithSameId = rebuiltById.get(relationship.id);
@@ -37592,12 +38030,7 @@ async function patchRebuiltDocxWithSourcePackage(document2, rebuiltBuffer) {
37592
38030
  continue;
37593
38031
  }
37594
38032
  const rebuiltBytes = await entry.async("uint8array");
37595
- if (canKeepSourcePartUntouched(
37596
- sourcePackage,
37597
- path,
37598
- actualPath,
37599
- rebuiltBytes
37600
- )) {
38033
+ if (canKeepSourcePartUntouched(sourcePackage, path, actualPath, rebuiltBytes)) {
37601
38034
  continue;
37602
38035
  }
37603
38036
  output.file(actualPath, rebuiltBytes);
@@ -37690,7 +38123,10 @@ function replaceAttributeByLocalName(element, localName2, value) {
37690
38123
  function collectHeaderFooterReferences(xml) {
37691
38124
  const document2 = new DOMParser().parseFromString(xml, "application/xml");
37692
38125
  const references = [];
37693
- const sectionProperties = collectElementsByLocalName(document2, "sectPr").filter(
38126
+ const sectionProperties = collectElementsByLocalName(
38127
+ document2,
38128
+ "sectPr"
38129
+ ).filter(
37694
38130
  (element) => {
37695
38131
  var _a;
37696
38132
  return ((_a = element.parentNode) == null ? void 0 : _a.localName) !== "sectPrChange";
@@ -37880,7 +38316,9 @@ function transformRelationshipsForOwner(relationships, currentOwnerPath, actualO
37880
38316
  if (relationship.targetMode === "External") {
37881
38317
  return relationship;
37882
38318
  }
37883
- const resolved = (_a = resolveOpcRelationships(currentOwnerPath, [relationship])[0]) == null ? void 0 : _a.resolvedTarget;
38319
+ const resolved = (_a = resolveOpcRelationships(currentOwnerPath, [
38320
+ relationship
38321
+ ])[0]) == null ? void 0 : _a.resolvedTarget;
37884
38322
  if (!resolved) {
37885
38323
  return relationship;
37886
38324
  }
@@ -38102,10 +38540,7 @@ async function prepareContentTypes(rebuilt, plan) {
38102
38540
  delete contentTypes.overrides[match.current.partPath];
38103
38541
  }
38104
38542
  }
38105
- rebuilt.file(
38106
- OPC_CONTENT_TYPES_PATH,
38107
- serializeOpcContentTypes(contentTypes)
38108
- );
38543
+ rebuilt.file(OPC_CONTENT_TYPES_PATH, serializeOpcContentTypes(contentTypes));
38109
38544
  }
38110
38545
  function sourceDocumentWithoutDeletedHeaderFooterParts(document2, deletedPartPaths) {
38111
38546
  const sourcePackage = document2.sourcePackage;
@@ -38211,7 +38646,8 @@ function children(node) {
38211
38646
  const result = [];
38212
38647
  for (let index = 0; index < node.childNodes.length; index += 1) {
38213
38648
  const child = node.childNodes[index];
38214
- if ((child == null ? void 0 : child.nodeType) === child.ELEMENT_NODE) result.push(child);
38649
+ if ((child == null ? void 0 : child.nodeType) === child.ELEMENT_NODE)
38650
+ result.push(child);
38215
38651
  }
38216
38652
  return result;
38217
38653
  }
@@ -38236,7 +38672,11 @@ function copyMissingAttributes$4(source, target) {
38236
38672
  const exists = attribute.namespaceURI ? target.hasAttributeNS(attribute.namespaceURI, localName2) : target.hasAttribute(attribute.name);
38237
38673
  if (exists) continue;
38238
38674
  if (attribute.namespaceURI) {
38239
- target.setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
38675
+ target.setAttributeNS(
38676
+ attribute.namespaceURI,
38677
+ attribute.name,
38678
+ attribute.value
38679
+ );
38240
38680
  } else {
38241
38681
  target.setAttribute(attribute.name, attribute.value);
38242
38682
  }
@@ -38265,14 +38705,17 @@ function isModeledBlock(element) {
38265
38705
  return element.namespaceURI === WORD_NS$6 && MODELED_BLOCK_NAMES.has(name(element));
38266
38706
  }
38267
38707
  function blockIdentity(element) {
38268
- if (element.namespaceURI !== WORD_NS$6 || name(element) !== "p") return void 0;
38708
+ if (element.namespaceURI !== WORD_NS$6 || name(element) !== "p")
38709
+ return void 0;
38269
38710
  const paraId = attr$1(element, "paraId");
38270
38711
  return paraId ? `p:${paraId}` : void 0;
38271
38712
  }
38272
38713
  function topologyStable(source, target) {
38273
38714
  const sourceBlocks = source.filter(isModeledBlock);
38274
38715
  const targetBlocks = target.filter(isModeledBlock);
38275
- return sourceBlocks.length === targetBlocks.length && sourceBlocks.every((block, index) => name(block) === name(targetBlocks[index]));
38716
+ return sourceBlocks.length === targetBlocks.length && sourceBlocks.every(
38717
+ (block, index) => name(block) === name(targetBlocks[index])
38718
+ );
38276
38719
  }
38277
38720
  function anchorForOpaqueChild(sourceChildren, sourceIndex, targetChildren, stable) {
38278
38721
  const nextSourceBlock = sourceChildren.slice(sourceIndex + 1).find(isModeledBlock);
@@ -38299,7 +38742,9 @@ function mergeRegularEntry(source, target) {
38299
38742
  const childKey = key$1(sourceChild);
38300
38743
  const occurrence = occurrences.get(childKey) ?? 0;
38301
38744
  occurrences.set(childKey, occurrence + 1);
38302
- if (children(target).filter((candidate) => key$1(candidate) === childKey)[occurrence]) {
38745
+ if (children(target).filter(
38746
+ (candidate) => key$1(candidate) === childKey
38747
+ )[occurrence]) {
38303
38748
  return;
38304
38749
  }
38305
38750
  const anchor = anchorForOpaqueChild(
@@ -38334,7 +38779,8 @@ function mergeNotePart(document2, sourceXml, rebuiltXml, spec) {
38334
38779
  );
38335
38780
  const targetByIdentity = /* @__PURE__ */ new Map();
38336
38781
  for (const entry of children(rebuiltRoot)) {
38337
- if (entry.namespaceURI !== WORD_NS$6 || name(entry) !== spec.entryName) continue;
38782
+ if (entry.namespaceURI !== WORD_NS$6 || name(entry) !== spec.entryName)
38783
+ continue;
38338
38784
  const identity = entryIdentity(entry);
38339
38785
  if (identity) targetByIdentity.set(identity, entry);
38340
38786
  }
@@ -38384,7 +38830,8 @@ function elementChildren$6(node) {
38384
38830
  const children2 = [];
38385
38831
  for (let index = 0; index < node.childNodes.length; index += 1) {
38386
38832
  const child = node.childNodes[index];
38387
- if ((child == null ? void 0 : child.nodeType) === child.ELEMENT_NODE) children2.push(child);
38833
+ if ((child == null ? void 0 : child.nodeType) === child.ELEMENT_NODE)
38834
+ children2.push(child);
38388
38835
  }
38389
38836
  return children2;
38390
38837
  }
@@ -38424,7 +38871,11 @@ function copyMissingAttributes$3(source, target) {
38424
38871
  const exists = attribute.namespaceURI ? target.hasAttributeNS(attribute.namespaceURI, localName2) : target.hasAttribute(attribute.name);
38425
38872
  if (exists) continue;
38426
38873
  if (attribute.namespaceURI) {
38427
- target.setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
38874
+ target.setAttributeNS(
38875
+ attribute.namespaceURI,
38876
+ attribute.name,
38877
+ attribute.value
38878
+ );
38428
38879
  } else {
38429
38880
  target.setAttribute(attribute.name, attribute.value);
38430
38881
  }
@@ -38433,7 +38884,8 @@ function copyMissingAttributes$3(source, target) {
38433
38884
  function mergeExtensionChildrenOnly$1(source, target) {
38434
38885
  const targetKeys = new Set(elementChildren$6(target).map(elementKey$3));
38435
38886
  for (const child of elementChildren$6(source)) {
38436
- if (child.namespaceURI === WORD_NS$3 || targetKeys.has(elementKey$3(child))) continue;
38887
+ if (child.namespaceURI === WORD_NS$3 || targetKeys.has(elementKey$3(child)))
38888
+ continue;
38437
38889
  target.appendChild(child.cloneNode(true));
38438
38890
  }
38439
38891
  }
@@ -38442,8 +38894,14 @@ function insertSourceChildInOrder$1(sourceChildren, sourceIndex, sourceChild, ta
38442
38894
  target.insertBefore(sourceChild.cloneNode(true), anchor ?? null);
38443
38895
  }
38444
38896
  function parseNumberingRoots(sourceXml, rebuiltXml) {
38445
- const sourceRoot = new DOMParser().parseFromString(sourceXml, "application/xml").documentElement;
38446
- const rebuiltRoot = new DOMParser().parseFromString(rebuiltXml, "application/xml").documentElement;
38897
+ const sourceRoot = new DOMParser().parseFromString(
38898
+ sourceXml,
38899
+ "application/xml"
38900
+ ).documentElement;
38901
+ const rebuiltRoot = new DOMParser().parseFromString(
38902
+ rebuiltXml,
38903
+ "application/xml"
38904
+ ).documentElement;
38447
38905
  if (!sourceRoot || !rebuiltRoot || sourceRoot.namespaceURI !== WORD_NS$3 || rebuiltRoot.namespaceURI !== WORD_NS$3 || elementLocalName$6(sourceRoot) !== "numbering" || elementLocalName$6(rebuiltRoot) !== "numbering") {
38448
38906
  return void 0;
38449
38907
  }
@@ -38469,7 +38927,8 @@ function filteredSourceRunProperties(source) {
38469
38927
  const clone = source.cloneNode(false);
38470
38928
  let preserved = false;
38471
38929
  for (const child of elementChildren$6(source)) {
38472
- if (child.namespaceURI === WORD_NS$3 && elementLocalName$6(child) === "rFonts") continue;
38930
+ if (child.namespaceURI === WORD_NS$3 && elementLocalName$6(child) === "rFonts")
38931
+ continue;
38473
38932
  clone.appendChild(child.cloneNode(true));
38474
38933
  preserved = true;
38475
38934
  }
@@ -38479,7 +38938,10 @@ function mergeLevelRunProperties(source, target) {
38479
38938
  copyMissingAttributes$3(source, target);
38480
38939
  const sourceChildren = elementChildren$6(source);
38481
38940
  const targetByKey = new Map(
38482
- elementChildren$6(target).map((child) => [elementKey$3(child), child])
38941
+ elementChildren$6(target).map((child) => [
38942
+ elementKey$3(child),
38943
+ child
38944
+ ])
38483
38945
  );
38484
38946
  sourceChildren.forEach((sourceChild, sourceIndex) => {
38485
38947
  const childKey = elementKey$3(sourceChild);
@@ -38489,7 +38951,8 @@ function mergeLevelRunProperties(source, target) {
38489
38951
  mergeExtensionChildrenOnly$1(sourceChild, targetChild);
38490
38952
  return;
38491
38953
  }
38492
- if (sourceChild.namespaceURI === WORD_NS$3 && elementLocalName$6(sourceChild) === "rFonts") return;
38954
+ if (sourceChild.namespaceURI === WORD_NS$3 && elementLocalName$6(sourceChild) === "rFonts")
38955
+ return;
38493
38956
  insertSourceChildInOrder$1(
38494
38957
  sourceChildren,
38495
38958
  sourceIndex,
@@ -38503,7 +38966,10 @@ function mergeLevelElement(source, target) {
38503
38966
  copyMissingAttributes$3(source, target);
38504
38967
  const sourceChildren = elementChildren$6(source);
38505
38968
  const targetByKey = new Map(
38506
- elementChildren$6(target).map((child) => [elementKey$3(child), child])
38969
+ elementChildren$6(target).map((child) => [
38970
+ elementKey$3(child),
38971
+ child
38972
+ ])
38507
38973
  );
38508
38974
  sourceChildren.forEach((sourceChild, sourceIndex) => {
38509
38975
  const childKey = elementKey$3(sourceChild);
@@ -38518,7 +38984,8 @@ function mergeLevelElement(source, target) {
38518
38984
  }
38519
38985
  return;
38520
38986
  }
38521
- if (sourceChild.namespaceURI === WORD_NS$3 && MODELED_LEVEL_CHILDREN.has(localName2)) return;
38987
+ if (sourceChild.namespaceURI === WORD_NS$3 && MODELED_LEVEL_CHILDREN.has(localName2))
38988
+ return;
38522
38989
  if (sourceChild.namespaceURI === WORD_NS$3 && localName2 === "rPr") {
38523
38990
  const filtered = filteredSourceRunProperties(sourceChild);
38524
38991
  if (filtered) target.appendChild(filtered);
@@ -38540,9 +39007,10 @@ function mergeAbstractNumElement(source, target) {
38540
39007
  copyMissingAttributes$3(source, target);
38541
39008
  const sourceChildren = elementChildren$6(source);
38542
39009
  const targetByKey = new Map(
38543
- elementChildren$6(target).map(
38544
- (child) => [abstractChildKey(child), child]
38545
- )
39010
+ elementChildren$6(target).map((child) => [
39011
+ abstractChildKey(child),
39012
+ child
39013
+ ])
38546
39014
  );
38547
39015
  sourceChildren.forEach((sourceChild, sourceIndex) => {
38548
39016
  const childKey = abstractChildKey(sourceChild);
@@ -38608,7 +39076,9 @@ function canonicalizeLevelOverride(sourceOverride, effectiveLevel) {
38608
39076
  continue;
38609
39077
  }
38610
39078
  if (sourceChild.namespaceURI === WORD_NS$3 && localName2 === "lvl") {
38611
- result.appendChild(canonicalizeOverrideLevel(sourceChild, effectiveLevel));
39079
+ result.appendChild(
39080
+ canonicalizeOverrideLevel(sourceChild, effectiveLevel)
39081
+ );
38612
39082
  continue;
38613
39083
  }
38614
39084
  result.appendChild(sourceChild.cloneNode(true));
@@ -38621,7 +39091,10 @@ function mergeNumElement(source, target, numberingRoot) {
38621
39091
  const existingOverrides = /* @__PURE__ */ new Map();
38622
39092
  for (const child of elementChildren$6(target)) {
38623
39093
  if (child.namespaceURI === WORD_NS$3 && elementLocalName$6(child) === "lvlOverride") {
38624
- existingOverrides.set(getAttributeByLocalName$3(child, "ilvl") ?? "0", child);
39094
+ existingOverrides.set(
39095
+ getAttributeByLocalName$3(child, "ilvl") ?? "0",
39096
+ child
39097
+ );
38625
39098
  }
38626
39099
  }
38627
39100
  for (const sourceChild of elementChildren$6(source)) {
@@ -38635,7 +39108,11 @@ function mergeNumElement(source, target, numberingRoot) {
38635
39108
  }
38636
39109
  if (sourceChild.namespaceURI === WORD_NS$3 && localName2 === "lvlOverride") {
38637
39110
  const ilvl = getAttributeByLocalName$3(sourceChild, "ilvl") ?? "0";
38638
- const effectiveLevel = findAbstractLevelForNum(numberingRoot, target, ilvl);
39111
+ const effectiveLevel = findAbstractLevelForNum(
39112
+ numberingRoot,
39113
+ target,
39114
+ ilvl
39115
+ );
38639
39116
  const canonical = canonicalizeLevelOverride(sourceChild, effectiveLevel);
38640
39117
  const existing = existingOverrides.get(ilvl);
38641
39118
  if (existing) {
@@ -38671,9 +39148,10 @@ function mergeNumberingOoxmlSource(sourceXml, rebuiltXml) {
38671
39148
  copyMissingAttributes$3(sourceRoot, rebuiltRoot);
38672
39149
  const sourceChildren = elementChildren$6(sourceRoot);
38673
39150
  const targetByKey = new Map(
38674
- elementChildren$6(rebuiltRoot).map(
38675
- (child) => [rootChildKey(child), child]
38676
- )
39151
+ elementChildren$6(rebuiltRoot).map((child) => [
39152
+ rootChildKey(child),
39153
+ child
39154
+ ])
38677
39155
  );
38678
39156
  sourceChildren.forEach((sourceChild, sourceIndex) => {
38679
39157
  const childKey = rootChildKey(sourceChild);
@@ -38823,7 +39301,11 @@ function copyMissingAttributes$2(source, target) {
38823
39301
  continue;
38824
39302
  }
38825
39303
  if (attribute.namespaceURI) {
38826
- target.setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
39304
+ target.setAttributeNS(
39305
+ attribute.namespaceURI,
39306
+ attribute.name,
39307
+ attribute.value
39308
+ );
38827
39309
  } else {
38828
39310
  target.setAttribute(attribute.name, attribute.value);
38829
39311
  }
@@ -38861,10 +39343,12 @@ function mergeSectionProperties(source, target) {
38861
39343
  if (isModeledSectionProperty(sourceChild)) {
38862
39344
  continue;
38863
39345
  }
38864
- const nextTargetAnchor = sourceChildren.slice(sourceIndex + 1).map((candidate) => {
38865
- var _a2;
38866
- return (_a2 = targetByKey.get(elementKey$2(candidate))) == null ? void 0 : _a2[0];
38867
- }).find((candidate) => Boolean(candidate));
39346
+ const nextTargetAnchor = sourceChildren.slice(sourceIndex + 1).map(
39347
+ (candidate) => {
39348
+ var _a2;
39349
+ return (_a2 = targetByKey.get(elementKey$2(candidate))) == null ? void 0 : _a2[0];
39350
+ }
39351
+ ).find((candidate) => Boolean(candidate));
38868
39352
  target.insertBefore(sourceChild.cloneNode(true), nextTargetAnchor ?? null);
38869
39353
  }
38870
39354
  }
@@ -39008,7 +39492,11 @@ async function filterSourceOnlyWordSingletons(rebuilt, originallyPresent) {
39008
39492
  ) || changed;
39009
39493
  }
39010
39494
  if (!originallyPresent.styles) {
39011
- changed = await filterSourceOnlyPart(rebuilt, "word/styles.xml", filterStylesXml) || changed;
39495
+ changed = await filterSourceOnlyPart(
39496
+ rebuilt,
39497
+ "word/styles.xml",
39498
+ filterStylesXml
39499
+ ) || changed;
39012
39500
  }
39013
39501
  if (!originallyPresent.fontTable) {
39014
39502
  changed = await filterSourceOnlyPart(
@@ -39083,9 +39571,10 @@ function insertParagraphPropertiesAtSourcePosition(sourceStyle, targetStyle, sou
39083
39571
  const sourceIndex = sourceChildren.indexOf(sourceProperties);
39084
39572
  const targetChildren = elementChildren$3(targetStyle);
39085
39573
  const targetByKey = new Map(
39086
- targetChildren.map(
39087
- (child) => [styleChildKey$1(child), child]
39088
- )
39574
+ targetChildren.map((child) => [
39575
+ styleChildKey$1(child),
39576
+ child
39577
+ ])
39089
39578
  );
39090
39579
  const anchor = sourceChildren.slice(sourceIndex + 1).map(
39091
39580
  (candidate) => targetByKey.get(styleChildKey$1(candidate))
@@ -39397,12 +39886,19 @@ async function patchRebuiltStyleRunPropertiesFromSource(sourcePackage, rebuilt)
39397
39886
  return true;
39398
39887
  }
39399
39888
  const REBUILT_STYLES_PATH = "word/styles.xml";
39400
- const CONDITIONAL_PROPERTY_NAMES = /* @__PURE__ */ new Set(["pPr", "rPr", "tblPr", "trPr", "tcPr"]);
39889
+ const CONDITIONAL_PROPERTY_NAMES = /* @__PURE__ */ new Set([
39890
+ "pPr",
39891
+ "rPr",
39892
+ "tblPr",
39893
+ "trPr",
39894
+ "tcPr"
39895
+ ]);
39401
39896
  function elementChildren$1(node) {
39402
39897
  const result = [];
39403
39898
  for (let index = 0; index < node.childNodes.length; index += 1) {
39404
39899
  const child = node.childNodes[index];
39405
- if ((child == null ? void 0 : child.nodeType) === child.ELEMENT_NODE) result.push(child);
39900
+ if ((child == null ? void 0 : child.nodeType) === child.ELEMENT_NODE)
39901
+ result.push(child);
39406
39902
  }
39407
39903
  return result;
39408
39904
  }
@@ -39427,7 +39923,11 @@ function copyMissingAttributes$1(source, target) {
39427
39923
  const exists = attribute.namespaceURI ? target.hasAttributeNS(attribute.namespaceURI, name2) : target.hasAttribute(attribute.name);
39428
39924
  if (exists) continue;
39429
39925
  if (attribute.namespaceURI) {
39430
- target.setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
39926
+ target.setAttributeNS(
39927
+ attribute.namespaceURI,
39928
+ attribute.name,
39929
+ attribute.value
39930
+ );
39431
39931
  } else {
39432
39932
  target.setAttribute(attribute.name, attribute.value);
39433
39933
  }
@@ -39530,7 +40030,10 @@ function mergeConditionalContainer(source, target) {
39530
40030
  function filteredOpaqueConditional(source) {
39531
40031
  const document2 = source.ownerDocument;
39532
40032
  if (!document2) return void 0;
39533
- const result = document2.createElementNS(WORD_NS$6, "w:tblStylePr");
40033
+ const result = document2.createElementNS(
40034
+ WORD_NS$6,
40035
+ "w:tblStylePr"
40036
+ );
39534
40037
  copyMissingAttributes$1(source, result);
39535
40038
  let preserved = false;
39536
40039
  for (const sourceChild of elementChildren$1(source)) {
@@ -39611,7 +40114,8 @@ function mergeTableStylePropertiesOoxmlSource(sourceXml, rebuiltXml) {
39611
40114
  }
39612
40115
  let changed = false;
39613
40116
  for (const sourceStyle of elementChildren$1(sourceRoot)) {
39614
- if (sourceStyle.namespaceURI !== WORD_NS$6 || localName(sourceStyle) !== "style") continue;
40117
+ if (sourceStyle.namespaceURI !== WORD_NS$6 || localName(sourceStyle) !== "style")
40118
+ continue;
39615
40119
  if (attr(sourceStyle, "type") !== "table") continue;
39616
40120
  const id = attr(sourceStyle, "styleId");
39617
40121
  const target = id ? rebuiltStyles.get(id) : void 0;
@@ -39667,7 +40171,11 @@ function copyMissingAttributes(source, target) {
39667
40171
  continue;
39668
40172
  }
39669
40173
  if (attribute.namespaceURI) {
39670
- target.setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
40174
+ target.setAttributeNS(
40175
+ attribute.namespaceURI,
40176
+ attribute.name,
40177
+ attribute.value
40178
+ );
39671
40179
  } else {
39672
40180
  target.setAttribute(attribute.name, attribute.value);
39673
40181
  }
@@ -39713,7 +40221,9 @@ const SETTINGS_MODELED_ROOT_NAMES = /* @__PURE__ */ new Set([
39713
40221
  function mergePartialSettingsContainer(source, target, modeledChildNames) {
39714
40222
  copyMissingAttributes(source, target);
39715
40223
  const targetChildren = elementChildren(target);
39716
- const targetByKey = new Map(targetChildren.map((child) => [elementKey(child), child]));
40224
+ const targetByKey = new Map(
40225
+ targetChildren.map((child) => [elementKey(child), child])
40226
+ );
39717
40227
  const sourceChildren = elementChildren(source);
39718
40228
  sourceChildren.forEach((sourceChild, sourceIndex) => {
39719
40229
  const key2 = elementKey(sourceChild);
@@ -39867,7 +40377,10 @@ function mergeStylesXml(sourceXml, rebuiltXml) {
39867
40377
  copyMissingAttributes(sourceRoot, rebuiltRoot);
39868
40378
  const sourceChildren = elementChildren(sourceRoot);
39869
40379
  const targetByKey = new Map(
39870
- elementChildren(rebuiltRoot).map((child) => [styleRootChildKey(child), child])
40380
+ elementChildren(rebuiltRoot).map((child) => [
40381
+ styleRootChildKey(child),
40382
+ child
40383
+ ])
39871
40384
  );
39872
40385
  sourceChildren.forEach((sourceChild, sourceIndex) => {
39873
40386
  const key2 = styleRootChildKey(sourceChild);
@@ -39939,7 +40452,10 @@ function mergeFontTableXml(sourceXml, rebuiltXml) {
39939
40452
  copyMissingAttributes(sourceRoot, rebuiltRoot);
39940
40453
  const sourceChildren = elementChildren(sourceRoot);
39941
40454
  const targetByKey = new Map(
39942
- elementChildren(rebuiltRoot).map((child) => [fontRootChildKey(child), child])
40455
+ elementChildren(rebuiltRoot).map((child) => [
40456
+ fontRootChildKey(child),
40457
+ child
40458
+ ])
39943
40459
  );
39944
40460
  sourceChildren.forEach((sourceChild, sourceIndex) => {
39945
40461
  const key2 = fontRootChildKey(sourceChild);
@@ -40050,18 +40566,34 @@ async function patchRebuiltDocxPreservingSource(document2, rebuiltBuffer) {
40050
40566
  styles: Boolean(rebuilt.file("word/styles.xml")),
40051
40567
  fontTable: Boolean(rebuilt.file("word/fontTable.xml"))
40052
40568
  };
40053
- let rebuiltChanged = await patchRebuiltWordSingletonsFromSource(sourcePackage, rebuilt);
40569
+ let rebuiltChanged = await patchRebuiltWordSingletonsFromSource(
40570
+ sourcePackage,
40571
+ rebuilt
40572
+ );
40054
40573
  if (numberingWasRebuilt) {
40055
40574
  rebuiltChanged = await patchRebuiltNumberingFromSource(sourcePackage, rebuilt) || rebuiltChanged;
40056
40575
  }
40057
40576
  if (originallyPresent.styles) {
40058
- rebuiltChanged = await patchRebuiltStyleParagraphPropertiesFromSource(sourcePackage, rebuilt) || rebuiltChanged;
40059
- rebuiltChanged = await patchRebuiltStyleRunPropertiesFromSource(sourcePackage, rebuilt) || rebuiltChanged;
40060
- rebuiltChanged = await patchRebuiltTableStylePropertiesFromSource(sourcePackage, rebuilt) || rebuiltChanged;
40577
+ rebuiltChanged = await patchRebuiltStyleParagraphPropertiesFromSource(
40578
+ sourcePackage,
40579
+ rebuilt
40580
+ ) || rebuiltChanged;
40581
+ rebuiltChanged = await patchRebuiltStyleRunPropertiesFromSource(
40582
+ sourcePackage,
40583
+ rebuilt
40584
+ ) || rebuiltChanged;
40585
+ rebuiltChanged = await patchRebuiltTableStylePropertiesFromSource(
40586
+ sourcePackage,
40587
+ rebuilt
40588
+ ) || rebuiltChanged;
40061
40589
  }
40062
40590
  rebuiltChanged = await filterSourceOnlyWordSingletons(rebuilt, originallyPresent) || rebuiltChanged;
40063
40591
  rebuiltChanged = await patchRebuiltRelatedStoryRootsFromSource(sourcePackage, rebuilt) || rebuiltChanged;
40064
- rebuiltChanged = await patchRebuiltNoteEntriesFromSource(document2, sourcePackage, rebuilt) || rebuiltChanged;
40592
+ rebuiltChanged = await patchRebuiltNoteEntriesFromSource(
40593
+ document2,
40594
+ sourcePackage,
40595
+ rebuilt
40596
+ ) || rebuiltChanged;
40065
40597
  rebuiltChanged = await patchRebuiltCommentEntriesFromSource(sourcePackage, rebuilt) || rebuiltChanged;
40066
40598
  rebuiltChanged = await patchRebuiltCommentsExtendedFromSource(sourcePackage, rebuilt) || rebuiltChanged;
40067
40599
  rebuiltChanged = await patchRebuiltHeaderFooterRootsFromSource(sourcePackage, rebuilt) || rebuiltChanged;
@@ -40080,7 +40612,10 @@ async function patchRebuiltDocxPreservingSource(document2, rebuiltBuffer) {
40080
40612
  rebuiltChanged = true;
40081
40613
  }
40082
40614
  const sourceAwareRebuiltBuffer = rebuiltChanged ? await rebuilt.generateAsync({ type: "arraybuffer" }) : rebuiltBuffer;
40083
- return patchRebuiltDocxWithHeaderFooterSourcePaths(document2, sourceAwareRebuiltBuffer);
40615
+ return patchRebuiltDocxWithHeaderFooterSourcePaths(
40616
+ document2,
40617
+ sourceAwareRebuiltBuffer
40618
+ );
40084
40619
  }
40085
40620
  async function exportEditorDocumentToDocxPreservingSource(document2) {
40086
40621
  if (!document2.sourcePackage) {
@@ -40950,7 +41485,7 @@ function emitFragmentGlyphs(chunkCtx, chars, originX, styles, line, fragment, pa
40950
41485
  }
40951
41486
  }
40952
41487
  async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, document2, originX, originY, fontRegistry, drawers) {
40953
- var _a, _b, _c;
41488
+ var _a, _b, _c, _d;
40954
41489
  if (fragment.image) {
40955
41490
  if (fragment.image.floating) return;
40956
41491
  const slot = line.slots.find((c) => c.offset === fragment.startOffset) ?? line.slots.find((c) => c.offset >= fragment.startOffset);
@@ -40983,9 +41518,32 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
40983
41518
  );
40984
41519
  return;
40985
41520
  }
41521
+ if (fragment.math) {
41522
+ const slot = line.slots.find((c) => c.offset === fragment.startOffset) ?? line.slots.find((c) => c.offset >= fragment.startOffset);
41523
+ if (!slot) return;
41524
+ const styles2 = resolveEffectiveTextStyleForParagraph(
41525
+ fragment.styles,
41526
+ (_a = paragraph.style) == null ? void 0 : _a.styleId,
41527
+ document2.styles
41528
+ );
41529
+ const fontFace2 = fontRegistry.resolveFontFace({
41530
+ fontFamily: "Cambria Math",
41531
+ bold: false,
41532
+ italic: false
41533
+ });
41534
+ writer.drawText(pageIndex, {
41535
+ x: pxToPt$1(originX + slot.left),
41536
+ y: pxToPt$1(originY + line.top + line.height * TEXT_BASELINE_RATIO),
41537
+ text: mathDisplayText(fragment.math),
41538
+ fontSize: textStyleToFontSizePt(styles2),
41539
+ color: styles2.color ?? "#000000",
41540
+ fontResourceName: fontFace2.writerResourceName
41541
+ });
41542
+ return;
41543
+ }
40986
41544
  const styles = resolveEffectiveTextStyleForParagraph(
40987
41545
  fragment.styles,
40988
- (_a = paragraph.style) == null ? void 0 : _a.styleId,
41546
+ (_b = paragraph.style) == null ? void 0 : _b.styleId,
40989
41547
  document2.styles
40990
41548
  );
40991
41549
  if (styles.hidden) return;
@@ -41071,7 +41629,7 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
41071
41629
  horizontalScale: styles.characterScale ?? 100,
41072
41630
  fontFeatures
41073
41631
  };
41074
- const mainColor = ((_b = styles.textFill) == null ? void 0 : _b.type) === "solid" ? styles.textFill.color : ((_c = styles.textFill) == null ? void 0 : _c.type) === "gradient" && styles.textFill.stops[0] ? styles.textFill.stops[0].color : styles.color ?? "#000000";
41632
+ const mainColor = ((_c = styles.textFill) == null ? void 0 : _c.type) === "solid" ? styles.textFill.color : ((_d = styles.textFill) == null ? void 0 : _d.type) === "gradient" && styles.textFill.stops[0] ? styles.textFill.stops[0].color : styles.color ?? "#000000";
41075
41633
  const gradientShadingName = resolveGradientShadingName(
41076
41634
  writer,
41077
41635
  pageIndex,
@@ -45465,10 +46023,7 @@ function computeCanvasSelectionGeometry(snapshot, state) {
45465
46023
  const focusTableCell = (_b = (snapshot.paragraphsById.get(state.selection.focus.paragraphId) ?? []).find((paragraph) => paragraph.tableCell)) == null ? void 0 : _b.tableCell;
45466
46024
  let isMultiCellSelection = false;
45467
46025
  if (anchorTableCell && focusTableCell && anchorTableCell.tableId === focusTableCell.tableId && (anchorTableCell.rowIndex !== focusTableCell.rowIndex || anchorTableCell.cellIndex !== focusTableCell.cellIndex)) {
45468
- const tableBlock = findTableById(
45469
- state.document,
45470
- anchorTableCell.tableId
45471
- );
46026
+ const tableBlock = findTableById(state.document, anchorTableCell.tableId);
45472
46027
  if (tableBlock) {
45473
46028
  const tableLayout = buildTableCellLayout(tableBlock);
45474
46029
  const anchorCell = tableLayout.find(
@@ -47142,11 +47697,7 @@ const applyTableAwareParagraphEdit = (current, getTargetBlocks, edit) => {
47142
47697
  if (!location || current.selection.anchor.paragraphId !== current.selection.focus.paragraphId) {
47143
47698
  return edit(current);
47144
47699
  }
47145
- const mutation = resolveTablePathMutation(
47146
- current,
47147
- getTargetBlocks,
47148
- location
47149
- );
47700
+ const mutation = resolveTablePathMutation(current, getTargetBlocks, location);
47150
47701
  if (!mutation) return edit(current);
47151
47702
  const tempState = {
47152
47703
  ...current,
@@ -47783,9 +48334,7 @@ function createTableCellSpanOperationsImpl(deps) {
47783
48334
  {
47784
48335
  ...cell,
47785
48336
  colSpan: void 0,
47786
- blocks: cell.blocks.map(
47787
- (block) => cloneBlock(block)
47788
- ),
48337
+ blocks: cell.blocks.map((block) => cloneBlock(block)),
47789
48338
  ...revision ? {
47790
48339
  style: {
47791
48340
  ...cell.style ?? {},
@@ -48277,18 +48826,14 @@ function createTableSelectionAwareCommandsImpl(deps) {
48277
48826
  const resultParagraphs = getParagraphs(tempResult);
48278
48827
  const lastSegment = tablePath[tablePath.length - 1];
48279
48828
  if (!lastSegment) return current;
48280
- const mutation = resolveTablePathMutation(
48281
- current,
48282
- deps.getTargetBlocks,
48283
- {
48284
- blockIndex,
48285
- rowIndex: lastSegment.rowIndex,
48286
- cellIndex: lastSegment.cellIndex,
48287
- paragraphIndex: 0,
48288
- tablePath,
48289
- zone
48290
- }
48291
- );
48829
+ const mutation = resolveTablePathMutation(current, deps.getTargetBlocks, {
48830
+ blockIndex,
48831
+ rowIndex: lastSegment.rowIndex,
48832
+ cellIndex: lastSegment.cellIndex,
48833
+ paragraphIndex: 0,
48834
+ tablePath,
48835
+ zone
48836
+ });
48292
48837
  if (!mutation) return current;
48293
48838
  let paragraphIndex = 0;
48294
48839
  for (let index = 0; index < cells.length; index += 1) {
@@ -48307,11 +48852,7 @@ function createTableSelectionAwareCommandsImpl(deps) {
48307
48852
  );
48308
48853
  }
48309
48854
  }
48310
- return updateBlocksInCurrentSection(
48311
- current,
48312
- mutation.targetBlocks,
48313
- zone
48314
- );
48855
+ return updateBlocksInCurrentSection(current, mutation.targetBlocks, zone);
48315
48856
  });
48316
48857
  };
48317
48858
  const applySelectionAwareTextCommand = (command) => {
@@ -50994,12 +51535,7 @@ function findTableInBlocks(blocks, tableId, nested, movableTopLevelStory) {
50994
51535
  }
50995
51536
  for (const row of block.rows) {
50996
51537
  for (const cell of row.cells) {
50997
- const found = findTableInBlocks(
50998
- cell.blocks,
50999
- tableId,
51000
- true,
51001
- false
51002
- );
51538
+ const found = findTableInBlocks(cell.blocks, tableId, true, false);
51003
51539
  if (found) return found;
51004
51540
  }
51005
51541
  }
@@ -51546,6 +52082,27 @@ function createEditorSurfaceEventsImpl(deps) {
51546
52082
  };
51547
52083
  const handleDoubleClickDown = (state, hit, paragraph) => {
51548
52084
  dragAnchor = null;
52085
+ let offset = 0;
52086
+ const mathRun = paragraph.runs.find((run) => {
52087
+ const hitRun = run.kind === "math" && hit.paragraphOffset >= offset && hit.paragraphOffset <= offset + run.text.length;
52088
+ offset += run.text.length;
52089
+ return hitRun;
52090
+ });
52091
+ if ((mathRun == null ? void 0 : mathRun.kind) === "math") {
52092
+ const position = paragraphOffsetToPosition(
52093
+ paragraph,
52094
+ hit.paragraphOffset
52095
+ );
52096
+ applyWithZone(
52097
+ state,
52098
+ hit.zone,
52099
+ setSelection(state, { anchor: position, focus: position }),
52100
+ position
52101
+ );
52102
+ stopDragging();
52103
+ deps.openEquationDialog(mathRun.math, mathRun.id);
52104
+ return;
52105
+ }
51549
52106
  const word = resolveWordSelection(
51550
52107
  getParagraphText(paragraph),
51551
52108
  hit.paragraphOffset
@@ -52410,7 +52967,8 @@ function useEditorInteractionWiring(ctx) {
52410
52967
  textDrag: {
52411
52968
  tryStartTextDrag: textDrag.tryStartTextDrag
52412
52969
  },
52413
- logger: ctx.logger
52970
+ logger: ctx.logger,
52971
+ openEquationDialog: ctx.openEquationDialog
52414
52972
  });
52415
52973
  const textInput = createEditorTextInput({
52416
52974
  state,
@@ -52587,7 +53145,8 @@ function createEditorInteractionRuntimeImpl(deps) {
52587
53145
  styleController,
52588
53146
  getForcePlainTextPaste,
52589
53147
  setForcePlainTextPaste,
52590
- insertImageFromFile
53148
+ insertImageFromFile,
53149
+ openEquationDialog: deps.openEquationDialog
52591
53150
  });
52592
53151
  const onEditorMouseDown = (event) => {
52593
53152
  if (event.button !== 0) {
@@ -53708,6 +54267,15 @@ function createAppCommandsControllerImpl(deps) {
53708
54267
  };
53709
54268
  return { commandsController, keyboardCommandsController };
53710
54269
  }
54270
+ function createNewDocumentAction(deps) {
54271
+ return () => {
54272
+ if (deps.isDirty()) {
54273
+ deps.requestConfirmation();
54274
+ return;
54275
+ }
54276
+ deps.resetDocument();
54277
+ };
54278
+ }
53711
54279
  class EditorCommandRegistry {
53712
54280
  constructor() {
53713
54281
  __publicField(this, "bindings", /* @__PURE__ */ new Map());
@@ -53746,6 +54314,13 @@ class EditorCommandRegistry {
53746
54314
  }
53747
54315
  }
53748
54316
  const defaultEditorKeyBindings = [
54317
+ {
54318
+ id: "newDocument",
54319
+ command: "newDocument",
54320
+ key: "n",
54321
+ ctrlOrMeta: true,
54322
+ execute: () => true
54323
+ },
53749
54324
  {
53750
54325
  id: "selectAll",
53751
54326
  command: "selectAll",
@@ -54445,6 +55020,22 @@ function buildCoreFormattingCommands({
54445
55020
  return {
54446
55021
  selectAll: command("selectAll", formatting.selectAll),
54447
55022
  insertFootnote: command("insertFootnote", formatting.insertFootnote),
55023
+ insertText: actionCommand("insertText", (p) => {
55024
+ const payload = typeof p === "object" && p !== null && "text" in p ? p : { text: p };
55025
+ formatting.insertText(
55026
+ String(payload.text ?? ""),
55027
+ typeof payload.fontFamily === "string" ? payload.fontFamily : null
55028
+ );
55029
+ }),
55030
+ insertEquation: actionCommand("insertEquation", (p) => {
55031
+ formatting.insertEquation(
55032
+ p
55033
+ );
55034
+ }),
55035
+ updateEquation: actionCommand("updateEquation", (p) => {
55036
+ const payload = p;
55037
+ formatting.updateEquation(payload.runId, payload.expression);
55038
+ }),
54448
55039
  pastePlainText: command("pastePlainText", formatting.pastePlainText),
54449
55040
  bold: command("bold", formatting.bold, () => ({
54450
55041
  isActive: Boolean(s().bold)
@@ -54650,6 +55241,10 @@ function buildDocumentAndBrowserCommands({
54650
55241
  () => browser.copy(),
54651
55242
  () => ({ isEnabled: true })
54652
55243
  ),
55244
+ newDocument: actionCommand(
55245
+ "newDocument",
55246
+ () => document2.newDocument()
55247
+ ),
54653
55248
  exportDocx: actionCommand("exportDocx", () => document2.exportDocx()),
54654
55249
  exportPdf: actionCommand("exportPdf", () => document2.exportPdf()),
54655
55250
  importDocument: actionCommand(
@@ -54664,6 +55259,14 @@ function buildDocumentAndBrowserCommands({
54664
55259
  "insertShape",
54665
55260
  (p) => document2.insertShape(String(p))
54666
55261
  ),
55262
+ openSymbolDialog: actionCommand(
55263
+ "openSymbolDialog",
55264
+ () => document2.openSymbolDialog()
55265
+ ),
55266
+ openEquationDialog: actionCommand(
55267
+ "openEquationDialog",
55268
+ () => document2.openEquationDialog()
55269
+ ),
54667
55270
  unlink: actionCommand(
54668
55271
  "unlink",
54669
55272
  () => link.remove(),
@@ -55137,7 +55740,11 @@ function createEssentialsPlugin(deps) {
55137
55740
  }
55138
55741
  function buildEssentialsGate(options) {
55139
55742
  return {
55140
- isCommandEnabled: (commandName) => !options.isReadOnly() && (commandName !== "insertFootnote" || options.commandsController.canInsertFootnoteCommand())
55743
+ isCommandEnabled: (commandName) => {
55744
+ if (commandName === "openSymbolDialog") return true;
55745
+ if (commandName === "openEquationDialog") return true;
55746
+ return !options.isReadOnly() && (commandName !== "insertFootnote" || options.commandsController.canInsertFootnoteCommand());
55747
+ }
55141
55748
  };
55142
55749
  }
55143
55750
  function buildEssentialsStyle(options) {
@@ -55385,6 +55992,35 @@ function buildEssentialsFormatting(options) {
55385
55992
  return true;
55386
55993
  },
55387
55994
  insertFootnote: () => (options.commandsController.applyInsertFootnoteCommand(), true),
55995
+ insertText: (text, fontFamily) => {
55996
+ if (text.length === 0) return false;
55997
+ const styleOverride = fontFamily ? { fontFamily } : void 0;
55998
+ options.applyTransactionalState(
55999
+ (current) => options.tableOps.applyTableAwareParagraphEdit(
56000
+ current,
56001
+ (temp) => insertTextAtSelection(temp, text, styleOverride)
56002
+ )
56003
+ );
56004
+ options.focusInput();
56005
+ return true;
56006
+ },
56007
+ insertEquation: (expression) => {
56008
+ options.applyTransactionalState(
56009
+ (current) => options.tableOps.applyTableAwareParagraphEdit(
56010
+ current,
56011
+ (temp) => insertMathAtSelection(temp, expression)
56012
+ )
56013
+ );
56014
+ options.focusInput();
56015
+ return true;
56016
+ },
56017
+ updateEquation: (runId, expression) => {
56018
+ options.applyTransactionalState(
56019
+ (current) => updateMathRun(current, runId, expression)
56020
+ );
56021
+ options.focusInput();
56022
+ return true;
56023
+ },
55388
56024
  insertTableOfContents: () => {
55389
56025
  options.applyTransactionalState(
55390
56026
  (current) => insertTableOfContents(current, buildTocPageResolver(current))
@@ -55567,6 +56203,9 @@ function buildEssentialsDocument(options) {
55567
56203
  };
55568
56204
  });
55569
56205
  },
56206
+ newDocument: () => options.newDocument(),
56207
+ openSymbolDialog: () => options.openSymbolDialog(),
56208
+ openEquationDialog: () => options.openEquationDialog(),
55570
56209
  exportDocx: () => void options.docIO.handleExportDocx(),
55571
56210
  exportPdf: () => void options.docIO.handleExportPdf(),
55572
56211
  importDocument: () => {
@@ -56017,13 +56656,13 @@ const defaultMenuItems = [
56017
56656
  path: "File/New",
56018
56657
  labelKey: "menu.file.new",
56019
56658
  shortcut: "Ctrl+N",
56020
- hidden: true,
56659
+ command: "newDocument",
56021
56660
  icon: "file-plus"
56022
56661
  },
56023
56662
  {
56024
56663
  id: "file_import",
56025
56664
  path: "File/Import",
56026
- labelKey: "toolbar.import",
56665
+ labelKey: "toolbar.importDocx",
56027
56666
  shortcut: "Ctrl+O",
56028
56667
  command: "importDocument",
56029
56668
  icon: "upload"
@@ -56604,6 +57243,33 @@ function createEditorCommandRuntimeImpl(deps) {
56604
57243
  applyTransactionalState: doc.applyTransactionalState,
56605
57244
  findReplace: {
56606
57245
  setIsOpen: interaction.fr.setIsOpen
57246
+ },
57247
+ newDocument: createNewDocumentAction({
57248
+ isDirty: () => runtimeClient.isDirty(),
57249
+ resetDocument: () => runtimeClient.resetDocument(),
57250
+ requestConfirmation: () => deps.setNewDocumentDialog({ isOpen: true })
57251
+ }),
57252
+ openSymbolDialog: () => deps.setSymbolDialog({ isOpen: true }),
57253
+ openEquationDialog: () => {
57254
+ const focus = deps.state.selection.focus;
57255
+ const paragraph = getDocumentParagraphs(deps.state.document).find(
57256
+ (block) => block.id === focus.paragraphId
57257
+ );
57258
+ if ((paragraph == null ? void 0 : paragraph.type) === "paragraph") {
57259
+ let offset = 0;
57260
+ for (const run of paragraph.runs) {
57261
+ if (run.kind === "math" && focus.offset >= offset && focus.offset <= offset + run.text.length) {
57262
+ deps.setEquationDialog({
57263
+ isOpen: true,
57264
+ initial: run.math,
57265
+ targetRunId: run.id
57266
+ });
57267
+ return;
57268
+ }
57269
+ offset += run.text.length;
57270
+ }
57271
+ }
57272
+ deps.setEquationDialog({ isOpen: true });
56607
57273
  }
56608
57274
  },
56609
57275
  externalPlugins: deps.runtimeOptions().plugins,
@@ -56778,7 +57444,13 @@ function OasisEditorApp(props = {}) {
56778
57444
  paragraphDialog,
56779
57445
  setParagraphDialog,
56780
57446
  tablePropertiesDialog,
56781
- setTablePropertiesDialog
57447
+ setTablePropertiesDialog,
57448
+ newDocumentDialog,
57449
+ setNewDocumentDialog,
57450
+ symbolDialog,
57451
+ setSymbolDialog,
57452
+ equationDialog,
57453
+ setEquationDialog
56782
57454
  } = createEditorDialogs();
56783
57455
  const [welcomeOpen, setWelcomeOpen] = createSignal(false);
56784
57456
  const viewportRef = () => focusController.viewportRef;
@@ -56848,7 +57520,14 @@ function OasisEditorApp(props = {}) {
56848
57520
  preferredColumnX,
56849
57521
  setPreferredColumnX,
56850
57522
  documentLayout,
56851
- canvasSnapshotProvider
57523
+ canvasSnapshotProvider,
57524
+ openEquationDialog: (initial, targetRunId) => {
57525
+ setEquationDialog({
57526
+ isOpen: true,
57527
+ initial,
57528
+ targetRunId
57529
+ });
57530
+ }
56852
57531
  });
56853
57532
  const {
56854
57533
  layoutOptionsOverlay,
@@ -56898,7 +57577,10 @@ function OasisEditorApp(props = {}) {
56898
57577
  imageInputRef,
56899
57578
  setLinkDialog,
56900
57579
  setImageAltDialog,
56901
- setImageCaptionDialog
57580
+ setImageCaptionDialog,
57581
+ setNewDocumentDialog,
57582
+ setSymbolDialog,
57583
+ setEquationDialog
56902
57584
  });
56903
57585
  const {
56904
57586
  commandsController,
@@ -57064,7 +57746,13 @@ function OasisEditorApp(props = {}) {
57064
57746
  paragraphDialog,
57065
57747
  setParagraphDialog,
57066
57748
  tablePropertiesDialog,
57067
- setTablePropertiesDialog
57749
+ setTablePropertiesDialog,
57750
+ newDocumentDialog,
57751
+ setNewDocumentDialog,
57752
+ symbolDialog,
57753
+ setSymbolDialog,
57754
+ equationDialog,
57755
+ setEquationDialog
57068
57756
  },
57069
57757
  findReplace: fr,
57070
57758
  fontFamilyOptions: computeFontFamilyOptions2,
@@ -57084,6 +57772,25 @@ function OasisEditorApp(props = {}) {
57084
57772
  applyParagraphDialogValues,
57085
57773
  setParagraphDialogDefault,
57086
57774
  applyTablePropertiesDialogValues,
57775
+ confirmNewDocument: () => runtimeClient.resetDocument(),
57776
+ insertSymbol: (symbol, fontFamily) => {
57777
+ runtimeEditor().commands.execute("insertText", {
57778
+ text: symbol,
57779
+ fontFamily
57780
+ });
57781
+ focusInput();
57782
+ },
57783
+ applyEquation: (expression, targetRunId) => {
57784
+ if (targetRunId) {
57785
+ runtimeEditor().commands.execute("updateEquation", {
57786
+ runId: targetRunId,
57787
+ expression
57788
+ });
57789
+ } else {
57790
+ runtimeEditor().commands.execute("insertEquation", expression);
57791
+ }
57792
+ focusInput();
57793
+ },
57087
57794
  closeContextMenu
57088
57795
  }), null);
57089
57796
  insert(_el$, createComponent(EditorWorkspace, {