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

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 +390 -74
  2. package/package.json +1 -1
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-AOxYjda5.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,26 @@ 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;
285951
286113
  }, DEFAULT_DECIMAL_SEPARATOR$1 = ".", DEFAULT_TAB_INTERVAL_TWIPS$1 = 720, normalizeColor$1 = (value) => {
285952
286114
  if (typeof value !== "string")
285953
286115
  return;
@@ -285965,6 +286127,37 @@ menclose::after {
285965
286127
  if (Object.prototype.hasOwnProperty.call(obj, key2))
285966
286128
  clone2[key2] = deepClone2(obj[key2]);
285967
286129
  return clone2;
286130
+ }, inferDirectionFromRuns = (para) => {
286131
+ const content3 = Array.isArray(para.content) ? para.content : [];
286132
+ let hasExplicitRtl = false;
286133
+ let hasExplicitLtr = false;
286134
+ for (const node2 of content3) {
286135
+ if (node2?.type !== "run")
286136
+ continue;
286137
+ const runProps = node2.attrs?.runProperties ?? {};
286138
+ const runDirection = runProps.rightToLeft ?? runProps.rtl;
286139
+ if (runDirection === true) {
286140
+ hasExplicitRtl = true;
286141
+ continue;
286142
+ }
286143
+ if (runDirection === false)
286144
+ hasExplicitLtr = true;
286145
+ }
286146
+ if (!hasExplicitRtl && !hasExplicitLtr)
286147
+ return;
286148
+ if (hasExplicitLtr)
286149
+ return;
286150
+ return "rtl";
286151
+ }, resolveEffectiveParagraphDirection = (para, resolvedParagraphProperties, _sectionDirection, docDefaultsDirection) => {
286152
+ if (resolvedParagraphProperties.rightToLeft === true)
286153
+ return "rtl";
286154
+ if (resolvedParagraphProperties.rightToLeft === false)
286155
+ return "ltr";
286156
+ const inferredFromRuns = inferDirectionFromRuns(para);
286157
+ if (inferredFromRuns)
286158
+ return inferredFromRuns;
286159
+ if (docDefaultsDirection)
286160
+ return docDefaultsDirection;
285968
286161
  }, normalizeIndentTwipsToPx = (indent2) => {
285969
286162
  if (!indent2)
285970
286163
  return;
@@ -285988,6 +286181,18 @@ menclose::after {
285988
286181
  if (hanging != null)
285989
286182
  result.hanging = twipsToPx$1(hanging);
285990
286183
  return Object.keys(result).length > 0 ? result : undefined;
286184
+ }, resolveLogicalIndentToPhysical = (indent2, _direction) => {
286185
+ if (!indent2)
286186
+ return;
286187
+ const resolved = { ...indent2 };
286188
+ const source = indent2;
286189
+ if (source.start != null)
286190
+ resolved.left = source.start;
286191
+ if (source.end != null)
286192
+ resolved.right = source.end;
286193
+ delete resolved.start;
286194
+ delete resolved.end;
286195
+ return resolved;
285991
286196
  }, normalizeFramePr = (value) => {
285992
286197
  if (!value)
285993
286198
  return;
@@ -286075,9 +286280,11 @@ menclose::after {
286075
286280
  resolvedParagraphProperties = paragraphProperties;
286076
286281
  else
286077
286282
  resolvedParagraphProperties = resolveParagraphProperties(converterContext, paragraphProperties, converterContext.tableInfo);
286078
- const isRtl = resolvedParagraphProperties.rightToLeft === true;
286283
+ const normalizedDirection = resolveEffectiveParagraphDirection(para, resolvedParagraphProperties, converterContext?.sectionDirection, converterContext?.translatedLinkedStyles?.docDefaults?.paragraphProperties?.rightToLeft === true ? "rtl" : converterContext?.translatedLinkedStyles?.docDefaults?.paragraphProperties?.rightToLeft === false ? "ltr" : undefined);
286284
+ const isRtl = normalizedDirection === "rtl";
286079
286285
  const normalizedSpacing = normalizeParagraphSpacing(resolvedParagraphProperties.spacing, Boolean(resolvedParagraphProperties.numberingProperties));
286080
- const normalizedIndent = normalizeIndentTwipsToPx(resolvedParagraphProperties.indent);
286286
+ const normalizedIndentBase = normalizeIndentTwipsToPx(resolveLogicalIndentToPhysical(resolvedParagraphProperties.indent, normalizedDirection));
286287
+ const normalizedIndent = isRtl && normalizedIndentBase ? mirrorIndentForRtl(normalizedIndentBase) : normalizedIndentBase;
286081
286288
  const normalizedTabStops = normalizeOoxmlTabs(resolvedParagraphProperties.tabStops);
286082
286289
  const normalizedAlignment = normalizeAlignment(resolvedParagraphProperties.justification, isRtl);
286083
286290
  const normalizedBorders = normalizeParagraphBorders(resolvedParagraphProperties.borders);
@@ -286085,7 +286292,6 @@ menclose::after {
286085
286292
  const paragraphDecimalSeparator = DEFAULT_DECIMAL_SEPARATOR$1;
286086
286293
  const tabIntervalTwips = DEFAULT_TAB_INTERVAL_TWIPS$1;
286087
286294
  const normalizedFramePr = normalizeFramePr(resolvedParagraphProperties.framePr);
286088
- const normalizedDirection = resolvedParagraphProperties.rightToLeft === true ? "rtl" : resolvedParagraphProperties.rightToLeft === false ? "ltr" : undefined;
286089
286295
  const floatAlignment = normalizedFramePr?.xAlign;
286090
286296
  const normalizedNumberingProperties = normalizeNumberingProperties(resolvedParagraphProperties.numberingProperties);
286091
286297
  const dropCapDescriptor = normalizeDropCap(resolvedParagraphProperties.framePr, para, converterContext);
@@ -286108,10 +286314,7 @@ menclose::after {
286108
286314
  keepLines: resolvedParagraphProperties.keepLines,
286109
286315
  floatAlignment,
286110
286316
  pageBreakBefore: resolvedParagraphProperties.pageBreakBefore,
286111
- ...normalizedDirection ? {
286112
- direction: normalizedDirection,
286113
- rtl: isRtl
286114
- } : {}
286317
+ ...normalizedDirection ? { direction: normalizedDirection } : {}
286115
286318
  };
286116
286319
  if (normalizedNumberingProperties && normalizedListRendering) {
286117
286320
  const markerRunAttrs = computeRunAttrs(resolveRunProperties(converterContext, resolvedParagraphProperties.runProperties, resolvedParagraphProperties, converterContext.tableInfo, true, Boolean(paragraphProperties.numberingProperties)), converterContext);
@@ -292765,12 +292968,12 @@ menclose::after {
292765
292968
  return;
292766
292969
  console.log(...args$1);
292767
292970
  }, 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(() => {
292971
+ var init_src_AOxYjda5_es = __esm(() => {
292769
292972
  init_rolldown_runtime_Bg48TavK_es();
292770
- init_SuperConverter_CjDkqrj8_es();
292973
+ init_SuperConverter_BecdrRIX_es();
292771
292974
  init_jszip_C49i9kUs_es();
292772
292975
  init_uuid_qzgm05fK_es();
292773
- init_create_headless_toolbar_pGestihw_es();
292976
+ init_create_headless_toolbar_DCeIAH_W_es();
292774
292977
  init_constants_DrU4EASo_es();
292775
292978
  init_dist_B8HfvhaK_es();
292776
292979
  init_unified_Dsuw2be5_es();
@@ -311065,10 +311268,25 @@ function print() { __p += __j.call(arguments, '') }
311065
311268
  handleKeyDown(view, event) {
311066
311269
  if (view.composing || !editor.isEditable)
311067
311270
  return false;
311068
- if (event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End") {
311271
+ if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
311069
311272
  view.dispatch(view.state.tr.setMeta(VerticalNavigationPluginKey, { type: "reset-goal-x" }));
311070
311273
  return false;
311071
311274
  }
311275
+ if (event.key === "Home" || event.key === "End") {
311276
+ view.dispatch(view.state.tr.setMeta(VerticalNavigationPluginKey, { type: "reset-goal-x" }));
311277
+ if (!isPresenting(editor))
311278
+ return false;
311279
+ if (event.ctrlKey || event.metaKey || event.altKey)
311280
+ return false;
311281
+ const targetPos = resolveLineBoundaryPosition(editor, view.state.selection, event.key);
311282
+ if (!Number.isFinite(targetPos))
311283
+ return false;
311284
+ const selection$1 = buildSelection(view.state, targetPos, event.shiftKey);
311285
+ if (!selection$1)
311286
+ return false;
311287
+ view.dispatch(view.state.tr.setSelection(selection$1));
311288
+ return true;
311289
+ }
311072
311290
  if (event.key === "PageUp" || event.key === "PageDown") {
311073
311291
  view.dispatch(view.state.tr.setMeta(VerticalNavigationPluginKey, { type: "reset-goal-x" }));
311074
311292
  return false;
@@ -320666,6 +320884,7 @@ function print() { __p += __j.call(arguments, '') }
320666
320884
  const expandedRunsForBlock = expandRunsForInlineNewlines(block.runs);
320667
320885
  content3.lines.forEach((resolvedLine) => {
320668
320886
  const paragraphMarkLeftOffset = this.resolveResolvedListParagraphMarkOffset(resolvedLine.isListFirstLine ? resolvedMarker : undefined, fragment.markerTextWidth, resolvedLine.indentOffset);
320887
+ const isRtl = block.attrs?.direction === "rtl";
320669
320888
  const lineEl = this.renderLine(block, resolvedLine.line, context, resolvedLine.availableWidth, resolvedLine.lineIndex, resolvedLine.skipJustify, expandedRunsForBlock, resolvedLine.resolvedListTextStartPx, resolvedLine.indentOffset, paragraphMarkLeftOffset);
320670
320889
  if (!resolvedLine.isListFirstLine) {
320671
320890
  if (resolvedLine.paddingLeftPx > 0)
@@ -320681,17 +320900,28 @@ function print() { __p += __j.call(arguments, '') }
320681
320900
  if (resolvedLine.paddingRightPx > 0)
320682
320901
  lineEl.style.paddingRight = `${resolvedLine.paddingRightPx}px`;
320683
320902
  if (resolvedLine.isListFirstLine && resolvedMarker) {
320684
- lineEl.style.paddingLeft = `${resolvedMarker.firstLinePaddingLeftPx}px`;
320903
+ if (isRtl)
320904
+ lineEl.style.paddingRight = `${resolvedMarker.firstLinePaddingLeftPx}px`;
320905
+ else
320906
+ lineEl.style.paddingLeft = `${resolvedMarker.firstLinePaddingLeftPx}px`;
320685
320907
  if (!resolvedMarker.vanish) {
320686
320908
  const markerContainer = createListMarkerElement(this.doc, resolvedMarker.text, resolvedMarker.run, resolvedMarker.sourceAnchor ?? resolvedItem?.sourceAnchor);
320687
320909
  markerContainer.style.position = "relative";
320688
320910
  if (resolvedMarker.justification === "right") {
320689
320911
  markerContainer.style.position = "absolute";
320690
- markerContainer.style.left = `${resolvedMarker.markerStartPx}px`;
320912
+ if (isRtl)
320913
+ markerContainer.style.right = `${resolvedMarker.markerStartPx}px`;
320914
+ else
320915
+ markerContainer.style.left = `${resolvedMarker.markerStartPx}px`;
320691
320916
  } else if (resolvedMarker.justification === "center") {
320692
320917
  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";
320918
+ if (isRtl) {
320919
+ markerContainer.style.right = `${resolvedMarker.markerStartPx - (resolvedMarker.centerPaddingAdjustPx ?? 0)}px`;
320920
+ lineEl.style.paddingRight = (parseFloat(lineEl.style.paddingRight || "0") + (resolvedMarker.centerPaddingAdjustPx ?? 0)).toString() + "px";
320921
+ } else {
320922
+ markerContainer.style.left = `${resolvedMarker.markerStartPx - (resolvedMarker.centerPaddingAdjustPx ?? 0)}px`;
320923
+ lineEl.style.paddingLeft = parseFloat(lineEl.style.paddingLeft) + (resolvedMarker.centerPaddingAdjustPx ?? 0) + "px";
320924
+ }
320695
320925
  }
320696
320926
  if (resolvedMarker.suffix === "tab") {
320697
320927
  const tabEl = this.doc.createElement("span");
@@ -320724,28 +320954,30 @@ function print() { __p += __j.call(arguments, '') }
320724
320954
  const paraIndent = block.attrs?.indent;
320725
320955
  const paraIndentLeft = paraIndent?.left ?? 0;
320726
320956
  const paraIndentRight = paraIndent?.right ?? 0;
320957
+ const isRtl = block.attrs?.direction === "rtl";
320958
+ const { anchorIndentPx: paraMarkerAnchorIndent, firstLinePx: markerFirstLine, hangingPx: markerHanging } = resolveMarkerIndent(paraIndent, isRtl);
320727
320959
  const firstLineOffset = block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
320728
320960
  const expandedRunsForBlock = expandRunsForInlineNewlines(block.runs);
320729
320961
  const paragraphEndsWithLineBreak = (block.runs.length > 0 ? block.runs[block.runs.length - 1] : null)?.kind === "lineBreak";
320730
320962
  const listFirstLineTextStartPx = !paraContinuesFromPrev && paraMarkerWidth && wordLayout?.marker ? resolvePainterListTextStartPx({
320731
320963
  wordLayout,
320732
- indentLeftPx: paraIndentLeft,
320733
- hangingIndentPx: paraIndent?.hanging ?? 0,
320734
- firstLineIndentPx: paraIndent?.firstLine ?? 0,
320964
+ indentLeftPx: paraMarkerAnchorIndent,
320965
+ hangingIndentPx: markerHanging,
320966
+ firstLineIndentPx: markerFirstLine,
320735
320967
  markerTextWidthPx: fragment.markerTextWidth
320736
320968
  }) : undefined;
320737
320969
  const listFirstLineMarkerGeometry = !paraContinuesFromPrev && paraMarkerWidth && wordLayout?.marker?.justification === "left" && wordLayout.firstLineIndentMode !== true && typeof fragment.markerTextWidth === "number" && Number.isFinite(fragment.markerTextWidth) && fragment.markerTextWidth >= 0 ? resolvePainterListMarkerGeometry({
320738
320970
  wordLayout,
320739
- indentLeftPx: paraIndentLeft,
320740
- hangingIndentPx: paraIndent?.hanging ?? 0,
320741
- firstLineIndentPx: paraIndent?.firstLine ?? 0,
320971
+ indentLeftPx: paraMarkerAnchorIndent,
320972
+ hangingIndentPx: markerHanging,
320973
+ firstLineIndentPx: markerFirstLine,
320742
320974
  markerTextWidthPx: fragment.markerTextWidth
320743
320975
  }) : undefined;
320744
320976
  let listTabWidth = 0;
320745
320977
  let markerStartPos = 0;
320746
320978
  if (!paraContinuesFromPrev && paraMarkerWidth && wordLayout?.marker) {
320747
320979
  const markerTextWidth = fragment.markerTextWidth;
320748
- const anchorPoint = paraIndentLeft - (paraIndent?.hanging ?? 0) + (paraIndent?.firstLine ?? 0);
320980
+ const anchorPoint = paraMarkerAnchorIndent - markerHanging + markerFirstLine;
320749
320981
  const markerJustification = wordLayout.marker.justification ?? "left";
320750
320982
  let currentPos;
320751
320983
  if (markerJustification === "left") {
@@ -320762,7 +320994,7 @@ function print() { __p += __j.call(arguments, '') }
320762
320994
  if (listFirstLineMarkerGeometry && (suffix === "tab" || suffix === "space"))
320763
320995
  listTabWidth = listFirstLineMarkerGeometry.suffixWidthPx;
320764
320996
  else if (suffix === "tab")
320765
- listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, paraIndent?.hanging, paraIndent?.firstLine, paraIndentLeft);
320997
+ listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, markerHanging, markerFirstLine, paraMarkerAnchorIndent);
320766
320998
  else if (suffix === "space")
320767
320999
  listTabWidth = 4;
320768
321000
  }
@@ -320804,18 +321036,30 @@ function print() { __p += __j.call(arguments, '') }
320804
321036
  const marker = wordLayout?.marker;
320805
321037
  if (!marker)
320806
321038
  return;
320807
- lineEl.style.paddingLeft = `${paraIndentLeft + (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0)}px`;
321039
+ const firstLineIndent = paraMarkerAnchorIndent - markerHanging + markerFirstLine;
321040
+ if (isRtl)
321041
+ lineEl.style.paddingRight = `${firstLineIndent}px`;
321042
+ else
321043
+ lineEl.style.paddingLeft = `${firstLineIndent}px`;
320808
321044
  if (!marker.run.vanish) {
320809
321045
  const markerContainer = createListMarkerElement(this.doc, marker.markerText ?? "", marker.run, block.sourceAnchor ?? resolvedItem?.sourceAnchor);
320810
321046
  const markerJustification = marker.justification ?? "left";
320811
321047
  markerContainer.style.position = "relative";
320812
321048
  if (markerJustification === "right") {
320813
321049
  markerContainer.style.position = "absolute";
320814
- markerContainer.style.left = `${markerStartPos}px`;
321050
+ if (isRtl)
321051
+ markerContainer.style.right = `${markerStartPos}px`;
321052
+ else
321053
+ markerContainer.style.left = `${markerStartPos}px`;
320815
321054
  } else if (markerJustification === "center") {
320816
321055
  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";
321056
+ if (isRtl) {
321057
+ markerContainer.style.right = `${markerStartPos - fragment.markerTextWidth / 2}px`;
321058
+ lineEl.style.paddingRight = (parseFloat(lineEl.style.paddingRight || "0") + fragment.markerTextWidth / 2).toString() + "px";
321059
+ } else {
321060
+ markerContainer.style.left = `${markerStartPos - fragment.markerTextWidth / 2}px`;
321061
+ lineEl.style.paddingLeft = parseFloat(lineEl.style.paddingLeft) + fragment.markerTextWidth / 2 + "px";
321062
+ }
320819
321063
  }
320820
321064
  const suffix = marker.suffix ?? "tab";
320821
321065
  if (suffix === "tab") {
@@ -325916,7 +326160,8 @@ function print() { __p += __j.call(arguments, '') }
325916
326160
  x: localX,
325917
326161
  y: localY
325918
326162
  };
325919
- const hit = clickToPositionGeometry(context.layout, context.blocks, context.measures, headerPoint) ?? null;
326163
+ const geometryHit = clickToPositionGeometry(context.layout, context.blocks, context.measures, headerPoint) ?? null;
326164
+ const hit = this.#resolveHeaderFooterDomHit(context, clientX, clientY) ?? geometryHit;
325920
326165
  if (!hit)
325921
326166
  return null;
325922
326167
  const doc$2 = this.getActiveEditor().state?.doc;
@@ -328995,6 +329240,63 @@ function print() { __p += __j.call(arguments, '') }
328995
329240
  lineIndex: -1
328996
329241
  };
328997
329242
  }
329243
+ #resolveHeaderFooterDomHit(context, clientX, clientY) {
329244
+ const layout = this.#layoutState.layout;
329245
+ if (!layout)
329246
+ return null;
329247
+ const blockIds = new Set(context.blocks.map((block) => block.id).filter((id2) => typeof id2 === "string" && id2.length > 0));
329248
+ if (blockIds.size === 0)
329249
+ return null;
329250
+ const doc$12 = this.#viewportHost.ownerDocument ?? document;
329251
+ const elementsFromPoint = typeof doc$12.elementsFromPoint === "function" ? doc$12.elementsFromPoint.bind(doc$12) : null;
329252
+ const tryResolve = (element3, enforceKnownBlockIds = true) => {
329253
+ const fragmentElement = element3 instanceof HTMLElement ? element3.closest("[data-block-id]") : null;
329254
+ const blockId = fragmentElement?.getAttribute("data-block-id") ?? "";
329255
+ if (!fragmentElement)
329256
+ return null;
329257
+ if (enforceKnownBlockIds && !blockIds.has(blockId))
329258
+ return null;
329259
+ const pos = resolvePositionWithinFragmentDom(fragmentElement, clientX, clientY);
329260
+ if (pos == null)
329261
+ return null;
329262
+ return {
329263
+ pos,
329264
+ layoutEpoch: readLayoutEpochFromDom(fragmentElement, clientX, clientY) ?? layout.layoutEpoch ?? 0,
329265
+ blockId,
329266
+ pageIndex: this.#resolveRenderedPageIndexForElement(fragmentElement),
329267
+ column: 0,
329268
+ lineIndex: -1
329269
+ };
329270
+ };
329271
+ if (elementsFromPoint) {
329272
+ for (const element3 of elementsFromPoint(clientX, clientY)) {
329273
+ const hit = tryResolve(element3, true);
329274
+ if (hit)
329275
+ return hit;
329276
+ }
329277
+ for (const element3 of elementsFromPoint(clientX, clientY)) {
329278
+ if (!element3.closest(".superdoc-page-header, .superdoc-page-footer"))
329279
+ continue;
329280
+ const hit = tryResolve(element3, false);
329281
+ if (hit)
329282
+ return hit;
329283
+ }
329284
+ }
329285
+ const surfaceSelector = context.region.kind === "footer" ? ".superdoc-page-footer" : ".superdoc-page-header";
329286
+ const surface = getPageElementByIndex(this.#viewportHost, context.region.pageIndex)?.querySelector(surfaceSelector) ?? null;
329287
+ if (surface instanceof HTMLElement) {
329288
+ const fragments = Array.from(surface.querySelectorAll(".superdoc-fragment"));
329289
+ for (const fragment of fragments) {
329290
+ const rect = fragment.getBoundingClientRect();
329291
+ if (clientX < rect.left || clientX > rect.right || clientY < rect.top || clientY > rect.bottom)
329292
+ continue;
329293
+ const hit = tryResolve(fragment, false);
329294
+ if (hit)
329295
+ return hit;
329296
+ }
329297
+ }
329298
+ return null;
329299
+ }
328998
329300
  #createCollapsedSelectionNearInlineContent(doc$12, pos) {
328999
329301
  const clampedPos = Math.max(0, Math.min(pos, doc$12.content.size));
329000
329302
  const directSelection = TextSelection.create(doc$12, clampedPos);
@@ -330514,11 +330816,11 @@ function print() { __p += __j.call(arguments, '') }
330514
330816
  ];
330515
330817
  });
330516
330818
 
330517
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-Cj3mqS9_.es.js
330819
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-fxrCn5X_.es.js
330518
330820
  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();
330821
+ var init_create_super_doc_ui_fxrCn5X__es = __esm(() => {
330822
+ init_SuperConverter_BecdrRIX_es();
330823
+ init_create_headless_toolbar_DCeIAH_W_es();
330522
330824
  MOD_ALIASES = new Set([
330523
330825
  "Mod",
330524
330826
  "Meta",
@@ -330560,16 +330862,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
330560
330862
 
330561
330863
  // ../../packages/superdoc/dist/super-editor.es.js
330562
330864
  var init_super_editor_es = __esm(() => {
330563
- init_src_tOywM1hR_es();
330564
- init_SuperConverter_CjDkqrj8_es();
330865
+ init_src_AOxYjda5_es();
330866
+ init_SuperConverter_BecdrRIX_es();
330565
330867
  init_jszip_C49i9kUs_es();
330566
330868
  init_xml_js_CqGKpaft_es();
330567
- init_create_headless_toolbar_pGestihw_es();
330869
+ init_create_headless_toolbar_DCeIAH_W_es();
330568
330870
  init_constants_DrU4EASo_es();
330569
330871
  init_dist_B8HfvhaK_es();
330570
330872
  init_unified_Dsuw2be5_es();
330571
330873
  init_DocxZipper_Dh4RtvcE_es();
330572
- init_create_super_doc_ui_Cj3mqS9__es();
330874
+ init_create_super_doc_ui_fxrCn5X__es();
330573
330875
  init_ui_CGB3qmy3_es();
330574
330876
  init_eventemitter3_UwU_CLPU_es();
330575
330877
  init_errors_C_DoKMoN_es();
@@ -331861,7 +332163,7 @@ var init_inline_run_patch = __esm(() => {
331861
332163
  runAttribute2("rtl", "boolean", "w:rtl", schemaBooleanOrNull2()),
331862
332164
  runAttribute2("cs", "boolean", "w:cs", schemaBooleanOrNull2()),
331863
332165
  runAttribute2("bCs", "boolean", "w:bCs", schemaBooleanOrNull2(), "boldCs"),
331864
- runAttribute2("iCs", "boolean", "w:iCs", schemaBooleanOrNull2()),
332166
+ runAttribute2("iCs", "boolean", "w:iCs", schemaBooleanOrNull2(), "italicCs"),
331865
332167
  runAttribute2("eastAsianLayout", "object", "w:eastAsianLayout", schemaObjectOrNull2({
331866
332168
  id: { oneOf: [{ type: "string", minLength: 1 }, { type: "null" }] },
331867
332169
  combine: { oneOf: [{ type: "boolean" }, { type: "null" }] },
@@ -386484,7 +386786,7 @@ var translator91;
386484
386786
  var init_iCs_translator = __esm(() => {
386485
386787
  init_node_translator2();
386486
386788
  init_utils();
386487
- translator91 = NodeTranslator3.from(createSingleBooleanPropertyHandler2("w:iCs"));
386789
+ translator91 = NodeTranslator3.from(createSingleBooleanPropertyHandler2("w:iCs", "italicCs"));
386488
386790
  });
386489
386791
 
386490
386792
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/webHidden/webHidden-translator.js
@@ -393312,11 +393614,15 @@ var XML_NODE_NAME12 = "w:r", SD_KEY_NAME2 = "run", REFERENCE_RUN_STYLE_BY_XML_NA
393312
393614
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext2(node4);
393313
393615
  const runTrackFormatMark = findTrackFormatMark2(runNodeForExport.marks);
393314
393616
  const runAttrs = runNodeForExport.attrs || {};
393315
- const runProperties = runAttrs.runProperties || {};
393617
+ const rawRunProperties = runAttrs.runProperties || {};
393618
+ const runProperties = rawRunProperties?.italicCs == null && rawRunProperties?.iCs != null ? { ...rawRunProperties, italicCs: rawRunProperties.iCs } : rawRunProperties;
393316
393619
  const inlineKeys = runAttrs.runPropertiesInlineKeys;
393317
393620
  const styleKeys = runAttrs.runPropertiesStyleKeys;
393318
393621
  const overrideKeys = runAttrs.runPropertiesOverrideKeys;
393319
393622
  const candidateKeys = inlineKeys != null ? [...new Set([...inlineKeys || [], ...overrideKeys || []])] : Object.keys(runProperties);
393623
+ if (candidateKeys.includes("iCs") && !candidateKeys.includes("italicCs")) {
393624
+ candidateKeys.push("italicCs");
393625
+ }
393320
393626
  const shouldExport = (key2) => (key2 in (runProperties || {})) && (!(Array.isArray(styleKeys) && styleKeys.includes(key2)) || Array.isArray(overrideKeys) && overrideKeys.includes(key2));
393321
393627
  const exportKeys = candidateKeys.filter(shouldExport);
393322
393628
  const runPropertiesToExport = exportKeys.length > 0 ? Object.fromEntries(exportKeys.map((k2) => [k2, runProperties[k2]])) : {};
@@ -426316,6 +426622,11 @@ function decodeRPrFromMarks2(marks) {
426316
426622
  case "italic":
426317
426623
  case "bold":
426318
426624
  runProperties[type] = mark2.attrs.value !== "0" && mark2.attrs.value !== false;
426625
+ if (type === "bold") {
426626
+ runProperties.boldCs = runProperties.bold;
426627
+ } else if (type === "italic") {
426628
+ runProperties.italicCs = runProperties.italic;
426629
+ }
426319
426630
  break;
426320
426631
  case "underline": {
426321
426632
  const { underlineType, underlineColor, underlineThemeColor, underlineThemeTint, underlineThemeShade } = mark2.attrs;
@@ -426369,7 +426680,9 @@ function decodeRPrFromMarks2(marks) {
426369
426680
  case "fontSize": {
426370
426681
  const points = parseFloat(value);
426371
426682
  if (!isNaN(points)) {
426372
- runProperties.fontSize = points * 2;
426683
+ const halfPoints = points * 2;
426684
+ runProperties.fontSize = halfPoints;
426685
+ runProperties.fontSizeCs = halfPoints;
426373
426686
  }
426374
426687
  break;
426375
426688
  }
@@ -426546,12 +426859,15 @@ var init_calculateInlineRunPropertiesPlugin = __esm(() => {
426546
426859
  RUN_PROPERTIES_DERIVED_FROM_MARKS2 = new Set([
426547
426860
  "strike",
426548
426861
  "italic",
426862
+ "italicCs",
426549
426863
  "bold",
426864
+ "boldCs",
426550
426865
  "underline",
426551
426866
  "highlight",
426552
426867
  "textTransform",
426553
426868
  "color",
426554
426869
  "fontSize",
426870
+ "fontSizeCs",
426555
426871
  "letterSpacing",
426556
426872
  "fontFamily",
426557
426873
  "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.71",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"