@superdoc-dev/mcp 0.3.0-next.70 → 0.3.0-next.72

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 (2) hide show
  1. package/dist/index.js +455 -74
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -51891,7 +51891,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
51891
51891
  emptyOptions2 = {};
51892
51892
  });
51893
51893
 
51894
- // ../../packages/superdoc/dist/chunks/SuperConverter-CjDkqrj8.es.js
51894
+ // ../../packages/superdoc/dist/chunks/SuperConverter-BecdrRIX.es.js
51895
51895
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
51896
51896
  const fieldValue = extension$1.config[field];
51897
51897
  if (typeof fieldValue === "function")
@@ -61542,6 +61542,10 @@ function decodeRPrFromMarks(marks) {
61542
61542
  case "italic":
61543
61543
  case "bold":
61544
61544
  runProperties[type] = mark.attrs.value !== "0" && mark.attrs.value !== false;
61545
+ if (type === "bold")
61546
+ runProperties.boldCs = runProperties.bold;
61547
+ else if (type === "italic")
61548
+ runProperties.italicCs = runProperties.italic;
61545
61549
  break;
61546
61550
  case "underline": {
61547
61551
  const { underlineType, underlineColor, underlineThemeColor, underlineThemeTint, underlineThemeShade } = mark.attrs;
@@ -61584,8 +61588,11 @@ function decodeRPrFromMarks(marks) {
61584
61588
  break;
61585
61589
  case "fontSize": {
61586
61590
  const points = parseFloat(value);
61587
- if (!isNaN(points))
61588
- runProperties.fontSize = points * 2;
61591
+ if (!isNaN(points)) {
61592
+ const halfPoints = points * 2;
61593
+ runProperties.fontSize = halfPoints;
61594
+ runProperties.fontSizeCs = halfPoints;
61595
+ }
61589
61596
  break;
61590
61597
  }
61591
61598
  case "letterSpacing": {
@@ -91196,11 +91203,17 @@ var isRegExp = (value) => {
91196
91203
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node2);
91197
91204
  const runTrackFormatMark = findTrackFormatMark(runNodeForExport.marks);
91198
91205
  const runAttrs = runNodeForExport.attrs || {};
91199
- const runProperties = runAttrs.runProperties || {};
91206
+ const rawRunProperties = runAttrs.runProperties || {};
91207
+ const runProperties = rawRunProperties?.italicCs == null && rawRunProperties?.iCs != null ? {
91208
+ ...rawRunProperties,
91209
+ italicCs: rawRunProperties.iCs
91210
+ } : rawRunProperties;
91200
91211
  const inlineKeys = runAttrs.runPropertiesInlineKeys;
91201
91212
  const styleKeys = runAttrs.runPropertiesStyleKeys;
91202
91213
  const overrideKeys = runAttrs.runPropertiesOverrideKeys;
91203
91214
  const candidateKeys = inlineKeys != null ? [...new Set([...inlineKeys || [], ...overrideKeys || []])] : Object.keys(runProperties);
91215
+ if (candidateKeys.includes("iCs") && !candidateKeys.includes("italicCs"))
91216
+ candidateKeys.push("italicCs");
91204
91217
  const shouldExport = (key) => (key in (runProperties || {})) && (!(Array.isArray(styleKeys) && styleKeys.includes(key)) || Array.isArray(overrideKeys) && overrideKeys.includes(key));
91205
91218
  const exportKeys = candidateKeys.filter(shouldExport);
91206
91219
  const runPropertiesToExport = exportKeys.length > 0 ? Object.fromEntries(exportKeys.map((k) => [k, runProperties[k]])) : {};
@@ -98748,7 +98761,7 @@ var isRegExp = (value) => {
98748
98761
  start: safeStart,
98749
98762
  end: safeEnd
98750
98763
  };
98751
- }, RUN_PROPERTIES_DERIVED_FROM_MARKS, TRANSIENT_HYPERLINK_STYLE_IDS, RUN_PROPERTY_PRESERVE_META_KEY = "sdPreserveRunPropertiesKeys", calculateInlineRunPropertiesPlugin = (editor) => new Plugin({ appendTransaction(transactions, _oldState, newState) {
98764
+ }, RUN_PROPERTIES_DERIVED_FROM_MARKS, TRANSIENT_HYPERLINK_STYLE_IDS, RUN_PROPERTY_PRESERVE_META_KEY = "sdPreserveRunPropertiesKeys", COMPANION_INLINE_KEYS, calculateInlineRunPropertiesPlugin = (editor) => new Plugin({ appendTransaction(transactions, _oldState, newState) {
98752
98765
  const tr = newState.tr;
98753
98766
  if (!transactions.some((t) => t.docChanged))
98754
98767
  return null;
@@ -98811,15 +98824,46 @@ var isRegExp = (value) => {
98811
98824
  const existingInlineKeys = runNode.attrs?.runPropertiesInlineKeys || [];
98812
98825
  const hadInlineKeysMetadata = Array.isArray(runNode.attrs?.runPropertiesInlineKeys);
98813
98826
  const styleKeys = runNode.attrs?.runPropertiesStyleKeys || [];
98827
+ const existingStyleComparableProps = resolveRunProperties({
98828
+ translatedNumbering: editor.converter?.translatedNumbering ?? {},
98829
+ translatedLinkedStyles: editor.converter?.translatedLinkedStyles ?? {}
98830
+ }, runNode.attrs?.runProperties?.styleId != null ? { styleId: runNode.attrs.runProperties.styleId } : {}, getResolvedParagraphProperties(paragraphNode) || calculateResolvedParagraphProperties(editor, paragraphNode, $pos), tableInfo, false, Boolean(paragraphNode.attrs.paragraphProperties?.numberingProperties));
98814
98831
  const keysFromMarks = (segment) => {
98815
98832
  const textNode = segment.content?.find((n) => n.isText);
98816
98833
  return Object.keys(decodeRPrFromMarks(textNode?.marks || []));
98817
98834
  };
98818
- const overrideKeysFromInlineProps = (inlineProps) => styleKeys.filter((k) => inlineProps && (k in inlineProps));
98835
+ const overrideKeysFromInlineProps = (inlineProps) => styleKeys.filter((k) => {
98836
+ if (!inlineProps || !(k in inlineProps))
98837
+ return false;
98838
+ if (!existingStyleComparableProps || !(k in existingStyleComparableProps))
98839
+ return true;
98840
+ return JSON.stringify(inlineProps[k]) !== JSON.stringify(existingStyleComparableProps[k]);
98841
+ });
98819
98842
  const existingRunPropsKeys = new Set(runNode.attrs?.runProperties ? Object.keys(runNode.attrs.runProperties) : []);
98820
98843
  const computeSegmentKeys = (segmentInlineProps, segment) => {
98821
- const hasNewInlineProps = segmentInlineProps != null && Object.keys(segmentInlineProps).some((k) => !existingRunPropsKeys.has(k));
98822
- const markKeysToAdd = !hadInlineKeysMetadata || existingInlineKeys.length > 0 || hasNewInlineProps ? keysFromMarks(segment) : [];
98844
+ const hasNewInlineProps = segmentInlineProps != null && Object.keys(segmentInlineProps).some((k) => {
98845
+ if (existingRunPropsKeys.has(k))
98846
+ return false;
98847
+ const baseKey = COMPANION_INLINE_KEYS[k];
98848
+ if (baseKey && existingRunPropsKeys.has(baseKey))
98849
+ return false;
98850
+ return true;
98851
+ });
98852
+ const hasChangedStyleComparableProps = segmentInlineProps != null && Object.keys(segmentInlineProps).some((k) => {
98853
+ if (!styleKeys.includes(k))
98854
+ return false;
98855
+ const current = segmentInlineProps[k];
98856
+ const fromStyle = existingStyleComparableProps?.[k];
98857
+ if (JSON.stringify(current) !== JSON.stringify(fromStyle))
98858
+ return true;
98859
+ const baseKey = COMPANION_INLINE_KEYS[k];
98860
+ if (!baseKey)
98861
+ return false;
98862
+ const currentBase = segmentInlineProps[baseKey];
98863
+ const styleBase = existingStyleComparableProps?.[baseKey];
98864
+ return JSON.stringify(currentBase) !== JSON.stringify(styleBase);
98865
+ });
98866
+ const markKeysToAdd = !hadInlineKeysMetadata || existingInlineKeys.length > 0 || hasNewInlineProps || hasChangedStyleComparableProps ? keysFromMarks(segment) : [];
98823
98867
  const keys$1 = [...new Set([...existingInlineKeys, ...markKeysToAdd])];
98824
98868
  const ok3 = overrideKeysFromInlineProps(segmentInlineProps);
98825
98869
  return {
@@ -104926,7 +104970,7 @@ var isRegExp = (value) => {
104926
104970
  state.kern = kernNode.attributes["w:val"];
104927
104971
  }
104928
104972
  }, SuperConverter;
104929
- var init_SuperConverter_CjDkqrj8_es = __esm(() => {
104973
+ var init_SuperConverter_BecdrRIX_es = __esm(() => {
104930
104974
  init_rolldown_runtime_Bg48TavK_es();
104931
104975
  init_jszip_C49i9kUs_es();
104932
104976
  init_xml_js_CqGKpaft_es();
@@ -107596,7 +107640,7 @@ var init_SuperConverter_CjDkqrj8_es = __esm(() => {
107596
107640
  runAttribute("rtl", "boolean", "w:rtl", schemaBooleanOrNull()),
107597
107641
  runAttribute("cs", "boolean", "w:cs", schemaBooleanOrNull()),
107598
107642
  runAttribute("bCs", "boolean", "w:bCs", schemaBooleanOrNull(), "boldCs"),
107599
- runAttribute("iCs", "boolean", "w:iCs", schemaBooleanOrNull()),
107643
+ runAttribute("iCs", "boolean", "w:iCs", schemaBooleanOrNull(), "italicCs"),
107600
107644
  runAttribute("eastAsianLayout", "object", "w:eastAsianLayout", schemaObjectOrNull({
107601
107645
  id: { oneOf: [{
107602
107646
  type: "string",
@@ -120374,7 +120418,7 @@ var init_SuperConverter_CjDkqrj8_es = __esm(() => {
120374
120418
  });
120375
120419
  translator$134 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:rtl"));
120376
120420
  translator$56 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:cs"));
120377
- translator$78 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:iCs"));
120421
+ translator$78 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:iCs", "italicCs"));
120378
120422
  translator$196 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:webHidden"));
120379
120423
  translator$213 = NodeTranslator.from({
120380
120424
  xmlName: XML_NAME$4,
@@ -134193,18 +134237,26 @@ var init_SuperConverter_CjDkqrj8_es = __esm(() => {
134193
134237
  RUN_PROPERTIES_DERIVED_FROM_MARKS = new Set([
134194
134238
  "strike",
134195
134239
  "italic",
134240
+ "italicCs",
134196
134241
  "bold",
134242
+ "boldCs",
134197
134243
  "underline",
134198
134244
  "highlight",
134199
134245
  "textTransform",
134200
134246
  "color",
134201
134247
  "fontSize",
134248
+ "fontSizeCs",
134202
134249
  "letterSpacing",
134203
134250
  "fontFamily",
134204
134251
  "vertAlign",
134205
134252
  "position"
134206
134253
  ]);
134207
134254
  TRANSIENT_HYPERLINK_STYLE_IDS = new Set(["Hyperlink", "FollowedHyperlink"]);
134255
+ COMPANION_INLINE_KEYS = {
134256
+ fontSizeCs: "fontSize",
134257
+ boldCs: "bold",
134258
+ italicCs: "italic"
134259
+ };
134208
134260
  init_dist();
134209
134261
  DEFAULT_ALLOWED_PROTOCOLS = [
134210
134262
  "http",
@@ -142786,7 +142838,7 @@ var init_SuperConverter_CjDkqrj8_es = __esm(() => {
142786
142838
  };
142787
142839
  });
142788
142840
 
142789
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-pGestihw.es.js
142841
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DCeIAH_W.es.js
142790
142842
  function parseSizeUnit(val = "0") {
142791
142843
  const length = val.toString() || "0";
142792
142844
  const value = Number.parseFloat(length);
@@ -145453,8 +145505,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
145453
145505
  }
145454
145506
  };
145455
145507
  };
145456
- var init_create_headless_toolbar_pGestihw_es = __esm(() => {
145457
- init_SuperConverter_CjDkqrj8_es();
145508
+ var init_create_headless_toolbar_DCeIAH_W_es = __esm(() => {
145509
+ init_SuperConverter_BecdrRIX_es();
145458
145510
  init_constants_DrU4EASo_es();
145459
145511
  init_dist_B8HfvhaK_es();
145460
145512
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -199673,7 +199725,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
199673
199725
  init_remark_gfm_BhnWr3yf_es();
199674
199726
  });
199675
199727
 
199676
- // ../../packages/superdoc/dist/chunks/src-tOywM1hR.es.js
199728
+ // ../../packages/superdoc/dist/chunks/src-DOdRGHiA.es.js
199677
199729
  function deleteProps(obj, propOrProps) {
199678
199730
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
199679
199731
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -202976,6 +203028,24 @@ function calcTabHeight(blockParent2) {
202976
203028
  const parentTextStyleMark = blockParent2.firstChild?.marks?.find((mark2) => mark2.type.name === "textStyle");
202977
203029
  return `${(parseInt(parentTextStyleMark?.attrs.fontSize) * ptToPxRatio || defaultFontSize) * defaultLineHeight}px`;
202978
203030
  }
203031
+ function inferParagraphRtlFromRuns(node2) {
203032
+ const fragment = node2?.content;
203033
+ if (!fragment || !fragment.childCount)
203034
+ return false;
203035
+ let hasExplicitRtl = false;
203036
+ for (let i4 = 0;i4 < fragment.childCount; i4++) {
203037
+ const child = fragment.child(i4);
203038
+ if (child.type.name !== "run")
203039
+ continue;
203040
+ const runProperties = child.attrs?.runProperties || {};
203041
+ const isRtl = runProperties.rightToLeft === true || runProperties.rtl === true;
203042
+ if (runProperties.rightToLeft === false || runProperties.rtl === false)
203043
+ return false;
203044
+ if (isRtl)
203045
+ hasExplicitRtl = true;
203046
+ }
203047
+ return hasExplicitRtl;
203048
+ }
202979
203049
  function createNumberingManager() {
202980
203050
  let countersMap = {};
202981
203051
  let abstractCountersMap = {};
@@ -203598,6 +203668,7 @@ function parseCssLength(value) {
203598
203668
  function parseAttrs(node2) {
203599
203669
  const numberingProperties = {};
203600
203670
  let indent2, spacing, justification;
203671
+ let rightToLeft;
203601
203672
  let sectionProperties = null;
203602
203673
  let pageBreakSource = null;
203603
203674
  const { styleid: styleId, ...extraAttrs } = Array.from(node2.attributes).reduce((acc, attr) => {
@@ -203630,7 +203701,12 @@ function parseAttrs(node2) {
203630
203701
  } catch {}
203631
203702
  else if (attr.name === "data-sd-page-break-source")
203632
203703
  pageBreakSource = attr.value || null;
203633
- else
203704
+ else if (attr.name === "dir") {
203705
+ if (attr.value === "rtl")
203706
+ rightToLeft = true;
203707
+ else if (attr.value === "ltr")
203708
+ rightToLeft = false;
203709
+ } else
203634
203710
  acc[attr.name] = attr.value;
203635
203711
  return acc;
203636
203712
  }, {});
@@ -203660,6 +203736,12 @@ function parseAttrs(node2) {
203660
203736
  const ml = parseCssLength(node2.style.marginLeft);
203661
203737
  if (ml && ml.unit !== "%" && ml.points >= 0)
203662
203738
  cssIndent.left = Math.round(ml.points * 20);
203739
+ const mis = parseCssLength(node2.style.marginInlineStart);
203740
+ if (mis && mis.unit !== "%" && mis.points >= 0)
203741
+ cssIndent.start = Math.round(mis.points * 20);
203742
+ const mie = parseCssLength(node2.style.marginInlineEnd);
203743
+ if (mie && mie.unit !== "%" && mie.points >= 0)
203744
+ cssIndent.end = Math.round(mie.points * 20);
203663
203745
  const ti = parseCssLength(node2.style.textIndent);
203664
203746
  if (ti && ti.unit !== "%")
203665
203747
  if (ti.points >= 0)
@@ -203674,6 +203756,12 @@ function parseAttrs(node2) {
203674
203756
  if (textAlign && CSS_ALIGN_TO_OOXML[textAlign])
203675
203757
  justification = CSS_ALIGN_TO_OOXML[textAlign];
203676
203758
  }
203759
+ if (rightToLeft == null && node2.style) {
203760
+ if (node2.style.direction === "rtl")
203761
+ rightToLeft = true;
203762
+ else if (node2.style.direction === "ltr")
203763
+ rightToLeft = false;
203764
+ }
203677
203765
  let attrs = {
203678
203766
  paragraphProperties: { styleId: styleId || null },
203679
203767
  extraAttrs
@@ -203684,6 +203772,8 @@ function parseAttrs(node2) {
203684
203772
  attrs.paragraphProperties.spacing = spacing;
203685
203773
  if (justification)
203686
203774
  attrs.paragraphProperties.justification = justification;
203775
+ if (rightToLeft != null)
203776
+ attrs.paragraphProperties.rightToLeft = rightToLeft;
203687
203777
  if (Object.keys(numberingProperties).length > 0)
203688
203778
  attrs.paragraphProperties.numberingProperties = numberingProperties;
203689
203779
  if (sectionProperties)
@@ -208588,6 +208678,21 @@ function getCurrentCoords(editor, selection) {
208588
208678
  y: layoutSpaceCoords.y
208589
208679
  };
208590
208680
  }
208681
+ function resolveLineBoundaryPosition(editor, selection, key2) {
208682
+ const coords = getCurrentCoords(editor, selection);
208683
+ if (!coords)
208684
+ return null;
208685
+ const doc$12 = editor.presentationEditor?.visibleHost?.ownerDocument ?? document;
208686
+ const caretX = coords.clientX;
208687
+ const lineEl = findLineElementAtPoint(doc$12, caretX, coords.clientY + coords.height / 2);
208688
+ if (!lineEl)
208689
+ return null;
208690
+ const pmStart = Number(lineEl.dataset?.pmStart);
208691
+ const pmEnd = Number(lineEl.dataset?.pmEnd);
208692
+ if (!Number.isFinite(pmStart) || !Number.isFinite(pmEnd))
208693
+ return null;
208694
+ return key2 === "Home" ? pmStart : pmEnd;
208695
+ }
208591
208696
  function getAdjacentLineClientTarget(editor, coords, direction) {
208592
208697
  const doc$12 = editor.presentationEditor.visibleHost?.ownerDocument ?? document;
208593
208698
  const caretX = coords.clientX;
@@ -242889,6 +242994,15 @@ function isMinimalWordLayout(value) {
242889
242994
  }
242890
242995
  return true;
242891
242996
  }
242997
+ function resolveMarkerIndent(indent2, isRtl) {
242998
+ const left$1 = indent2?.left ?? 0;
242999
+ const right$1 = indent2?.right ?? 0;
243000
+ return {
243001
+ anchorIndentPx: isRtl ? right$1 : left$1,
243002
+ firstLinePx: isRtl ? -(indent2?.firstLine ?? 0) : indent2?.firstLine ?? 0,
243003
+ hangingPx: isRtl ? -(indent2?.hanging ?? 0) : indent2?.hanging ?? 0
243004
+ };
243005
+ }
242892
243006
  function computeTabWidth(currentPos, justification, tabs, hangingIndent, firstLineIndent, leftIndent) {
242893
243007
  const nextDefaultTabStop = currentPos + 48 - currentPos % 48;
242894
243008
  let tabWidth;
@@ -243937,17 +244051,18 @@ function resolveParagraphContent(fragment, block, measure) {
243937
244051
  const paraIndent = block.attrs?.indent;
243938
244052
  const paraIndentLeft = paraIndent?.left ?? 0;
243939
244053
  const paraIndentRight = paraIndent?.right ?? 0;
244054
+ const { anchorIndentPx: paraMarkerAnchorIndent, firstLinePx: markerFirstLine, hangingPx: markerHanging } = resolveMarkerIndent(paraIndent, block.attrs?.direction === "rtl");
243940
244055
  const firstLineOffset = block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
243941
244056
  const paragraphEndsWithLineBreak = (block.runs.length > 0 ? block.runs[block.runs.length - 1] : null)?.kind === "lineBreak";
243942
244057
  const lines = fragment.lines ?? measure.lines.slice(fragment.fromLine, fragment.toLine);
243943
244058
  const hasMarker = !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
243944
- const listFirstLineTextStartPx = hasMarker ? resolverListTextStartPx(wordLayout, paraIndentLeft, paraIndent?.hanging ?? 0, paraIndent?.firstLine ?? 0, fragment.markerTextWidth) : undefined;
243945
- const listFirstLineMarkerGeometry = !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker?.justification === "left" && wordLayout.firstLineIndentMode !== true && typeof fragment.markerTextWidth === "number" && Number.isFinite(fragment.markerTextWidth) && fragment.markerTextWidth >= 0 ? resolverListMarkerGeometry(wordLayout, paraIndentLeft, paraIndent?.hanging ?? 0, paraIndent?.firstLine ?? 0, fragment.markerTextWidth) : undefined;
244059
+ const listFirstLineTextStartPx = hasMarker ? resolverListTextStartPx(wordLayout, paraMarkerAnchorIndent, markerHanging, markerFirstLine, fragment.markerTextWidth) : undefined;
244060
+ const listFirstLineMarkerGeometry = !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker?.justification === "left" && wordLayout.firstLineIndentMode !== true && typeof fragment.markerTextWidth === "number" && Number.isFinite(fragment.markerTextWidth) && fragment.markerTextWidth >= 0 ? resolverListMarkerGeometry(wordLayout, paraMarkerAnchorIndent, markerHanging, markerFirstLine, fragment.markerTextWidth) : undefined;
243946
244061
  let listTabWidth = 0;
243947
244062
  let markerStartPos = 0;
243948
244063
  if (hasMarker) {
243949
244064
  const markerTextWidth = fragment.markerTextWidth;
243950
- const anchorPoint = paraIndentLeft - (paraIndent?.hanging ?? 0) + (paraIndent?.firstLine ?? 0);
244065
+ const anchorPoint = paraMarkerAnchorIndent - markerHanging + markerFirstLine;
243951
244066
  const markerJustification = wordLayout.marker.justification ?? "left";
243952
244067
  let currentPos;
243953
244068
  if (markerJustification === "left") {
@@ -243964,7 +244079,7 @@ function resolveParagraphContent(fragment, block, measure) {
243964
244079
  if (listFirstLineMarkerGeometry && (suffix === "tab" || suffix === "space"))
243965
244080
  listTabWidth = listFirstLineMarkerGeometry.suffixWidthPx;
243966
244081
  else if (suffix === "tab")
243967
- listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, paraIndent?.hanging, paraIndent?.firstLine, paraIndentLeft);
244082
+ listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, markerHanging, markerFirstLine, paraMarkerAnchorIndent);
243968
244083
  else if (suffix === "space")
243969
244084
  listTabWidth = 4;
243970
244085
  }
@@ -243972,7 +244087,7 @@ function resolveParagraphContent(fragment, block, measure) {
243972
244087
  if (hasMarker) {
243973
244088
  const m$1 = wordLayout.marker;
243974
244089
  const justification = m$1.justification ?? "left";
243975
- const firstLinePaddingLeftPx = paraIndentLeft + (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
244090
+ const firstLinePaddingLeftPx = paraMarkerAnchorIndent - markerHanging + markerFirstLine;
243976
244091
  let centerPaddingAdjustPx;
243977
244092
  if (justification === "center")
243978
244093
  centerPaddingAdjustPx = fragment.markerTextWidth / 2;
@@ -256113,6 +256228,20 @@ function handleTableNode(node2, context) {
256113
256228
  recordBlockKind?.(tableBlock.kind);
256114
256229
  }
256115
256230
  }
256231
+ function resolveSectionDirectionFromSectPr$1(sectPr) {
256232
+ if (!sectPr || typeof sectPr !== "object")
256233
+ return;
256234
+ const elements = sectPr.elements;
256235
+ if (!Array.isArray(elements))
256236
+ return;
256237
+ const bidi = elements.find((element3) => element3?.name === "w:bidi");
256238
+ if (!bidi)
256239
+ return;
256240
+ const val = bidi.attributes?.["w:val"] ?? bidi.attributes?.val;
256241
+ if (val === "0" || val === 0 || val === false || val === "false" || val === "off")
256242
+ return "ltr";
256243
+ return "rtl";
256244
+ }
256116
256245
  function sourceAnchorFromNode(node2) {
256117
256246
  const sourceAnchor = node2.attrs?.sourceAnchor;
256118
256247
  return sourceAnchor && typeof sourceAnchor === "object" && !Array.isArray(sourceAnchor) ? sourceAnchor : undefined;
@@ -256438,6 +256567,7 @@ function handleParagraphNode2(node2, context) {
256438
256567
  blocks2.push(sectionBreak);
256439
256568
  recordBlockKind?.(sectionBreak.kind);
256440
256569
  sectionState.currentSectionIndex++;
256570
+ converterContext.sectionDirection = resolveSectionDirectionFromSectPr$1(nextSection.sectPr);
256441
256571
  }
256442
256572
  }
256443
256573
  const paragraphToFlowBlocks$1 = converters$1.paragraphToFlowBlocks;
@@ -256534,6 +256664,20 @@ function handleMathBlockNode(node2, context) {
256534
256664
  blocks2.push(block);
256535
256665
  recordBlockKind?.(block.kind);
256536
256666
  }
256667
+ function resolveSectionDirectionFromSectPr(sectPr) {
256668
+ if (!sectPr || typeof sectPr !== "object")
256669
+ return;
256670
+ const elements = sectPr.elements;
256671
+ if (!Array.isArray(elements))
256672
+ return;
256673
+ const bidi = elements.find((element3) => element3?.name === "w:bidi");
256674
+ if (!bidi)
256675
+ return;
256676
+ const val = bidi.attributes?.["w:val"] ?? bidi.attributes?.val;
256677
+ if (val === "0" || val === 0 || val === false || val === "false" || val === "off")
256678
+ return "ltr";
256679
+ return "rtl";
256680
+ }
256537
256681
  function toFlowBlocks(pmDoc, options) {
256538
256682
  const defaultFont = options?.defaultFont ?? DEFAULT_FONT;
256539
256683
  const defaultSize = options?.defaultSize ?? DEFAULT_SIZE;
@@ -256571,6 +256715,7 @@ function toFlowBlocks(pmDoc, options) {
256571
256715
  };
256572
256716
  const bodySectionProps = doc$12.attrs?.bodySectPr ?? doc$12.attrs?.sectPr;
256573
256717
  const sectionRanges = options?.emitSectionBreaks ? analyzeSectionRanges(doc$12, bodySectionProps) : [];
256718
+ converterContext.sectionDirection = converterContext.sectionDirection ?? resolveSectionDirectionFromSectPr(sectionRanges[0]?.sectPr ?? bodySectionProps);
256574
256719
  publishSectionMetadata(sectionRanges, options);
256575
256720
  if (sectionRanges.length > 0 && sectionRanges[0]) {
256576
256721
  const sectionBreak = createSectionBreakBlock(sectionRanges[0], nextBlockId, { isFirstSection: true });
@@ -258015,8 +258160,10 @@ function computeCaretLayoutRectGeometry({ layout, blocks: blocks2, measures, pai
258015
258160
  hangingIndent: indent2.hanging,
258016
258161
  wordLayout
258017
258162
  });
258018
- const charX = measureCharacterX(block, line, pmOffset, Math.max(0, fragment.width - (indentAdjust + indent2.right)));
258019
- const localX = fragment.x + indentAdjust + charX;
258163
+ const availableWidth = Math.max(0, fragment.width - (indentAdjust + indent2.right));
258164
+ const charX = measureCharacterX(block, line, pmOffset, availableWidth);
258165
+ const resolvedCharX = block.attrs?.direction === "rtl" ? Math.max(0, availableWidth - charX) : charX;
258166
+ const localX = fragment.x + indentAdjust + resolvedCharX;
258020
258167
  const lineOffset = lineHeightBeforeIndex(measure.lines, fragment.fromLine, index2);
258021
258168
  const localY = fragment.y + lineOffset;
258022
258169
  const result = {
@@ -267458,7 +267605,7 @@ var Node$13 = class Node$14 {
267458
267605
  this.dom.classList.remove("sd-editor-dropcap");
267459
267606
  if (paragraphProperties.styleId)
267460
267607
  this.dom.setAttribute("styleid", paragraphProperties.styleId);
267461
- if (paragraphProperties.rightToLeft)
267608
+ if (paragraphProperties.rightToLeft === true || paragraphProperties.rightToLeft !== false && inferParagraphRtlFromRuns(this.node))
267462
267609
  this.dom.setAttribute("dir", "rtl");
267463
267610
  else
267464
267611
  this.dom.removeAttribute("dir");
@@ -280782,7 +280929,7 @@ menclose::after {
280782
280929
  y$1 += actualRowHeight + cellSpacingPx;
280783
280930
  }
280784
280931
  return container;
280785
- }, isRtlParagraph = (attrs) => attrs?.direction === "rtl" || attrs?.rtl === true, resolveTextAlign = (alignment$1, isRtl) => {
280932
+ }, isRtlParagraph = (attrs) => attrs?.direction === "rtl", resolveTextAlign = (alignment$1, isRtl) => {
280786
280933
  switch (alignment$1) {
280787
280934
  case "center":
280788
280935
  case "right":
@@ -280797,6 +280944,9 @@ menclose::after {
280797
280944
  if (rtl) {
280798
280945
  element3.setAttribute("dir", "rtl");
280799
280946
  element3.style.direction = "rtl";
280947
+ } else {
280948
+ element3.removeAttribute("dir");
280949
+ element3.style.direction = "";
280800
280950
  }
280801
280951
  element3.style.textAlign = resolveTextAlign(attrs?.alignment, rtl);
280802
280952
  return rtl;
@@ -282099,7 +282249,6 @@ menclose::after {
282099
282249
  attrs.shading?.fill ?? "",
282100
282250
  attrs.shading?.color ?? "",
282101
282251
  attrs.direction ?? "",
282102
- attrs.rtl ? "1" : "",
282103
282252
  attrs.tabs?.length ? JSON.stringify(attrs.tabs) : ""
282104
282253
  ].join(":") : "";
282105
282254
  const sdtAttrs = block.attrs?.sdt;
@@ -282228,7 +282377,6 @@ menclose::after {
282228
282377
  hash$3 = hashString(hash$3, attrs.shading?.fill ?? "");
282229
282378
  hash$3 = hashString(hash$3, attrs.shading?.color ?? "");
282230
282379
  hash$3 = hashString(hash$3, attrs.direction ?? "");
282231
- hash$3 = hashString(hash$3, attrs.rtl ? "1" : "");
282232
282380
  if (attrs.borders)
282233
282381
  hash$3 = hashString(hash$3, hashParagraphBorders$1(attrs.borders));
282234
282382
  }
@@ -282942,8 +283090,6 @@ menclose::after {
282942
283090
  }
282943
283091
  if (attrs.direction)
282944
283092
  parts.push(`dir:${attrs.direction}`);
282945
- if (attrs.rtl)
282946
- parts.push("rtl");
282947
283093
  if (parts.length > 0)
282948
283094
  cellHashes.push(`pa:${parts.join(":")}`);
282949
283095
  }
@@ -283051,8 +283197,6 @@ menclose::after {
283051
283197
  }
283052
283198
  if (attrs.direction)
283053
283199
  parts.push(`dir:${attrs.direction}`);
283054
- if (attrs.rtl)
283055
- parts.push("rtl");
283056
283200
  if (attrs.keepNext)
283057
283201
  parts.push("kn");
283058
283202
  if (attrs.keepLines)
@@ -283784,7 +283928,7 @@ menclose::after {
283784
283928
  return true;
283785
283929
  if (!a2 || !b$1)
283786
283930
  return !a2 && !b$1;
283787
- if (a2.alignment !== b$1.alignment || a2.contextualSpacing !== b$1.contextualSpacing || a2.suppressFirstLineIndent !== b$1.suppressFirstLineIndent || a2.dropCap !== b$1.dropCap || a2.decimalSeparator !== b$1.decimalSeparator || a2.tabIntervalTwips !== b$1.tabIntervalTwips || a2.keepNext !== b$1.keepNext || a2.keepLines !== b$1.keepLines || a2.direction !== b$1.direction || a2.rtl !== b$1.rtl || a2.floatAlignment !== b$1.floatAlignment)
283931
+ if (a2.alignment !== b$1.alignment || a2.contextualSpacing !== b$1.contextualSpacing || a2.suppressFirstLineIndent !== b$1.suppressFirstLineIndent || a2.dropCap !== b$1.dropCap || a2.decimalSeparator !== b$1.decimalSeparator || a2.tabIntervalTwips !== b$1.tabIntervalTwips || a2.keepNext !== b$1.keepNext || a2.keepLines !== b$1.keepLines || a2.direction !== b$1.direction || a2.floatAlignment !== b$1.floatAlignment)
283788
283932
  return false;
283789
283933
  if (!paragraphSpacingEqual(a2.spacing, b$1.spacing))
283790
283934
  return false;
@@ -284715,8 +284859,6 @@ menclose::after {
284715
284859
  const directionAttr = attrs.direction ?? attrs.dir ?? attrs.textDirection;
284716
284860
  if (typeof directionAttr === "string" && directionAttr.toLowerCase() === "rtl")
284717
284861
  return true;
284718
- if (typeof attrs.rtl === "boolean")
284719
- return attrs.rtl;
284720
284862
  return false;
284721
284863
  }, determineColumn = (layout, fragmentX) => {
284722
284864
  const columns = layout.columns;
@@ -285948,6 +286090,119 @@ menclose::after {
285948
286090
  default:
285949
286091
  return;
285950
286092
  }
286093
+ }, mirrorIndentForRtl = (indent2) => {
286094
+ const mirrored = {};
286095
+ let mutated = false;
286096
+ if (indent2.right != null) {
286097
+ mirrored.left = indent2.right;
286098
+ mutated = true;
286099
+ }
286100
+ if (indent2.left != null) {
286101
+ mirrored.right = indent2.left;
286102
+ mutated = true;
286103
+ }
286104
+ if (indent2.firstLine != null) {
286105
+ mirrored.firstLine = -indent2.firstLine;
286106
+ mutated = true;
286107
+ }
286108
+ if (indent2.hanging != null) {
286109
+ mirrored.hanging = -indent2.hanging;
286110
+ mutated = true;
286111
+ }
286112
+ return mutated ? mirrored : indent2;
286113
+ }, DEFAULT_PAGE_DIRECTION = "ltr", DEFAULT_WRITING_MODE = "horizontal-tb", isToggleOn = (val) => {
286114
+ if (val === undefined || val === null)
286115
+ return true;
286116
+ if (val === "0" || val === 0 || val === false)
286117
+ return false;
286118
+ if (val === "false" || val === "off")
286119
+ return false;
286120
+ return true;
286121
+ }, writingModeFromTextDirection$1 = (val) => {
286122
+ if (typeof val !== "string")
286123
+ return;
286124
+ switch (val) {
286125
+ case "lrTb":
286126
+ case "lrTbV":
286127
+ case "tb":
286128
+ case "tbV":
286129
+ return "horizontal-tb";
286130
+ case "tbRl":
286131
+ case "tbRlV":
286132
+ case "rl":
286133
+ case "rlV":
286134
+ return "vertical-rl";
286135
+ case "btLr":
286136
+ case "lr":
286137
+ case "lrV":
286138
+ case "tbLrV":
286139
+ return "vertical-lr";
286140
+ default:
286141
+ return;
286142
+ }
286143
+ }, resolveSectionDirection = (sectPr) => {
286144
+ let pageDirection = DEFAULT_PAGE_DIRECTION;
286145
+ let writingMode = DEFAULT_WRITING_MODE;
286146
+ let rtlGutter = false;
286147
+ if (sectPr && typeof sectPr === "object") {
286148
+ const elements = sectPr.elements;
286149
+ if (Array.isArray(elements))
286150
+ for (const el of elements) {
286151
+ if (!el?.name)
286152
+ continue;
286153
+ const val = el.attributes?.["w:val"] ?? el.attributes?.val;
286154
+ if (el.name === "w:bidi" && isToggleOn(val)) {
286155
+ pageDirection = "rtl";
286156
+ continue;
286157
+ }
286158
+ if (el.name === "w:textDirection") {
286159
+ const mode = writingModeFromTextDirection$1(val);
286160
+ if (mode)
286161
+ writingMode = mode;
286162
+ continue;
286163
+ }
286164
+ if (el.name === "w:rtlGutter" && isToggleOn(val)) {
286165
+ rtlGutter = true;
286166
+ continue;
286167
+ }
286168
+ }
286169
+ }
286170
+ return {
286171
+ pageDirection,
286172
+ writingMode,
286173
+ rtlGutter
286174
+ };
286175
+ }, writingModeFromTextDirection = (val) => {
286176
+ switch (val) {
286177
+ case "lrTb":
286178
+ case "lrTbV":
286179
+ case "tb":
286180
+ case "tbV":
286181
+ return "horizontal-tb";
286182
+ case "tbRl":
286183
+ case "tbRlV":
286184
+ case "rl":
286185
+ case "rlV":
286186
+ return "vertical-rl";
286187
+ case "btLr":
286188
+ case "lr":
286189
+ case "lrV":
286190
+ case "tbLrV":
286191
+ return "vertical-lr";
286192
+ default:
286193
+ return;
286194
+ }
286195
+ }, resolveParagraphDirection = (paragraphProperties, parentSection, parentCell) => {
286196
+ let inlineDirection;
286197
+ if (paragraphProperties?.rightToLeft === true)
286198
+ inlineDirection = "rtl";
286199
+ else if (paragraphProperties?.rightToLeft === false)
286200
+ inlineDirection = "ltr";
286201
+ const writingMode = writingModeFromTextDirection(paragraphProperties?.textDirection) ?? parentCell?.writingMode ?? parentSection.writingMode;
286202
+ return {
286203
+ inlineDirection,
286204
+ writingMode
286205
+ };
285951
286206
  }, DEFAULT_DECIMAL_SEPARATOR$1 = ".", DEFAULT_TAB_INTERVAL_TWIPS$1 = 720, normalizeColor$1 = (value) => {
285952
286207
  if (typeof value !== "string")
285953
286208
  return;
@@ -285988,6 +286243,18 @@ menclose::after {
285988
286243
  if (hanging != null)
285989
286244
  result.hanging = twipsToPx$1(hanging);
285990
286245
  return Object.keys(result).length > 0 ? result : undefined;
286246
+ }, resolveLogicalIndentToPhysical = (indent2, _direction) => {
286247
+ if (!indent2)
286248
+ return;
286249
+ const resolved = { ...indent2 };
286250
+ const source = indent2;
286251
+ if (source.start != null)
286252
+ resolved.left = source.start;
286253
+ if (source.end != null)
286254
+ resolved.right = source.end;
286255
+ delete resolved.start;
286256
+ delete resolved.end;
286257
+ return resolved;
285991
286258
  }, normalizeFramePr = (value) => {
285992
286259
  if (!value)
285993
286260
  return;
@@ -286075,9 +286342,13 @@ menclose::after {
286075
286342
  resolvedParagraphProperties = paragraphProperties;
286076
286343
  else
286077
286344
  resolvedParagraphProperties = resolveParagraphProperties(converterContext, paragraphProperties, converterContext.tableInfo);
286078
- const isRtl = resolvedParagraphProperties.rightToLeft === true;
286345
+ const sectionContext = resolveSectionDirection(undefined);
286346
+ const directionContext = resolveParagraphDirection(resolvedParagraphProperties, sectionContext);
286347
+ const normalizedDirection = directionContext.inlineDirection;
286348
+ const isRtl = normalizedDirection === "rtl";
286079
286349
  const normalizedSpacing = normalizeParagraphSpacing(resolvedParagraphProperties.spacing, Boolean(resolvedParagraphProperties.numberingProperties));
286080
- const normalizedIndent = normalizeIndentTwipsToPx(resolvedParagraphProperties.indent);
286350
+ const normalizedIndentBase = normalizeIndentTwipsToPx(resolveLogicalIndentToPhysical(resolvedParagraphProperties.indent, normalizedDirection));
286351
+ const normalizedIndent = isRtl && normalizedIndentBase ? mirrorIndentForRtl(normalizedIndentBase) : normalizedIndentBase;
286081
286352
  const normalizedTabStops = normalizeOoxmlTabs(resolvedParagraphProperties.tabStops);
286082
286353
  const normalizedAlignment = normalizeAlignment(resolvedParagraphProperties.justification, isRtl);
286083
286354
  const normalizedBorders = normalizeParagraphBorders(resolvedParagraphProperties.borders);
@@ -286085,7 +286356,6 @@ menclose::after {
286085
286356
  const paragraphDecimalSeparator = DEFAULT_DECIMAL_SEPARATOR$1;
286086
286357
  const tabIntervalTwips = DEFAULT_TAB_INTERVAL_TWIPS$1;
286087
286358
  const normalizedFramePr = normalizeFramePr(resolvedParagraphProperties.framePr);
286088
- const normalizedDirection = resolvedParagraphProperties.rightToLeft === true ? "rtl" : resolvedParagraphProperties.rightToLeft === false ? "ltr" : undefined;
286089
286359
  const floatAlignment = normalizedFramePr?.xAlign;
286090
286360
  const normalizedNumberingProperties = normalizeNumberingProperties(resolvedParagraphProperties.numberingProperties);
286091
286361
  const dropCapDescriptor = normalizeDropCap(resolvedParagraphProperties.framePr, para, converterContext);
@@ -286108,10 +286378,8 @@ menclose::after {
286108
286378
  keepLines: resolvedParagraphProperties.keepLines,
286109
286379
  floatAlignment,
286110
286380
  pageBreakBefore: resolvedParagraphProperties.pageBreakBefore,
286111
- ...normalizedDirection ? {
286112
- direction: normalizedDirection,
286113
- rtl: isRtl
286114
- } : {}
286381
+ ...normalizedDirection ? { direction: normalizedDirection } : {},
286382
+ directionContext
286115
286383
  };
286116
286384
  if (normalizedNumberingProperties && normalizedListRendering) {
286117
286385
  const markerRunAttrs = computeRunAttrs(resolveRunProperties(converterContext, resolvedParagraphProperties.runProperties, resolvedParagraphProperties, converterContext.tableInfo, true, Boolean(paragraphProperties.numberingProperties)), converterContext);
@@ -292765,12 +293033,12 @@ menclose::after {
292765
293033
  return;
292766
293034
  console.log(...args$1);
292767
293035
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
292768
- var init_src_tOywM1hR_es = __esm(() => {
293036
+ var init_src_DOdRGHiA_es = __esm(() => {
292769
293037
  init_rolldown_runtime_Bg48TavK_es();
292770
- init_SuperConverter_CjDkqrj8_es();
293038
+ init_SuperConverter_BecdrRIX_es();
292771
293039
  init_jszip_C49i9kUs_es();
292772
293040
  init_uuid_qzgm05fK_es();
292773
- init_create_headless_toolbar_pGestihw_es();
293041
+ init_create_headless_toolbar_DCeIAH_W_es();
292774
293042
  init_constants_DrU4EASo_es();
292775
293043
  init_dist_B8HfvhaK_es();
292776
293044
  init_unified_Dsuw2be5_es();
@@ -311065,10 +311333,25 @@ function print() { __p += __j.call(arguments, '') }
311065
311333
  handleKeyDown(view, event) {
311066
311334
  if (view.composing || !editor.isEditable)
311067
311335
  return false;
311068
- if (event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End") {
311336
+ if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
311069
311337
  view.dispatch(view.state.tr.setMeta(VerticalNavigationPluginKey, { type: "reset-goal-x" }));
311070
311338
  return false;
311071
311339
  }
311340
+ if (event.key === "Home" || event.key === "End") {
311341
+ view.dispatch(view.state.tr.setMeta(VerticalNavigationPluginKey, { type: "reset-goal-x" }));
311342
+ if (!isPresenting(editor))
311343
+ return false;
311344
+ if (event.ctrlKey || event.metaKey || event.altKey)
311345
+ return false;
311346
+ const targetPos = resolveLineBoundaryPosition(editor, view.state.selection, event.key);
311347
+ if (!Number.isFinite(targetPos))
311348
+ return false;
311349
+ const selection$1 = buildSelection(view.state, targetPos, event.shiftKey);
311350
+ if (!selection$1)
311351
+ return false;
311352
+ view.dispatch(view.state.tr.setSelection(selection$1));
311353
+ return true;
311354
+ }
311072
311355
  if (event.key === "PageUp" || event.key === "PageDown") {
311073
311356
  view.dispatch(view.state.tr.setMeta(VerticalNavigationPluginKey, { type: "reset-goal-x" }));
311074
311357
  return false;
@@ -320666,6 +320949,7 @@ function print() { __p += __j.call(arguments, '') }
320666
320949
  const expandedRunsForBlock = expandRunsForInlineNewlines(block.runs);
320667
320950
  content3.lines.forEach((resolvedLine) => {
320668
320951
  const paragraphMarkLeftOffset = this.resolveResolvedListParagraphMarkOffset(resolvedLine.isListFirstLine ? resolvedMarker : undefined, fragment.markerTextWidth, resolvedLine.indentOffset);
320952
+ const isRtl = block.attrs?.direction === "rtl";
320669
320953
  const lineEl = this.renderLine(block, resolvedLine.line, context, resolvedLine.availableWidth, resolvedLine.lineIndex, resolvedLine.skipJustify, expandedRunsForBlock, resolvedLine.resolvedListTextStartPx, resolvedLine.indentOffset, paragraphMarkLeftOffset);
320670
320954
  if (!resolvedLine.isListFirstLine) {
320671
320955
  if (resolvedLine.paddingLeftPx > 0)
@@ -320681,17 +320965,28 @@ function print() { __p += __j.call(arguments, '') }
320681
320965
  if (resolvedLine.paddingRightPx > 0)
320682
320966
  lineEl.style.paddingRight = `${resolvedLine.paddingRightPx}px`;
320683
320967
  if (resolvedLine.isListFirstLine && resolvedMarker) {
320684
- lineEl.style.paddingLeft = `${resolvedMarker.firstLinePaddingLeftPx}px`;
320968
+ if (isRtl)
320969
+ lineEl.style.paddingRight = `${resolvedMarker.firstLinePaddingLeftPx}px`;
320970
+ else
320971
+ lineEl.style.paddingLeft = `${resolvedMarker.firstLinePaddingLeftPx}px`;
320685
320972
  if (!resolvedMarker.vanish) {
320686
320973
  const markerContainer = createListMarkerElement(this.doc, resolvedMarker.text, resolvedMarker.run, resolvedMarker.sourceAnchor ?? resolvedItem?.sourceAnchor);
320687
320974
  markerContainer.style.position = "relative";
320688
320975
  if (resolvedMarker.justification === "right") {
320689
320976
  markerContainer.style.position = "absolute";
320690
- markerContainer.style.left = `${resolvedMarker.markerStartPx}px`;
320977
+ if (isRtl)
320978
+ markerContainer.style.right = `${resolvedMarker.markerStartPx}px`;
320979
+ else
320980
+ markerContainer.style.left = `${resolvedMarker.markerStartPx}px`;
320691
320981
  } else if (resolvedMarker.justification === "center") {
320692
320982
  markerContainer.style.position = "absolute";
320693
- markerContainer.style.left = `${resolvedMarker.markerStartPx - (resolvedMarker.centerPaddingAdjustPx ?? 0)}px`;
320694
- lineEl.style.paddingLeft = parseFloat(lineEl.style.paddingLeft) + (resolvedMarker.centerPaddingAdjustPx ?? 0) + "px";
320983
+ if (isRtl) {
320984
+ markerContainer.style.right = `${resolvedMarker.markerStartPx - (resolvedMarker.centerPaddingAdjustPx ?? 0)}px`;
320985
+ lineEl.style.paddingRight = (parseFloat(lineEl.style.paddingRight || "0") + (resolvedMarker.centerPaddingAdjustPx ?? 0)).toString() + "px";
320986
+ } else {
320987
+ markerContainer.style.left = `${resolvedMarker.markerStartPx - (resolvedMarker.centerPaddingAdjustPx ?? 0)}px`;
320988
+ lineEl.style.paddingLeft = parseFloat(lineEl.style.paddingLeft) + (resolvedMarker.centerPaddingAdjustPx ?? 0) + "px";
320989
+ }
320695
320990
  }
320696
320991
  if (resolvedMarker.suffix === "tab") {
320697
320992
  const tabEl = this.doc.createElement("span");
@@ -320724,28 +321019,30 @@ function print() { __p += __j.call(arguments, '') }
320724
321019
  const paraIndent = block.attrs?.indent;
320725
321020
  const paraIndentLeft = paraIndent?.left ?? 0;
320726
321021
  const paraIndentRight = paraIndent?.right ?? 0;
321022
+ const isRtl = block.attrs?.direction === "rtl";
321023
+ const { anchorIndentPx: paraMarkerAnchorIndent, firstLinePx: markerFirstLine, hangingPx: markerHanging } = resolveMarkerIndent(paraIndent, isRtl);
320727
321024
  const firstLineOffset = block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
320728
321025
  const expandedRunsForBlock = expandRunsForInlineNewlines(block.runs);
320729
321026
  const paragraphEndsWithLineBreak = (block.runs.length > 0 ? block.runs[block.runs.length - 1] : null)?.kind === "lineBreak";
320730
321027
  const listFirstLineTextStartPx = !paraContinuesFromPrev && paraMarkerWidth && wordLayout?.marker ? resolvePainterListTextStartPx({
320731
321028
  wordLayout,
320732
- indentLeftPx: paraIndentLeft,
320733
- hangingIndentPx: paraIndent?.hanging ?? 0,
320734
- firstLineIndentPx: paraIndent?.firstLine ?? 0,
321029
+ indentLeftPx: paraMarkerAnchorIndent,
321030
+ hangingIndentPx: markerHanging,
321031
+ firstLineIndentPx: markerFirstLine,
320735
321032
  markerTextWidthPx: fragment.markerTextWidth
320736
321033
  }) : undefined;
320737
321034
  const listFirstLineMarkerGeometry = !paraContinuesFromPrev && paraMarkerWidth && wordLayout?.marker?.justification === "left" && wordLayout.firstLineIndentMode !== true && typeof fragment.markerTextWidth === "number" && Number.isFinite(fragment.markerTextWidth) && fragment.markerTextWidth >= 0 ? resolvePainterListMarkerGeometry({
320738
321035
  wordLayout,
320739
- indentLeftPx: paraIndentLeft,
320740
- hangingIndentPx: paraIndent?.hanging ?? 0,
320741
- firstLineIndentPx: paraIndent?.firstLine ?? 0,
321036
+ indentLeftPx: paraMarkerAnchorIndent,
321037
+ hangingIndentPx: markerHanging,
321038
+ firstLineIndentPx: markerFirstLine,
320742
321039
  markerTextWidthPx: fragment.markerTextWidth
320743
321040
  }) : undefined;
320744
321041
  let listTabWidth = 0;
320745
321042
  let markerStartPos = 0;
320746
321043
  if (!paraContinuesFromPrev && paraMarkerWidth && wordLayout?.marker) {
320747
321044
  const markerTextWidth = fragment.markerTextWidth;
320748
- const anchorPoint = paraIndentLeft - (paraIndent?.hanging ?? 0) + (paraIndent?.firstLine ?? 0);
321045
+ const anchorPoint = paraMarkerAnchorIndent - markerHanging + markerFirstLine;
320749
321046
  const markerJustification = wordLayout.marker.justification ?? "left";
320750
321047
  let currentPos;
320751
321048
  if (markerJustification === "left") {
@@ -320762,7 +321059,7 @@ function print() { __p += __j.call(arguments, '') }
320762
321059
  if (listFirstLineMarkerGeometry && (suffix === "tab" || suffix === "space"))
320763
321060
  listTabWidth = listFirstLineMarkerGeometry.suffixWidthPx;
320764
321061
  else if (suffix === "tab")
320765
- listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, paraIndent?.hanging, paraIndent?.firstLine, paraIndentLeft);
321062
+ listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, markerHanging, markerFirstLine, paraMarkerAnchorIndent);
320766
321063
  else if (suffix === "space")
320767
321064
  listTabWidth = 4;
320768
321065
  }
@@ -320804,18 +321101,30 @@ function print() { __p += __j.call(arguments, '') }
320804
321101
  const marker = wordLayout?.marker;
320805
321102
  if (!marker)
320806
321103
  return;
320807
- lineEl.style.paddingLeft = `${paraIndentLeft + (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0)}px`;
321104
+ const firstLineIndent = paraMarkerAnchorIndent - markerHanging + markerFirstLine;
321105
+ if (isRtl)
321106
+ lineEl.style.paddingRight = `${firstLineIndent}px`;
321107
+ else
321108
+ lineEl.style.paddingLeft = `${firstLineIndent}px`;
320808
321109
  if (!marker.run.vanish) {
320809
321110
  const markerContainer = createListMarkerElement(this.doc, marker.markerText ?? "", marker.run, block.sourceAnchor ?? resolvedItem?.sourceAnchor);
320810
321111
  const markerJustification = marker.justification ?? "left";
320811
321112
  markerContainer.style.position = "relative";
320812
321113
  if (markerJustification === "right") {
320813
321114
  markerContainer.style.position = "absolute";
320814
- markerContainer.style.left = `${markerStartPos}px`;
321115
+ if (isRtl)
321116
+ markerContainer.style.right = `${markerStartPos}px`;
321117
+ else
321118
+ markerContainer.style.left = `${markerStartPos}px`;
320815
321119
  } else if (markerJustification === "center") {
320816
321120
  markerContainer.style.position = "absolute";
320817
- markerContainer.style.left = `${markerStartPos - fragment.markerTextWidth / 2}px`;
320818
- lineEl.style.paddingLeft = parseFloat(lineEl.style.paddingLeft) + fragment.markerTextWidth / 2 + "px";
321121
+ if (isRtl) {
321122
+ markerContainer.style.right = `${markerStartPos - fragment.markerTextWidth / 2}px`;
321123
+ lineEl.style.paddingRight = (parseFloat(lineEl.style.paddingRight || "0") + fragment.markerTextWidth / 2).toString() + "px";
321124
+ } else {
321125
+ markerContainer.style.left = `${markerStartPos - fragment.markerTextWidth / 2}px`;
321126
+ lineEl.style.paddingLeft = parseFloat(lineEl.style.paddingLeft) + fragment.markerTextWidth / 2 + "px";
321127
+ }
320819
321128
  }
320820
321129
  const suffix = marker.suffix ?? "tab";
320821
321130
  if (suffix === "tab") {
@@ -325916,7 +326225,8 @@ function print() { __p += __j.call(arguments, '') }
325916
326225
  x: localX,
325917
326226
  y: localY
325918
326227
  };
325919
- const hit = clickToPositionGeometry(context.layout, context.blocks, context.measures, headerPoint) ?? null;
326228
+ const geometryHit = clickToPositionGeometry(context.layout, context.blocks, context.measures, headerPoint) ?? null;
326229
+ const hit = this.#resolveHeaderFooterDomHit(context, clientX, clientY) ?? geometryHit;
325920
326230
  if (!hit)
325921
326231
  return null;
325922
326232
  const doc$2 = this.getActiveEditor().state?.doc;
@@ -328995,6 +329305,63 @@ function print() { __p += __j.call(arguments, '') }
328995
329305
  lineIndex: -1
328996
329306
  };
328997
329307
  }
329308
+ #resolveHeaderFooterDomHit(context, clientX, clientY) {
329309
+ const layout = this.#layoutState.layout;
329310
+ if (!layout)
329311
+ return null;
329312
+ const blockIds = new Set(context.blocks.map((block) => block.id).filter((id2) => typeof id2 === "string" && id2.length > 0));
329313
+ if (blockIds.size === 0)
329314
+ return null;
329315
+ const doc$12 = this.#viewportHost.ownerDocument ?? document;
329316
+ const elementsFromPoint = typeof doc$12.elementsFromPoint === "function" ? doc$12.elementsFromPoint.bind(doc$12) : null;
329317
+ const tryResolve = (element3, enforceKnownBlockIds = true) => {
329318
+ const fragmentElement = element3 instanceof HTMLElement ? element3.closest("[data-block-id]") : null;
329319
+ const blockId = fragmentElement?.getAttribute("data-block-id") ?? "";
329320
+ if (!fragmentElement)
329321
+ return null;
329322
+ if (enforceKnownBlockIds && !blockIds.has(blockId))
329323
+ return null;
329324
+ const pos = resolvePositionWithinFragmentDom(fragmentElement, clientX, clientY);
329325
+ if (pos == null)
329326
+ return null;
329327
+ return {
329328
+ pos,
329329
+ layoutEpoch: readLayoutEpochFromDom(fragmentElement, clientX, clientY) ?? layout.layoutEpoch ?? 0,
329330
+ blockId,
329331
+ pageIndex: this.#resolveRenderedPageIndexForElement(fragmentElement),
329332
+ column: 0,
329333
+ lineIndex: -1
329334
+ };
329335
+ };
329336
+ if (elementsFromPoint) {
329337
+ for (const element3 of elementsFromPoint(clientX, clientY)) {
329338
+ const hit = tryResolve(element3, true);
329339
+ if (hit)
329340
+ return hit;
329341
+ }
329342
+ for (const element3 of elementsFromPoint(clientX, clientY)) {
329343
+ if (!element3.closest(".superdoc-page-header, .superdoc-page-footer"))
329344
+ continue;
329345
+ const hit = tryResolve(element3, false);
329346
+ if (hit)
329347
+ return hit;
329348
+ }
329349
+ }
329350
+ const surfaceSelector = context.region.kind === "footer" ? ".superdoc-page-footer" : ".superdoc-page-header";
329351
+ const surface = getPageElementByIndex(this.#viewportHost, context.region.pageIndex)?.querySelector(surfaceSelector) ?? null;
329352
+ if (surface instanceof HTMLElement) {
329353
+ const fragments = Array.from(surface.querySelectorAll(".superdoc-fragment"));
329354
+ for (const fragment of fragments) {
329355
+ const rect = fragment.getBoundingClientRect();
329356
+ if (clientX < rect.left || clientX > rect.right || clientY < rect.top || clientY > rect.bottom)
329357
+ continue;
329358
+ const hit = tryResolve(fragment, false);
329359
+ if (hit)
329360
+ return hit;
329361
+ }
329362
+ }
329363
+ return null;
329364
+ }
328998
329365
  #createCollapsedSelectionNearInlineContent(doc$12, pos) {
328999
329366
  const clampedPos = Math.max(0, Math.min(pos, doc$12.content.size));
329000
329367
  const directSelection = TextSelection.create(doc$12, clampedPos);
@@ -330514,11 +330881,11 @@ function print() { __p += __j.call(arguments, '') }
330514
330881
  ];
330515
330882
  });
330516
330883
 
330517
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-Cj3mqS9_.es.js
330884
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-fxrCn5X_.es.js
330518
330885
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
330519
- var init_create_super_doc_ui_Cj3mqS9__es = __esm(() => {
330520
- init_SuperConverter_CjDkqrj8_es();
330521
- init_create_headless_toolbar_pGestihw_es();
330886
+ var init_create_super_doc_ui_fxrCn5X__es = __esm(() => {
330887
+ init_SuperConverter_BecdrRIX_es();
330888
+ init_create_headless_toolbar_DCeIAH_W_es();
330522
330889
  MOD_ALIASES = new Set([
330523
330890
  "Mod",
330524
330891
  "Meta",
@@ -330560,16 +330927,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
330560
330927
 
330561
330928
  // ../../packages/superdoc/dist/super-editor.es.js
330562
330929
  var init_super_editor_es = __esm(() => {
330563
- init_src_tOywM1hR_es();
330564
- init_SuperConverter_CjDkqrj8_es();
330930
+ init_src_DOdRGHiA_es();
330931
+ init_SuperConverter_BecdrRIX_es();
330565
330932
  init_jszip_C49i9kUs_es();
330566
330933
  init_xml_js_CqGKpaft_es();
330567
- init_create_headless_toolbar_pGestihw_es();
330934
+ init_create_headless_toolbar_DCeIAH_W_es();
330568
330935
  init_constants_DrU4EASo_es();
330569
330936
  init_dist_B8HfvhaK_es();
330570
330937
  init_unified_Dsuw2be5_es();
330571
330938
  init_DocxZipper_Dh4RtvcE_es();
330572
- init_create_super_doc_ui_Cj3mqS9__es();
330939
+ init_create_super_doc_ui_fxrCn5X__es();
330573
330940
  init_ui_CGB3qmy3_es();
330574
330941
  init_eventemitter3_UwU_CLPU_es();
330575
330942
  init_errors_C_DoKMoN_es();
@@ -331861,7 +332228,7 @@ var init_inline_run_patch = __esm(() => {
331861
332228
  runAttribute2("rtl", "boolean", "w:rtl", schemaBooleanOrNull2()),
331862
332229
  runAttribute2("cs", "boolean", "w:cs", schemaBooleanOrNull2()),
331863
332230
  runAttribute2("bCs", "boolean", "w:bCs", schemaBooleanOrNull2(), "boldCs"),
331864
- runAttribute2("iCs", "boolean", "w:iCs", schemaBooleanOrNull2()),
332231
+ runAttribute2("iCs", "boolean", "w:iCs", schemaBooleanOrNull2(), "italicCs"),
331865
332232
  runAttribute2("eastAsianLayout", "object", "w:eastAsianLayout", schemaObjectOrNull2({
331866
332233
  id: { oneOf: [{ type: "string", minLength: 1 }, { type: "null" }] },
331867
332234
  combine: { oneOf: [{ type: "boolean" }, { type: "null" }] },
@@ -386484,7 +386851,7 @@ var translator91;
386484
386851
  var init_iCs_translator = __esm(() => {
386485
386852
  init_node_translator2();
386486
386853
  init_utils();
386487
- translator91 = NodeTranslator3.from(createSingleBooleanPropertyHandler2("w:iCs"));
386854
+ translator91 = NodeTranslator3.from(createSingleBooleanPropertyHandler2("w:iCs", "italicCs"));
386488
386855
  });
386489
386856
 
386490
386857
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/webHidden/webHidden-translator.js
@@ -393312,11 +393679,15 @@ var XML_NODE_NAME12 = "w:r", SD_KEY_NAME2 = "run", REFERENCE_RUN_STYLE_BY_XML_NA
393312
393679
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext2(node4);
393313
393680
  const runTrackFormatMark = findTrackFormatMark2(runNodeForExport.marks);
393314
393681
  const runAttrs = runNodeForExport.attrs || {};
393315
- const runProperties = runAttrs.runProperties || {};
393682
+ const rawRunProperties = runAttrs.runProperties || {};
393683
+ const runProperties = rawRunProperties?.italicCs == null && rawRunProperties?.iCs != null ? { ...rawRunProperties, italicCs: rawRunProperties.iCs } : rawRunProperties;
393316
393684
  const inlineKeys = runAttrs.runPropertiesInlineKeys;
393317
393685
  const styleKeys = runAttrs.runPropertiesStyleKeys;
393318
393686
  const overrideKeys = runAttrs.runPropertiesOverrideKeys;
393319
393687
  const candidateKeys = inlineKeys != null ? [...new Set([...inlineKeys || [], ...overrideKeys || []])] : Object.keys(runProperties);
393688
+ if (candidateKeys.includes("iCs") && !candidateKeys.includes("italicCs")) {
393689
+ candidateKeys.push("italicCs");
393690
+ }
393320
393691
  const shouldExport = (key2) => (key2 in (runProperties || {})) && (!(Array.isArray(styleKeys) && styleKeys.includes(key2)) || Array.isArray(overrideKeys) && overrideKeys.includes(key2));
393321
393692
  const exportKeys = candidateKeys.filter(shouldExport);
393322
393693
  const runPropertiesToExport = exportKeys.length > 0 ? Object.fromEntries(exportKeys.map((k2) => [k2, runProperties[k2]])) : {};
@@ -426316,6 +426687,11 @@ function decodeRPrFromMarks2(marks) {
426316
426687
  case "italic":
426317
426688
  case "bold":
426318
426689
  runProperties[type] = mark2.attrs.value !== "0" && mark2.attrs.value !== false;
426690
+ if (type === "bold") {
426691
+ runProperties.boldCs = runProperties.bold;
426692
+ } else if (type === "italic") {
426693
+ runProperties.italicCs = runProperties.italic;
426694
+ }
426319
426695
  break;
426320
426696
  case "underline": {
426321
426697
  const { underlineType, underlineColor, underlineThemeColor, underlineThemeTint, underlineThemeShade } = mark2.attrs;
@@ -426369,7 +426745,9 @@ function decodeRPrFromMarks2(marks) {
426369
426745
  case "fontSize": {
426370
426746
  const points = parseFloat(value);
426371
426747
  if (!isNaN(points)) {
426372
- runProperties.fontSize = points * 2;
426748
+ const halfPoints = points * 2;
426749
+ runProperties.fontSize = halfPoints;
426750
+ runProperties.fontSizeCs = halfPoints;
426373
426751
  }
426374
426752
  break;
426375
426753
  }
@@ -426546,12 +426924,15 @@ var init_calculateInlineRunPropertiesPlugin = __esm(() => {
426546
426924
  RUN_PROPERTIES_DERIVED_FROM_MARKS2 = new Set([
426547
426925
  "strike",
426548
426926
  "italic",
426927
+ "italicCs",
426549
426928
  "bold",
426929
+ "boldCs",
426550
426930
  "underline",
426551
426931
  "highlight",
426552
426932
  "textTransform",
426553
426933
  "color",
426554
426934
  "fontSize",
426935
+ "fontSizeCs",
426555
426936
  "letterSpacing",
426556
426937
  "fontFamily",
426557
426938
  "vertAlign",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.3.0-next.70",
3
+ "version": "0.3.0-next.72",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -20,8 +20,8 @@
20
20
  "@types/node": "22.19.2",
21
21
  "typescript": "^5.9.2",
22
22
  "@superdoc/document-api": "0.0.1",
23
- "@superdoc/super-editor": "0.0.1",
24
- "superdoc": "1.31.0"
23
+ "superdoc": "1.31.0",
24
+ "@superdoc/super-editor": "0.0.1"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"