@harbour-enterprises/superdoc 1.0.0-beta.96 → 1.0.0-beta.97

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-Cdp1WJ9e.es.js → PdfViewer-BHcBfUWj.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-BGTfnD4T.cjs → PdfViewer-YvkZg201.cjs} +1 -1
  3. package/dist/chunks/{index-C-IS20yQ.cjs → index-DZ_AI-HW.cjs} +3 -3
  4. package/dist/chunks/{index-BV9YtiyI.es.js → index-DeQfFbTb.es.js} +3 -3
  5. package/dist/chunks/{index-lfdM_gm7-qtx-V4oF.cjs → index-Pvlqsxge-IH3eauKE.cjs} +1 -1
  6. package/dist/chunks/{index-lfdM_gm7-_EQjLyqH.es.js → index-Pvlqsxge-vW641SZt.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-D2zn943K.cjs → super-editor.es-BP3PKkwh.cjs} +190 -72
  8. package/dist/chunks/{super-editor.es-De2XS3A1.es.js → super-editor.es-BinyZw4F.es.js} +190 -72
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-B29ATZFC.js → converter-BEVM5t3i.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-BPktKUBx.js → docx-zipper-vETk3IMG.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-BRHMYtPA.js → editor-B8k1bwD_.js} +191 -73
  13. package/dist/super-editor/chunks/{index-lfdM_gm7.js → index-Pvlqsxge.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CB2cJCLh.js → toolbar-j1GSUGWU.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +192 -74
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -42404,7 +42404,7 @@ const _SuperConverter = class _SuperConverter2 {
42404
42404
  static getStoredSuperdocVersion(docx) {
42405
42405
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42406
42406
  }
42407
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.96") {
42407
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.97") {
42408
42408
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42409
42409
  }
42410
42410
  /**
@@ -59622,7 +59622,7 @@ const isHeadless = (editor) => {
59622
59622
  const shouldSkipNodeView = (editor) => {
59623
59623
  return isHeadless(editor);
59624
59624
  };
59625
- const summaryVersion = "1.0.0-beta.96";
59625
+ const summaryVersion = "1.0.0-beta.97";
59626
59626
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59627
59627
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59628
59628
  function mapAttributes(attrs) {
@@ -60411,7 +60411,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60411
60411
  { default: remarkStringify },
60412
60412
  { default: remarkGfm }
60413
60413
  ] = await Promise.all([
60414
- import("./index-lfdM_gm7-_EQjLyqH.es.js"),
60414
+ import("./index-Pvlqsxge-vW641SZt.es.js"),
60415
60415
  import("./index-DRCvimau-Cw339678.es.js"),
60416
60416
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60417
60417
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60616,7 +60616,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60616
60616
  * Process collaboration migrations
60617
60617
  */
60618
60618
  processCollaborationMigrations() {
60619
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.96");
60619
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.97");
60620
60620
  if (!this.options.ydoc) return;
60621
60621
  const metaMap = this.options.ydoc.getMap("meta");
60622
60622
  let docVersion = metaMap.get("version");
@@ -62940,12 +62940,12 @@ var SectionType = /* @__PURE__ */ ((SectionType2) => {
62940
62940
  })(SectionType || {});
62941
62941
  const DEFAULT_PARAGRAPH_SECTION_TYPE = "nextPage";
62942
62942
  const DEFAULT_BODY_SECTION_TYPE = "continuous";
62943
- const TWIPS_PER_INCH$3 = 1440;
62944
- const PX_PER_INCH$2 = 96;
62943
+ const TWIPS_PER_INCH$4 = 1440;
62944
+ const PX_PER_INCH$3 = 96;
62945
62945
  const DEFAULT_COLUMN_GAP_INCHES = 0.5;
62946
62946
  function twipsToPixels$1(twips) {
62947
62947
  const n = Number(twips);
62948
- return Number.isFinite(n) ? n / TWIPS_PER_INCH$3 * PX_PER_INCH$2 : void 0;
62948
+ return Number.isFinite(n) ? n / TWIPS_PER_INCH$4 * PX_PER_INCH$3 : void 0;
62949
62949
  }
62950
62950
  function parseColumnCount(rawValue) {
62951
62951
  if (rawValue == null) return 1;
@@ -62955,7 +62955,7 @@ function parseColumnCount(rawValue) {
62955
62955
  function parseColumnGap(gapTwips) {
62956
62956
  if (gapTwips == null) return DEFAULT_COLUMN_GAP_INCHES;
62957
62957
  const gap = Number(gapTwips);
62958
- return Number.isFinite(gap) ? gap / TWIPS_PER_INCH$3 : DEFAULT_COLUMN_GAP_INCHES;
62958
+ return Number.isFinite(gap) ? gap / TWIPS_PER_INCH$4 : DEFAULT_COLUMN_GAP_INCHES;
62959
62959
  }
62960
62960
  function extractNormalizedMargins(attrs) {
62961
62961
  const sectionMargins = attrs.sectionMargins;
@@ -63039,7 +63039,7 @@ function extractColumns(elements) {
63039
63039
  const gapInches = parseColumnGap(cols.attributes["w:space"]);
63040
63040
  return {
63041
63041
  count,
63042
- gap: gapInches * PX_PER_INCH$2
63042
+ gap: gapInches * PX_PER_INCH$3
63043
63043
  };
63044
63044
  }
63045
63045
  function extractVerticalAlign(elements) {
@@ -63275,8 +63275,8 @@ function analyzeSectionRanges(doc2, bodySectPr) {
63275
63275
  }
63276
63276
  return ranges;
63277
63277
  }
63278
- const TWIPS_PER_INCH$2 = 1440;
63279
- const PX_PER_INCH$1 = 96;
63278
+ const TWIPS_PER_INCH$3 = 1440;
63279
+ const PX_PER_INCH$2 = 96;
63280
63280
  const PX_PER_PT = 96 / 72;
63281
63281
  SectionType.NEXT_PAGE;
63282
63282
  SectionType.CONTINUOUS;
@@ -63415,7 +63415,7 @@ const applyTrackedChangesModeToRuns = (runs, config2, hyperlinkConfig, applyMark
63415
63415
  }
63416
63416
  return filtered;
63417
63417
  };
63418
- const twipsToPx$1 = (value) => value / TWIPS_PER_INCH$2 * PX_PER_INCH$1;
63418
+ const twipsToPx$2 = (value) => value / TWIPS_PER_INCH$3 * PX_PER_INCH$2;
63419
63419
  const ptToPx = (pt) => {
63420
63420
  if (pt == null || !Number.isFinite(pt)) return void 0;
63421
63421
  return pt * PX_PER_PT;
@@ -64925,8 +64925,8 @@ const normalizeParagraphSpacing = (value) => {
64925
64925
  const beforeAutospacing = toBooleanFlag(source.beforeAutospacing ?? source.beforeAutoSpacing);
64926
64926
  const afterAutospacing = toBooleanFlag(source.afterAutospacing ?? source.afterAutoSpacing);
64927
64927
  const contextualSpacing = toBooleanFlag(source.contextualSpacing);
64928
- const before = beforeRaw != null ? twipsToPx$1(beforeRaw) : pickNumber(source.lineSpaceBefore);
64929
- const after = afterRaw != null ? twipsToPx$1(afterRaw) : pickNumber(source.lineSpaceAfter);
64928
+ const before = beforeRaw != null ? twipsToPx$2(beforeRaw) : pickNumber(source.lineSpaceBefore);
64929
+ const after = afterRaw != null ? twipsToPx$2(afterRaw) : pickNumber(source.lineSpaceAfter);
64930
64930
  const line = normalizeLineValue(lineRaw, lineRule);
64931
64931
  if (before != null) spacing.before = before;
64932
64932
  if (after != null) spacing.after = after;
@@ -64956,9 +64956,9 @@ const normalizeLineValue = (value, lineRule) => {
64956
64956
  if (value > 0 && value <= MAX_AUTO_LINE_MULTIPLIER) {
64957
64957
  return value;
64958
64958
  }
64959
- return twipsToPx$1(value);
64959
+ return twipsToPx$2(value);
64960
64960
  }
64961
- return twipsToPx$1(value);
64961
+ return twipsToPx$2(value);
64962
64962
  };
64963
64963
  const normalizeLineRule = (value) => {
64964
64964
  if (value === "auto" || value === "exact" || value === "atLeast") {
@@ -64995,7 +64995,7 @@ const normalizeParagraphIndent = (value) => {
64995
64995
  if (Math.abs(num) <= TWIPS_THRESHOLD$1) {
64996
64996
  return num;
64997
64997
  }
64998
- return twipsToPx$1(Number(num));
64998
+ return twipsToPx$2(Number(num));
64999
64999
  };
65000
65000
  const left2 = convert(pickNumber(source.left));
65001
65001
  const right2 = convert(pickNumber(source.right));
@@ -65575,9 +65575,9 @@ const buildFontCss = (run2) => {
65575
65575
  const family = run2.fontFamily ?? "Times New Roman";
65576
65576
  return `${style2}${weight}${size2} ${family}`;
65577
65577
  };
65578
- const TWIPS_PER_INCH$1 = 1440;
65578
+ const TWIPS_PER_INCH$2 = 1440;
65579
65579
  const PIXELS_PER_INCH = 96;
65580
- const TWIPS_PER_PIXEL = Math.round(TWIPS_PER_INCH$1 / PIXELS_PER_INCH);
65580
+ const TWIPS_PER_PIXEL = Math.round(TWIPS_PER_INCH$2 / PIXELS_PER_INCH);
65581
65581
  const PIXELS_PER_TWIP = 1 / TWIPS_PER_PIXEL;
65582
65582
  const toFiniteNumber = (value) => {
65583
65583
  if (value == null) return null;
@@ -66601,7 +66601,7 @@ const extractMarkerRun = (lvl) => {
66601
66601
  }
66602
66602
  const spacingTwips = parseNumberAttr(getAttribute(findChild(rPr, "w:spacing"), "w:val"));
66603
66603
  if (spacingTwips != null && Number.isFinite(spacingTwips)) {
66604
- run2.letterSpacing = twipsToPx$1(spacingTwips);
66604
+ run2.letterSpacing = twipsToPx$2(spacingTwips);
66605
66605
  }
66606
66606
  return Object.keys(run2).length ? run2 : void 0;
66607
66607
  };
@@ -66825,10 +66825,19 @@ const buildNumberingPath = (numId, ilvl, counterValue, listCounterContext) => {
66825
66825
  const convertIndentTwipsToPx = (indent) => {
66826
66826
  if (!indent) return void 0;
66827
66827
  const result = {};
66828
- if (isFiniteNumber(indent.left)) result.left = twipsToPx$1(Number(indent.left));
66829
- if (isFiniteNumber(indent.right)) result.right = twipsToPx$1(Number(indent.right));
66830
- if (isFiniteNumber(indent.firstLine)) result.firstLine = twipsToPx$1(Number(indent.firstLine));
66831
- if (isFiniteNumber(indent.hanging)) result.hanging = twipsToPx$1(Number(indent.hanging));
66828
+ const toNum = (v2) => {
66829
+ if (typeof v2 === "string" && v2.trim() !== "" && isFinite(Number(v2))) return Number(v2);
66830
+ if (isFiniteNumber(v2)) return Number(v2);
66831
+ return void 0;
66832
+ };
66833
+ const left2 = toNum(indent.left);
66834
+ const right2 = toNum(indent.right);
66835
+ const firstLine = toNum(indent.firstLine);
66836
+ const hanging = toNum(indent.hanging);
66837
+ if (left2 != null) result.left = twipsToPx$2(left2);
66838
+ if (right2 != null) result.right = twipsToPx$2(right2);
66839
+ if (firstLine != null) result.firstLine = twipsToPx$2(firstLine);
66840
+ if (hanging != null) result.hanging = twipsToPx$2(hanging);
66832
66841
  return Object.keys(result).length > 0 ? result : void 0;
66833
66842
  };
66834
66843
  const toAdapterNumberingProps = (value) => {
@@ -66853,7 +66862,7 @@ const toResolvedTabStops = (tabs) => {
66853
66862
  if (!stop || typeof stop.pos !== "number") continue;
66854
66863
  const alignment2 = normalizeResolvedTabAlignment(stop.val);
66855
66864
  if (!alignment2) continue;
66856
- const position = twipsToPx$1(stop.pos);
66865
+ const position = twipsToPx$2(stop.pos);
66857
66866
  if (!Number.isFinite(position)) continue;
66858
66867
  const resolvedStop = {
66859
66868
  position,
@@ -67294,9 +67303,9 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67294
67303
  const vAnchor = asString2(framePr["w:vAnchor"] ?? framePr.vAnchor);
67295
67304
  if (vAnchor) frame.vAnchor = vAnchor;
67296
67305
  const xTwips = pickNumber(framePr["w:x"] ?? framePr.x);
67297
- if (xTwips != null) frame.x = twipsToPx$1(xTwips);
67306
+ if (xTwips != null) frame.x = twipsToPx$2(xTwips);
67298
67307
  const yTwips = pickNumber(framePr["w:y"] ?? framePr.y);
67299
- if (yTwips != null) frame.y = twipsToPx$1(yTwips);
67308
+ if (yTwips != null) frame.y = twipsToPx$2(yTwips);
67300
67309
  if (Object.keys(frame).length > 0) {
67301
67310
  paragraphAttrs.frame = frame;
67302
67311
  }
@@ -67384,7 +67393,29 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
67384
67393
  }
67385
67394
  }
67386
67395
  }
67387
- const wordLayout = computeWordLayoutForParagraph(paragraphAttrs, enrichedNumberingProps, styleContext);
67396
+ let wordLayout = computeWordLayoutForParagraph(paragraphAttrs, enrichedNumberingProps, styleContext);
67397
+ if (!wordLayout && enrichedNumberingProps.resolvedLevelIndent) {
67398
+ const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
67399
+ const firstLinePx = resolvedIndentPx?.firstLine ?? 0;
67400
+ if (firstLinePx > 0) {
67401
+ wordLayout = {
67402
+ // Treat as first-line-indent mode: text starts after the marker+firstLine offset.
67403
+ firstLineIndentMode: true,
67404
+ textStartPx: firstLinePx
67405
+ };
67406
+ }
67407
+ }
67408
+ if (wordLayout && (!wordLayout.textStartPx || !Number.isFinite(wordLayout.textStartPx)) && enrichedNumberingProps.resolvedLevelIndent) {
67409
+ const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
67410
+ const firstLinePx = resolvedIndentPx?.firstLine ?? 0;
67411
+ if (firstLinePx > 0) {
67412
+ wordLayout = {
67413
+ ...wordLayout,
67414
+ firstLineIndentMode: wordLayout.firstLineIndentMode ?? true,
67415
+ textStartPx: firstLinePx
67416
+ };
67417
+ }
67418
+ }
67388
67419
  if (wordLayout) {
67389
67420
  if (wordLayout.marker) {
67390
67421
  if (listRendering?.markerText) {
@@ -69295,7 +69326,7 @@ const measurementToPx = (value) => {
69295
69326
  const entry = value;
69296
69327
  if (typeof entry.value !== "number") return void 0;
69297
69328
  if (!entry.type || entry.type === "px" || entry.type === "pixel") return entry.value;
69298
- if (entry.type === "dxa") return twipsToPx$1(entry.value);
69329
+ if (entry.type === "dxa") return twipsToPx$2(entry.value);
69299
69330
  return void 0;
69300
69331
  };
69301
69332
  const normalizeTableWidth = (value) => {
@@ -69307,7 +69338,7 @@ const normalizeTableWidth = (value) => {
69307
69338
  return { width: raw, type: measurement.type ?? "px" };
69308
69339
  }
69309
69340
  if (measurement.type === "dxa") {
69310
- return { width: twipsToPx$1(raw), type: "px" };
69341
+ return { width: twipsToPx$2(raw), type: "px" };
69311
69342
  }
69312
69343
  return { width: raw, type: measurement.type };
69313
69344
  };
@@ -69335,13 +69366,13 @@ const extractTableStyleParagraphProps = (styleId, docx) => {
69335
69366
  const line = parseIntSafe$1(attrs["w:line"]);
69336
69367
  const rawLineRule = attrs["w:lineRule"];
69337
69368
  const lineRule = rawLineRule === "auto" || rawLineRule === "exact" || rawLineRule === "atLeast" ? rawLineRule : void 0;
69338
- if (before != null) spacing.before = twipsToPx$1(before);
69339
- if (after != null) spacing.after = twipsToPx$1(after);
69369
+ if (before != null) spacing.before = twipsToPx$2(before);
69370
+ if (after != null) spacing.after = twipsToPx$2(after);
69340
69371
  if (line != null) {
69341
69372
  if (lineRule === "auto") {
69342
69373
  spacing.line = line / 240;
69343
69374
  } else {
69344
- spacing.line = twipsToPx$1(line);
69375
+ spacing.line = twipsToPx$2(line);
69345
69376
  }
69346
69377
  }
69347
69378
  if (lineRule) spacing.lineRule = lineRule;
@@ -69367,7 +69398,7 @@ const normalizeRowHeight = (rowProps) => {
69367
69398
  if (rawValue == null) return void 0;
69368
69399
  const rawRule = heightObj.rule ?? heightObj.hRule;
69369
69400
  const rule = rawRule === "exact" || rawRule === "atLeast" || rawRule === "auto" ? rawRule : "atLeast";
69370
- const valuePx = twipsToPx$1(rawValue);
69401
+ const valuePx = twipsToPx$2(rawValue);
69371
69402
  return {
69372
69403
  value: valuePx,
69373
69404
  rule
@@ -69617,10 +69648,10 @@ function extractFloatingTableAnchorWrap(node) {
69617
69648
  anchor.alignV = floatingProps.tblpYSpec;
69618
69649
  }
69619
69650
  if (floatingProps.tblpX !== void 0) {
69620
- anchor.offsetH = twipsToPx$1(floatingProps.tblpX);
69651
+ anchor.offsetH = twipsToPx$2(floatingProps.tblpX);
69621
69652
  }
69622
69653
  if (floatingProps.tblpY !== void 0) {
69623
- anchor.offsetV = twipsToPx$1(floatingProps.tblpY);
69654
+ anchor.offsetV = twipsToPx$2(floatingProps.tblpY);
69624
69655
  }
69625
69656
  const hasDistances = floatingProps.leftFromText !== void 0 || floatingProps.rightFromText !== void 0 || floatingProps.topFromText !== void 0 || floatingProps.bottomFromText !== void 0;
69626
69657
  const wrap2 = {
@@ -69631,16 +69662,16 @@ function extractFloatingTableAnchorWrap(node) {
69631
69662
  };
69632
69663
  if (hasDistances) {
69633
69664
  if (floatingProps.topFromText !== void 0) {
69634
- wrap2.distTop = twipsToPx$1(floatingProps.topFromText);
69665
+ wrap2.distTop = twipsToPx$2(floatingProps.topFromText);
69635
69666
  }
69636
69667
  if (floatingProps.bottomFromText !== void 0) {
69637
- wrap2.distBottom = twipsToPx$1(floatingProps.bottomFromText);
69668
+ wrap2.distBottom = twipsToPx$2(floatingProps.bottomFromText);
69638
69669
  }
69639
69670
  if (floatingProps.leftFromText !== void 0) {
69640
- wrap2.distLeft = twipsToPx$1(floatingProps.leftFromText);
69671
+ wrap2.distLeft = twipsToPx$2(floatingProps.leftFromText);
69641
69672
  }
69642
69673
  if (floatingProps.rightFromText !== void 0) {
69643
- wrap2.distRight = twipsToPx$1(floatingProps.rightFromText);
69674
+ wrap2.distRight = twipsToPx$2(floatingProps.rightFromText);
69644
69675
  }
69645
69676
  }
69646
69677
  return { anchor, wrap: wrap2 };
@@ -76813,7 +76844,7 @@ const _DomPainter = class _DomPainter2 {
76813
76844
  }
76814
76845
  const runsForLine = sliceRunsForLine(block, line);
76815
76846
  const trackedConfig = this.resolveTrackedChangesConfig(block);
76816
- const textSlices = runsForLine.length > 0 ? runsForLine.filter((r2) => (r2.kind === "text" || r2.kind === void 0) && "text" in r2 && r2.text != null).map((r2) => r2.text) : gatherTextSlicesForLine(block, line);
76847
+ runsForLine.length > 0 ? runsForLine.filter((r2) => (r2.kind === "text" || r2.kind === void 0) && "text" in r2 && r2.text != null).map((r2) => r2.text) : gatherTextSlicesForLine(block, line);
76817
76848
  if (runsForLine.length === 0) {
76818
76849
  const span = this.doc.createElement("span");
76819
76850
  span.innerHTML = "&nbsp;";
@@ -76860,19 +76891,7 @@ const _DomPainter = class _DomPainter2 {
76860
76891
  });
76861
76892
  }
76862
76893
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
76863
- const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
76864
- const shouldJustify = !skipJustify && effectiveAlignment === "justify" && !hasExplicitPositioning;
76865
- if (shouldJustify) {
76866
- const spaceCount = textSlices.reduce(
76867
- (sum, s2) => sum + Array.from(s2).filter((ch) => ch === " " || ch === " ").length,
76868
- 0
76869
- );
76870
- const slack = availableWidth - line.width;
76871
- if (spaceCount > 0 && slack !== 0) {
76872
- const spacingPerSpace = slack / spaceCount;
76873
- el.style.wordSpacing = `${spacingPerSpace}px`;
76874
- }
76875
- }
76894
+ availableWidthOverride ?? line.maxWidth ?? line.width;
76876
76895
  if (hasExplicitPositioning && line.segments) {
76877
76896
  const paraIndent = block.attrs?.indent;
76878
76897
  const indentLeft = paraIndent?.left ?? 0;
@@ -82194,7 +82213,13 @@ function getCtx() {
82194
82213
  return ctx$1;
82195
82214
  }
82196
82215
  function isTextRun(run2) {
82197
- return run2.kind === "tab" ? false : true;
82216
+ if (run2.kind === "tab" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation") {
82217
+ return false;
82218
+ }
82219
+ if ("src" in run2) {
82220
+ return false;
82221
+ }
82222
+ return true;
82198
82223
  }
82199
82224
  function fontString(run2) {
82200
82225
  const textRun = isTextRun(run2) ? run2 : null;
@@ -82207,6 +82232,42 @@ function fontString(run2) {
82207
82232
  function runText(run2) {
82208
82233
  return "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
82209
82234
  }
82235
+ const DEFAULT_TAB_INTERVAL_TWIPS$1 = 720;
82236
+ const TWIPS_PER_INCH$1 = 1440;
82237
+ const PX_PER_INCH$1 = 96;
82238
+ const TWIPS_PER_PX$1 = TWIPS_PER_INCH$1 / PX_PER_INCH$1;
82239
+ const TAB_EPSILON$1 = 0.1;
82240
+ const WIDTH_FUDGE_PX = 0.5;
82241
+ const twipsToPx$1 = (twips) => twips / TWIPS_PER_PX$1;
82242
+ const pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1);
82243
+ const buildTabStopsPx$1 = (indent, tabs, tabIntervalTwips) => {
82244
+ const paragraphIndentTwips = {
82245
+ left: pxToTwips$1(Math.max(0, indent?.left ?? 0)),
82246
+ right: pxToTwips$1(Math.max(0, indent?.right ?? 0)),
82247
+ firstLine: pxToTwips$1(Math.max(0, indent?.firstLine ?? 0)),
82248
+ hanging: pxToTwips$1(Math.max(0, indent?.hanging ?? 0))
82249
+ };
82250
+ const stops = computeTabStops$1({
82251
+ explicitStops: tabs ?? [],
82252
+ defaultTabInterval: tabIntervalTwips ?? DEFAULT_TAB_INTERVAL_TWIPS$1,
82253
+ paragraphIndent: paragraphIndentTwips
82254
+ });
82255
+ return stops.map((stop) => ({
82256
+ pos: twipsToPx$1(stop.pos),
82257
+ val: stop.val,
82258
+ leader: stop.leader
82259
+ }));
82260
+ };
82261
+ const getNextTabStopPx$1 = (currentX, tabStops, startIndex) => {
82262
+ let index2 = startIndex;
82263
+ while (index2 < tabStops.length && tabStops[index2].pos <= currentX + TAB_EPSILON$1) {
82264
+ index2 += 1;
82265
+ }
82266
+ if (index2 < tabStops.length) {
82267
+ return { target: tabStops[index2].pos, nextIndex: index2 + 1 };
82268
+ }
82269
+ return { target: currentX + twipsToPx$1(DEFAULT_TAB_INTERVAL_TWIPS$1), nextIndex: index2 };
82270
+ };
82210
82271
  function measureRunSliceWidth(run2, fromChar, toChar) {
82211
82272
  const context = getCtx();
82212
82273
  const text = runText(run2).slice(fromChar, toChar);
@@ -82230,13 +82291,38 @@ function lineHeightForRuns(runs, fromRun, toRun) {
82230
82291
  return maxSize2 * 1.2;
82231
82292
  }
82232
82293
  function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
82294
+ if (!Number.isFinite(maxWidth) || maxWidth <= 0) {
82295
+ throw new Error(`remeasureParagraph: maxWidth must be a positive number, got ${maxWidth}`);
82296
+ }
82297
+ if (!Number.isFinite(firstLineIndent)) {
82298
+ throw new Error(`remeasureParagraph: firstLineIndent must be a finite number, got ${firstLineIndent}`);
82299
+ }
82300
+ if (!block) {
82301
+ throw new Error("remeasureParagraph: block must be defined");
82302
+ }
82303
+ if (!Array.isArray(block.runs)) {
82304
+ throw new Error(`remeasureParagraph: block.runs must be an array, got ${typeof block.runs}`);
82305
+ }
82233
82306
  const runs = block.runs ?? [];
82234
82307
  const lines = [];
82308
+ const attrs = block.attrs;
82309
+ const indent = attrs?.indent;
82310
+ const wordLayout = attrs?.wordLayout;
82311
+ const indentLeft = Math.max(0, indent?.left ?? 0);
82312
+ const indentRight = Math.max(0, indent?.right ?? 0);
82313
+ const indentFirstLine = Math.max(0, indent?.firstLine ?? 0);
82314
+ const indentHanging = Math.max(0, indent?.hanging ?? 0);
82315
+ const rawFirstLineOffset = Math.max(0, firstLineIndent || indentFirstLine - indentHanging);
82316
+ const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
82317
+ const textStartPx = wordLayout?.textStartPx;
82318
+ const treatAsHanging = textStartPx && indentLeft === 0 && indentHanging === 0;
82319
+ const firstLineWidth = typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging ? Math.max(1, maxWidth - textStartPx - indentRight) : Math.max(1, contentWidth - rawFirstLineOffset);
82320
+ const tabStops = buildTabStopsPx$1(indent, attrs?.tabs, attrs?.tabIntervalTwips);
82235
82321
  let currentRun = 0;
82236
82322
  let currentChar = 0;
82237
82323
  while (currentRun < runs.length) {
82238
82324
  const isFirstLine = lines.length === 0;
82239
- const effectiveMaxWidth = isFirstLine ? maxWidth - firstLineIndent : maxWidth;
82325
+ const effectiveMaxWidth = Math.max(1, isFirstLine ? firstLineWidth : contentWidth);
82240
82326
  const startRun = currentRun;
82241
82327
  const startChar = currentChar;
82242
82328
  let width = 0;
@@ -82244,13 +82330,26 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
82244
82330
  let lastBreakChar = -1;
82245
82331
  let endRun = currentRun;
82246
82332
  let endChar = currentChar;
82333
+ let tabStopCursor = 0;
82334
+ let didBreakInThisLine = false;
82247
82335
  for (let r2 = currentRun; r2 < runs.length; r2 += 1) {
82248
82336
  const run2 = runs[r2];
82337
+ if (run2.kind === "tab") {
82338
+ const { target, nextIndex } = getNextTabStopPx$1(width, tabStops, tabStopCursor);
82339
+ const tabAdvance = Math.max(0, target - width);
82340
+ width += tabAdvance;
82341
+ tabStopCursor = nextIndex;
82342
+ endRun = r2;
82343
+ endChar = 1;
82344
+ lastBreakRun = r2;
82345
+ lastBreakChar = 1;
82346
+ continue;
82347
+ }
82249
82348
  const text = runText(run2);
82250
82349
  const start2 = r2 === currentRun ? currentChar : 0;
82251
82350
  for (let c2 = start2; c2 < text.length; c2 += 1) {
82252
82351
  const w2 = measureRunSliceWidth(run2, c2, c2 + 1);
82253
- if (width + w2 > effectiveMaxWidth && width > 0) {
82352
+ if (width + w2 > effectiveMaxWidth - WIDTH_FUDGE_PX && width > 0) {
82254
82353
  if (lastBreakRun >= 0) {
82255
82354
  endRun = lastBreakRun;
82256
82355
  endChar = lastBreakChar;
@@ -82258,6 +82357,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
82258
82357
  endRun = r2;
82259
82358
  endChar = c2;
82260
82359
  }
82360
+ didBreakInThisLine = true;
82261
82361
  break;
82262
82362
  }
82263
82363
  width += w2;
@@ -82269,9 +82369,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
82269
82369
  lastBreakChar = c2 + 1;
82270
82370
  }
82271
82371
  }
82272
- if (endRun !== r2 || endRun === r2 && (r2 === lastBreakRun ? endChar === lastBreakChar : false)) {
82273
- break;
82274
- }
82372
+ if (didBreakInThisLine) break;
82275
82373
  }
82276
82374
  if (startRun === endRun && startChar === endChar) {
82277
82375
  endRun = startRun;
@@ -82285,11 +82383,15 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
82285
82383
  width,
82286
82384
  ascent: 0,
82287
82385
  descent: 0,
82288
- lineHeight: lineHeightForRuns(runs, startRun, endRun)
82386
+ lineHeight: lineHeightForRuns(runs, startRun, endRun),
82387
+ maxWidth: effectiveMaxWidth
82289
82388
  };
82290
82389
  lines.push(line);
82291
82390
  currentRun = endRun;
82292
82391
  currentChar = endChar;
82392
+ if (currentRun >= runs.length) {
82393
+ break;
82394
+ }
82293
82395
  if (currentChar >= runText(runs[currentRun]).length) {
82294
82396
  currentRun += 1;
82295
82397
  currentChar = 0;
@@ -84502,7 +84604,7 @@ async function measureBlock(block, constraints) {
84502
84604
  async function measureParagraphBlock(block, maxWidth) {
84503
84605
  const ctx2 = getCanvasContext();
84504
84606
  const wordLayout = block.attrs?.wordLayout;
84505
- const WIDTH_FUDGE_PX = 0.5;
84607
+ const WIDTH_FUDGE_PX2 = 0.5;
84506
84608
  const lines = [];
84507
84609
  const indent = block.attrs?.indent;
84508
84610
  const spacing = block.attrs?.spacing;
@@ -84518,7 +84620,8 @@ async function measureParagraphBlock(block, maxWidth) {
84518
84620
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
84519
84621
  let initialAvailableWidth;
84520
84622
  const textStartPx = wordLayout?.textStartPx;
84521
- if (typeof textStartPx === "number" && textStartPx > indentLeft) {
84623
+ const treatAsHanging = isWordLayoutList && indentLeft === 0 && hanging === 0 && typeof textStartPx === "number";
84624
+ if (typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging) {
84522
84625
  initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
84523
84626
  } else {
84524
84627
  initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
@@ -84565,6 +84668,21 @@ async function measureParagraphBlock(block, maxWidth) {
84565
84668
  totalHeight: metrics.lineHeight
84566
84669
  };
84567
84670
  }
84671
+ const isListLike = Boolean(block.attrs?.numId || wordLayout?.marker);
84672
+ if (isListLike) {
84673
+ console.log(
84674
+ "[measureParagraph][list]",
84675
+ JSON.stringify({
84676
+ blockId: block.id,
84677
+ maxWidth,
84678
+ indentLeft,
84679
+ indentRight,
84680
+ textStartPx: textStartPx ?? null,
84681
+ firstLineOffset: firstLineOffset ?? null,
84682
+ initialAvailableWidth
84683
+ })
84684
+ );
84685
+ }
84568
84686
  let currentLine = null;
84569
84687
  const getEffectiveWidth = (baseWidth) => {
84570
84688
  if (dropCapMeasure && lines.length < dropCapMeasure.lines && dropCapMeasure.mode === "drop") {
@@ -84972,7 +85090,7 @@ async function measureParagraphBlock(block, maxWidth) {
84972
85090
  };
84973
85091
  } else {
84974
85092
  const boundarySpacing = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
84975
- if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth - WIDTH_FUDGE_PX && currentLine.width > 0) {
85093
+ if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
84976
85094
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
84977
85095
  const { spaceCount: _sc, ...lineBase } = currentLine;
84978
85096
  const completedLine = {
@@ -85038,7 +85156,7 @@ async function measureParagraphBlock(block, maxWidth) {
85038
85156
  };
85039
85157
  } else {
85040
85158
  const boundarySpacing2 = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
85041
- if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX && currentLine.width > 0) {
85159
+ if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
85042
85160
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
85043
85161
  const { spaceCount: _sc, ...lineBase } = currentLine;
85044
85162
  const completedLine = { ...lineBase, ...metrics };
@@ -85096,7 +85214,7 @@ async function measureParagraphBlock(block, maxWidth) {
85096
85214
  const hasTabOnlyLine = currentLine && currentLine.segments.length === 0 && currentLine.width > 0;
85097
85215
  const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
85098
85216
  const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
85099
- const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX, font, ctx2, run2);
85217
+ const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX2, font, ctx2, run2);
85100
85218
  let chunkCharOffset = wordStartChar;
85101
85219
  for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
85102
85220
  const chunk = chunks[chunkIndex];
@@ -85118,7 +85236,7 @@ async function measureParagraphBlock(block, maxWidth) {
85118
85236
  });
85119
85237
  if (isLastChunk) {
85120
85238
  const ls = run2.letterSpacing ?? 0;
85121
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
85239
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
85122
85240
  currentLine.toChar = wordEndWithSpace;
85123
85241
  currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
85124
85242
  charPosInRun = wordEndWithSpace;
@@ -85150,7 +85268,7 @@ async function measureParagraphBlock(block, maxWidth) {
85150
85268
  spaceCount: 0
85151
85269
  };
85152
85270
  const ls = run2.letterSpacing ?? 0;
85153
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
85271
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
85154
85272
  currentLine.toChar = wordEndWithSpace;
85155
85273
  currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
85156
85274
  charPosInRun = wordEndWithSpace;
@@ -85192,7 +85310,7 @@ async function measureParagraphBlock(block, maxWidth) {
85192
85310
  spaceCount: 0
85193
85311
  };
85194
85312
  const ls = run2.letterSpacing ?? 0;
85195
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
85313
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
85196
85314
  currentLine.toChar = wordEndWithSpace;
85197
85315
  currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
85198
85316
  charPosInRun = wordEndWithSpace;
@@ -85207,7 +85325,7 @@ async function measureParagraphBlock(block, maxWidth) {
85207
85325
  const justifyAlignment = block.attrs?.alignment === "justify";
85208
85326
  const totalWidthWithWord = currentLine.width + boundarySpacing + wordCommitWidth + // Safe cast: only TextRuns produce word segments from split(), other run types are handled earlier
85209
85327
  (isLastWord ? 0 : run2.letterSpacing ?? 0);
85210
- const availableWidth = currentLine.maxWidth - WIDTH_FUDGE_PX;
85328
+ const availableWidth = currentLine.maxWidth - WIDTH_FUDGE_PX2;
85211
85329
  let shouldBreak = currentLine.width + boundarySpacing + wordOnlyWidth > availableWidth && currentLine.width > 0 && !isTocEntry;
85212
85330
  let compressedWidth = null;
85213
85331
  if (shouldBreak && justifyAlignment) {
@@ -85252,7 +85370,7 @@ async function measureParagraphBlock(block, maxWidth) {
85252
85370
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
85253
85371
  spaceCount: 0
85254
85372
  };
85255
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
85373
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
85256
85374
  currentLine.toChar = wordEndWithSpace;
85257
85375
  currentLine.width = roundValue(currentLine.width + spaceWidth + (run2.letterSpacing ?? 0));
85258
85376
  charPosInRun = wordEndWithSpace;
@@ -85262,7 +85380,7 @@ async function measureParagraphBlock(block, maxWidth) {
85262
85380
  }
85263
85381
  } else {
85264
85382
  currentLine.toRun = runIndex;
85265
- if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX) {
85383
+ if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2) {
85266
85384
  currentLine.toChar = wordEndNoSpace;
85267
85385
  currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
85268
85386
  currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-B29ATZFC.js";
3
- import { _ as _export_sfc } from "./chunks/editor-BRHMYtPA.js";
2
+ import { T as TextSelection } from "./chunks/converter-BEVM5t3i.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-B8k1bwD_.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -42721,7 +42721,7 @@ const _SuperConverter = class _SuperConverter {
42721
42721
  static getStoredSuperdocVersion(docx) {
42722
42722
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42723
42723
  }
42724
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.96") {
42724
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.97") {
42725
42725
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42726
42726
  }
42727
42727
  /**
@@ -1,4 +1,4 @@
1
- import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-B29ATZFC.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-BEVM5t3i.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }