@harbour-enterprises/superdoc 1.0.0-next.2 → 1.0.0-next.4

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 (40) hide show
  1. package/dist/chunks/{PdfViewer-B-xTd4XY.cjs → PdfViewer-CtSTAdvv.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-eykNsWyi.es.js → PdfViewer-DtdN17V4.es.js} +2 -2
  3. package/dist/chunks/{eventemitter3-CcXAdeql.es.js → eventemitter3-44XulWQe.es.js} +1 -1
  4. package/dist/chunks/{index-rF5HExWB.cjs → index-Bj1kFbYe.cjs} +465 -228
  5. package/dist/chunks/{index-DpQ8ZYM0.es.js → index-Cxv7dMYN.es.js} +468 -231
  6. package/dist/chunks/{index-BDVXUeCy-7mwhYeJ7.es.js → index-D_KE9gpD-aIqhxcuF.es.js} +1 -1
  7. package/dist/chunks/{index-BDVXUeCy-Di6ozaOM.cjs → index-D_KE9gpD-radGpP4I.cjs} +1 -1
  8. package/dist/chunks/{jszip-5vvIqAEE.es.js → jszip-VP334ufO.es.js} +1 -1
  9. package/dist/chunks/{super-editor.es-CxajnL9u.es.js → super-editor.es-B2fSLkzN.es.js} +1033 -493
  10. package/dist/chunks/{super-editor.es-CcKbh84I.cjs → super-editor.es-BhQu31e4.cjs} +1032 -492
  11. package/dist/chunks/{vue-Dysv_7z5.es.js → vue-BuPTonTJ.es.js} +27 -27
  12. package/dist/chunks/xml-js-LkEmUa9-.es.js +2 -0
  13. package/dist/packages/superdoc/src/composables/useUiFontFamily.d.ts +42 -0
  14. package/dist/packages/superdoc/src/composables/useUiFontFamily.d.ts.map +1 -0
  15. package/dist/packages/superdoc/src/core/SuperDoc.d.ts +3 -3
  16. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  17. package/dist/packages/superdoc/src/core/types/index.d.ts +4 -167
  18. package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
  19. package/dist/style.css +88 -86
  20. package/dist/super-editor/ai-writer.es.js +3 -3
  21. package/dist/super-editor/chunks/{converter-DN_dhslo.js → converter-CVqUjX24.js} +1 -1
  22. package/dist/super-editor/chunks/{docx-zipper-Bhl_yBjL.js → docx-zipper-CsWjoVKD.js} +1 -1
  23. package/dist/super-editor/chunks/{editor-3klx7hyV.js → editor-Cc8nus2C.js} +429 -129
  24. package/dist/super-editor/chunks/{index-BDVXUeCy.js → index-D_KE9gpD.js} +1 -1
  25. package/dist/super-editor/chunks/{toolbar-8YA9ltNC.js → toolbar-CoOpR1xE.js} +804 -568
  26. package/dist/super-editor/converter.es.js +1 -1
  27. package/dist/super-editor/docx-zipper.es.js +2 -2
  28. package/dist/super-editor/editor.es.js +3 -3
  29. package/dist/super-editor/file-zipper.es.js +1 -1
  30. package/dist/super-editor/style.css +22 -21
  31. package/dist/super-editor/super-editor.es.js +10 -6
  32. package/dist/super-editor/toolbar.es.js +2 -2
  33. package/dist/super-editor.cjs +1 -1
  34. package/dist/super-editor.es.js +2 -2
  35. package/dist/superdoc.cjs +2 -2
  36. package/dist/superdoc.es.js +2 -2
  37. package/dist/superdoc.umd.js +1495 -718
  38. package/dist/superdoc.umd.js.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/chunks/xml-js-ClO_jHnq.es.js +0 -2
@@ -42428,7 +42428,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42428
42428
  static getStoredSuperdocVersion(docx) {
42429
42429
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42430
42430
  }
42431
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.2") {
42431
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.4") {
42432
42432
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42433
42433
  }
42434
42434
  /**
@@ -66424,28 +66424,28 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66424
66424
  }
66425
66425
  return false;
66426
66426
  };
66427
- function canRenderFont(fontName, fallbackFont = "sans-serif") {
66428
- const _canRenderFont = (fontName2, fallbackFont2) => {
66427
+ function canRenderFont(fontName, uiDisplayFallbackFont = "sans-serif") {
66428
+ const _canRenderFont = (fontName2, uiDisplayFallbackFont2) => {
66429
66429
  const canvas2 = document.createElement("canvas");
66430
66430
  const ctx2 = canvas2.getContext("2d");
66431
66431
  ctx2.textBaseline = "top";
66432
66432
  const text2 = "abcdefghijklmnopqrstuvwxyz0123456789";
66433
- ctx2.font = `72px ${fallbackFont2}`;
66433
+ ctx2.font = `72px ${uiDisplayFallbackFont2}`;
66434
66434
  const initialTextMeasurement = ctx2.measureText(text2);
66435
66435
  const fallbackWidth = initialTextMeasurement.width;
66436
66436
  const fallbackHeight = initialTextMeasurement.actualBoundingBoxDescent;
66437
- ctx2.font = `72px "${fontName2}", ${fallbackFont2}`;
66437
+ ctx2.font = `72px "${fontName2}", ${uiDisplayFallbackFont2}`;
66438
66438
  const customTextMeasurement = ctx2.measureText(text2);
66439
66439
  const customFontWidth = customTextMeasurement.width;
66440
66440
  const customFontHeight = customTextMeasurement.actualBoundingBoxDescent;
66441
66441
  const isAvailable = customFontWidth !== fallbackWidth || customFontHeight !== fallbackHeight;
66442
66442
  return isAvailable;
66443
66443
  };
66444
- if (_canRenderFont(fontName, fallbackFont)) {
66444
+ if (_canRenderFont(fontName, uiDisplayFallbackFont)) {
66445
66445
  return true;
66446
66446
  }
66447
- const oppositeFallbackFont = fallbackFont === "sans-serif" ? "serif" : "sans-serif";
66448
- return _canRenderFont(fontName, oppositeFallbackFont);
66447
+ const oppositeUiDisplayFallbackFont = uiDisplayFallbackFont === "sans-serif" ? "serif" : "sans-serif";
66448
+ return _canRenderFont(fontName, oppositeUiDisplayFallbackFont);
66449
66449
  }
66450
66450
  const { findChildren: findChildren$3 } = helpers;
66451
66451
  function getAllFieldAnnotations(state2) {
@@ -67513,7 +67513,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67513
67513
  const shouldSkipNodeView = (editor) => {
67514
67514
  return isHeadless(editor);
67515
67515
  };
67516
- const summaryVersion = "1.0.0-next.2";
67516
+ const summaryVersion = "1.0.0-next.4";
67517
67517
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67518
67518
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67519
67519
  function mapAttributes(attrs) {
@@ -68302,7 +68302,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68302
68302
  { default: remarkStringify2 },
68303
68303
  { default: remarkGfm2 }
68304
68304
  ] = await Promise.all([
68305
- Promise.resolve().then(() => indexBDVXUeCy),
68305
+ Promise.resolve().then(() => indexD_KE9gpD),
68306
68306
  Promise.resolve().then(() => indexDRCvimau),
68307
68307
  Promise.resolve().then(() => indexC_x_N6Uh),
68308
68308
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68507,7 +68507,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68507
68507
  * Process collaboration migrations
68508
68508
  */
68509
68509
  processCollaborationMigrations() {
68510
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.2");
68510
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.4");
68511
68511
  if (!this.options.ydoc) return;
68512
68512
  const metaMap = this.options.ydoc.getMap("meta");
68513
68513
  let docVersion = metaMap.get("version");
@@ -74112,6 +74112,34 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74112
74112
  tabStopPosUsed: nextStop.pos
74113
74113
  };
74114
74114
  }
74115
+ const SPACE_CHARS$1 = /* @__PURE__ */ new Set([" ", " "]);
74116
+ function shouldApplyJustify(params2) {
74117
+ const { alignment: alignment2, hasExplicitPositioning, isLastLineOfParagraph, paragraphEndsWithLineBreak, skipJustifyOverride } = params2;
74118
+ if (alignment2 !== "justify" && alignment2 !== "both") {
74119
+ return false;
74120
+ }
74121
+ if (skipJustifyOverride === true) {
74122
+ return false;
74123
+ }
74124
+ if (hasExplicitPositioning) {
74125
+ return false;
74126
+ }
74127
+ if (isLastLineOfParagraph && !paragraphEndsWithLineBreak) {
74128
+ return false;
74129
+ }
74130
+ return true;
74131
+ }
74132
+ function calculateJustifySpacing(params2) {
74133
+ const { lineWidth, availableWidth, spaceCount, shouldJustify } = params2;
74134
+ if (!shouldJustify) {
74135
+ return 0;
74136
+ }
74137
+ if (spaceCount <= 0) {
74138
+ return 0;
74139
+ }
74140
+ const slack = availableWidth - lineWidth;
74141
+ return slack / spaceCount;
74142
+ }
74115
74143
  function resolveSpacingIndent$1(style2, numbering) {
74116
74144
  const spacing = {
74117
74145
  before: style2.spacing?.before ?? 0,
@@ -74378,13 +74406,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74378
74406
  };
74379
74407
  }
74380
74408
  }
74409
+ const normalizedAlign = normalizeAlignment(resolvedExtended.justification);
74381
74410
  const hydrated = {
74382
74411
  resolved,
74383
74412
  spacing: resolvedSpacing,
74384
74413
  indent: resolvedIndent,
74385
74414
  borders: cloneIfObject(resolvedExtended.borders),
74386
74415
  shading: cloneIfObject(resolvedExtended.shading),
74387
- alignment: resolvedExtended.justification,
74416
+ alignment: normalizedAlign,
74388
74417
  tabStops: cloneIfObject(resolvedExtended.tabStops),
74389
74418
  keepLines: resolvedExtended.keepLines,
74390
74419
  keepNext: resolvedExtended.keepNext,
@@ -75085,7 +75114,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75085
75114
  } else if (styleAlignment) {
75086
75115
  paragraphAttrs.alignment = styleAlignment;
75087
75116
  } else if (computed2.paragraph.alignment) {
75088
- paragraphAttrs.alignment = computed2.paragraph.alignment;
75117
+ paragraphAttrs.alignment = normalizeAlignment(computed2.paragraph.alignment);
75089
75118
  }
75090
75119
  const spacingPx = spacingPtToPx(spacing, normalizedSpacing);
75091
75120
  if (spacingPx) paragraphAttrs.spacing = spacingPx;
@@ -76237,9 +76266,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
76237
76266
  const font = findFirstTextFont(para.content);
76238
76267
  return font;
76239
76268
  };
76240
- const applyBaseRunDefaults = (run2, defaults2, fallbackFont, fallbackSize) => {
76269
+ const applyBaseRunDefaults = (run2, defaults2, uiDisplayFallbackFont, fallbackSize) => {
76241
76270
  if (!run2) return;
76242
- if (defaults2.fontFamily && run2.fontFamily === fallbackFont) {
76271
+ if (defaults2.fontFamily && run2.fontFamily === uiDisplayFallbackFont) {
76243
76272
  run2.fontFamily = defaults2.fontFamily;
76244
76273
  }
76245
76274
  if (defaults2.fontSizePx != null && run2.fontSize === fallbackSize) {
@@ -78042,7 +78071,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78042
78071
  let measurementCanvas = null;
78043
78072
  let measurementCtx = null;
78044
78073
  const TAB_CHAR_LENGTH = 1;
78045
- const SPACE_CHARS = /* @__PURE__ */ new Set([" ", " "]);
78074
+ const SPACE_CHARS = SPACE_CHARS$1;
78046
78075
  const isTabRun$1 = (run2) => run2?.kind === "tab";
78047
78076
  function getMeasurementContext() {
78048
78077
  if (measurementCtx) return measurementCtx;
@@ -78068,29 +78097,50 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78068
78097
  }
78069
78098
  return spaces;
78070
78099
  };
78071
- const getJustifyAdjustment = (block, line, availableWidthOverride, alignmentOverride) => {
78100
+ const getJustifyAdjustment = (block, line, availableWidthOverride, alignmentOverride, isLastLineOfParagraph, paragraphEndsWithLineBreak, skipJustifyOverride) => {
78072
78101
  if (block.kind !== "paragraph") {
78073
78102
  return { extraPerSpace: 0, totalSpaces: 0 };
78074
78103
  }
78075
- const alignment2 = alignmentOverride ?? block.attrs?.alignment;
78076
- const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
78077
- const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
78078
- const slack = Math.max(0, availableWidth - line.width);
78079
- if (alignment2 !== "justify" || hasExplicitPositioning || slack <= 0) {
78104
+ if (block.runs.length === 0) {
78080
78105
  return { extraPerSpace: 0, totalSpaces: 0 };
78081
78106
  }
78082
- const runs2 = sliceRunsForLine$1(block, line);
78083
- const totalSpaces = runs2.reduce((sum, run2) => {
78084
- if (isTabRun$1(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation") {
78085
- return sum;
78086
- }
78087
- return sum + countSpaces(run2.text ?? "");
78088
- }, 0);
78089
- if (totalSpaces <= 0) {
78107
+ const alignment2 = alignmentOverride ?? block.attrs?.alignment;
78108
+ const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0) ?? false;
78109
+ const lastRunIndex = block.runs.length - 1;
78110
+ const lastRun = block.runs[lastRunIndex];
78111
+ const derivedIsLastLine = line.toRun >= lastRunIndex;
78112
+ const derivedEndsWithLineBreak = lastRun ? lastRun.kind === "lineBreak" : false;
78113
+ const shouldJustify = shouldApplyJustify({
78114
+ alignment: alignment2,
78115
+ hasExplicitPositioning,
78116
+ isLastLineOfParagraph: derivedIsLastLine,
78117
+ paragraphEndsWithLineBreak: derivedEndsWithLineBreak,
78118
+ skipJustifyOverride
78119
+ });
78120
+ if (!shouldJustify) {
78090
78121
  return { extraPerSpace: 0, totalSpaces: 0 };
78091
78122
  }
78123
+ let totalSpaces = line.spaceCount ?? 0;
78124
+ if (totalSpaces === 0) {
78125
+ const runs2 = sliceRunsForLine$1(block, line);
78126
+ totalSpaces = runs2.reduce((sum, run2) => {
78127
+ if (isTabRun$1(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation") {
78128
+ return sum;
78129
+ }
78130
+ return sum + countSpaces(run2.text ?? "");
78131
+ }, 0);
78132
+ }
78133
+ const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
78134
+ const lineWidth = line.naturalWidth ?? line.width;
78135
+ const extraPerSpace = calculateJustifySpacing({
78136
+ lineWidth,
78137
+ availableWidth,
78138
+ spaceCount: totalSpaces,
78139
+ shouldJustify: true
78140
+ // Already checked above
78141
+ });
78092
78142
  return {
78093
- extraPerSpace: slack / totalSpaces,
78143
+ extraPerSpace,
78094
78144
  totalSpaces
78095
78145
  };
78096
78146
  };
@@ -78157,7 +78207,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78157
78207
  line.width;
78158
78208
  const justify = getJustifyAdjustment(block, line, availableWidth, alignmentOverride);
78159
78209
  const alignment2 = alignmentOverride ?? (block.kind === "paragraph" ? block.attrs?.alignment : void 0);
78160
- const renderedLineWidth = alignment2 === "justify" ? line.width + Math.max(0, availableWidth - line.width) : line.width;
78210
+ const renderedLineWidth = alignment2 === "justify" && justify.extraPerSpace !== 0 ? availableWidth : line.width;
78161
78211
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
78162
78212
  const alignmentOffset = !hasExplicitPositioning && alignment2 === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment2 === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
78163
78213
  if (hasExplicitPositioning && line.segments && ctx2) {
@@ -78200,13 +78250,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
78200
78250
  const textUpToTarget = text2.slice(0, offsetInRun);
78201
78251
  const measured2 = ctx2.measureText(textUpToTarget);
78202
78252
  const spacingWidth = computeLetterSpacingWidth(run2, offsetInRun, runLength);
78203
- const spacesInPortion = justify.extraPerSpace > 0 ? countSpaces(textUpToTarget) : 0;
78253
+ const spacesInPortion = justify.extraPerSpace !== 0 ? countSpaces(textUpToTarget) : 0;
78204
78254
  return alignmentOffset + currentX + measured2.width + spacingWidth + justify.extraPerSpace * (spaceTally + spacesInPortion);
78205
78255
  }
78206
78256
  ctx2.font = getRunFontString(run2);
78207
78257
  const measured = ctx2.measureText(text2);
78208
78258
  const runLetterSpacing = computeLetterSpacingWidth(run2, runLength, runLength);
78209
- const spacesInRun = justify.extraPerSpace > 0 ? countSpaces(text2) : 0;
78259
+ const spacesInRun = justify.extraPerSpace !== 0 ? countSpaces(text2) : 0;
78210
78260
  currentX += measured.width + runLetterSpacing + justify.extraPerSpace * spacesInRun;
78211
78261
  spaceTally += spacesInRun;
78212
78262
  currentCharOffset += runLength;
@@ -83358,9 +83408,66 @@ ${l}
83358
83408
  const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
83359
83409
  const lastRun = block.runs.length > 0 ? block.runs[block.runs.length - 1] : null;
83360
83410
  const paragraphEndsWithLineBreak = lastRun?.kind === "lineBreak";
83411
+ let listFirstLineMarkerTabWidth;
83412
+ if (!fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker) {
83413
+ const markerBoxWidth = fragment.markerWidth;
83414
+ const markerTextWidth = fragment.markerTextWidth != null && isFinite(fragment.markerTextWidth) && fragment.markerTextWidth >= 0 ? fragment.markerTextWidth : markerBoxWidth;
83415
+ const suffix2 = wordLayout.marker.suffix ?? "tab";
83416
+ if (suffix2 === "tab") {
83417
+ const markerJustification = wordLayout.marker.justification ?? "left";
83418
+ const isFirstLineIndentMode = wordLayout.firstLineIndentMode === true;
83419
+ let markerStartPos;
83420
+ if (isFirstLineIndentMode && wordLayout.marker.markerX !== void 0 && Number.isFinite(wordLayout.marker.markerX)) {
83421
+ markerStartPos = wordLayout.marker.markerX;
83422
+ } else {
83423
+ const hanging = paraIndent?.hanging ?? 0;
83424
+ const firstLine = paraIndent?.firstLine ?? 0;
83425
+ markerStartPos = paraIndentLeft - hanging + firstLine;
83426
+ }
83427
+ const validMarkerStartPos = Number.isFinite(markerStartPos) ? markerStartPos : 0;
83428
+ let tabWidth;
83429
+ if (markerJustification === "left") {
83430
+ const currentPos = validMarkerStartPos + markerTextWidth;
83431
+ if (isFirstLineIndentMode) {
83432
+ const textStartTarget = wordLayout.marker.textStartX !== void 0 && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : wordLayout.textStartPx;
83433
+ if (textStartTarget !== void 0 && Number.isFinite(textStartTarget) && textStartTarget > currentPos) {
83434
+ tabWidth = textStartTarget - currentPos;
83435
+ } else {
83436
+ tabWidth = LIST_MARKER_GAP$1;
83437
+ }
83438
+ } else {
83439
+ const firstLine = paraIndent?.firstLine ?? 0;
83440
+ const textStart = paraIndentLeft + firstLine;
83441
+ tabWidth = textStart - currentPos;
83442
+ if (tabWidth <= 0) {
83443
+ tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
83444
+ } else if (tabWidth < LIST_MARKER_GAP$1) {
83445
+ tabWidth = LIST_MARKER_GAP$1;
83446
+ }
83447
+ }
83448
+ } else {
83449
+ const gutterWidth = fragment.markerGutter ?? wordLayout.marker.gutterWidthPx;
83450
+ tabWidth = gutterWidth !== void 0 && Number.isFinite(gutterWidth) && gutterWidth > 0 ? gutterWidth : LIST_MARKER_GAP$1;
83451
+ }
83452
+ if (tabWidth < LIST_MARKER_GAP$1) {
83453
+ tabWidth = LIST_MARKER_GAP$1;
83454
+ }
83455
+ listFirstLineMarkerTabWidth = validMarkerStartPos + markerTextWidth + tabWidth;
83456
+ } else if (suffix2 === "space") {
83457
+ const hanging = paraIndent?.hanging ?? 0;
83458
+ const firstLine = paraIndent?.firstLine ?? 0;
83459
+ const markerStartPos = paraIndentLeft - hanging + firstLine;
83460
+ const validMarkerStartPos = Number.isFinite(markerStartPos) ? markerStartPos : 0;
83461
+ listFirstLineMarkerTabWidth = validMarkerStartPos + markerTextWidth + 4;
83462
+ }
83463
+ }
83361
83464
  lines.forEach((line, index2) => {
83362
- const fallbackAvailableWidth = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
83363
- const availableWidthOverride = line.maxWidth ?? fallbackAvailableWidth;
83465
+ const positiveIndentReduction = Math.max(0, paraIndentLeft) + Math.max(0, paraIndentRight);
83466
+ const fallbackAvailableWidth = Math.max(0, fragment.width - positiveIndentReduction);
83467
+ let availableWidthOverride = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
83468
+ if (index2 === 0 && listFirstLineMarkerTabWidth != null) {
83469
+ availableWidthOverride = fragment.width - listFirstLineMarkerTabWidth - Math.max(0, paraIndentRight);
83470
+ }
83364
83471
  const isLastLineOfFragment = index2 === lines.length - 1;
83365
83472
  const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
83366
83473
  const shouldSkipJustifyForLastLine = isLastLineOfParagraph && !paragraphEndsWithLineBreak;
@@ -83386,7 +83493,10 @@ ${l}
83386
83493
  }
83387
83494
  } else if (paraIndentLeft && paraIndentLeft > 0) {
83388
83495
  lineEl.style.paddingLeft = `${paraIndentLeft}px`;
83389
- } else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0) {
83496
+ } else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0 && // Only apply hanging padding when left indent is NOT negative.
83497
+ // When left indent is negative, the fragment position already accounts for it.
83498
+ // Adding padding here would shift body lines right, causing right-side overflow.
83499
+ !(paraIndentLeft != null && paraIndentLeft < 0)) {
83390
83500
  lineEl.style.paddingLeft = `${paraIndent.hanging}px`;
83391
83501
  }
83392
83502
  }
@@ -83415,6 +83525,7 @@ ${l}
83415
83525
  lineEl.style.paddingLeft = `${validMarkerStartPos}px`;
83416
83526
  const markerContainer = this.doc.createElement("span");
83417
83527
  markerContainer.style.display = "inline-block";
83528
+ markerContainer.style.wordSpacing = "0px";
83418
83529
  const markerEl = this.doc.createElement("span");
83419
83530
  markerEl.classList.add("superdoc-paragraph-marker");
83420
83531
  markerEl.textContent = wordLayout.marker.markerText ?? "";
@@ -83500,10 +83611,15 @@ ${l}
83500
83611
  }
83501
83612
  }
83502
83613
  tabEl.style.display = "inline-block";
83614
+ tabEl.style.wordSpacing = "0px";
83503
83615
  tabEl.style.width = `${tabWidth}px`;
83504
83616
  lineEl.prepend(tabEl);
83505
83617
  } else if (suffix2 === "space") {
83506
- lineEl.prepend(this.doc.createTextNode(" "));
83618
+ const spaceEl = this.doc.createElement("span");
83619
+ spaceEl.classList.add("superdoc-marker-suffix-space");
83620
+ spaceEl.style.wordSpacing = "0px";
83621
+ spaceEl.textContent = " ";
83622
+ lineEl.prepend(spaceEl);
83507
83623
  }
83508
83624
  lineEl.prepend(markerContainer);
83509
83625
  }
@@ -84795,11 +84911,8 @@ ${l}
84795
84911
  el.setAttribute("styleid", styleId);
84796
84912
  }
84797
84913
  const alignment2 = block.attrs?.alignment;
84798
- const effectiveAlignment = alignment2;
84799
- if (effectiveAlignment === "center" || effectiveAlignment === "right") {
84800
- el.style.textAlign = effectiveAlignment;
84801
- } else if (effectiveAlignment === "justify") {
84802
- el.style.textAlign = "left";
84914
+ if (alignment2 === "center" || alignment2 === "right") {
84915
+ el.style.textAlign = alignment2;
84803
84916
  } else {
84804
84917
  el.style.textAlign = "left";
84805
84918
  }
@@ -84810,9 +84923,8 @@ ${l}
84810
84923
  if (lineRange.pmEnd != null) {
84811
84924
  el.dataset.pmEnd = String(lineRange.pmEnd);
84812
84925
  }
84813
- const runsForLine = sliceRunsForLine(block, line);
84926
+ let runsForLine = sliceRunsForLine(block, line);
84814
84927
  const trackedConfig = this.resolveTrackedChangesConfig(block);
84815
- 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);
84816
84928
  if (runsForLine.length === 0) {
84817
84929
  const span = this.doc.createElement("span");
84818
84930
  span.innerHTML = "&nbsp;";
@@ -84859,7 +84971,156 @@ ${l}
84859
84971
  });
84860
84972
  }
84861
84973
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
84862
- availableWidthOverride ?? line.maxWidth ?? line.width;
84974
+ const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
84975
+ const justifyShouldApply = shouldApplyJustify({
84976
+ alignment: block.attrs?.alignment,
84977
+ hasExplicitPositioning: hasExplicitPositioning ?? false,
84978
+ // Caller already folds last-line + trailing lineBreak behavior into skipJustify.
84979
+ isLastLineOfParagraph: false,
84980
+ paragraphEndsWithLineBreak: false,
84981
+ skipJustifyOverride: skipJustify
84982
+ });
84983
+ const countSpaces2 = (text2) => {
84984
+ let count = 0;
84985
+ for (let i2 = 0; i2 < text2.length; i2 += 1) {
84986
+ if (SPACE_CHARS$1.has(text2[i2])) count += 1;
84987
+ }
84988
+ return count;
84989
+ };
84990
+ if (justifyShouldApply) {
84991
+ const stableDataAttrs = (attrs) => {
84992
+ if (!attrs) return void 0;
84993
+ const keys2 = Object.keys(attrs).sort();
84994
+ const out = {};
84995
+ keys2.forEach((key2) => {
84996
+ out[key2] = attrs[key2];
84997
+ });
84998
+ return out;
84999
+ };
85000
+ const mergeSignature = (run2) => JSON.stringify({
85001
+ kind: run2.kind ?? "text",
85002
+ fontFamily: run2.fontFamily,
85003
+ fontSize: run2.fontSize,
85004
+ bold: run2.bold ?? false,
85005
+ italic: run2.italic ?? false,
85006
+ letterSpacing: run2.letterSpacing ?? null,
85007
+ color: run2.color ?? null,
85008
+ underline: run2.underline ?? null,
85009
+ strike: run2.strike ?? false,
85010
+ highlight: run2.highlight ?? null,
85011
+ textTransform: run2.textTransform ?? null,
85012
+ token: run2.token ?? null,
85013
+ pageRefMetadata: run2.pageRefMetadata ?? null,
85014
+ trackedChange: run2.trackedChange ?? null,
85015
+ sdt: run2.sdt ?? null,
85016
+ link: run2.link ?? null,
85017
+ comments: run2.comments ?? null,
85018
+ dataAttrs: stableDataAttrs(run2.dataAttrs) ?? null
85019
+ });
85020
+ const isWhitespaceOnly = (text2) => {
85021
+ if (text2.length === 0) return false;
85022
+ for (let i2 = 0; i2 < text2.length; i2 += 1) {
85023
+ if (!SPACE_CHARS$1.has(text2[i2])) return false;
85024
+ }
85025
+ return true;
85026
+ };
85027
+ const cloneTextRun = (run2) => ({
85028
+ ...run2,
85029
+ comments: run2.comments ? [...run2.comments] : void 0,
85030
+ dataAttrs: run2.dataAttrs ? { ...run2.dataAttrs } : void 0,
85031
+ underline: run2.underline ? { ...run2.underline } : void 0,
85032
+ pageRefMetadata: run2.pageRefMetadata ? { ...run2.pageRefMetadata } : void 0
85033
+ });
85034
+ const normalized = runsForLine.map((run2) => {
85035
+ if (run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2)) return run2;
85036
+ return cloneTextRun(run2);
85037
+ });
85038
+ const merged = [];
85039
+ for (let i2 = 0; i2 < normalized.length; i2 += 1) {
85040
+ const run2 = normalized[i2];
85041
+ if (run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2)) {
85042
+ merged.push(run2);
85043
+ continue;
85044
+ }
85045
+ const textRun = run2;
85046
+ if (!isWhitespaceOnly(textRun.text ?? "")) {
85047
+ merged.push(textRun);
85048
+ continue;
85049
+ }
85050
+ const prev = merged[merged.length - 1];
85051
+ if (prev && (prev.kind === "text" || prev.kind === void 0) && "text" in prev) {
85052
+ const prevTextRun = prev;
85053
+ if (mergeSignature(prevTextRun) === mergeSignature(textRun)) {
85054
+ const extra = textRun.text ?? "";
85055
+ prevTextRun.text = (prevTextRun.text ?? "") + extra;
85056
+ if (prevTextRun.pmStart != null) {
85057
+ prevTextRun.pmEnd = prevTextRun.pmStart + prevTextRun.text.length;
85058
+ } else if (prevTextRun.pmEnd != null) {
85059
+ prevTextRun.pmEnd = prevTextRun.pmEnd + extra.length;
85060
+ }
85061
+ continue;
85062
+ }
85063
+ }
85064
+ const next2 = normalized[i2 + 1];
85065
+ if (next2 && (next2.kind === "text" || next2.kind === void 0) && "text" in next2) {
85066
+ const nextTextRun = next2;
85067
+ if (mergeSignature(nextTextRun) === mergeSignature(textRun)) {
85068
+ const extra = textRun.text ?? "";
85069
+ nextTextRun.text = extra + (nextTextRun.text ?? "");
85070
+ if (textRun.pmStart != null) {
85071
+ nextTextRun.pmStart = textRun.pmStart;
85072
+ } else if (nextTextRun.pmStart != null) {
85073
+ nextTextRun.pmStart = nextTextRun.pmStart - extra.length;
85074
+ }
85075
+ if (nextTextRun.pmStart != null && nextTextRun.pmEnd == null) {
85076
+ nextTextRun.pmEnd = nextTextRun.pmStart + nextTextRun.text.length;
85077
+ }
85078
+ continue;
85079
+ }
85080
+ }
85081
+ merged.push(textRun);
85082
+ }
85083
+ runsForLine = merged;
85084
+ const hasNonSpaceText = runsForLine.some(
85085
+ (run2) => (run2.kind === "text" || run2.kind === void 0) && "text" in run2 && (run2.text ?? "").trim().length > 0
85086
+ );
85087
+ if (hasNonSpaceText) {
85088
+ for (let i2 = runsForLine.length - 1; i2 >= 0; i2 -= 1) {
85089
+ const run2 = runsForLine[i2];
85090
+ if (run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2)) continue;
85091
+ const text2 = run2.text ?? "";
85092
+ let trimCount = 0;
85093
+ for (let j2 = text2.length - 1; j2 >= 0 && text2[j2] === " "; j2 -= 1) {
85094
+ trimCount += 1;
85095
+ }
85096
+ if (trimCount === 0) break;
85097
+ const nextText = text2.slice(0, Math.max(0, text2.length - trimCount));
85098
+ if (nextText.length === 0) {
85099
+ runsForLine.splice(i2, 1);
85100
+ continue;
85101
+ }
85102
+ run2.text = nextText;
85103
+ if (run2.pmEnd != null) {
85104
+ run2.pmEnd = run2.pmEnd - trimCount;
85105
+ }
85106
+ break;
85107
+ }
85108
+ }
85109
+ }
85110
+ const spaceCount = line.spaceCount ?? runsForLine.reduce((sum, run2) => {
85111
+ if (run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2) || run2.text == null) return sum;
85112
+ return sum + countSpaces2(run2.text);
85113
+ }, 0);
85114
+ const lineWidth = line.naturalWidth ?? line.width;
85115
+ const spacingPerSpace = calculateJustifySpacing({
85116
+ lineWidth,
85117
+ availableWidth,
85118
+ spaceCount,
85119
+ shouldJustify: justifyShouldApply
85120
+ });
85121
+ if (spacingPerSpace !== 0) {
85122
+ el.style.wordSpacing = `${spacingPerSpace}px`;
85123
+ }
84863
85124
  if (hasExplicitPositioning && line.segments) {
84864
85125
  const paraIndent = block.attrs?.indent;
84865
85126
  const indentLeft = paraIndent?.left ?? 0;
@@ -85731,7 +85992,7 @@ ${l}
85731
85992
  element2.setAttribute("styleid", attrs.styleId);
85732
85993
  }
85733
85994
  if (attrs.alignment) {
85734
- element2.style.textAlign = attrs.alignment;
85995
+ element2.style.textAlign = attrs.alignment === "justify" || attrs.alignment === "both" ? "left" : attrs.alignment;
85735
85996
  }
85736
85997
  if (attrs.dropCap) {
85737
85998
  element2.classList.add("sd-editor-dropcap");
@@ -85796,23 +86057,6 @@ ${l}
85796
86057
  if (!shading?.fill) return;
85797
86058
  element2.style.backgroundColor = shading.fill;
85798
86059
  };
85799
- const gatherTextSlicesForLine = (block, line) => {
85800
- const slices = [];
85801
- const startRun = line.fromRun ?? 0;
85802
- const endRun = line.toRun ?? startRun;
85803
- for (let runIndex = startRun; runIndex <= endRun; runIndex += 1) {
85804
- const run2 = block.runs[runIndex];
85805
- if (!run2 || run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2) || !run2.text) continue;
85806
- const isFirst = runIndex === startRun;
85807
- const isLast = runIndex === endRun;
85808
- const start2 = isFirst ? line.fromChar ?? 0 : 0;
85809
- const end2 = isLast ? line.toChar ?? run2.text.length : run2.text.length;
85810
- if (start2 >= end2) continue;
85811
- const slice2 = run2.text.slice(start2, end2);
85812
- if (slice2) slices.push(slice2);
85813
- }
85814
- return slices;
85815
- };
85816
86060
  const sliceRunsForLine = (block, line) => {
85817
86061
  const result = [];
85818
86062
  for (let runIndex = line.fromRun; runIndex <= line.toRun; runIndex += 1) {
@@ -86434,7 +86678,8 @@ ${l}
86434
86678
  let indentAdjust = paraIndentLeft;
86435
86679
  if (isListItem2 && isFirstLine && isFirstLineIndentMode) {
86436
86680
  const textStartFallback = paraIndentLeft + Math.max(firstLineIndent, 0) + markerWidth;
86437
- indentAdjust = typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : textStartFallback;
86681
+ const markerTextStartX = wordLayout?.marker?.textStartX;
86682
+ indentAdjust = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : textStartFallback;
86438
86683
  } else if (isFirstLine && !isListItem2) {
86439
86684
  indentAdjust += firstLineOffset;
86440
86685
  }
@@ -87124,6 +87369,20 @@ ${l}
87124
87369
  }
87125
87370
  return value;
87126
87371
  };
87372
+ function calculateFirstLineIndent(block, measure) {
87373
+ const wordLayout = block.attrs?.wordLayout;
87374
+ if (!wordLayout?.firstLineIndentMode) {
87375
+ return 0;
87376
+ }
87377
+ if (!wordLayout.marker || !measure.marker) {
87378
+ return 0;
87379
+ }
87380
+ const markerWidthRaw = measure.marker.markerWidth ?? wordLayout.marker.markerBoxWidthPx ?? 0;
87381
+ const markerWidth = Number.isFinite(markerWidthRaw) && markerWidthRaw >= 0 ? markerWidthRaw : 0;
87382
+ const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
87383
+ const gutterWidth = Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0;
87384
+ return markerWidth + gutterWidth;
87385
+ }
87127
87386
  function layoutParagraphBlock(ctx2, anchors) {
87128
87387
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
87129
87388
  const remeasureParagraph2 = ctx2.remeasureParagraph;
@@ -87253,17 +87512,8 @@ ${l}
87253
87512
  const remeasureWidth = Math.max(1, columnWidth - indentLeft - indentRight);
87254
87513
  let didRemeasureForColumnWidth = false;
87255
87514
  if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
87256
- let firstLineIndent = 0;
87257
- const wordLayout = block.attrs?.wordLayout;
87258
- if (wordLayout?.marker && measure.marker) {
87259
- const markerJustification = wordLayout.marker.justification ?? "left";
87260
- if (markerJustification === "left") {
87261
- const markerWidth = measure.marker.markerWidth ?? 0;
87262
- const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
87263
- firstLineIndent = markerWidth + gutterWidth;
87264
- }
87265
- }
87266
- const newMeasure = remeasureParagraph2(block, remeasureWidth, firstLineIndent);
87515
+ const firstLineIndent = calculateFirstLineIndent(block, measure);
87516
+ const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
87267
87517
  lines = normalizeLines(newMeasure);
87268
87518
  didRemeasureForColumnWidth = true;
87269
87519
  }
@@ -87344,16 +87594,7 @@ ${l}
87344
87594
  }
87345
87595
  const narrowestRemeasureWidth = Math.max(1, narrowestWidth - indentLeft - indentRight);
87346
87596
  if (narrowestRemeasureWidth < remeasureWidth) {
87347
- let firstLineIndent = 0;
87348
- const wordLayout = block.attrs?.wordLayout;
87349
- if (wordLayout?.marker && measure.marker) {
87350
- const markerJustification = wordLayout.marker.justification ?? "left";
87351
- if (markerJustification === "left") {
87352
- const markerWidth = measure.marker.markerWidth ?? 0;
87353
- const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
87354
- firstLineIndent = markerWidth + gutterWidth;
87355
- }
87356
- }
87597
+ const firstLineIndent = calculateFirstLineIndent(block, measure);
87357
87598
  const newMeasure = remeasureParagraph2(block, narrowestRemeasureWidth, firstLineIndent);
87358
87599
  lines = normalizeLines(newMeasure);
87359
87600
  didRemeasureForFloats = true;
@@ -90500,7 +90741,8 @@ ${l}
90500
90741
  const indentHanging = Math.max(0, indent2?.hanging ?? 0);
90501
90742
  const rawFirstLineOffset = Math.max(0, firstLineIndent || indentFirstLine - indentHanging);
90502
90743
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
90503
- const textStartPx = wordLayout?.textStartPx;
90744
+ const markerTextStartX = wordLayout?.marker?.textStartX;
90745
+ const textStartPx = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : void 0;
90504
90746
  const treatAsHanging = textStartPx && indentLeft === 0 && indentHanging === 0;
90505
90747
  const firstLineWidth = typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging ? Math.max(1, maxWidth - textStartPx - indentRight) : Math.max(1, contentWidth - rawFirstLineOffset);
90506
90748
  const tabStops = buildTabStopsPx$1(indent2, attrs?.tabs, attrs?.tabIntervalTwips);
@@ -90512,6 +90754,7 @@ ${l}
90512
90754
  const startRun = currentRun;
90513
90755
  const startChar = currentChar;
90514
90756
  let width = 0;
90757
+ let widthAtLastBreak = -1;
90515
90758
  let lastBreakRun = -1;
90516
90759
  let lastBreakChar = -1;
90517
90760
  let endRun = currentRun;
@@ -90529,6 +90772,7 @@ ${l}
90529
90772
  endChar = 1;
90530
90773
  lastBreakRun = r2;
90531
90774
  lastBreakChar = 1;
90775
+ widthAtLastBreak = width;
90532
90776
  continue;
90533
90777
  }
90534
90778
  const text2 = runText(run2);
@@ -90539,6 +90783,7 @@ ${l}
90539
90783
  if (lastBreakRun >= 0) {
90540
90784
  endRun = lastBreakRun;
90541
90785
  endChar = lastBreakChar;
90786
+ width = widthAtLastBreak >= 0 ? widthAtLastBreak : width;
90542
90787
  } else {
90543
90788
  endRun = r2;
90544
90789
  endChar = c2;
@@ -90553,6 +90798,7 @@ ${l}
90553
90798
  if (ch === " " || ch === " " || ch === "-") {
90554
90799
  lastBreakRun = r2;
90555
90800
  lastBreakChar = c2 + 1;
90801
+ widthAtLastBreak = width;
90556
90802
  }
90557
90803
  }
90558
90804
  if (didBreakInThisLine) break;
@@ -92263,7 +92509,9 @@ ${l}
92263
92509
  }
92264
92510
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
92265
92511
  const isListItem3 = markerWidth > 0;
92266
- const alignmentOverride = isListItem3 ? "left" : void 0;
92512
+ const paraAlignment = block.attrs?.alignment;
92513
+ const isJustified = paraAlignment === "justify" || paraAlignment === "both";
92514
+ const alignmentOverride = isListItem3 && !isJustified ? "left" : void 0;
92267
92515
  const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth, alignmentOverride);
92268
92516
  if (pos == null) {
92269
92517
  logClickStage("warn", "no-position", {
@@ -92330,7 +92578,9 @@ ${l}
92330
92578
  }
92331
92579
  const cellMarkerWidth = cellMeasure.marker?.markerWidth ?? 0;
92332
92580
  const isListItem3 = cellMarkerWidth > 0;
92333
- const alignmentOverride = isListItem3 ? "left" : void 0;
92581
+ const cellAlignment = cellBlock.attrs?.alignment;
92582
+ const isJustified = cellAlignment === "justify" || cellAlignment === "both";
92583
+ const alignmentOverride = isListItem3 && !isJustified ? "left" : void 0;
92334
92584
  const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth, alignmentOverride);
92335
92585
  if (pos != null) {
92336
92586
  logClickStage("log", "success", {
@@ -92499,7 +92749,9 @@ ${l}
92499
92749
  const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
92500
92750
  const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
92501
92751
  const isListItemFlag = isListItem(markerWidth, block);
92502
- const alignmentOverride = isListItemFlag ? "left" : void 0;
92752
+ const blockAlignment = block.attrs?.alignment;
92753
+ const isJustified = blockAlignment === "justify" || blockAlignment === "both";
92754
+ const alignmentOverride = isListItemFlag && !isJustified ? "left" : void 0;
92503
92755
  const startX = mapPmToX(block, line, charOffsetFrom, fragment.width, alignmentOverride);
92504
92756
  const endX = mapPmToX(block, line, charOffsetTo, fragment.width, alignmentOverride);
92505
92757
  const indent2 = extractParagraphIndent(block.attrs?.indent);
@@ -93241,7 +93493,9 @@ ${l}
93241
93493
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
93242
93494
  const bodyContentWidth = contentWidth;
93243
93495
  let initialAvailableWidth;
93244
- const textStartPx = wordLayout?.textStartPx;
93496
+ const rawTextStartPx = wordLayout?.textStartPx;
93497
+ const markerTextStartX = wordLayout?.marker?.textStartX;
93498
+ const textStartPx = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof rawTextStartPx === "number" && Number.isFinite(rawTextStartPx) ? rawTextStartPx : void 0;
93245
93499
  if (typeof textStartPx === "number" && textStartPx > indentLeft) {
93246
93500
  initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
93247
93501
  } else {
@@ -93376,12 +93630,40 @@ ${l}
93376
93630
  runsToProcess.push(run2);
93377
93631
  }
93378
93632
  }
93633
+ const trimTrailingWrapSpaces = (lineToTrim) => {
93634
+ const lastRun = runsToProcess[lineToTrim.toRun];
93635
+ if (!lastRun || !("text" in lastRun) || typeof lastRun.text !== "string") return;
93636
+ const sliceStart = lineToTrim.toRun === lineToTrim.fromRun ? lineToTrim.fromChar : 0;
93637
+ const sliceEnd = lineToTrim.toChar;
93638
+ if (sliceEnd <= sliceStart) return;
93639
+ const sliceText = lastRun.text.slice(sliceStart, sliceEnd);
93640
+ let trimCount = 0;
93641
+ for (let i2 = sliceText.length - 1; i2 >= 0 && sliceText[i2] === " "; i2 -= 1) {
93642
+ trimCount += 1;
93643
+ }
93644
+ if (trimCount === 0) return;
93645
+ if (lineToTrim.fromRun === lineToTrim.toRun && sliceText.trim().length === 0) {
93646
+ return;
93647
+ }
93648
+ const keptText = sliceText.slice(0, Math.max(0, sliceText.length - trimCount));
93649
+ const { font } = buildFontString(
93650
+ lastRun
93651
+ );
93652
+ const fullWidth = measureRunWidth(sliceText, font, ctx2, lastRun);
93653
+ const keptWidth = keptText.length > 0 ? measureRunWidth(keptText, font, ctx2, lastRun) : 0;
93654
+ const delta = Math.max(0, fullWidth - keptWidth);
93655
+ lineToTrim.width = roundValue(Math.max(0, lineToTrim.width - delta));
93656
+ lineToTrim.spaceCount = Math.max(0, lineToTrim.spaceCount - trimCount);
93657
+ if (lineToTrim.naturalWidth != null && typeof lineToTrim.naturalWidth === "number") {
93658
+ lineToTrim.naturalWidth = roundValue(Math.max(0, lineToTrim.naturalWidth - delta));
93659
+ }
93660
+ };
93379
93661
  for (let runIndex = 0; runIndex < runsToProcess.length; runIndex++) {
93380
93662
  const run2 = runsToProcess[runIndex];
93381
93663
  if (run2.kind === "break") {
93382
93664
  if (currentLine) {
93383
93665
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
93384
- const { spaceCount: _sc, ...lineBase } = currentLine;
93666
+ const lineBase = currentLine;
93385
93667
  const completedLine = { ...lineBase, ...metrics };
93386
93668
  addBarTabsToLine(completedLine);
93387
93669
  lines.push(completedLine);
@@ -93426,7 +93708,7 @@ ${l}
93426
93708
  toRun: runIndex,
93427
93709
  toChar: 0,
93428
93710
  width: 0,
93429
- maxWidth: getEffectiveWidth(initialAvailableWidth),
93711
+ maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
93430
93712
  segments: [],
93431
93713
  ...metrics
93432
93714
  };
@@ -93461,7 +93743,7 @@ ${l}
93461
93743
  width: 0,
93462
93744
  maxFontSize: 12,
93463
93745
  // Default font size for tabs
93464
- maxWidth: getEffectiveWidth(initialAvailableWidth),
93746
+ maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
93465
93747
  segments: [],
93466
93748
  spaceCount: 0
93467
93749
  };
@@ -93511,7 +93793,7 @@ ${l}
93511
93793
  width: imageWidth,
93512
93794
  maxFontSize: imageHeight,
93513
93795
  // Use image height for line height calculation
93514
- maxWidth: getEffectiveWidth(initialAvailableWidth),
93796
+ maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
93515
93797
  spaceCount: 0,
93516
93798
  segments: [
93517
93799
  {
@@ -93527,8 +93809,9 @@ ${l}
93527
93809
  }
93528
93810
  const appliedTabAlign = lastAppliedTabAlign;
93529
93811
  if (currentLine.width + imageWidth > currentLine.maxWidth && currentLine.width > 0) {
93812
+ trimTrailingWrapSpaces(currentLine);
93530
93813
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
93531
- const { spaceCount: _sc, ...lineBase } = currentLine;
93814
+ const lineBase = currentLine;
93532
93815
  const completedLine = {
93533
93816
  ...lineBase,
93534
93817
  ...metrics
@@ -93601,7 +93884,7 @@ ${l}
93601
93884
  // Field annotations are atomic units
93602
93885
  width: annotationWidth,
93603
93886
  maxFontSize: annotationHeight,
93604
- maxWidth: getEffectiveWidth(initialAvailableWidth),
93887
+ maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
93605
93888
  spaceCount: 0,
93606
93889
  segments: [
93607
93890
  {
@@ -93616,8 +93899,9 @@ ${l}
93616
93899
  continue;
93617
93900
  }
93618
93901
  if (currentLine.width + annotationWidth > currentLine.maxWidth && currentLine.width > 0) {
93902
+ trimTrailingWrapSpaces(currentLine);
93619
93903
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
93620
- const { spaceCount: _sc, ...lineBase } = currentLine;
93904
+ const lineBase = currentLine;
93621
93905
  const completedLine = {
93622
93906
  ...lineBase,
93623
93907
  ...metrics
@@ -93690,15 +93974,16 @@ ${l}
93690
93974
  width: spacesWidth,
93691
93975
  maxFontSize: run2.fontSize,
93692
93976
  maxFontInfo: getFontInfoFromRun(run2),
93693
- maxWidth: getEffectiveWidth(initialAvailableWidth),
93977
+ maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
93694
93978
  segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }],
93695
93979
  spaceCount: spacesLength
93696
93980
  };
93697
93981
  } else {
93698
93982
  const boundarySpacing = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
93699
93983
  if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
93984
+ trimTrailingWrapSpaces(currentLine);
93700
93985
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
93701
- const { spaceCount: _sc, ...lineBase } = currentLine;
93986
+ const lineBase = currentLine;
93702
93987
  const completedLine = {
93703
93988
  ...lineBase,
93704
93989
  ...metrics
@@ -93734,6 +94019,13 @@ ${l}
93734
94019
  continue;
93735
94020
  }
93736
94021
  const words = segment.split(" ");
94022
+ let lastNonEmptyWordIndex = -1;
94023
+ for (let i2 = words.length - 1; i2 >= 0; i2 -= 1) {
94024
+ if (words[i2] !== "") {
94025
+ lastNonEmptyWordIndex = i2;
94026
+ break;
94027
+ }
94028
+ }
93737
94029
  let segmentStartX;
93738
94030
  if (currentLine && pendingTabAlignment) {
93739
94031
  segmentStartX = alignSegmentAtTab(segment, font, run2);
@@ -93756,15 +94048,16 @@ ${l}
93756
94048
  width: singleSpaceWidth,
93757
94049
  maxFontSize: run2.fontSize,
93758
94050
  maxFontInfo: getFontInfoFromRun(run2),
93759
- maxWidth: getEffectiveWidth(initialAvailableWidth),
94051
+ maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
93760
94052
  segments: [{ runIndex, fromChar: spaceStartChar, toChar: spaceEndChar, width: singleSpaceWidth }],
93761
94053
  spaceCount: 1
93762
94054
  };
93763
94055
  } else {
93764
94056
  const boundarySpacing2 = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
93765
94057
  if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
94058
+ trimTrailingWrapSpaces(currentLine);
93766
94059
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
93767
- const { spaceCount: _sc, ...lineBase } = currentLine;
94060
+ const lineBase = currentLine;
93768
94061
  const completedLine = { ...lineBase, ...metrics };
93769
94062
  addBarTabsToLine(completedLine);
93770
94063
  lines.push(completedLine);
@@ -93796,19 +94089,19 @@ ${l}
93796
94089
  charPosInRun = spaceEndChar;
93797
94090
  continue;
93798
94091
  }
93799
- const isLastWordInSegment = wordIndex === words.length - 1;
93800
- const isLastWord = isLastWordInSegment && isLastSegment;
93801
94092
  const wordOnlyWidth = measureRunWidth(word, font, ctx2, run2);
93802
- const spaceWidth = isLastWord ? 0 : measureRunWidth(" ", font, ctx2, run2);
93803
- const wordCommitWidth = isLastWord ? wordOnlyWidth : wordOnlyWidth + spaceWidth;
94093
+ const shouldIncludeDelimiterSpace = wordIndex < lastNonEmptyWordIndex;
94094
+ const spaceWidth = shouldIncludeDelimiterSpace ? measureRunWidth(" ", font, ctx2, run2) : 0;
94095
+ const wordCommitWidth = wordOnlyWidth + spaceWidth;
93804
94096
  const wordStartChar = charPosInRun;
93805
94097
  const wordEndNoSpace = charPosInRun + word.length;
93806
- const wordEndWithSpace = charPosInRun + (isLastWord ? word.length : word.length + 1);
94098
+ const wordEndWithSpace = wordEndNoSpace + (shouldIncludeDelimiterSpace ? 1 : 0);
93807
94099
  const effectiveMaxWidth = currentLine ? currentLine.maxWidth : getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
93808
94100
  if (wordOnlyWidth > effectiveMaxWidth && word.length > 1) {
93809
94101
  if (currentLine && currentLine.width > 0 && currentLine.segments && currentLine.segments.length > 0) {
94102
+ trimTrailingWrapSpaces(currentLine);
93810
94103
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
93811
- const { spaceCount: _sc, ...lineBase } = currentLine;
94104
+ const lineBase = currentLine;
93812
94105
  const completedLine = { ...lineBase, ...metrics };
93813
94106
  addBarTabsToLine(completedLine);
93814
94107
  lines.push(completedLine);
@@ -93842,7 +94135,7 @@ ${l}
93842
94135
  });
93843
94136
  if (isLastChunk) {
93844
94137
  const ls = run2.letterSpacing ?? 0;
93845
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
94138
+ if (shouldIncludeDelimiterSpace && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
93846
94139
  currentLine.toChar = wordEndWithSpace;
93847
94140
  currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
93848
94141
  charPosInRun = wordEndWithSpace;
@@ -93851,8 +94144,9 @@ ${l}
93851
94144
  charPosInRun = wordEndWithSpace;
93852
94145
  }
93853
94146
  } else {
94147
+ trimTrailingWrapSpaces(currentLine);
93854
94148
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
93855
- const { spaceCount: _sc, ...lineBase } = currentLine;
94149
+ const lineBase = currentLine;
93856
94150
  const completedLine = { ...lineBase, ...metrics };
93857
94151
  addBarTabsToLine(completedLine);
93858
94152
  lines.push(completedLine);
@@ -93874,7 +94168,7 @@ ${l}
93874
94168
  spaceCount: 0
93875
94169
  };
93876
94170
  const ls = run2.letterSpacing ?? 0;
93877
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
94171
+ if (shouldIncludeDelimiterSpace && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
93878
94172
  currentLine.toChar = wordEndWithSpace;
93879
94173
  currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
93880
94174
  charPosInRun = wordEndWithSpace;
@@ -93911,12 +94205,12 @@ ${l}
93911
94205
  width: wordOnlyWidth,
93912
94206
  maxFontSize: run2.fontSize,
93913
94207
  maxFontInfo: getFontInfoFromRun(run2),
93914
- maxWidth: getEffectiveWidth(initialAvailableWidth),
94208
+ maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
93915
94209
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
93916
94210
  spaceCount: 0
93917
94211
  };
93918
94212
  const ls = run2.letterSpacing ?? 0;
93919
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
94213
+ if (shouldIncludeDelimiterSpace && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
93920
94214
  currentLine.toChar = wordEndWithSpace;
93921
94215
  currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
93922
94216
  charPosInRun = wordEndWithSpace;
@@ -93930,15 +94224,16 @@ ${l}
93930
94224
  const boundarySpacing = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
93931
94225
  const justifyAlignment = block.attrs?.alignment === "justify";
93932
94226
  const totalWidthWithWord = currentLine.width + boundarySpacing + wordCommitWidth + // Safe cast: only TextRuns produce word segments from split(), other run types are handled earlier
93933
- (isLastWord ? 0 : run2.letterSpacing ?? 0);
94227
+ (shouldIncludeDelimiterSpace ? run2.letterSpacing ?? 0 : 0);
93934
94228
  const availableWidth = currentLine.maxWidth - WIDTH_FUDGE_PX2;
93935
94229
  let shouldBreak = currentLine.width + boundarySpacing + wordOnlyWidth > availableWidth && currentLine.width > 0 && !isTocEntry;
93936
94230
  let compressedWidth = null;
93937
94231
  if (shouldBreak && justifyAlignment) {
93938
- const isParagraphLastWord = isLastWord && runIndex === runsToProcess.length - 1;
94232
+ const isLastNonEmptyWordInSegment = wordIndex === lastNonEmptyWordIndex;
94233
+ const isParagraphLastWord = isLastSegment && isLastNonEmptyWordInSegment && runIndex === runsToProcess.length - 1;
93939
94234
  if (!isParagraphLastWord) {
93940
94235
  const existingSpaces = currentLine.spaceCount ?? 0;
93941
- const candidateSpaces = existingSpaces + (isLastWord ? 0 : 1);
94236
+ const candidateSpaces = existingSpaces + (shouldIncludeDelimiterSpace ? 1 : 0);
93942
94237
  if (candidateSpaces > 0) {
93943
94238
  const overflow = totalWidthWithWord - availableWidth;
93944
94239
  if (overflow > 0) {
@@ -93954,8 +94249,9 @@ ${l}
93954
94249
  }
93955
94250
  }
93956
94251
  if (shouldBreak) {
94252
+ trimTrailingWrapSpaces(currentLine);
93957
94253
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
93958
- const { spaceCount: _sc, ...lineBase } = currentLine;
94254
+ const lineBase = currentLine;
93959
94255
  const completedLine = {
93960
94256
  ...lineBase,
93961
94257
  ...metrics
@@ -93976,7 +94272,7 @@ ${l}
93976
94272
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
93977
94273
  spaceCount: 0
93978
94274
  };
93979
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
94275
+ if (shouldIncludeDelimiterSpace && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
93980
94276
  currentLine.toChar = wordEndWithSpace;
93981
94277
  currentLine.width = roundValue(currentLine.width + spaceWidth + (run2.letterSpacing ?? 0));
93982
94278
  charPosInRun = wordEndWithSpace;
@@ -93986,7 +94282,7 @@ ${l}
93986
94282
  }
93987
94283
  } else {
93988
94284
  currentLine.toRun = runIndex;
93989
- if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2) {
94285
+ if (shouldIncludeDelimiterSpace && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2) {
93990
94286
  currentLine.toChar = wordEndNoSpace;
93991
94287
  currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
93992
94288
  currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
@@ -94000,8 +94296,9 @@ ${l}
94000
94296
  wordOnlyWidth,
94001
94297
  useExplicitXHere ? segmentStartX : void 0
94002
94298
  );
94299
+ trimTrailingWrapSpaces(currentLine);
94003
94300
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
94004
- const { spaceCount: _sc, ...lineBase } = currentLine;
94301
+ const lineBase = currentLine;
94005
94302
  const completedLine = { ...lineBase, ...metrics };
94006
94303
  addBarTabsToLine(completedLine);
94007
94304
  lines.push(completedLine);
@@ -94011,20 +94308,23 @@ ${l}
94011
94308
  charPosInRun = wordEndNoSpace + 1;
94012
94309
  continue;
94013
94310
  }
94014
- const newToChar = isLastWord ? wordEndNoSpace : wordEndWithSpace;
94311
+ const newToChar = shouldIncludeDelimiterSpace ? wordEndWithSpace : wordEndNoSpace;
94015
94312
  currentLine.toChar = newToChar;
94016
94313
  const useExplicitX = wordIndex === 0 && segmentStartX !== void 0;
94017
94314
  const explicitX = useExplicitX ? segmentStartX : void 0;
94018
- const targetWidth = compressedWidth != null ? compressedWidth : currentLine.width + boundarySpacing + wordCommitWidth + (isLastWord ? 0 : run2.letterSpacing ?? 0);
94315
+ const targetWidth = compressedWidth != null ? compressedWidth : currentLine.width + boundarySpacing + wordCommitWidth + (shouldIncludeDelimiterSpace ? run2.letterSpacing ?? 0 : 0);
94316
+ if (compressedWidth != null) {
94317
+ currentLine.naturalWidth = roundValue(totalWidthWithWord);
94318
+ }
94019
94319
  currentLine.width = roundValue(targetWidth);
94020
94320
  currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
94021
94321
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
94022
94322
  appendSegment(currentLine.segments, runIndex, wordStartChar, newToChar, wordCommitWidth, explicitX);
94023
- if (!isLastWord) {
94323
+ if (shouldIncludeDelimiterSpace) {
94024
94324
  currentLine.spaceCount += 1;
94025
94325
  }
94026
94326
  }
94027
- charPosInRun = isLastWord ? wordEndNoSpace : wordEndWithSpace;
94327
+ charPosInRun = shouldIncludeDelimiterSpace ? wordEndWithSpace : wordEndNoSpace;
94028
94328
  }
94029
94329
  if (lastAppliedTabAlign && currentLine) {
94030
94330
  const appliedTab = lastAppliedTabAlign;
@@ -94044,7 +94344,7 @@ ${l}
94044
94344
  width: 0,
94045
94345
  maxFontSize: run2.fontSize,
94046
94346
  maxFontInfo: getFontInfoFromRun(run2),
94047
- maxWidth: getEffectiveWidth(initialAvailableWidth),
94347
+ maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
94048
94348
  segments: [],
94049
94349
  spaceCount: 0
94050
94350
  };
@@ -94076,8 +94376,8 @@ ${l}
94076
94376
  }
94077
94377
  }
94078
94378
  if (!currentLine && lines.length === 0) {
94079
- const fallbackFontSize = (block.runs[0]?.kind === "text" ? block.runs[0].fontSize : void 0) ?? 12;
94080
- const metrics = calculateTypographyMetrics(fallbackFontSize, spacing);
94379
+ const uiDisplayFallbackFontSize = (block.runs[0]?.kind === "text" ? block.runs[0].fontSize : void 0) ?? 12;
94380
+ const metrics = calculateTypographyMetrics(uiDisplayFallbackFontSize, spacing);
94081
94381
  const fallbackLine = {
94082
94382
  fromRun: 0,
94083
94383
  fromChar: 0,
@@ -94092,7 +94392,7 @@ ${l}
94092
94392
  }
94093
94393
  if (currentLine) {
94094
94394
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
94095
- const { spaceCount: _sc, ...lineBase } = currentLine;
94395
+ const lineBase = currentLine;
94096
94396
  const finalLine = {
94097
94397
  ...lineBase,
94098
94398
  ...metrics
@@ -118714,316 +119014,6 @@ ${l}
118714
119014
  paste: pasteIconSvg,
118715
119015
  strikethrough: strikethroughSvg
118716
119016
  };
118717
- const _hoisted_1$4$2 = { class: "toolbar-icon" };
118718
- const _hoisted_2$3$2 = ["innerHTML"];
118719
- const _sfc_main$5$2 = {
118720
- __name: "ToolbarButtonIcon",
118721
- props: {
118722
- name: {
118723
- type: String,
118724
- required: true
118725
- },
118726
- color: {
118727
- type: String,
118728
- default: null
118729
- },
118730
- icon: {
118731
- type: String,
118732
- default: null
118733
- }
118734
- },
118735
- setup(__props) {
118736
- const props = __props;
118737
- const getBarColor = computed(() => {
118738
- if (props.name === "color") return { backgroundColor: props.color || "#111111" };
118739
- if (props.name === "highlight") return { backgroundColor: props.color || "#D6D6D6" };
118740
- });
118741
- const hasColorBar = computed(() => {
118742
- return ["color", "highlight"].includes(props.name);
118743
- });
118744
- return (_ctx, _cache) => {
118745
- return openBlock(), createElementBlock("div", _hoisted_1$4$2, [
118746
- createBaseVNode("div", {
118747
- class: normalizeClass(["toolbar-icon__icon", [`toolbar-icon__icon--${props.name}`]]),
118748
- innerHTML: __props.icon
118749
- }, null, 10, _hoisted_2$3$2),
118750
- hasColorBar.value ? (openBlock(), createElementBlock("div", {
118751
- key: 0,
118752
- class: "color-bar",
118753
- style: normalizeStyle(getBarColor.value)
118754
- }, null, 4)) : createCommentVNode("", true)
118755
- ]);
118756
- };
118757
- }
118758
- };
118759
- const ToolbarButtonIcon = /* @__PURE__ */ _export_sfc$1(_sfc_main$5$2, [["__scopeId", "data-v-6d7523ab"]]);
118760
- const _hoisted_1$3$2 = ["role", "aria-label", "onKeydown"];
118761
- const _hoisted_2$2$2 = ["data-item"];
118762
- const _hoisted_3$2$2 = {
118763
- key: 1,
118764
- class: "button-label"
118765
- };
118766
- const _hoisted_4$1$2 = { key: 2 };
118767
- const _hoisted_5$5 = ["onKeydown", "id"];
118768
- const _hoisted_6$3 = ["placeholder", "onKeydown", "id"];
118769
- const _hoisted_7$3 = ["innerHTML"];
118770
- const _hoisted_8$3 = {
118771
- "aria-live": "polite",
118772
- class: "visually-hidden"
118773
- };
118774
- const _sfc_main$4$2 = {
118775
- __name: "ToolbarButton",
118776
- props: {
118777
- iconColor: {
118778
- type: String,
118779
- default: null
118780
- },
118781
- active: {
118782
- type: Boolean,
118783
- default: false
118784
- },
118785
- isNarrow: {
118786
- type: Boolean,
118787
- default: false
118788
- },
118789
- isWide: {
118790
- type: Boolean,
118791
- default: false
118792
- },
118793
- toolbarItem: {
118794
- type: Object,
118795
- required: true
118796
- },
118797
- defaultLabel: {
118798
- type: String,
118799
- default: null
118800
- },
118801
- isOverflowItem: {
118802
- type: Boolean,
118803
- default: false
118804
- }
118805
- },
118806
- emits: ["buttonClick", "textSubmit"],
118807
- setup(__props, { emit: __emit }) {
118808
- const emit2 = __emit;
118809
- const props = __props;
118810
- const {
118811
- name,
118812
- active,
118813
- icon,
118814
- label,
118815
- hideLabel,
118816
- iconColor,
118817
- hasCaret,
118818
- disabled,
118819
- inlineTextInputVisible,
118820
- hasInlineTextInput,
118821
- minWidth,
118822
- style: style2,
118823
- attributes
118824
- } = props.toolbarItem;
118825
- const inlineTextInput = ref(label);
118826
- const inlineInput = ref(null);
118827
- const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode$1();
118828
- const handleClick2 = () => {
118829
- if (hasInlineTextInput) {
118830
- nextTick(() => {
118831
- inlineInput.value?.focus();
118832
- inlineInput.value?.select();
118833
- });
118834
- }
118835
- emit2("buttonClick");
118836
- };
118837
- const handleInputSubmit = () => {
118838
- const value = inlineTextInput.value;
118839
- const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
118840
- emit2("textSubmit", cleanValue);
118841
- inlineTextInput.value = cleanValue;
118842
- };
118843
- const getStyle = computed(() => {
118844
- if (style2.value) return style2.value;
118845
- return {
118846
- minWidth: props.minWidth
118847
- };
118848
- });
118849
- const caretIcon = computed(() => {
118850
- return active.value ? toolbarIcons.dropdownCaretUp : toolbarIcons.dropdownCaretDown;
118851
- });
118852
- return (_ctx, _cache) => {
118853
- return openBlock(), createElementBlock("div", {
118854
- class: normalizeClass(["toolbar-item", unref(attributes).className]),
118855
- style: normalizeStyle(getStyle.value),
118856
- role: __props.isOverflowItem ? "menuitem" : "button",
118857
- "aria-label": unref(attributes).ariaLabel,
118858
- onClick: handleClick2,
118859
- onKeydown: withKeys(withModifiers(handleClick2, ["stop"]), ["enter"]),
118860
- tabindex: "0"
118861
- }, [
118862
- createBaseVNode("div", {
118863
- class: normalizeClass(["toolbar-button", {
118864
- active: unref(active),
118865
- disabled: unref(disabled),
118866
- narrow: __props.isNarrow,
118867
- wide: __props.isWide,
118868
- "has-inline-text-input": unref(hasInlineTextInput),
118869
- "high-contrast": unref(isHighContrastMode2)
118870
- }]),
118871
- "data-item": `btn-${unref(name) || ""}`
118872
- }, [
118873
- unref(icon) ? (openBlock(), createBlock(ToolbarButtonIcon, {
118874
- key: 0,
118875
- color: unref(iconColor),
118876
- class: "toolbar-icon",
118877
- icon: unref(icon),
118878
- name: unref(name)
118879
- }, null, 8, ["color", "icon", "name"])) : createCommentVNode("", true),
118880
- unref(label) && !unref(hideLabel) && !unref(inlineTextInputVisible) ? (openBlock(), createElementBlock("div", _hoisted_3$2$2, toDisplayString(unref(label)), 1)) : createCommentVNode("", true),
118881
- unref(inlineTextInputVisible) ? (openBlock(), createElementBlock("span", _hoisted_4$1$2, [
118882
- unref(name) === "fontSize" ? withDirectives((openBlock(), createElementBlock("input", {
118883
- key: 0,
118884
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inlineTextInput.value = $event),
118885
- onKeydown: withKeys(withModifiers(handleInputSubmit, ["prevent"]), ["enter"]),
118886
- type: "text",
118887
- class: normalizeClass(["button-text-input button-text-input--font-size", { "high-contrast": unref(isHighContrastMode2) }]),
118888
- id: "inlineTextInput-" + unref(name),
118889
- autocomplete: "off",
118890
- ref_key: "inlineInput",
118891
- ref: inlineInput
118892
- }, null, 42, _hoisted_5$5)), [
118893
- [vModelText, inlineTextInput.value]
118894
- ]) : withDirectives((openBlock(), createElementBlock("input", {
118895
- key: 1,
118896
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inlineTextInput.value = $event),
118897
- placeholder: unref(label),
118898
- onKeydown: withKeys(withModifiers(handleInputSubmit, ["prevent"]), ["enter"]),
118899
- type: "text",
118900
- class: "button-text-input",
118901
- id: "inlineTextInput-" + unref(name),
118902
- autocomplete: "off",
118903
- ref_key: "inlineInput",
118904
- ref: inlineInput
118905
- }, null, 40, _hoisted_6$3)), [
118906
- [vModelText, inlineTextInput.value]
118907
- ])
118908
- ])) : createCommentVNode("", true),
118909
- unref(hasCaret) ? (openBlock(), createElementBlock("div", {
118910
- key: 3,
118911
- class: "dropdown-caret",
118912
- innerHTML: caretIcon.value,
118913
- style: normalizeStyle({ opacity: unref(disabled) ? 0.6 : 1 })
118914
- }, null, 12, _hoisted_7$3)) : createCommentVNode("", true),
118915
- createBaseVNode("div", _hoisted_8$3, toDisplayString(`${unref(attributes).ariaLabel} ${unref(active) ? "selected" : "unset"}`), 1)
118916
- ], 10, _hoisted_2$2$2)
118917
- ], 46, _hoisted_1$3$2);
118918
- };
118919
- }
118920
- };
118921
- const ToolbarButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$4$2, [["__scopeId", "data-v-ea93b080"]]);
118922
- const _hoisted_1$2$2 = {
118923
- class: "toolbar-separator",
118924
- role: "separator",
118925
- "aria-label": "Toolbar separator"
118926
- };
118927
- const _sfc_main$3$2 = {
118928
- __name: "ToolbarSeparator",
118929
- props: {
118930
- active: {
118931
- type: Boolean,
118932
- default: false
118933
- }
118934
- },
118935
- emits: ["command"],
118936
- setup(__props, { emit: __emit }) {
118937
- const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode$1();
118938
- const getSeparatorColor = () => {
118939
- if (isHighContrastMode2.value) {
118940
- return "#000";
118941
- }
118942
- return "#dbdbdb";
118943
- };
118944
- return (_ctx, _cache) => {
118945
- return openBlock(), createElementBlock("div", _hoisted_1$2$2, [
118946
- createBaseVNode("div", {
118947
- class: "separator-inner",
118948
- style: normalizeStyle({ backgroundColor: getSeparatorColor() })
118949
- }, null, 4)
118950
- ]);
118951
- };
118952
- }
118953
- };
118954
- const ToolbarSeparator = /* @__PURE__ */ _export_sfc$1(_sfc_main$3$2, [["__scopeId", "data-v-4ef9aa18"]]);
118955
- const _hoisted_1$1$2 = { class: "overflow-menu" };
118956
- const _hoisted_2$1$2 = { class: "overflow-menu-trigger" };
118957
- const _hoisted_3$1$2 = {
118958
- key: 0,
118959
- class: "overflow-menu_items",
118960
- role: "group"
118961
- };
118962
- const _sfc_main$2$2 = {
118963
- __name: "OverflowMenu",
118964
- props: {
118965
- toolbarItem: {
118966
- type: Object,
118967
- required: true
118968
- },
118969
- overflowItems: {
118970
- type: Array,
118971
- required: true
118972
- }
118973
- },
118974
- emits: ["buttonClick", "close"],
118975
- setup(__props, { emit: __emit }) {
118976
- const { proxy } = getCurrentInstance();
118977
- const emit2 = __emit;
118978
- const props = __props;
118979
- const isOverflowMenuOpened = computed(() => props.toolbarItem.expand.value);
118980
- const hasOpenDropdown = ref(false);
118981
- const overflowToolbarItem = computed(() => ({
118982
- ...props.toolbarItem,
118983
- active: isOverflowMenuOpened.value
118984
- }));
118985
- const toggleOverflowMenu = () => {
118986
- emit2("buttonClick", props.toolbarItem);
118987
- };
118988
- const handleCommand = ({ item, argument }) => {
118989
- proxy.$toolbar.emitCommand({ item, argument });
118990
- };
118991
- const handleKeyDown2 = (e) => {
118992
- if (e.key === "Escape") {
118993
- if (isOverflowMenuOpened.value && !hasOpenDropdown.value) {
118994
- e.preventDefault();
118995
- emit2("close");
118996
- }
118997
- }
118998
- };
118999
- onMounted(() => {
119000
- document.addEventListener("keydown", handleKeyDown2, true);
119001
- });
119002
- onBeforeUnmount(() => {
119003
- document.removeEventListener("keydown", handleKeyDown2, true);
119004
- });
119005
- return (_ctx, _cache) => {
119006
- return openBlock(), createElementBlock("div", _hoisted_1$1$2, [
119007
- createBaseVNode("div", _hoisted_2$1$2, [
119008
- createVNode(ToolbarButton, {
119009
- "toolbar-item": overflowToolbarItem.value,
119010
- onButtonClick: toggleOverflowMenu
119011
- }, null, 8, ["toolbar-item"])
119012
- ]),
119013
- isOverflowMenuOpened.value ? (openBlock(), createElementBlock("div", _hoisted_3$1$2, [
119014
- createVNode(ButtonGroup, {
119015
- class: "superdoc-toolbar-overflow",
119016
- "toolbar-items": __props.overflowItems,
119017
- "from-overflow": "",
119018
- onCommand: handleCommand,
119019
- onDropdownUpdateShow: _cache[0] || (_cache[0] = ($event) => hasOpenDropdown.value = $event)
119020
- }, null, 8, ["toolbar-items"])
119021
- ])) : createCommentVNode("", true)
119022
- ]);
119023
- };
119024
- }
119025
- };
119026
- const OverflowMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$2$2, [["__scopeId", "data-v-ef28da92"]]);
119027
119017
  function plugin$1$1(options) {
119028
119018
  let _bPrefix = ".";
119029
119019
  let _ePrefix = "__";
@@ -122634,30 +122624,30 @@ ${style2}
122634
122624
  function useConfig$1(props = {}, options = {
122635
122625
  defaultBordered: true
122636
122626
  }) {
122637
- const NConfigProvider = inject(configProviderInjectionKey$1, null);
122627
+ const NConfigProvider2 = inject(configProviderInjectionKey$1, null);
122638
122628
  return {
122639
122629
  // NConfigProvider,
122640
- inlineThemeDisabled: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.inlineThemeDisabled,
122641
- mergedRtlRef: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedRtlRef,
122642
- mergedComponentPropsRef: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedComponentPropsRef,
122643
- mergedBreakpointsRef: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedBreakpointsRef,
122630
+ inlineThemeDisabled: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.inlineThemeDisabled,
122631
+ mergedRtlRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedRtlRef,
122632
+ mergedComponentPropsRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef,
122633
+ mergedBreakpointsRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBreakpointsRef,
122644
122634
  mergedBorderedRef: computed(() => {
122645
122635
  var _a2, _b2;
122646
122636
  const {
122647
122637
  bordered
122648
122638
  } = props;
122649
122639
  if (bordered !== void 0) return bordered;
122650
- return (_b2 = (_a2 = NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedBorderedRef.value) !== null && _a2 !== void 0 ? _a2 : options.defaultBordered) !== null && _b2 !== void 0 ? _b2 : true;
122640
+ return (_b2 = (_a2 = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBorderedRef.value) !== null && _a2 !== void 0 ? _a2 : options.defaultBordered) !== null && _b2 !== void 0 ? _b2 : true;
122651
122641
  }),
122652
- mergedClsPrefixRef: NConfigProvider ? NConfigProvider.mergedClsPrefixRef : shallowRef(defaultClsPrefix$1),
122653
- namespaceRef: computed(() => NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedNamespaceRef.value)
122642
+ mergedClsPrefixRef: NConfigProvider2 ? NConfigProvider2.mergedClsPrefixRef : shallowRef(defaultClsPrefix$1),
122643
+ namespaceRef: computed(() => NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedNamespaceRef.value)
122654
122644
  };
122655
122645
  }
122656
122646
  function useThemeClass$1(componentName, hashRef, cssVarsRef, props) {
122657
122647
  if (!cssVarsRef) throwError$1("useThemeClass", "cssVarsRef is not passed");
122658
- const NConfigProvider = inject(configProviderInjectionKey$1, null);
122659
- const mergedThemeHashRef = NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedThemeHashRef;
122660
- const styleMountTarget = NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget;
122648
+ const NConfigProvider2 = inject(configProviderInjectionKey$1, null);
122649
+ const mergedThemeHashRef = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeHashRef;
122650
+ const styleMountTarget = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget;
122661
122651
  const themeClassRef = ref("");
122662
122652
  const ssrAdapter2 = useSsrAdapter$1();
122663
122653
  let renderCallback;
@@ -124002,7 +123992,7 @@ ${style2}
124002
123992
  }
124003
123993
  return componentRtlState;
124004
123994
  });
124005
- const NConfigProvider = inject(configProviderInjectionKey$1, null);
123995
+ const NConfigProvider2 = inject(configProviderInjectionKey$1, null);
124006
123996
  const mountStyle = () => {
124007
123997
  watchEffect(() => {
124008
123998
  const {
@@ -124022,7 +124012,7 @@ ${style2}
124022
124012
  bPrefix: clsPrefix ? `.${clsPrefix}-` : void 0
124023
124013
  },
124024
124014
  ssr: ssrAdapter2,
124025
- parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
124015
+ parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
124026
124016
  });
124027
124017
  });
124028
124018
  };
@@ -124080,7 +124070,7 @@ ${style2}
124080
124070
  }
124081
124071
  function useTheme$1(resolveId, mountId, style2, defaultTheme, props, clsPrefixRef) {
124082
124072
  const ssrAdapter2 = useSsrAdapter$1();
124083
- const NConfigProvider = inject(configProviderInjectionKey$1, null);
124073
+ const NConfigProvider2 = inject(configProviderInjectionKey$1, null);
124084
124074
  if (style2) {
124085
124075
  const mountStyle = () => {
124086
124076
  const clsPrefix = clsPrefixRef === null || clsPrefixRef === void 0 ? void 0 : clsPrefixRef.value;
@@ -124092,15 +124082,15 @@ ${style2}
124092
124082
  },
124093
124083
  anchorMetaName: cssrAnchorMetaName$2,
124094
124084
  ssr: ssrAdapter2,
124095
- parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
124085
+ parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
124096
124086
  });
124097
- if (!(NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.preflightStyleDisabled)) {
124087
+ if (!(NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.preflightStyleDisabled)) {
124098
124088
  globalStyle$1.mount({
124099
124089
  id: "n-global",
124100
124090
  head: true,
124101
124091
  anchorMetaName: cssrAnchorMetaName$2,
124102
124092
  ssr: ssrAdapter2,
124103
- parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
124093
+ parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
124104
124094
  });
124105
124095
  }
124106
124096
  };
@@ -124132,11 +124122,11 @@ ${style2}
124132
124122
  self: globalSelf = void 0,
124133
124123
  peers: globalPeers = {}
124134
124124
  } = {}
124135
- } = (NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedThemeRef.value) || {};
124125
+ } = (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeRef.value) || {};
124136
124126
  const {
124137
124127
  common: globalCommonOverrides = void 0,
124138
124128
  [resolveId]: globalSelfOverrides = {}
124139
- } = (NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedThemeOverridesRef.value) || {};
124129
+ } = (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value) || {};
124140
124130
  const {
124141
124131
  common: globalSelfCommonOverrides,
124142
124132
  peers: globalPeersOverrides = {}
@@ -126894,6 +126884,209 @@ ${style2}
126894
126884
  });
126895
126885
  }
126896
126886
  });
126887
+ const configProviderProps$1 = {
126888
+ abstract: Boolean,
126889
+ bordered: {
126890
+ type: Boolean,
126891
+ default: void 0
126892
+ },
126893
+ clsPrefix: String,
126894
+ locale: Object,
126895
+ dateLocale: Object,
126896
+ namespace: String,
126897
+ rtl: Array,
126898
+ tag: {
126899
+ type: String,
126900
+ default: "div"
126901
+ },
126902
+ hljs: Object,
126903
+ katex: Object,
126904
+ theme: Object,
126905
+ themeOverrides: Object,
126906
+ componentOptions: Object,
126907
+ icons: Object,
126908
+ breakpoints: Object,
126909
+ preflightStyleDisabled: Boolean,
126910
+ styleMountTarget: Object,
126911
+ inlineThemeDisabled: {
126912
+ type: Boolean,
126913
+ default: void 0
126914
+ },
126915
+ // deprecated
126916
+ as: {
126917
+ type: String,
126918
+ validator: () => {
126919
+ warn$3("config-provider", "`as` is deprecated, please use `tag` instead.");
126920
+ return true;
126921
+ },
126922
+ default: void 0
126923
+ }
126924
+ };
126925
+ const NConfigProvider$1 = /* @__PURE__ */ defineComponent({
126926
+ name: "ConfigProvider",
126927
+ alias: ["App"],
126928
+ props: configProviderProps$1,
126929
+ setup(props) {
126930
+ const NConfigProvider2 = inject(configProviderInjectionKey$1, null);
126931
+ const mergedThemeRef = computed(() => {
126932
+ const {
126933
+ theme
126934
+ } = props;
126935
+ if (theme === null) return void 0;
126936
+ const inheritedTheme = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeRef.value;
126937
+ return theme === void 0 ? inheritedTheme : inheritedTheme === void 0 ? theme : Object.assign({}, inheritedTheme, theme);
126938
+ });
126939
+ const mergedThemeOverridesRef = computed(() => {
126940
+ const {
126941
+ themeOverrides
126942
+ } = props;
126943
+ if (themeOverrides === null) return void 0;
126944
+ if (themeOverrides === void 0) {
126945
+ return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value;
126946
+ } else {
126947
+ const inheritedThemeOverrides = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value;
126948
+ if (inheritedThemeOverrides === void 0) {
126949
+ return themeOverrides;
126950
+ } else {
126951
+ return merge$1$1({}, inheritedThemeOverrides, themeOverrides);
126952
+ }
126953
+ }
126954
+ });
126955
+ const mergedNamespaceRef = useMemo$1(() => {
126956
+ const {
126957
+ namespace: namespace2
126958
+ } = props;
126959
+ return namespace2 === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedNamespaceRef.value : namespace2;
126960
+ });
126961
+ const mergedBorderedRef = useMemo$1(() => {
126962
+ const {
126963
+ bordered
126964
+ } = props;
126965
+ return bordered === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBorderedRef.value : bordered;
126966
+ });
126967
+ const mergedIconsRef = computed(() => {
126968
+ const {
126969
+ icons: icons2
126970
+ } = props;
126971
+ return icons2 === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedIconsRef.value : icons2;
126972
+ });
126973
+ const mergedComponentPropsRef = computed(() => {
126974
+ const {
126975
+ componentOptions
126976
+ } = props;
126977
+ if (componentOptions !== void 0) return componentOptions;
126978
+ return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef.value;
126979
+ });
126980
+ const mergedClsPrefixRef = computed(() => {
126981
+ const {
126982
+ clsPrefix
126983
+ } = props;
126984
+ if (clsPrefix !== void 0) return clsPrefix;
126985
+ if (NConfigProvider2) return NConfigProvider2.mergedClsPrefixRef.value;
126986
+ return defaultClsPrefix$1;
126987
+ });
126988
+ const mergedRtlRef = computed(() => {
126989
+ var _a2;
126990
+ const {
126991
+ rtl
126992
+ } = props;
126993
+ if (rtl === void 0) {
126994
+ return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedRtlRef.value;
126995
+ }
126996
+ const rtlEnabledState = {};
126997
+ for (const rtlInfo of rtl) {
126998
+ rtlEnabledState[rtlInfo.name] = markRaw(rtlInfo);
126999
+ (_a2 = rtlInfo.peers) === null || _a2 === void 0 ? void 0 : _a2.forEach((peerRtlInfo) => {
127000
+ if (!(peerRtlInfo.name in rtlEnabledState)) {
127001
+ rtlEnabledState[peerRtlInfo.name] = markRaw(peerRtlInfo);
127002
+ }
127003
+ });
127004
+ }
127005
+ return rtlEnabledState;
127006
+ });
127007
+ const mergedBreakpointsRef = computed(() => {
127008
+ return props.breakpoints || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBreakpointsRef.value);
127009
+ });
127010
+ const inlineThemeDisabled = props.inlineThemeDisabled || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.inlineThemeDisabled);
127011
+ const preflightStyleDisabled = props.preflightStyleDisabled || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.preflightStyleDisabled);
127012
+ const styleMountTarget = props.styleMountTarget || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget);
127013
+ const mergedThemeHashRef = computed(() => {
127014
+ const {
127015
+ value: theme
127016
+ } = mergedThemeRef;
127017
+ const {
127018
+ value: mergedThemeOverrides
127019
+ } = mergedThemeOverridesRef;
127020
+ const hasThemeOverrides = mergedThemeOverrides && Object.keys(mergedThemeOverrides).length !== 0;
127021
+ const themeName = theme === null || theme === void 0 ? void 0 : theme.name;
127022
+ if (themeName) {
127023
+ if (hasThemeOverrides) {
127024
+ return `${themeName}-${murmur2$1(JSON.stringify(mergedThemeOverridesRef.value))}`;
127025
+ }
127026
+ return themeName;
127027
+ } else {
127028
+ if (hasThemeOverrides) {
127029
+ return murmur2$1(JSON.stringify(mergedThemeOverridesRef.value));
127030
+ }
127031
+ return "";
127032
+ }
127033
+ });
127034
+ provide(configProviderInjectionKey$1, {
127035
+ mergedThemeHashRef,
127036
+ mergedBreakpointsRef,
127037
+ mergedRtlRef,
127038
+ mergedIconsRef,
127039
+ mergedComponentPropsRef,
127040
+ mergedBorderedRef,
127041
+ mergedNamespaceRef,
127042
+ mergedClsPrefixRef,
127043
+ mergedLocaleRef: computed(() => {
127044
+ const {
127045
+ locale
127046
+ } = props;
127047
+ if (locale === null) return void 0;
127048
+ return locale === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedLocaleRef.value : locale;
127049
+ }),
127050
+ mergedDateLocaleRef: computed(() => {
127051
+ const {
127052
+ dateLocale
127053
+ } = props;
127054
+ if (dateLocale === null) return void 0;
127055
+ return dateLocale === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedDateLocaleRef.value : dateLocale;
127056
+ }),
127057
+ mergedHljsRef: computed(() => {
127058
+ const {
127059
+ hljs
127060
+ } = props;
127061
+ return hljs === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedHljsRef.value : hljs;
127062
+ }),
127063
+ mergedKatexRef: computed(() => {
127064
+ const {
127065
+ katex
127066
+ } = props;
127067
+ return katex === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedKatexRef.value : katex;
127068
+ }),
127069
+ mergedThemeRef,
127070
+ mergedThemeOverridesRef,
127071
+ inlineThemeDisabled: inlineThemeDisabled || false,
127072
+ preflightStyleDisabled: preflightStyleDisabled || false,
127073
+ styleMountTarget
127074
+ });
127075
+ return {
127076
+ mergedClsPrefix: mergedClsPrefixRef,
127077
+ mergedBordered: mergedBorderedRef,
127078
+ mergedNamespace: mergedNamespaceRef,
127079
+ mergedTheme: mergedThemeRef,
127080
+ mergedThemeOverrides: mergedThemeOverridesRef
127081
+ };
127082
+ },
127083
+ render() {
127084
+ var _a2, _b2, _c, _d;
127085
+ return !this.abstract ? h$1(this.as || this.tag, {
127086
+ class: `${this.mergedClsPrefix || defaultClsPrefix$1}-config-provider`
127087
+ }, (_b2 = (_a2 = this.$slots).default) === null || _b2 === void 0 ? void 0 : _b2.call(_a2)) : (_d = (_c = this.$slots).default) === null || _d === void 0 ? void 0 : _d.call(_c);
127088
+ }
127089
+ });
126897
127090
  const commonVariables$5 = {
126898
127091
  padding: "4px 0",
126899
127092
  optionIconSizeSmall: "14px",
@@ -128371,6 +128564,316 @@ ${style2}
128371
128564
  return child;
128372
128565
  }
128373
128566
  });
128567
+ const _hoisted_1$4$2 = { class: "toolbar-icon" };
128568
+ const _hoisted_2$3$2 = ["innerHTML"];
128569
+ const _sfc_main$5$2 = {
128570
+ __name: "ToolbarButtonIcon",
128571
+ props: {
128572
+ name: {
128573
+ type: String,
128574
+ required: true
128575
+ },
128576
+ color: {
128577
+ type: String,
128578
+ default: null
128579
+ },
128580
+ icon: {
128581
+ type: String,
128582
+ default: null
128583
+ }
128584
+ },
128585
+ setup(__props) {
128586
+ const props = __props;
128587
+ const getBarColor = computed(() => {
128588
+ if (props.name === "color") return { backgroundColor: props.color || "#111111" };
128589
+ if (props.name === "highlight") return { backgroundColor: props.color || "#D6D6D6" };
128590
+ });
128591
+ const hasColorBar = computed(() => {
128592
+ return ["color", "highlight"].includes(props.name);
128593
+ });
128594
+ return (_ctx, _cache) => {
128595
+ return openBlock(), createElementBlock("div", _hoisted_1$4$2, [
128596
+ createBaseVNode("div", {
128597
+ class: normalizeClass(["toolbar-icon__icon", [`toolbar-icon__icon--${props.name}`]]),
128598
+ innerHTML: __props.icon
128599
+ }, null, 10, _hoisted_2$3$2),
128600
+ hasColorBar.value ? (openBlock(), createElementBlock("div", {
128601
+ key: 0,
128602
+ class: "color-bar",
128603
+ style: normalizeStyle(getBarColor.value)
128604
+ }, null, 4)) : createCommentVNode("", true)
128605
+ ]);
128606
+ };
128607
+ }
128608
+ };
128609
+ const ToolbarButtonIcon = /* @__PURE__ */ _export_sfc$1(_sfc_main$5$2, [["__scopeId", "data-v-6d7523ab"]]);
128610
+ const _hoisted_1$3$2 = ["role", "aria-label", "onKeydown"];
128611
+ const _hoisted_2$2$2 = ["data-item"];
128612
+ const _hoisted_3$2$2 = {
128613
+ key: 1,
128614
+ class: "button-label"
128615
+ };
128616
+ const _hoisted_4$1$2 = { key: 2 };
128617
+ const _hoisted_5$5 = ["onKeydown", "id"];
128618
+ const _hoisted_6$3 = ["placeholder", "onKeydown", "id"];
128619
+ const _hoisted_7$3 = ["innerHTML"];
128620
+ const _hoisted_8$3 = {
128621
+ "aria-live": "polite",
128622
+ class: "visually-hidden"
128623
+ };
128624
+ const _sfc_main$4$2 = {
128625
+ __name: "ToolbarButton",
128626
+ props: {
128627
+ iconColor: {
128628
+ type: String,
128629
+ default: null
128630
+ },
128631
+ active: {
128632
+ type: Boolean,
128633
+ default: false
128634
+ },
128635
+ isNarrow: {
128636
+ type: Boolean,
128637
+ default: false
128638
+ },
128639
+ isWide: {
128640
+ type: Boolean,
128641
+ default: false
128642
+ },
128643
+ toolbarItem: {
128644
+ type: Object,
128645
+ required: true
128646
+ },
128647
+ defaultLabel: {
128648
+ type: String,
128649
+ default: null
128650
+ },
128651
+ isOverflowItem: {
128652
+ type: Boolean,
128653
+ default: false
128654
+ }
128655
+ },
128656
+ emits: ["buttonClick", "textSubmit"],
128657
+ setup(__props, { emit: __emit }) {
128658
+ const emit2 = __emit;
128659
+ const props = __props;
128660
+ const {
128661
+ name,
128662
+ active,
128663
+ icon,
128664
+ label,
128665
+ hideLabel,
128666
+ iconColor,
128667
+ hasCaret,
128668
+ disabled,
128669
+ inlineTextInputVisible,
128670
+ hasInlineTextInput,
128671
+ minWidth,
128672
+ style: style2,
128673
+ attributes
128674
+ } = props.toolbarItem;
128675
+ const inlineTextInput = ref(label);
128676
+ const inlineInput = ref(null);
128677
+ const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode$1();
128678
+ const handleClick2 = () => {
128679
+ if (hasInlineTextInput) {
128680
+ nextTick(() => {
128681
+ inlineInput.value?.focus();
128682
+ inlineInput.value?.select();
128683
+ });
128684
+ }
128685
+ emit2("buttonClick");
128686
+ };
128687
+ const handleInputSubmit = () => {
128688
+ const value = inlineTextInput.value;
128689
+ const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
128690
+ emit2("textSubmit", cleanValue);
128691
+ inlineTextInput.value = cleanValue;
128692
+ };
128693
+ const getStyle = computed(() => {
128694
+ if (style2.value) return style2.value;
128695
+ return {
128696
+ minWidth: props.minWidth
128697
+ };
128698
+ });
128699
+ const caretIcon = computed(() => {
128700
+ return active.value ? toolbarIcons.dropdownCaretUp : toolbarIcons.dropdownCaretDown;
128701
+ });
128702
+ return (_ctx, _cache) => {
128703
+ return openBlock(), createElementBlock("div", {
128704
+ class: normalizeClass(["toolbar-item", unref(attributes).className]),
128705
+ style: normalizeStyle(getStyle.value),
128706
+ role: __props.isOverflowItem ? "menuitem" : "button",
128707
+ "aria-label": unref(attributes).ariaLabel,
128708
+ onClick: handleClick2,
128709
+ onKeydown: withKeys(withModifiers(handleClick2, ["stop"]), ["enter"]),
128710
+ tabindex: "0"
128711
+ }, [
128712
+ createBaseVNode("div", {
128713
+ class: normalizeClass(["toolbar-button", {
128714
+ active: unref(active),
128715
+ disabled: unref(disabled),
128716
+ narrow: __props.isNarrow,
128717
+ wide: __props.isWide,
128718
+ "has-inline-text-input": unref(hasInlineTextInput),
128719
+ "high-contrast": unref(isHighContrastMode2)
128720
+ }]),
128721
+ "data-item": `btn-${unref(name) || ""}`
128722
+ }, [
128723
+ unref(icon) ? (openBlock(), createBlock(ToolbarButtonIcon, {
128724
+ key: 0,
128725
+ color: unref(iconColor),
128726
+ class: "toolbar-icon",
128727
+ icon: unref(icon),
128728
+ name: unref(name)
128729
+ }, null, 8, ["color", "icon", "name"])) : createCommentVNode("", true),
128730
+ unref(label) && !unref(hideLabel) && !unref(inlineTextInputVisible) ? (openBlock(), createElementBlock("div", _hoisted_3$2$2, toDisplayString(unref(label)), 1)) : createCommentVNode("", true),
128731
+ unref(inlineTextInputVisible) ? (openBlock(), createElementBlock("span", _hoisted_4$1$2, [
128732
+ unref(name) === "fontSize" ? withDirectives((openBlock(), createElementBlock("input", {
128733
+ key: 0,
128734
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inlineTextInput.value = $event),
128735
+ onKeydown: withKeys(withModifiers(handleInputSubmit, ["prevent"]), ["enter"]),
128736
+ type: "text",
128737
+ class: normalizeClass(["button-text-input button-text-input--font-size", { "high-contrast": unref(isHighContrastMode2) }]),
128738
+ id: "inlineTextInput-" + unref(name),
128739
+ autocomplete: "off",
128740
+ ref_key: "inlineInput",
128741
+ ref: inlineInput
128742
+ }, null, 42, _hoisted_5$5)), [
128743
+ [vModelText, inlineTextInput.value]
128744
+ ]) : withDirectives((openBlock(), createElementBlock("input", {
128745
+ key: 1,
128746
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inlineTextInput.value = $event),
128747
+ placeholder: unref(label),
128748
+ onKeydown: withKeys(withModifiers(handleInputSubmit, ["prevent"]), ["enter"]),
128749
+ type: "text",
128750
+ class: "button-text-input",
128751
+ id: "inlineTextInput-" + unref(name),
128752
+ autocomplete: "off",
128753
+ ref_key: "inlineInput",
128754
+ ref: inlineInput
128755
+ }, null, 40, _hoisted_6$3)), [
128756
+ [vModelText, inlineTextInput.value]
128757
+ ])
128758
+ ])) : createCommentVNode("", true),
128759
+ unref(hasCaret) ? (openBlock(), createElementBlock("div", {
128760
+ key: 3,
128761
+ class: "dropdown-caret",
128762
+ innerHTML: caretIcon.value,
128763
+ style: normalizeStyle({ opacity: unref(disabled) ? 0.6 : 1 })
128764
+ }, null, 12, _hoisted_7$3)) : createCommentVNode("", true),
128765
+ createBaseVNode("div", _hoisted_8$3, toDisplayString(`${unref(attributes).ariaLabel} ${unref(active) ? "selected" : "unset"}`), 1)
128766
+ ], 10, _hoisted_2$2$2)
128767
+ ], 46, _hoisted_1$3$2);
128768
+ };
128769
+ }
128770
+ };
128771
+ const ToolbarButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$4$2, [["__scopeId", "data-v-ea93b080"]]);
128772
+ const _hoisted_1$2$2 = {
128773
+ class: "toolbar-separator",
128774
+ role: "separator",
128775
+ "aria-label": "Toolbar separator"
128776
+ };
128777
+ const _sfc_main$3$2 = {
128778
+ __name: "ToolbarSeparator",
128779
+ props: {
128780
+ active: {
128781
+ type: Boolean,
128782
+ default: false
128783
+ }
128784
+ },
128785
+ emits: ["command"],
128786
+ setup(__props, { emit: __emit }) {
128787
+ const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode$1();
128788
+ const getSeparatorColor = () => {
128789
+ if (isHighContrastMode2.value) {
128790
+ return "#000";
128791
+ }
128792
+ return "#dbdbdb";
128793
+ };
128794
+ return (_ctx, _cache) => {
128795
+ return openBlock(), createElementBlock("div", _hoisted_1$2$2, [
128796
+ createBaseVNode("div", {
128797
+ class: "separator-inner",
128798
+ style: normalizeStyle({ backgroundColor: getSeparatorColor() })
128799
+ }, null, 4)
128800
+ ]);
128801
+ };
128802
+ }
128803
+ };
128804
+ const ToolbarSeparator = /* @__PURE__ */ _export_sfc$1(_sfc_main$3$2, [["__scopeId", "data-v-4ef9aa18"]]);
128805
+ const _hoisted_1$1$2 = { class: "overflow-menu" };
128806
+ const _hoisted_2$1$2 = { class: "overflow-menu-trigger" };
128807
+ const _hoisted_3$1$2 = {
128808
+ key: 0,
128809
+ class: "overflow-menu_items",
128810
+ role: "group"
128811
+ };
128812
+ const _sfc_main$2$2 = {
128813
+ __name: "OverflowMenu",
128814
+ props: {
128815
+ toolbarItem: {
128816
+ type: Object,
128817
+ required: true
128818
+ },
128819
+ overflowItems: {
128820
+ type: Array,
128821
+ required: true
128822
+ }
128823
+ },
128824
+ emits: ["buttonClick", "close"],
128825
+ setup(__props, { emit: __emit }) {
128826
+ const { proxy } = getCurrentInstance();
128827
+ const emit2 = __emit;
128828
+ const props = __props;
128829
+ const isOverflowMenuOpened = computed(() => props.toolbarItem.expand.value);
128830
+ const hasOpenDropdown = ref(false);
128831
+ const overflowToolbarItem = computed(() => ({
128832
+ ...props.toolbarItem,
128833
+ active: isOverflowMenuOpened.value
128834
+ }));
128835
+ const toggleOverflowMenu = () => {
128836
+ emit2("buttonClick", props.toolbarItem);
128837
+ };
128838
+ const handleCommand = ({ item, argument }) => {
128839
+ proxy.$toolbar.emitCommand({ item, argument });
128840
+ };
128841
+ const handleKeyDown2 = (e) => {
128842
+ if (e.key === "Escape") {
128843
+ if (isOverflowMenuOpened.value && !hasOpenDropdown.value) {
128844
+ e.preventDefault();
128845
+ emit2("close");
128846
+ }
128847
+ }
128848
+ };
128849
+ onMounted(() => {
128850
+ document.addEventListener("keydown", handleKeyDown2, true);
128851
+ });
128852
+ onBeforeUnmount(() => {
128853
+ document.removeEventListener("keydown", handleKeyDown2, true);
128854
+ });
128855
+ return (_ctx, _cache) => {
128856
+ return openBlock(), createElementBlock("div", _hoisted_1$1$2, [
128857
+ createBaseVNode("div", _hoisted_2$1$2, [
128858
+ createVNode(ToolbarButton, {
128859
+ "toolbar-item": overflowToolbarItem.value,
128860
+ onButtonClick: toggleOverflowMenu
128861
+ }, null, 8, ["toolbar-item"])
128862
+ ]),
128863
+ isOverflowMenuOpened.value ? (openBlock(), createElementBlock("div", _hoisted_3$1$2, [
128864
+ createVNode(ButtonGroup, {
128865
+ class: "superdoc-toolbar-overflow",
128866
+ "toolbar-items": __props.overflowItems,
128867
+ "from-overflow": "",
128868
+ onCommand: handleCommand,
128869
+ onDropdownUpdateShow: _cache[0] || (_cache[0] = ($event) => hasOpenDropdown.value = $event)
128870
+ }, null, 8, ["toolbar-items"])
128871
+ ])) : createCommentVNode("", true)
128872
+ ]);
128873
+ };
128874
+ }
128875
+ };
128876
+ const OverflowMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$2$2, [["__scopeId", "data-v-ef28da92"]]);
128374
128877
  const _hoisted_1$j = ["onKeydown", "tabindex", "data-item-id"];
128375
128878
  const _hoisted_2$c = { key: 0 };
128376
128879
  const _hoisted_3$a = { key: 0 };
@@ -128386,6 +128889,16 @@ ${style2}
128386
128889
  type: Array,
128387
128890
  default: () => []
128388
128891
  },
128892
+ /**
128893
+ * The font-family to use for UI elements like dropdowns and tooltips.
128894
+ * This ensures consistent typography across toolbar UI components.
128895
+ * @type {string}
128896
+ * @default 'Arial, Helvetica, sans-serif'
128897
+ */
128898
+ uiFontFamily: {
128899
+ type: String,
128900
+ default: "Arial, Helvetica, sans-serif"
128901
+ },
128389
128902
  position: {
128390
128903
  type: String,
128391
128904
  default: "left"
@@ -128578,6 +129091,7 @@ ${style2}
128578
129091
  options: dropdownOptions(item),
128579
129092
  trigger: item.disabled.value ? null : "click",
128580
129093
  show: item.expand.value,
129094
+ "content-style": { fontFamily: props.uiFontFamily },
128581
129095
  size: "medium",
128582
129096
  placement: "bottom-start",
128583
129097
  class: normalizeClass(["toolbar-button toolbar-dropdown sd-editor-toolbar-dropdown", { "high-contrast": unref(isHighContrastMode2) }]),
@@ -128585,14 +129099,16 @@ ${style2}
128585
129099
  onUpdateShow: handleDropdownUpdateShow,
128586
129100
  style: normalizeStyle(item.dropdownStyles.value),
128587
129101
  "menu-props": () => ({
128588
- role: "menu"
129102
+ role: "menu",
129103
+ style: { fontFamily: props.uiFontFamily }
128589
129104
  }),
128590
129105
  "node-props": (option) => getDropdownAttributes(option, item)
128591
129106
  }, {
128592
129107
  default: withCtx(() => [
128593
129108
  createVNode(unref(NTooltip), {
128594
129109
  trigger: "hover",
128595
- disabled: !item.tooltip?.value
129110
+ disabled: !item.tooltip?.value,
129111
+ "content-style": { fontFamily: props.uiFontFamily }
128596
129112
  }, {
128597
129113
  trigger: withCtx(() => [
128598
129114
  createVNode(ToolbarButton, {
@@ -128609,13 +129125,14 @@ ${style2}
128609
129125
  ])
128610
129126
  ]),
128611
129127
  _: 2
128612
- }, 1032, ["disabled"])
129128
+ }, 1032, ["disabled", "content-style"])
128613
129129
  ]),
128614
129130
  _: 2
128615
- }, 1032, ["options", "trigger", "show", "class", "onSelect", "style", "node-props"])) : isButton(item) ? (openBlock(), createBlock(unref(NTooltip), {
129131
+ }, 1032, ["options", "trigger", "show", "content-style", "class", "onSelect", "style", "menu-props", "node-props"])) : isButton(item) ? (openBlock(), createBlock(unref(NTooltip), {
128616
129132
  key: 2,
128617
129133
  trigger: "hover",
128618
- class: "sd-editor-toolbar-tooltip"
129134
+ class: "sd-editor-toolbar-tooltip",
129135
+ "content-style": { fontFamily: props.uiFontFamily }
128619
129136
  }, {
128620
129137
  trigger: withCtx(() => [
128621
129138
  createVNode(ToolbarButton, {
@@ -128632,7 +129149,7 @@ ${style2}
128632
129149
  ])) : createCommentVNode("", true)
128633
129150
  ]),
128634
129151
  _: 2
128635
- }, 1024)) : createCommentVNode("", true),
129152
+ }, 1032, ["content-style"])) : createCommentVNode("", true),
128636
129153
  isOverflow(item) && __props.overflowItems.length ? (openBlock(), createBlock(OverflowMenu, {
128637
129154
  key: 3,
128638
129155
  "toolbar-item": item,
@@ -128646,13 +129163,21 @@ ${style2}
128646
129163
  };
128647
129164
  }
128648
129165
  };
128649
- const ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$2, [["__scopeId", "data-v-c80a1e51"]]);
129166
+ const ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$2, [["__scopeId", "data-v-f732136c"]]);
129167
+ const DEFAULT_UI_FONT_FAMILY$1 = "Arial, Helvetica, sans-serif";
128650
129168
  const _sfc_main$k = {
128651
129169
  __name: "Toolbar",
128652
129170
  emits: ["command", "toggle", "select"],
128653
129171
  setup(__props, { emit: __emit }) {
128654
129172
  const { proxy } = getCurrentInstance();
128655
129173
  let toolbarKey = ref(1);
129174
+ const uiFontFamily = computed(() => {
129175
+ const configured = proxy?.$toolbar?.config?.uiDisplayFallbackFont;
129176
+ if (typeof configured === "string" && configured.trim()) {
129177
+ return configured.trim();
129178
+ }
129179
+ return DEFAULT_UI_FONT_FAMILY$1;
129180
+ });
128656
129181
  const showLeftSide = proxy.$toolbar.config?.toolbarGroups?.includes("left");
128657
129182
  const showRightSide = proxy.$toolbar.config?.toolbarGroups?.includes("right");
128658
129183
  const excludeButtonsList = proxy.$toolbar.config?.toolbarButtonsExclude || [];
@@ -128699,37 +129224,48 @@ ${style2}
128699
129224
  "aria-label": "Toolbar",
128700
129225
  "data-editor-ui-surface": ""
128701
129226
  }, [
128702
- unref(showLeftSide) ? (openBlock(), createBlock(ButtonGroup, {
128703
- key: 0,
128704
- tabindex: "0",
128705
- "toolbar-items": getFilteredItems("left"),
128706
- position: "left",
128707
- onCommand: handleCommand,
128708
- onItemClicked: restoreSelection2,
128709
- class: "superdoc-toolbar-group-side"
128710
- }, null, 8, ["toolbar-items"])) : createCommentVNode("", true),
128711
- createVNode(ButtonGroup, {
128712
- tabindex: "0",
128713
- "toolbar-items": getFilteredItems("center"),
128714
- "overflow-items": unref(proxy).$toolbar.overflowItems,
128715
- position: "center",
128716
- onCommand: handleCommand,
128717
- onItemClicked: restoreSelection2
128718
- }, null, 8, ["toolbar-items", "overflow-items"]),
128719
- unref(showRightSide) ? (openBlock(), createBlock(ButtonGroup, {
128720
- key: 1,
128721
- tabindex: "0",
128722
- "toolbar-items": getFilteredItems("right"),
128723
- position: "right",
128724
- onCommand: handleCommand,
128725
- onItemClicked: restoreSelection2,
128726
- class: "superdoc-toolbar-group-side"
128727
- }, null, 8, ["toolbar-items"])) : createCommentVNode("", true)
129227
+ createVNode(unref(NConfigProvider$1), {
129228
+ abstract: "",
129229
+ "preflight-style-disabled": ""
129230
+ }, {
129231
+ default: withCtx(() => [
129232
+ unref(showLeftSide) ? (openBlock(), createBlock(ButtonGroup, {
129233
+ key: 0,
129234
+ tabindex: "0",
129235
+ "toolbar-items": getFilteredItems("left"),
129236
+ "ui-font-family": uiFontFamily.value,
129237
+ position: "left",
129238
+ onCommand: handleCommand,
129239
+ onItemClicked: restoreSelection2,
129240
+ class: "superdoc-toolbar-group-side"
129241
+ }, null, 8, ["toolbar-items", "ui-font-family"])) : createCommentVNode("", true),
129242
+ createVNode(ButtonGroup, {
129243
+ tabindex: "0",
129244
+ "toolbar-items": getFilteredItems("center"),
129245
+ "overflow-items": unref(proxy).$toolbar.overflowItems,
129246
+ "ui-font-family": uiFontFamily.value,
129247
+ position: "center",
129248
+ onCommand: handleCommand,
129249
+ onItemClicked: restoreSelection2
129250
+ }, null, 8, ["toolbar-items", "overflow-items", "ui-font-family"]),
129251
+ unref(showRightSide) ? (openBlock(), createBlock(ButtonGroup, {
129252
+ key: 1,
129253
+ tabindex: "0",
129254
+ "toolbar-items": getFilteredItems("right"),
129255
+ "ui-font-family": uiFontFamily.value,
129256
+ position: "right",
129257
+ onCommand: handleCommand,
129258
+ onItemClicked: restoreSelection2,
129259
+ class: "superdoc-toolbar-group-side"
129260
+ }, null, 8, ["toolbar-items", "ui-font-family"])) : createCommentVNode("", true)
129261
+ ]),
129262
+ _: 1
129263
+ })
128728
129264
  ]);
128729
129265
  };
128730
129266
  }
128731
129267
  };
128732
- const Toolbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__scopeId", "data-v-3f5ec271"]]);
129268
+ const Toolbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__scopeId", "data-v-c7a72aa9"]]);
128733
129269
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
128734
129270
  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: ";
128735
129271
  async function baseInsightsFetch(payload, options = {}) {
@@ -129246,7 +129782,7 @@ ${style2}
129246
129782
  };
129247
129783
  }
129248
129784
  };
129249
- const AIWriter = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__scopeId", "data-v-d869be75"]]);
129785
+ const AIWriter = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__scopeId", "data-v-a4bc3d14"]]);
129250
129786
  async function createZip(blobs, fileNames) {
129251
129787
  const zip = new JSZip();
129252
129788
  blobs.forEach((blob, index2) => {
@@ -132095,6 +132631,10 @@ ${style2}
132095
132631
  this.config.selector = this.config.element;
132096
132632
  }
132097
132633
  this.toolbarContainer = this.findElementBySelector(this.config.selector);
132634
+ if (this.toolbarContainer) {
132635
+ const uiFontFamily = (this.config?.uiDisplayFallbackFont || "").toString().trim() || "Arial, Helvetica, sans-serif";
132636
+ this.toolbarContainer.style.setProperty("--sd-ui-font-family", uiFontFamily);
132637
+ }
132098
132638
  __privateMethod(this, _SuperToolbar_instances, initToolbarGroups_fn).call(this);
132099
132639
  __privateMethod(this, _SuperToolbar_instances, makeToolbarItems_fn).call(this, {
132100
132640
  superToolbar: this,
@@ -139076,6 +139616,62 @@ ${reason}`);
139076
139616
  handleTrackedChangeUpdate
139077
139617
  };
139078
139618
  });
139619
+ const commentIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4c0 0 0 0 0 0s0 0 0 0s0 0 0 0c0 0 0 0 0 0l.3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>';
139620
+ const caretDownIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z"/></svg>';
139621
+ const userCheckIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM0 482.3C0 383.8 79.8 304 178.3 304l91.4 0C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7L29.7 512C13.3 512 0 498.7 0 482.3zM625 177L497 305c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L591 143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>';
139622
+ const usersIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M144 0a80 80 0 1 1 0 160A80 80 0 1 1 144 0zM512 0a80 80 0 1 1 0 160A80 80 0 1 1 512 0zM0 298.7C0 239.8 47.8 192 106.7 192l42.7 0c15.9 0 31 3.5 44.6 9.7c-1.3 7.2-1.9 14.7-1.9 22.3c0 38.2 16.8 72.5 43.3 96c-.2 0-.4 0-.7 0L21.3 320C9.6 320 0 310.4 0 298.7zM405.3 320c-.2 0-.4 0-.7 0c26.6-23.5 43.3-57.8 43.3-96c0-7.6-.7-15-1.9-22.3c13.6-6.3 28.7-9.7 44.6-9.7l42.7 0C592.2 192 640 239.8 640 298.7c0 11.8-9.6 21.3-21.3 21.3l-213.3 0zM224 224a96 96 0 1 1 192 0 96 96 0 1 1 -192 0zM128 485.3C128 411.7 187.7 352 261.3 352l117.3 0C452.3 352 512 411.7 512 485.3c0 14.7-11.9 26.7-26.7 26.7l-330.7 0c-14.7 0-26.7-11.9-26.7-26.7z"/></svg>';
139623
+ const checkIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>';
139624
+ const xmarkIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>';
139625
+ const ellipsisVerticalSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"/></svg>';
139626
+ const superdocIcons = {
139627
+ comment: commentIconSvg,
139628
+ caretDown: caretDownIconSvg,
139629
+ internal: userCheckIconSvg,
139630
+ external: usersIconSvg,
139631
+ markDone: checkIconSvg,
139632
+ acceptChange: checkIconSvg,
139633
+ rejectChange: xmarkIconSvg,
139634
+ overflow: ellipsisVerticalSvg
139635
+ };
139636
+ const _export_sfc = (sfc, props) => {
139637
+ const target = sfc.__vccOpts || sfc;
139638
+ for (const [key2, val] of props) {
139639
+ target[key2] = val;
139640
+ }
139641
+ return target;
139642
+ };
139643
+ const _hoisted_1$g = { class: "user-container" };
139644
+ const _hoisted_2$9 = ["src"];
139645
+ const _hoisted_3$7 = {
139646
+ key: 1,
139647
+ class: "user-bg"
139648
+ };
139649
+ const _sfc_main$h = {
139650
+ __name: "Avatar",
139651
+ props: {
139652
+ user: {
139653
+ type: Object,
139654
+ required: true
139655
+ }
139656
+ },
139657
+ setup(__props) {
139658
+ const getInitials2 = (name, email) => {
139659
+ if (!name && !email) return;
139660
+ const firstLetter = name?.substring(0, 1) || email?.substring(0, 1) || null;
139661
+ return firstLetter;
139662
+ };
139663
+ return (_ctx, _cache) => {
139664
+ return openBlock(), createElementBlock("div", _hoisted_1$g, [
139665
+ __props.user.image ? (openBlock(), createElementBlock("img", {
139666
+ key: 0,
139667
+ class: "user-bg",
139668
+ src: __props.user.image.startsWith("http") ? __props.user.image : `data:image/png;base64,${__props.user.image}`
139669
+ }, null, 8, _hoisted_2$9)) : (openBlock(), createElementBlock("span", _hoisted_3$7, toDisplayString(getInitials2(__props.user.name, __props.user.email)), 1))
139670
+ ]);
139671
+ };
139672
+ }
139673
+ };
139674
+ const Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-53e13009"]]);
139079
139675
  function plugin$1(options) {
139080
139676
  let _bPrefix = ".";
139081
139677
  let _ePrefix = "__";
@@ -142663,30 +143259,30 @@ ${style2}
142663
143259
  function useConfig(props = {}, options = {
142664
143260
  defaultBordered: true
142665
143261
  }) {
142666
- const NConfigProvider = inject(configProviderInjectionKey, null);
143262
+ const NConfigProvider2 = inject(configProviderInjectionKey, null);
142667
143263
  return {
142668
143264
  // NConfigProvider,
142669
- inlineThemeDisabled: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.inlineThemeDisabled,
142670
- mergedRtlRef: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedRtlRef,
142671
- mergedComponentPropsRef: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedComponentPropsRef,
142672
- mergedBreakpointsRef: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedBreakpointsRef,
143265
+ inlineThemeDisabled: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.inlineThemeDisabled,
143266
+ mergedRtlRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedRtlRef,
143267
+ mergedComponentPropsRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef,
143268
+ mergedBreakpointsRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBreakpointsRef,
142673
143269
  mergedBorderedRef: computed(() => {
142674
143270
  var _a2, _b2;
142675
143271
  const {
142676
143272
  bordered
142677
143273
  } = props;
142678
143274
  if (bordered !== void 0) return bordered;
142679
- return (_b2 = (_a2 = NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedBorderedRef.value) !== null && _a2 !== void 0 ? _a2 : options.defaultBordered) !== null && _b2 !== void 0 ? _b2 : true;
143275
+ return (_b2 = (_a2 = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBorderedRef.value) !== null && _a2 !== void 0 ? _a2 : options.defaultBordered) !== null && _b2 !== void 0 ? _b2 : true;
142680
143276
  }),
142681
- mergedClsPrefixRef: NConfigProvider ? NConfigProvider.mergedClsPrefixRef : shallowRef(defaultClsPrefix),
142682
- namespaceRef: computed(() => NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedNamespaceRef.value)
143277
+ mergedClsPrefixRef: NConfigProvider2 ? NConfigProvider2.mergedClsPrefixRef : shallowRef(defaultClsPrefix),
143278
+ namespaceRef: computed(() => NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedNamespaceRef.value)
142683
143279
  };
142684
143280
  }
142685
143281
  function useThemeClass(componentName, hashRef, cssVarsRef, props) {
142686
143282
  if (!cssVarsRef) throwError("useThemeClass", "cssVarsRef is not passed");
142687
- const NConfigProvider = inject(configProviderInjectionKey, null);
142688
- const mergedThemeHashRef = NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedThemeHashRef;
142689
- const styleMountTarget = NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget;
143283
+ const NConfigProvider2 = inject(configProviderInjectionKey, null);
143284
+ const mergedThemeHashRef = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeHashRef;
143285
+ const styleMountTarget = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget;
142690
143286
  const themeClassRef = ref("");
142691
143287
  const ssrAdapter2 = useSsrAdapter();
142692
143288
  let renderCallback;
@@ -144155,7 +144751,7 @@ ${style2}
144155
144751
  }
144156
144752
  return componentRtlState;
144157
144753
  });
144158
- const NConfigProvider = inject(configProviderInjectionKey, null);
144754
+ const NConfigProvider2 = inject(configProviderInjectionKey, null);
144159
144755
  const mountStyle = () => {
144160
144756
  watchEffect(() => {
144161
144757
  const {
@@ -144175,7 +144771,7 @@ ${style2}
144175
144771
  bPrefix: clsPrefix ? `.${clsPrefix}-` : void 0
144176
144772
  },
144177
144773
  ssr: ssrAdapter2,
144178
- parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
144774
+ parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
144179
144775
  });
144180
144776
  });
144181
144777
  };
@@ -144233,7 +144829,7 @@ ${style2}
144233
144829
  return;
144234
144830
  }
144235
144831
  const ssrAdapter2 = useSsrAdapter();
144236
- const NConfigProvider = inject(configProviderInjectionKey, null);
144832
+ const NConfigProvider2 = inject(configProviderInjectionKey, null);
144237
144833
  const mountStyle = () => {
144238
144834
  const clsPrefix = clsPrefixRef.value;
144239
144835
  style2.mount({
@@ -144244,15 +144840,15 @@ ${style2}
144244
144840
  bPrefix: clsPrefix ? `.${clsPrefix}-` : void 0
144245
144841
  },
144246
144842
  ssr: ssrAdapter2,
144247
- parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
144843
+ parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
144248
144844
  });
144249
- if (!(NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.preflightStyleDisabled)) {
144845
+ if (!(NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.preflightStyleDisabled)) {
144250
144846
  globalStyle.mount({
144251
144847
  id: "n-global",
144252
144848
  head: true,
144253
144849
  anchorMetaName: cssrAnchorMetaName,
144254
144850
  ssr: ssrAdapter2,
144255
- parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
144851
+ parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
144256
144852
  });
144257
144853
  }
144258
144854
  };
@@ -144267,7 +144863,7 @@ ${style2}
144267
144863
  }
144268
144864
  function useTheme(resolveId, mountId, style2, defaultTheme, props, clsPrefixRef) {
144269
144865
  const ssrAdapter2 = useSsrAdapter();
144270
- const NConfigProvider = inject(configProviderInjectionKey, null);
144866
+ const NConfigProvider2 = inject(configProviderInjectionKey, null);
144271
144867
  if (style2) {
144272
144868
  const mountStyle = () => {
144273
144869
  const clsPrefix = clsPrefixRef === null || clsPrefixRef === void 0 ? void 0 : clsPrefixRef.value;
@@ -144279,15 +144875,15 @@ ${style2}
144279
144875
  },
144280
144876
  anchorMetaName: cssrAnchorMetaName,
144281
144877
  ssr: ssrAdapter2,
144282
- parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
144878
+ parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
144283
144879
  });
144284
- if (!(NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.preflightStyleDisabled)) {
144880
+ if (!(NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.preflightStyleDisabled)) {
144285
144881
  globalStyle.mount({
144286
144882
  id: "n-global",
144287
144883
  head: true,
144288
144884
  anchorMetaName: cssrAnchorMetaName,
144289
144885
  ssr: ssrAdapter2,
144290
- parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
144886
+ parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
144291
144887
  });
144292
144888
  }
144293
144889
  };
@@ -144319,11 +144915,11 @@ ${style2}
144319
144915
  self: globalSelf = void 0,
144320
144916
  peers: globalPeers = {}
144321
144917
  } = {}
144322
- } = (NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedThemeRef.value) || {};
144918
+ } = (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeRef.value) || {};
144323
144919
  const {
144324
144920
  common: globalCommonOverrides = void 0,
144325
144921
  [resolveId]: globalSelfOverrides = {}
144326
- } = (NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedThemeOverridesRef.value) || {};
144922
+ } = (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value) || {};
144327
144923
  const {
144328
144924
  common: globalSelfCommonOverrides,
144329
144925
  peers: globalPeersOverrides = {}
@@ -148129,6 +148725,209 @@ ${style2}
148129
148725
  }))), labelNode);
148130
148726
  }
148131
148727
  });
148728
+ const configProviderProps = {
148729
+ abstract: Boolean,
148730
+ bordered: {
148731
+ type: Boolean,
148732
+ default: void 0
148733
+ },
148734
+ clsPrefix: String,
148735
+ locale: Object,
148736
+ dateLocale: Object,
148737
+ namespace: String,
148738
+ rtl: Array,
148739
+ tag: {
148740
+ type: String,
148741
+ default: "div"
148742
+ },
148743
+ hljs: Object,
148744
+ katex: Object,
148745
+ theme: Object,
148746
+ themeOverrides: Object,
148747
+ componentOptions: Object,
148748
+ icons: Object,
148749
+ breakpoints: Object,
148750
+ preflightStyleDisabled: Boolean,
148751
+ styleMountTarget: Object,
148752
+ inlineThemeDisabled: {
148753
+ type: Boolean,
148754
+ default: void 0
148755
+ },
148756
+ // deprecated
148757
+ as: {
148758
+ type: String,
148759
+ validator: () => {
148760
+ warn("config-provider", "`as` is deprecated, please use `tag` instead.");
148761
+ return true;
148762
+ },
148763
+ default: void 0
148764
+ }
148765
+ };
148766
+ const NConfigProvider = /* @__PURE__ */ defineComponent({
148767
+ name: "ConfigProvider",
148768
+ alias: ["App"],
148769
+ props: configProviderProps,
148770
+ setup(props) {
148771
+ const NConfigProvider2 = inject(configProviderInjectionKey, null);
148772
+ const mergedThemeRef = computed(() => {
148773
+ const {
148774
+ theme
148775
+ } = props;
148776
+ if (theme === null) return void 0;
148777
+ const inheritedTheme = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeRef.value;
148778
+ return theme === void 0 ? inheritedTheme : inheritedTheme === void 0 ? theme : Object.assign({}, inheritedTheme, theme);
148779
+ });
148780
+ const mergedThemeOverridesRef = computed(() => {
148781
+ const {
148782
+ themeOverrides
148783
+ } = props;
148784
+ if (themeOverrides === null) return void 0;
148785
+ if (themeOverrides === void 0) {
148786
+ return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value;
148787
+ } else {
148788
+ const inheritedThemeOverrides = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value;
148789
+ if (inheritedThemeOverrides === void 0) {
148790
+ return themeOverrides;
148791
+ } else {
148792
+ return merge$2({}, inheritedThemeOverrides, themeOverrides);
148793
+ }
148794
+ }
148795
+ });
148796
+ const mergedNamespaceRef = useMemo(() => {
148797
+ const {
148798
+ namespace: namespace2
148799
+ } = props;
148800
+ return namespace2 === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedNamespaceRef.value : namespace2;
148801
+ });
148802
+ const mergedBorderedRef = useMemo(() => {
148803
+ const {
148804
+ bordered
148805
+ } = props;
148806
+ return bordered === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBorderedRef.value : bordered;
148807
+ });
148808
+ const mergedIconsRef = computed(() => {
148809
+ const {
148810
+ icons: icons2
148811
+ } = props;
148812
+ return icons2 === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedIconsRef.value : icons2;
148813
+ });
148814
+ const mergedComponentPropsRef = computed(() => {
148815
+ const {
148816
+ componentOptions
148817
+ } = props;
148818
+ if (componentOptions !== void 0) return componentOptions;
148819
+ return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef.value;
148820
+ });
148821
+ const mergedClsPrefixRef = computed(() => {
148822
+ const {
148823
+ clsPrefix
148824
+ } = props;
148825
+ if (clsPrefix !== void 0) return clsPrefix;
148826
+ if (NConfigProvider2) return NConfigProvider2.mergedClsPrefixRef.value;
148827
+ return defaultClsPrefix;
148828
+ });
148829
+ const mergedRtlRef = computed(() => {
148830
+ var _a2;
148831
+ const {
148832
+ rtl
148833
+ } = props;
148834
+ if (rtl === void 0) {
148835
+ return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedRtlRef.value;
148836
+ }
148837
+ const rtlEnabledState = {};
148838
+ for (const rtlInfo of rtl) {
148839
+ rtlEnabledState[rtlInfo.name] = markRaw(rtlInfo);
148840
+ (_a2 = rtlInfo.peers) === null || _a2 === void 0 ? void 0 : _a2.forEach((peerRtlInfo) => {
148841
+ if (!(peerRtlInfo.name in rtlEnabledState)) {
148842
+ rtlEnabledState[peerRtlInfo.name] = markRaw(peerRtlInfo);
148843
+ }
148844
+ });
148845
+ }
148846
+ return rtlEnabledState;
148847
+ });
148848
+ const mergedBreakpointsRef = computed(() => {
148849
+ return props.breakpoints || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBreakpointsRef.value);
148850
+ });
148851
+ const inlineThemeDisabled = props.inlineThemeDisabled || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.inlineThemeDisabled);
148852
+ const preflightStyleDisabled = props.preflightStyleDisabled || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.preflightStyleDisabled);
148853
+ const styleMountTarget = props.styleMountTarget || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget);
148854
+ const mergedThemeHashRef = computed(() => {
148855
+ const {
148856
+ value: theme
148857
+ } = mergedThemeRef;
148858
+ const {
148859
+ value: mergedThemeOverrides
148860
+ } = mergedThemeOverridesRef;
148861
+ const hasThemeOverrides = mergedThemeOverrides && Object.keys(mergedThemeOverrides).length !== 0;
148862
+ const themeName = theme === null || theme === void 0 ? void 0 : theme.name;
148863
+ if (themeName) {
148864
+ if (hasThemeOverrides) {
148865
+ return `${themeName}-${murmur2(JSON.stringify(mergedThemeOverridesRef.value))}`;
148866
+ }
148867
+ return themeName;
148868
+ } else {
148869
+ if (hasThemeOverrides) {
148870
+ return murmur2(JSON.stringify(mergedThemeOverridesRef.value));
148871
+ }
148872
+ return "";
148873
+ }
148874
+ });
148875
+ provide(configProviderInjectionKey, {
148876
+ mergedThemeHashRef,
148877
+ mergedBreakpointsRef,
148878
+ mergedRtlRef,
148879
+ mergedIconsRef,
148880
+ mergedComponentPropsRef,
148881
+ mergedBorderedRef,
148882
+ mergedNamespaceRef,
148883
+ mergedClsPrefixRef,
148884
+ mergedLocaleRef: computed(() => {
148885
+ const {
148886
+ locale
148887
+ } = props;
148888
+ if (locale === null) return void 0;
148889
+ return locale === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedLocaleRef.value : locale;
148890
+ }),
148891
+ mergedDateLocaleRef: computed(() => {
148892
+ const {
148893
+ dateLocale
148894
+ } = props;
148895
+ if (dateLocale === null) return void 0;
148896
+ return dateLocale === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedDateLocaleRef.value : dateLocale;
148897
+ }),
148898
+ mergedHljsRef: computed(() => {
148899
+ const {
148900
+ hljs
148901
+ } = props;
148902
+ return hljs === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedHljsRef.value : hljs;
148903
+ }),
148904
+ mergedKatexRef: computed(() => {
148905
+ const {
148906
+ katex
148907
+ } = props;
148908
+ return katex === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedKatexRef.value : katex;
148909
+ }),
148910
+ mergedThemeRef,
148911
+ mergedThemeOverridesRef,
148912
+ inlineThemeDisabled: inlineThemeDisabled || false,
148913
+ preflightStyleDisabled: preflightStyleDisabled || false,
148914
+ styleMountTarget
148915
+ });
148916
+ return {
148917
+ mergedClsPrefix: mergedClsPrefixRef,
148918
+ mergedBordered: mergedBorderedRef,
148919
+ mergedNamespace: mergedNamespaceRef,
148920
+ mergedTheme: mergedThemeRef,
148921
+ mergedThemeOverrides: mergedThemeOverridesRef
148922
+ };
148923
+ },
148924
+ render() {
148925
+ var _a2, _b2, _c, _d;
148926
+ return !this.abstract ? h$1(this.as || this.tag, {
148927
+ class: `${this.mergedClsPrefix || defaultClsPrefix}-config-provider`
148928
+ }, (_b2 = (_a2 = this.$slots).default) === null || _b2 === void 0 ? void 0 : _b2.call(_a2)) : (_d = (_c = this.$slots).default) === null || _d === void 0 ? void 0 : _d.call(_c);
148929
+ }
148930
+ });
148132
148931
  const commonVariables$1 = {
148133
148932
  padding: "4px 0",
148134
148933
  optionIconSizeSmall: "14px",
@@ -150224,62 +151023,20 @@ ${style2}
150224
151023
  })) : icon;
150225
151024
  }
150226
151025
  });
150227
- const commentIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4c0 0 0 0 0 0s0 0 0 0s0 0 0 0c0 0 0 0 0 0l.3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>';
150228
- const caretDownIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z"/></svg>';
150229
- const userCheckIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM0 482.3C0 383.8 79.8 304 178.3 304l91.4 0C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7L29.7 512C13.3 512 0 498.7 0 482.3zM625 177L497 305c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L591 143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>';
150230
- const usersIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M144 0a80 80 0 1 1 0 160A80 80 0 1 1 144 0zM512 0a80 80 0 1 1 0 160A80 80 0 1 1 512 0zM0 298.7C0 239.8 47.8 192 106.7 192l42.7 0c15.9 0 31 3.5 44.6 9.7c-1.3 7.2-1.9 14.7-1.9 22.3c0 38.2 16.8 72.5 43.3 96c-.2 0-.4 0-.7 0L21.3 320C9.6 320 0 310.4 0 298.7zM405.3 320c-.2 0-.4 0-.7 0c26.6-23.5 43.3-57.8 43.3-96c0-7.6-.7-15-1.9-22.3c13.6-6.3 28.7-9.7 44.6-9.7l42.7 0C592.2 192 640 239.8 640 298.7c0 11.8-9.6 21.3-21.3 21.3l-213.3 0zM224 224a96 96 0 1 1 192 0 96 96 0 1 1 -192 0zM128 485.3C128 411.7 187.7 352 261.3 352l117.3 0C452.3 352 512 411.7 512 485.3c0 14.7-11.9 26.7-26.7 26.7l-330.7 0c-14.7 0-26.7-11.9-26.7-26.7z"/></svg>';
150231
- const checkIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>';
150232
- const xmarkIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>';
150233
- const ellipsisVerticalSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"/></svg>';
150234
- const superdocIcons = {
150235
- comment: commentIconSvg,
150236
- caretDown: caretDownIconSvg,
150237
- internal: userCheckIconSvg,
150238
- external: usersIconSvg,
150239
- markDone: checkIconSvg,
150240
- acceptChange: checkIconSvg,
150241
- rejectChange: xmarkIconSvg,
150242
- overflow: ellipsisVerticalSvg
150243
- };
150244
- const _export_sfc = (sfc, props) => {
150245
- const target = sfc.__vccOpts || sfc;
150246
- for (const [key2, val] of props) {
150247
- target[key2] = val;
150248
- }
150249
- return target;
150250
- };
150251
- const _hoisted_1$g = { class: "user-container" };
150252
- const _hoisted_2$9 = ["src"];
150253
- const _hoisted_3$7 = {
150254
- key: 1,
150255
- class: "user-bg"
150256
- };
150257
- const _sfc_main$h = {
150258
- __name: "Avatar",
150259
- props: {
150260
- user: {
150261
- type: Object,
150262
- required: true
151026
+ const DEFAULT_UI_FONT_FAMILY = "Arial, Helvetica, sans-serif";
151027
+ function useUiFontFamily() {
151028
+ const instance = getCurrentInstance();
151029
+ const uiFontFamily = computed(() => {
151030
+ const configured = instance?.proxy?.$superdoc?.config?.uiDisplayFallbackFont;
151031
+ if (typeof configured === "string" && configured.trim()) {
151032
+ return configured.trim();
150263
151033
  }
150264
- },
150265
- setup(__props) {
150266
- const getInitials2 = (name, email) => {
150267
- if (!name && !email) return;
150268
- const firstLetter = name?.substring(0, 1) || email?.substring(0, 1) || null;
150269
- return firstLetter;
150270
- };
150271
- return (_ctx, _cache) => {
150272
- return openBlock(), createElementBlock("div", _hoisted_1$g, [
150273
- __props.user.image ? (openBlock(), createElementBlock("img", {
150274
- key: 0,
150275
- class: "user-bg",
150276
- src: __props.user.image.startsWith("http") ? __props.user.image : `data:image/png;base64,${__props.user.image}`
150277
- }, null, 8, _hoisted_2$9)) : (openBlock(), createElementBlock("span", _hoisted_3$7, toDisplayString(getInitials2(__props.user.name, __props.user.email)), 1))
150278
- ]);
150279
- };
150280
- }
150281
- };
150282
- const Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-53e13009"]]);
151034
+ return DEFAULT_UI_FONT_FAMILY;
151035
+ });
151036
+ return {
151037
+ uiFontFamily
151038
+ };
151039
+ }
150283
151040
  const _hoisted_1$f = { class: "comment-option" };
150284
151041
  const _hoisted_2$8 = ["innerHTML"];
150285
151042
  const _hoisted_3$6 = { class: "option-state" };
@@ -150300,6 +151057,7 @@ ${style2}
150300
151057
  setup(__props, { emit: __emit }) {
150301
151058
  const emit2 = __emit;
150302
151059
  const props = __props;
151060
+ const { uiFontFamily } = useUiFontFamily();
150303
151061
  const renderIcon = (icon) => {
150304
151062
  return () => {
150305
151063
  return h$1("div", { innerHTML: icon, class: "internal-dropdown__item-icon" });
@@ -150361,7 +151119,8 @@ ${style2}
150361
151119
  trigger: "click",
150362
151120
  options,
150363
151121
  onSelect: _cache[0] || (_cache[0] = ($event) => handleSelect($event)),
150364
- disabled: __props.isDisabled
151122
+ disabled: __props.isDisabled,
151123
+ "content-style": { fontFamily: unref(uiFontFamily) }
150365
151124
  }, {
150366
151125
  default: withCtx(() => [
150367
151126
  createBaseVNode("div", _hoisted_1$f, [
@@ -150377,12 +151136,12 @@ ${style2}
150377
151136
  ])
150378
151137
  ]),
150379
151138
  _: 1
150380
- }, 8, ["disabled"])
151139
+ }, 8, ["disabled", "content-style"])
150381
151140
  ], 4);
150382
151141
  };
150383
151142
  }
150384
151143
  };
150385
- const InternalDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-a88dddd9"]]);
151144
+ const InternalDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-8b9e3b75"]]);
150386
151145
  function formatDate(timestamp) {
150387
151146
  const date = new Date(timestamp);
150388
151147
  const hours = date.getHours();
@@ -150528,6 +151287,7 @@ ${style2}
150528
151287
  const role = proxy.$superdoc.config.role;
150529
151288
  const isInternal = proxy.$superdoc.config.isInternal;
150530
151289
  const isOwnComment = props.comment.creatorEmail === proxy.$superdoc.config.user.email;
151290
+ const { uiFontFamily } = useUiFontFamily();
150531
151291
  const OVERFLOW_OPTIONS = Object.freeze({
150532
151292
  edit: { label: "Edit", key: "edit" },
150533
151293
  delete: { label: "Delete", key: "delete" }
@@ -150631,7 +151391,8 @@ ${style2}
150631
151391
  key: 2,
150632
151392
  trigger: "click",
150633
151393
  options: getOverflowOptions.value,
150634
- onSelect: handleSelect
151394
+ onSelect: handleSelect,
151395
+ "content-style": { fontFamily: unref(uiFontFamily) }
150635
151396
  }, {
150636
151397
  default: withCtx(() => [
150637
151398
  createBaseVNode("div", {
@@ -150646,13 +151407,13 @@ ${style2}
150646
151407
  ])
150647
151408
  ]),
150648
151409
  _: 1
150649
- }, 8, ["options"])) : createCommentVNode("", true)
151410
+ }, 8, ["options", "content-style"])) : createCommentVNode("", true)
150650
151411
  ])
150651
151412
  ]);
150652
151413
  };
150653
151414
  }
150654
151415
  };
150655
- const CommentHeader = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-0f4f53ef"]]);
151416
+ const CommentHeader = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-5e404f08"]]);
150656
151417
  const _hoisted_1$d = { class: "input-section" };
150657
151418
  const _sfc_main$e = {
150658
151419
  __name: "CommentInput",
@@ -151072,7 +151833,7 @@ ${style2}
151072
151833
  };
151073
151834
  }
151074
151835
  };
151075
- const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-36e5f63e"]]);
151836
+ const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-abfa4e05"]]);
151076
151837
  const _hoisted_1$b = { class: "comments-list" };
151077
151838
  const _hoisted_2$5 = { key: 0 };
151078
151839
  const _hoisted_3$3 = { class: "comment-item" };
@@ -151673,7 +152434,7 @@ ${style2}
151673
152434
  };
151674
152435
  }
151675
152436
  };
151676
- const SelectField = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-b8cacb22"]]);
152437
+ const SelectField = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-1e49d9b3"]]);
151677
152438
  const floor = (val, precision) => {
151678
152439
  const multiplier = 10 ** precision;
151679
152440
  return Math.floor(val * multiplier) / multiplier;
@@ -152118,11 +152879,15 @@ ${style2}
152118
152879
  const { proxy } = getCurrentInstance();
152119
152880
  commentsStore.proxy = proxy;
152120
152881
  const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
152882
+ const { uiFontFamily } = useUiFontFamily();
152121
152883
  const commentsModuleConfig = computed(() => {
152122
152884
  const config2 = modules.comments;
152123
152885
  if (config2 === false || config2 == null) return null;
152124
152886
  return config2;
152125
152887
  });
152888
+ const superdocStyleVars = computed(() => ({
152889
+ "--sd-ui-font-family": uiFontFamily.value
152890
+ }));
152126
152891
  const layers = ref(null);
152127
152892
  const commentsLayer = ref(null);
152128
152893
  const toolsMenuPosition = reactive({ top: null, right: "-25px", zIndex: 101 });
@@ -152639,155 +153404,164 @@ ${style2}
152639
153404
  });
152640
153405
  return (_ctx, _cache) => {
152641
153406
  const _directive_click_outside = resolveDirective("click-outside");
152642
- return openBlock(), createElementBlock("div", {
152643
- class: normalizeClass(["superdoc", { "superdoc--with-sidebar": showCommentsSidebar.value, "high-contrast": unref(isHighContrastMode2) }])
152644
- }, [
152645
- createBaseVNode("div", {
152646
- class: "superdoc__layers layers",
152647
- ref_key: "layers",
152648
- ref: layers,
152649
- role: "group"
152650
- }, [
152651
- showToolsFloatingMenu.value ? (openBlock(), createElementBlock("div", {
152652
- key: 0,
152653
- class: "superdoc__tools tools",
152654
- style: normalizeStyle(toolsMenuPosition)
153407
+ return openBlock(), createBlock(unref(NConfigProvider), {
153408
+ abstract: "",
153409
+ "preflight-style-disabled": ""
153410
+ }, {
153411
+ default: withCtx(() => [
153412
+ createBaseVNode("div", {
153413
+ class: normalizeClass(["superdoc", { "superdoc--with-sidebar": showCommentsSidebar.value, "high-contrast": unref(isHighContrastMode2) }]),
153414
+ style: normalizeStyle(superdocStyleVars.value)
152655
153415
  }, [
152656
153416
  createBaseVNode("div", {
152657
- class: "tools-item",
152658
- "data-id": "is-tool",
152659
- onMousedown: _cache[0] || (_cache[0] = withModifiers(($event) => handleToolClick("comments"), ["stop", "prevent"]))
152660
- }, [
152661
- createBaseVNode("div", {
152662
- class: "superdoc__tools-icon",
152663
- innerHTML: unref(superdocIcons).comment
152664
- }, null, 8, _hoisted_1$1)
152665
- ], 32),
152666
- unref(proxy).$superdoc.config.modules.ai ? (openBlock(), createElementBlock("div", {
152667
- key: 0,
152668
- class: "tools-item",
152669
- "data-id": "is-tool",
152670
- onMousedown: _cache[1] || (_cache[1] = withModifiers(($event) => handleToolClick("ai"), ["stop", "prevent"]))
152671
- }, [..._cache[3] || (_cache[3] = [
152672
- createBaseVNode("div", { class: "superdoc__tools-icon ai-tool" }, null, -1)
152673
- ])], 32)) : createCommentVNode("", true)
152674
- ], 4)) : createCommentVNode("", true),
152675
- createBaseVNode("div", _hoisted_2, [
152676
- isCommentsEnabled.value ? (openBlock(), createElementBlock("div", {
152677
- key: 0,
152678
- class: "superdoc__selection-layer selection-layer",
152679
- onMousedown: handleSelectionStart,
152680
- onMouseup: handleDragEnd,
152681
- ref_key: "selectionLayer",
152682
- ref: selectionLayer
153417
+ class: "superdoc__layers layers",
153418
+ ref_key: "layers",
153419
+ ref: layers,
153420
+ role: "group"
152683
153421
  }, [
152684
- unref(selectionPosition) && shouldShowSelection.value ? (openBlock(), createElementBlock("div", {
153422
+ showToolsFloatingMenu.value ? (openBlock(), createElementBlock("div", {
152685
153423
  key: 0,
152686
- style: normalizeStyle(getSelectionPosition.value),
152687
- class: "superdoc__temp-selection temp-selection sd-highlight sd-initial-highlight"
152688
- }, null, 4)) : createCommentVNode("", true)
152689
- ], 544)) : createCommentVNode("", true),
152690
- "hrbr-fields" in unref(modules) && layers.value ? (openBlock(), createBlock(HrbrFieldsLayer, {
152691
- key: 1,
152692
- fields: unref(modules)["hrbr-fields"],
152693
- class: "superdoc__comments-layer comments-layer",
152694
- style: { "z-index": "2" },
152695
- ref_key: "hrbrFieldsLayer",
152696
- ref: hrbrFieldsLayer
152697
- }, null, 8, ["fields"])) : createCommentVNode("", true),
152698
- layers.value ? (openBlock(), createBlock(CommentsLayer, {
152699
- key: 2,
152700
- class: "superdoc__comments-layer comments-layer",
152701
- style: { "z-index": "3" },
152702
- ref_key: "commentsLayer",
152703
- ref: commentsLayer,
152704
- parent: layers.value,
152705
- user: unref(user),
152706
- onHighlightClick: handleHighlightClick
152707
- }, null, 8, ["parent", "user"])) : createCommentVNode("", true),
152708
- unref(showAiLayer) ? (openBlock(), createBlock(AiLayer, {
152709
- key: 3,
152710
- class: "ai-layer",
152711
- style: { "z-index": "4" },
152712
- ref_key: "aiLayer",
152713
- ref: aiLayer,
152714
- editor: unref(proxy).$superdoc.activeEditor
152715
- }, null, 8, ["editor"])) : createCommentVNode("", true),
152716
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(documents), (doc2) => {
152717
- return openBlock(), createElementBlock("div", {
152718
- class: "superdoc__sub-document sub-document",
152719
- key: doc2.id
153424
+ class: "superdoc__tools tools",
153425
+ style: normalizeStyle(toolsMenuPosition)
152720
153426
  }, [
152721
- doc2.type === unref(PDF) ? (openBlock(), createBlock(unref(PdfViewer2), {
153427
+ createBaseVNode("div", {
153428
+ class: "tools-item",
153429
+ "data-id": "is-tool",
153430
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(($event) => handleToolClick("comments"), ["stop", "prevent"]))
153431
+ }, [
153432
+ createBaseVNode("div", {
153433
+ class: "superdoc__tools-icon",
153434
+ innerHTML: unref(superdocIcons).comment
153435
+ }, null, 8, _hoisted_1$1)
153436
+ ], 32),
153437
+ unref(proxy).$superdoc.config.modules.ai ? (openBlock(), createElementBlock("div", {
152722
153438
  key: 0,
152723
- "document-data": doc2,
152724
- config: unref(pdfConfig),
152725
- onSelectionChange: handleSelectionChange,
152726
- onReady: handleDocumentReady,
152727
- onPageLoaded: unref(handlePageReady),
152728
- onBypassSelection: handlePdfClick
152729
- }, null, 8, ["document-data", "config", "onPageLoaded"])) : createCommentVNode("", true),
152730
- createVNode(unref(NMessageProvider), null, {
152731
- default: withCtx(() => [
152732
- doc2.type === unref(DOCX) ? (openBlock(), createBlock(unref(SuperEditor), {
153439
+ class: "tools-item",
153440
+ "data-id": "is-tool",
153441
+ onMousedown: _cache[1] || (_cache[1] = withModifiers(($event) => handleToolClick("ai"), ["stop", "prevent"]))
153442
+ }, [..._cache[3] || (_cache[3] = [
153443
+ createBaseVNode("div", { class: "superdoc__tools-icon ai-tool" }, null, -1)
153444
+ ])], 32)) : createCommentVNode("", true)
153445
+ ], 4)) : createCommentVNode("", true),
153446
+ createBaseVNode("div", _hoisted_2, [
153447
+ isCommentsEnabled.value ? (openBlock(), createElementBlock("div", {
153448
+ key: 0,
153449
+ class: "superdoc__selection-layer selection-layer",
153450
+ onMousedown: handleSelectionStart,
153451
+ onMouseup: handleDragEnd,
153452
+ ref_key: "selectionLayer",
153453
+ ref: selectionLayer
153454
+ }, [
153455
+ unref(selectionPosition) && shouldShowSelection.value ? (openBlock(), createElementBlock("div", {
153456
+ key: 0,
153457
+ style: normalizeStyle(getSelectionPosition.value),
153458
+ class: "superdoc__temp-selection temp-selection sd-highlight sd-initial-highlight"
153459
+ }, null, 4)) : createCommentVNode("", true)
153460
+ ], 544)) : createCommentVNode("", true),
153461
+ "hrbr-fields" in unref(modules) && layers.value ? (openBlock(), createBlock(HrbrFieldsLayer, {
153462
+ key: 1,
153463
+ fields: unref(modules)["hrbr-fields"],
153464
+ class: "superdoc__comments-layer comments-layer",
153465
+ style: { "z-index": "2" },
153466
+ ref_key: "hrbrFieldsLayer",
153467
+ ref: hrbrFieldsLayer
153468
+ }, null, 8, ["fields"])) : createCommentVNode("", true),
153469
+ layers.value ? (openBlock(), createBlock(CommentsLayer, {
153470
+ key: 2,
153471
+ class: "superdoc__comments-layer comments-layer",
153472
+ style: { "z-index": "3" },
153473
+ ref_key: "commentsLayer",
153474
+ ref: commentsLayer,
153475
+ parent: layers.value,
153476
+ user: unref(user),
153477
+ onHighlightClick: handleHighlightClick
153478
+ }, null, 8, ["parent", "user"])) : createCommentVNode("", true),
153479
+ unref(showAiLayer) ? (openBlock(), createBlock(AiLayer, {
153480
+ key: 3,
153481
+ class: "ai-layer",
153482
+ style: { "z-index": "4" },
153483
+ ref_key: "aiLayer",
153484
+ ref: aiLayer,
153485
+ editor: unref(proxy).$superdoc.activeEditor
153486
+ }, null, 8, ["editor"])) : createCommentVNode("", true),
153487
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(documents), (doc2) => {
153488
+ return openBlock(), createElementBlock("div", {
153489
+ class: "superdoc__sub-document sub-document",
153490
+ key: doc2.id
153491
+ }, [
153492
+ doc2.type === unref(PDF) ? (openBlock(), createBlock(unref(PdfViewer2), {
152733
153493
  key: 0,
153494
+ "document-data": doc2,
153495
+ config: unref(pdfConfig),
153496
+ onSelectionChange: handleSelectionChange,
153497
+ onReady: handleDocumentReady,
153498
+ onPageLoaded: unref(handlePageReady),
153499
+ onBypassSelection: handlePdfClick
153500
+ }, null, 8, ["document-data", "config", "onPageLoaded"])) : createCommentVNode("", true),
153501
+ createVNode(unref(NMessageProvider), null, {
153502
+ default: withCtx(() => [
153503
+ doc2.type === unref(DOCX) ? (openBlock(), createBlock(unref(SuperEditor), {
153504
+ key: 0,
153505
+ "file-source": doc2.data,
153506
+ state: doc2.state,
153507
+ "document-id": doc2.id,
153508
+ options: { ...editorOptions(doc2), rulers: doc2.rulers },
153509
+ onEditorReady,
153510
+ onPageMarginsChange: ($event) => handleSuperEditorPageMarginsChange(doc2, $event)
153511
+ }, null, 8, ["file-source", "state", "document-id", "options", "onPageMarginsChange"])) : createCommentVNode("", true)
153512
+ ]),
153513
+ _: 2
153514
+ }, 1024),
153515
+ doc2.type === unref(HTML) ? (openBlock(), createBlock(HtmlViewer, {
153516
+ key: 1,
153517
+ onReady: _cache[2] || (_cache[2] = (id) => handleDocumentReady(id, null)),
153518
+ onSelectionChange: handleSelectionChange,
152734
153519
  "file-source": doc2.data,
152735
- state: doc2.state,
152736
- "document-id": doc2.id,
152737
- options: { ...editorOptions(doc2), rulers: doc2.rulers },
152738
- onEditorReady,
152739
- onPageMarginsChange: ($event) => handleSuperEditorPageMarginsChange(doc2, $event)
152740
- }, null, 8, ["file-source", "state", "document-id", "options", "onPageMarginsChange"])) : createCommentVNode("", true)
152741
- ]),
152742
- _: 2
152743
- }, 1024),
152744
- doc2.type === unref(HTML) ? (openBlock(), createBlock(HtmlViewer, {
152745
- key: 1,
152746
- onReady: _cache[2] || (_cache[2] = (id) => handleDocumentReady(id, null)),
152747
- onSelectionChange: handleSelectionChange,
152748
- "file-source": doc2.data,
152749
- "document-id": doc2.id
152750
- }, null, 8, ["file-source", "document-id"])) : createCommentVNode("", true)
152751
- ]);
152752
- }), 128))
152753
- ])
152754
- ], 512),
152755
- showCommentsSidebar.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
152756
- unref(pendingComment) ? withDirectives((openBlock(), createBlock(CommentDialog, {
152757
- key: 0,
152758
- comment: unref(pendingComment),
152759
- "auto-focus": true,
152760
- "is-floating": true
152761
- }, null, 8, ["comment"])), [
152762
- [_directive_click_outside, cancelPendingComment]
152763
- ]) : createCommentVNode("", true),
152764
- createBaseVNode("div", _hoisted_4, [
152765
- unref(hasInitializedLocations) && unref(getFloatingComments).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(documentsWithConverations), (doc2) => {
152766
- return openBlock(), createBlock(FloatingComments, {
152767
- parent: layers.value,
152768
- "current-document": doc2
152769
- }, null, 8, ["parent", "current-document"]);
152770
- }), 256)) : createCommentVNode("", true)
152771
- ])
152772
- ])) : createCommentVNode("", true),
152773
- unref(showAiWriter) ? (openBlock(), createElementBlock("div", {
152774
- key: 1,
152775
- class: "ai-writer-container",
152776
- style: normalizeStyle(unref(aiWriterPosition))
152777
- }, [
152778
- createVNode(unref(AIWriter), {
152779
- "selected-text": unref(selectedText),
152780
- "handle-close": unref(handleAiWriterClose),
152781
- editor: unref(proxy).$superdoc.activeEditor,
152782
- "api-key": unref(proxy).$superdoc.toolbar?.config?.aiApiKey,
152783
- endpoint: unref(proxy).$superdoc.config?.modules?.ai?.endpoint
152784
- }, null, 8, ["selected-text", "handle-close", "editor", "api-key", "endpoint"])
152785
- ], 4)) : createCommentVNode("", true)
152786
- ], 2);
153520
+ "document-id": doc2.id
153521
+ }, null, 8, ["file-source", "document-id"])) : createCommentVNode("", true)
153522
+ ]);
153523
+ }), 128))
153524
+ ])
153525
+ ], 512),
153526
+ showCommentsSidebar.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
153527
+ unref(pendingComment) ? withDirectives((openBlock(), createBlock(CommentDialog, {
153528
+ key: 0,
153529
+ comment: unref(pendingComment),
153530
+ "auto-focus": true,
153531
+ "is-floating": true
153532
+ }, null, 8, ["comment"])), [
153533
+ [_directive_click_outside, cancelPendingComment]
153534
+ ]) : createCommentVNode("", true),
153535
+ createBaseVNode("div", _hoisted_4, [
153536
+ unref(hasInitializedLocations) && unref(getFloatingComments).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(documentsWithConverations), (doc2) => {
153537
+ return openBlock(), createBlock(FloatingComments, {
153538
+ parent: layers.value,
153539
+ "current-document": doc2
153540
+ }, null, 8, ["parent", "current-document"]);
153541
+ }), 256)) : createCommentVNode("", true)
153542
+ ])
153543
+ ])) : createCommentVNode("", true),
153544
+ unref(showAiWriter) ? (openBlock(), createElementBlock("div", {
153545
+ key: 1,
153546
+ class: "ai-writer-container",
153547
+ style: normalizeStyle(unref(aiWriterPosition))
153548
+ }, [
153549
+ createVNode(unref(AIWriter), {
153550
+ "selected-text": unref(selectedText),
153551
+ "handle-close": unref(handleAiWriterClose),
153552
+ editor: unref(proxy).$superdoc.activeEditor,
153553
+ "api-key": unref(proxy).$superdoc.toolbar?.config?.aiApiKey,
153554
+ endpoint: unref(proxy).$superdoc.config?.modules?.ai?.endpoint
153555
+ }, null, 8, ["selected-text", "handle-close", "editor", "api-key", "endpoint"])
153556
+ ], 4)) : createCommentVNode("", true)
153557
+ ], 6)
153558
+ ]),
153559
+ _: 1
153560
+ });
152787
153561
  };
152788
153562
  }
152789
153563
  };
152790
- const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e229774d"]]);
153564
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-309688b3"]]);
152791
153565
  const createSuperdocVueApp = () => {
152792
153566
  const app = createApp(App);
152793
153567
  const pinia = createPinia();
@@ -152897,6 +153671,8 @@ ${style2}
152897
153671
  toolbarGroups: ["left", "center", "right"],
152898
153672
  toolbarIcons: {},
152899
153673
  toolbarTexts: {},
153674
+ // UI font for SuperDoc surfaces (toolbar, comments UI, etc.)
153675
+ uiDisplayFallbackFont: "Arial, Helvetica, sans-serif",
152900
153676
  isDev: false,
152901
153677
  // telemetry config
152902
153678
  telemetry: null,
@@ -152967,7 +153743,7 @@ ${style2}
152967
153743
  this.config.colors = shuffleArray(this.config.colors);
152968
153744
  this.userColorMap = /* @__PURE__ */ new Map();
152969
153745
  this.colorIndex = 0;
152970
- this.version = "1.0.0-next.2";
153746
+ this.version = "1.0.0-next.4";
152971
153747
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
152972
153748
  this.superdocId = config2.superdocId || v4();
152973
153749
  this.colors = this.config.colors;
@@ -153326,6 +154102,7 @@ ${style2}
153326
154102
  superdoc: this,
153327
154103
  aiApiKey: this.config.modules?.ai?.apiKey,
153328
154104
  aiEndpoint: this.config.modules?.ai?.endpoint,
154105
+ uiDisplayFallbackFont: this.config.uiDisplayFallbackFont,
153329
154106
  ...moduleConfig,
153330
154107
  excludeItems
153331
154108
  // Override moduleConfig.excludeItems with our computed list
@@ -155439,7 +156216,7 @@ ${style2}
155439
156216
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
155440
156217
  );
155441
156218
  }
155442
- const indexBDVXUeCy = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
156219
+ const indexD_KE9gpD = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
155443
156220
  __proto__: null,
155444
156221
  unified
155445
156222
  }, Symbol.toStringTag, { value: "Module" }));