@superdoc-dev/cli 0.17.0-next.16 → 0.17.0-next.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1446 -445
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -68327,7 +68327,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
68327
68327
  emptyOptions2 = {};
68328
68328
  });
68329
68329
 
68330
- // ../../packages/superdoc/dist/chunks/SuperConverter-DBlOjc68.es.js
68330
+ // ../../packages/superdoc/dist/chunks/SuperConverter-kDrJISzz.es.js
68331
68331
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68332
68332
  const fieldValue = extension$1.config[field];
68333
68333
  if (typeof fieldValue === "function")
@@ -84415,6 +84415,61 @@ function parseStyleId(chartSpace) {
84415
84415
  const val = getAttr(findChild$1(chartSpace, "c:style"), "val");
84416
84416
  return val != null ? Number(val) : undefined;
84417
84417
  }
84418
+ function stripRunNodeMarks(nodes) {
84419
+ if (!Array.isArray(nodes))
84420
+ return nodes;
84421
+ return nodes.map((node3) => {
84422
+ if (!node3 || typeof node3 !== "object")
84423
+ return node3;
84424
+ const stripped = node3.type === "run" && Array.isArray(node3.marks) && node3.marks.length > 0 ? {
84425
+ ...node3,
84426
+ marks: []
84427
+ } : node3;
84428
+ if (Array.isArray(stripped.content))
84429
+ return {
84430
+ ...stripped,
84431
+ content: stripRunNodeMarks(stripped.content)
84432
+ };
84433
+ return stripped;
84434
+ });
84435
+ }
84436
+ function importDrawingMLTextbox({ params: params3, drawingNode, textBoxContent, bodyPr, baseAttrs = {}, paragraphImporter }) {
84437
+ if (!textBoxContent)
84438
+ return null;
84439
+ const textboxParagraphs = collectTextBoxParagraphs(preProcessTextBoxContent(textBoxContent, params3)?.elements || []);
84440
+ const importParagraph = typeof paragraphImporter === "function" ? paragraphImporter : (paragraph2) => {
84441
+ return handleParagraphNode$1({
84442
+ ...params3,
84443
+ nodes: [paragraph2]
84444
+ })?.nodes || [];
84445
+ };
84446
+ const contentNodes = stripRunNodeMarks(textboxParagraphs.flatMap((paragraph2) => {
84447
+ const imported = importParagraph(paragraph2);
84448
+ return Array.isArray(imported) ? imported : imported ? [imported] : [];
84449
+ }));
84450
+ const { verticalAlign, insets } = extractBodyPrProperties(bodyPr);
84451
+ return {
84452
+ type: "shapeContainer",
84453
+ attrs: {
84454
+ ...baseAttrs,
84455
+ drawingContent: drawingNode
84456
+ },
84457
+ content: [{
84458
+ type: "shapeTextbox",
84459
+ attrs: {
84460
+ textInsets: {
84461
+ top: insets.top,
84462
+ right: insets.right,
84463
+ bottom: insets.bottom,
84464
+ left: insets.left
84465
+ },
84466
+ textVerticalAlign: verticalAlign,
84467
+ attributes: {}
84468
+ },
84469
+ content: contentNodes
84470
+ }]
84471
+ };
84472
+ }
84418
84473
  function handleImageNode$1(node3, params3, isAnchor) {
84419
84474
  if (!node3)
84420
84475
  return null;
@@ -84886,6 +84941,122 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params3 = {}) {
84886
84941
  wrap: wrap$1
84887
84942
  };
84888
84943
  }
84944
+ function extractFieldInlineNodes(node3) {
84945
+ if (node3?.name === "sd:autoPageNumber")
84946
+ return [{
84947
+ type: "page-number",
84948
+ attrs: {
84949
+ marksAsAttrs: [],
84950
+ instruction: "PAGE"
84951
+ }
84952
+ }];
84953
+ if (node3?.name === "sd:totalPageNumber")
84954
+ return [{
84955
+ type: "total-page-number",
84956
+ attrs: {
84957
+ marksAsAttrs: [],
84958
+ instruction: "NUMPAGES"
84959
+ }
84960
+ }];
84961
+ if (node3?.name === "sd:sectionPageCount") {
84962
+ const cachedText = node3?.attributes?.resolvedText ?? node3?.attributes?.importedCachedText ?? "";
84963
+ if (!cachedText)
84964
+ return [];
84965
+ return [{
84966
+ type: "text",
84967
+ text: cachedText
84968
+ }];
84969
+ }
84970
+ return [];
84971
+ }
84972
+ function extractInlineNodesFromRun(run$1, params3) {
84973
+ if (!run$1?.elements)
84974
+ return [];
84975
+ const nodes = [];
84976
+ run$1.elements.forEach((el) => {
84977
+ if (el.name === "w:t" || el.name === "w:delText") {
84978
+ const textNode = el.elements?.find((n) => n.type === "text");
84979
+ if (!textNode || typeof textNode.text !== "string")
84980
+ return;
84981
+ const cleanedText = textNode.text.replace(/\[\[sdspace\]\]/g, " ");
84982
+ if (cleanedText.length > 0)
84983
+ nodes.push({
84984
+ type: "text",
84985
+ text: cleanedText
84986
+ });
84987
+ } else if (el.name === "w:tab")
84988
+ nodes.push({
84989
+ type: "text",
84990
+ text: "\t"
84991
+ });
84992
+ else if (el.name === "w:br")
84993
+ nodes.push({
84994
+ type: "lineBreak",
84995
+ attrs: {}
84996
+ });
84997
+ else if (el.name === "sd:autoPageNumber" || el.name === "sd:totalPageNumber" || el.name === "sd:sectionPageCount")
84998
+ nodes.push(...extractFieldInlineNodes(el));
84999
+ else if (el.name === "w:drawing") {
85000
+ const inline = el.elements?.find((child) => child?.name === "wp:inline");
85001
+ if (!inline)
85002
+ return;
85003
+ const imagePm = handleImageNode$1(inline, {
85004
+ ...params3,
85005
+ nodes: [el]
85006
+ }, false);
85007
+ if (imagePm?.type === "image" && imagePm.attrs?.hidden !== true)
85008
+ nodes.push(imagePm);
85009
+ }
85010
+ });
85011
+ return nodes;
85012
+ }
85013
+ function paragraphToPmParagraph(paragraph2, params3) {
85014
+ const paragraphNode = collectTextBoxParagraphs([paragraph2])[0];
85015
+ if (!paragraphNode)
85016
+ return null;
85017
+ const paragraphProperties = resolveParagraphPropertiesForTextBox(paragraphNode, params3);
85018
+ const alignment = extractParagraphAlignment(paragraphNode) || "left";
85019
+ const content$2 = [];
85020
+ let pendingRunContent = [];
85021
+ const flushPendingRun = () => {
85022
+ if (pendingRunContent.length === 0)
85023
+ return;
85024
+ content$2.push({
85025
+ type: "run",
85026
+ attrs: {},
85027
+ content: pendingRunContent
85028
+ });
85029
+ pendingRunContent = [];
85030
+ };
85031
+ (paragraphNode.elements || []).forEach((element) => {
85032
+ if (element?.name === "w:r") {
85033
+ extractInlineNodesFromRun(element, params3).forEach((part) => {
85034
+ if (part?.type === "image") {
85035
+ flushPendingRun();
85036
+ content$2.push(part);
85037
+ return;
85038
+ }
85039
+ pendingRunContent.push(part);
85040
+ });
85041
+ return;
85042
+ }
85043
+ if (element?.name?.startsWith("sd:")) {
85044
+ const runContent = extractFieldInlineNodes(element);
85045
+ if (runContent.length > 0)
85046
+ pendingRunContent.push(...runContent);
85047
+ }
85048
+ });
85049
+ flushPendingRun();
85050
+ return {
85051
+ type: "paragraph",
85052
+ attrs: {
85053
+ paragraphProperties,
85054
+ textAlign: alignment
85055
+ },
85056
+ content: content$2,
85057
+ marks: []
85058
+ };
85059
+ }
84889
85060
  function getVectorShape({ params: params3, node: node3, graphicData, size: size2, marginOffset, anchorData, wrap: wrap$1, isAnchor, customGeometry }) {
84890
85061
  const schemaAttrs = {};
84891
85062
  const drawingNode = params3.nodes?.[0];
@@ -84921,14 +85092,45 @@ function getVectorShape({ params: params3, node: node3, graphicData, size: size2
84921
85092
  const textBoxContent = wsp.elements?.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
84922
85093
  const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
84923
85094
  const nonVisualShapeProps = wsp.elements?.find((el) => el.name === "wps:cNvSpPr");
85095
+ const isWordArt = bodyPr?.attributes?.["fromWordArt"] === "1";
85096
+ const isTextBox = nonVisualShapeProps?.attributes?.["txBox"] === "1";
85097
+ if (isTextBox && textBoxContent)
85098
+ return importDrawingMLTextbox({
85099
+ params: params3,
85100
+ drawingNode: drawingNode?.name === "w:drawing" ? drawingNode : null,
85101
+ textBoxContent,
85102
+ bodyPr,
85103
+ baseAttrs: {
85104
+ ...schemaAttrs,
85105
+ width,
85106
+ height,
85107
+ rotation,
85108
+ flipH,
85109
+ flipV,
85110
+ fillColor,
85111
+ strokeColor,
85112
+ strokeWidth,
85113
+ lineEnds,
85114
+ effectExtent,
85115
+ marginOffset,
85116
+ anchorData,
85117
+ wrap: wrap$1,
85118
+ isAnchor,
85119
+ isWordArt,
85120
+ isTextBox,
85121
+ originalAttributes: node3?.attributes
85122
+ },
85123
+ paragraphImporter: params3?.nodeListHandler != null ? undefined : (paragraph2) => {
85124
+ const imported = paragraphToPmParagraph(paragraph2, params3);
85125
+ return Array.isArray(imported) ? imported : imported ? [imported] : [];
85126
+ }
85127
+ });
84924
85128
  let textContent = null;
84925
85129
  let textAlign = "left";
84926
85130
  if (textBoxContent) {
84927
85131
  textContent = extractTextFromTextBox(textBoxContent, bodyPr, params3);
84928
85132
  textAlign = textContent?.horizontalAlign || "left";
84929
85133
  }
84930
- const isWordArt = bodyPr?.attributes?.["fromWordArt"] === "1";
84931
- const isTextBox = nonVisualShapeProps?.attributes?.["txBox"] === "1";
84932
85134
  return {
84933
85135
  type: "vectorShape",
84934
85136
  attrs: {
@@ -101152,9 +101354,15 @@ function handleShapeTextboxImport({ params: params3, pict }) {
101152
101354
  schemaAttrs.attributes = shapeAttrs;
101153
101355
  if (shapeAttrs.fillcolor)
101154
101356
  schemaAttrs.fillcolor = shapeAttrs.fillcolor;
101155
- const shapeStyle = buildStyles(parseInlineStyles(shapeAttrs.style));
101357
+ const parsedStyle = parseInlineStyles(shapeAttrs.style);
101358
+ const shapeStyle = buildStyles(parsedStyle);
101359
+ const positionData = extractPositionData(parsedStyle);
101156
101360
  if (shapeStyle)
101157
101361
  schemaAttrs.style = shapeStyle;
101362
+ if (positionData.anchorData)
101363
+ schemaAttrs.anchorData = positionData.anchorData;
101364
+ if (positionData.marginOffset)
101365
+ schemaAttrs.marginOffset = positionData.marginOffset;
101158
101366
  const textbox = shape.elements?.find((el) => el.name === "v:textbox");
101159
101367
  const wrap$1 = shape.elements?.find((el) => el.name === "w10:wrap");
101160
101368
  if (wrap$1?.attributes)
@@ -101184,6 +101392,38 @@ function buildStyles(styleObject) {
101184
101392
  style += `${prop}: ${value};`;
101185
101393
  return style;
101186
101394
  }
101395
+ function extractPositionData(styleObject) {
101396
+ const anchorData = {};
101397
+ const marginOffset = {};
101398
+ if (styleObject["mso-position-horizontal"])
101399
+ anchorData.alignH = styleObject["mso-position-horizontal"];
101400
+ if (styleObject["mso-position-horizontal-relative"])
101401
+ anchorData.hRelativeFrom = styleObject["mso-position-horizontal-relative"];
101402
+ if (styleObject["mso-position-vertical"])
101403
+ anchorData.alignV = styleObject["mso-position-vertical"];
101404
+ if (styleObject["mso-position-vertical-relative"])
101405
+ anchorData.vRelativeFrom = styleObject["mso-position-vertical-relative"];
101406
+ if (styleObject["margin-left"] != null)
101407
+ marginOffset.horizontal = convertToPixels$2(styleObject["margin-left"]);
101408
+ if (styleObject["margin-top"] != null)
101409
+ marginOffset.top = convertToPixels$2(styleObject["margin-top"]);
101410
+ return {
101411
+ ...Object.keys(anchorData).length > 0 ? { anchorData } : {},
101412
+ ...Object.keys(marginOffset).length > 0 ? { marginOffset } : {}
101413
+ };
101414
+ }
101415
+ function convertToPixels$2(value) {
101416
+ const num = parseFloat(value);
101417
+ if (Number.isNaN(num))
101418
+ return 0;
101419
+ if (value.endsWith("pt"))
101420
+ return num * 96 / 72;
101421
+ if (value.endsWith("in"))
101422
+ return num * 96;
101423
+ if (value.endsWith("px"))
101424
+ return num;
101425
+ return num;
101426
+ }
101187
101427
  function handleShapeImageWatermarkImport({ params: params3, pict }) {
101188
101428
  const shape = pict.elements?.find((el) => el.name === "v:shape");
101189
101429
  if (!shape)
@@ -101704,15 +101944,69 @@ function pictNodeTypeStrategy(node3) {
101704
101944
  handler: null
101705
101945
  };
101706
101946
  }
101947
+ function translateDrawingMLTextbox(params3) {
101948
+ const { node: node3 } = params3;
101949
+ const drawingContent = node3?.attrs?.drawingContent;
101950
+ const shapeTextbox = node3?.content?.find((child) => child?.type === "shapeTextbox");
101951
+ if (!drawingContent || !shapeTextbox)
101952
+ return null;
101953
+ const drawing = carbonCopy(drawingContent);
101954
+ const liveParagraphs = translateChildNodes({
101955
+ ...params3,
101956
+ node: shapeTextbox
101957
+ });
101958
+ const txbxContent = findTextboxContentNode(drawing);
101959
+ if (!txbxContent)
101960
+ return null;
101961
+ txbxContent.elements = liveParagraphs;
101962
+ return wrapTextInRun({
101963
+ name: "mc:AlternateContent",
101964
+ elements: [{
101965
+ name: "mc:Choice",
101966
+ attributes: { Requires: "wps" },
101967
+ elements: [drawing]
101968
+ }]
101969
+ });
101970
+ }
101971
+ function findTextboxContentNode(node3) {
101972
+ if (!node3 || typeof node3 !== "object")
101973
+ return null;
101974
+ if (node3.name === "w:txbxContent")
101975
+ return node3;
101976
+ if (!Array.isArray(node3.elements))
101977
+ return null;
101978
+ for (const child of node3.elements) {
101979
+ const found$1 = findTextboxContentNode(child);
101980
+ if (found$1)
101981
+ return found$1;
101982
+ }
101983
+ return null;
101984
+ }
101707
101985
  function translateShapeContainer(params3) {
101708
101986
  const { node: node3 } = params3;
101987
+ if (node3?.attrs?.drawingContent) {
101988
+ const run$1 = translateDrawingMLTextbox(params3);
101989
+ if (run$1)
101990
+ return {
101991
+ name: "w:p",
101992
+ elements: [run$1]
101993
+ };
101994
+ return {
101995
+ name: "w:p",
101996
+ elements: [wrapTextInRun(node3.attrs.drawingContent)]
101997
+ };
101998
+ }
101709
101999
  const elements = translateChildNodes(params3);
102000
+ const shapeAttributes = {
102001
+ ...node3.attrs.attributes,
102002
+ fillcolor: node3.attrs.fillcolor
102003
+ };
102004
+ const style = buildShapeStyle(node3.attrs);
102005
+ if (style)
102006
+ shapeAttributes.style = style;
101710
102007
  const shape = {
101711
102008
  name: "v:shape",
101712
- attributes: {
101713
- ...node3.attrs.attributes,
101714
- fillcolor: node3.attrs.fillcolor
101715
- },
102009
+ attributes: shapeAttributes,
101716
102010
  elements: [...elements, ...node3.attrs.wrapAttributes ? [{
101717
102011
  name: "w10:wrap",
101718
102012
  attributes: { ...node3.attrs.wrapAttributes }
@@ -101727,6 +102021,33 @@ function translateShapeContainer(params3) {
101727
102021
  })]
101728
102022
  };
101729
102023
  }
102024
+ function buildShapeStyle(attrs) {
102025
+ const originalStyle = parseInlineStyles(attrs.attributes?.style);
102026
+ const managedStyle = parseInlineStyles(attrs.style);
102027
+ const style = {
102028
+ ...originalStyle,
102029
+ ...managedStyle
102030
+ };
102031
+ if (attrs.marginOffset?.horizontal !== undefined)
102032
+ style["margin-left"] = `${convertToPt$2(attrs.marginOffset.horizontal)}pt`;
102033
+ if (attrs.marginOffset?.top !== undefined)
102034
+ style["margin-top"] = `${convertToPt$2(attrs.marginOffset.top)}pt`;
102035
+ if (attrs.anchorData?.alignH)
102036
+ style["mso-position-horizontal"] = attrs.anchorData.alignH;
102037
+ if (attrs.anchorData?.hRelativeFrom)
102038
+ style["mso-position-horizontal-relative"] = attrs.anchorData.hRelativeFrom;
102039
+ if (attrs.anchorData?.alignV)
102040
+ style["mso-position-vertical"] = attrs.anchorData.alignV;
102041
+ if (attrs.anchorData?.vRelativeFrom)
102042
+ style["mso-position-vertical-relative"] = attrs.anchorData.vRelativeFrom;
102043
+ const entries2 = Object.entries(style);
102044
+ if (entries2.length === 0)
102045
+ return;
102046
+ return entries2.map(([prop, value]) => `${prop}:${value}`).join(";");
102047
+ }
102048
+ function convertToPt$2(pixels) {
102049
+ return pixels * 72 / 96;
102050
+ }
101730
102051
  function translateShapeTextbox(params3) {
101731
102052
  const { node: node3 } = params3;
101732
102053
  const textboxContent = {
@@ -104103,7 +104424,7 @@ function hydrateImageBlocks(blocks, mediaFiles) {
104103
104424
  }
104104
104425
  if (blk.kind === "drawing") {
104105
104426
  const drawingBlock = blk;
104106
- if (drawingBlock.drawingKind === "vectorShape") {
104427
+ if (drawingBlock.drawingKind === "vectorShape" || drawingBlock.drawingKind === "textboxShape") {
104107
104428
  const parts = drawingBlock.textContent?.parts;
104108
104429
  if (!parts || parts.length === 0)
104109
104430
  return blk;
@@ -106158,6 +106479,14 @@ function lineBreakNodeToRun({ node: node3, positions, sdtMetadata }) {
106158
106479
  lineBreakRun.sdt = sdtMetadata;
106159
106480
  return lineBreakRun;
106160
106481
  }
106482
+ function hydrateTextboxDrawingContent(node3, drawingBlock, context) {
106483
+ if (drawingBlock.drawingKind !== "textboxShape")
106484
+ return drawingBlock;
106485
+ return {
106486
+ ...drawingBlock,
106487
+ contentBlocks: toTextboxParagraphBlocks(node3, context)
106488
+ };
106489
+ }
106161
106490
  function vectorShapeNodeToDrawingBlock(node3, nextBlockId, positions) {
106162
106491
  const rawAttrs = getAttrs$2(node3);
106163
106492
  if (isHiddenDrawing$1(rawAttrs))
@@ -106202,25 +106531,43 @@ function shapeContainerNodeToDrawingBlock(node3, nextBlockId, positions) {
106202
106531
  const rawAttrs = getAttrs$2(node3);
106203
106532
  if (isHiddenDrawing$1(rawAttrs))
106204
106533
  return null;
106205
- return buildDrawingBlock(rawAttrs, nextBlockId, positions, node3, {
106534
+ const geometry = {
106206
106535
  width: coercePositiveNumber(rawAttrs.width, 1),
106207
106536
  height: coercePositiveNumber(rawAttrs.height, 1),
106208
106537
  rotation: coerceNumber(rawAttrs.rotation) ?? 0,
106209
106538
  flipH: coerceBoolean(rawAttrs.flipH) ?? false,
106210
106539
  flipV: coerceBoolean(rawAttrs.flipV) ?? false
106211
- }, "vectorShape");
106540
+ };
106541
+ const shapeTextboxNode = resolveNestedShapeTextboxNode(node3);
106542
+ const textboxAttrs = shapeTextboxNode ? getAttrs$2(shapeTextboxNode) : {};
106543
+ const textContent = shapeTextboxNode ? extractTextboxTextContent(shapeTextboxNode) : undefined;
106544
+ return buildDrawingBlock({
106545
+ ...rawAttrs,
106546
+ ...textContent ? { textContent } : {},
106547
+ ...rawAttrs.textAlign == null && textContent?.horizontalAlign ? { textAlign: textContent.horizontalAlign } : {},
106548
+ ...rawAttrs.textInsets == null ? { textInsets: resolveTextboxInsetsFromAttrs(textboxAttrs) } : {},
106549
+ ...rawAttrs.textVerticalAlign == null ? { textVerticalAlign: resolveTextboxVerticalAlignFromAttrs(textboxAttrs) } : {}
106550
+ }, nextBlockId, positions, node3, geometry, "textboxShape", { contentBlocks: [] });
106212
106551
  }
106213
106552
  function shapeTextboxNodeToDrawingBlock(node3, nextBlockId, positions) {
106214
106553
  const rawAttrs = getAttrs$2(node3);
106215
106554
  if (isHiddenDrawing$1(rawAttrs))
106216
106555
  return null;
106217
- return buildDrawingBlock(rawAttrs, nextBlockId, positions, node3, {
106556
+ const geometry = {
106218
106557
  width: coercePositiveNumber(rawAttrs.width, 1),
106219
106558
  height: coercePositiveNumber(rawAttrs.height, 1),
106220
106559
  rotation: coerceNumber(rawAttrs.rotation) ?? 0,
106221
106560
  flipH: coerceBoolean(rawAttrs.flipH) ?? false,
106222
106561
  flipV: coerceBoolean(rawAttrs.flipV) ?? false
106223
- }, "vectorShape");
106562
+ };
106563
+ const textContent = extractTextboxTextContent(node3);
106564
+ return buildDrawingBlock({
106565
+ ...rawAttrs,
106566
+ ...textContent ? { textContent } : {},
106567
+ ...rawAttrs.textAlign == null && textContent?.horizontalAlign ? { textAlign: textContent.horizontalAlign } : {},
106568
+ ...rawAttrs.textInsets == null ? { textInsets: resolveTextboxInsetsFromAttrs(rawAttrs) } : {},
106569
+ ...rawAttrs.textVerticalAlign == null ? { textVerticalAlign: resolveTextboxVerticalAlignFromAttrs(rawAttrs) } : {}
106570
+ }, nextBlockId, positions, node3, geometry, "textboxShape", { contentBlocks: [] });
106224
106571
  }
106225
106572
  function handleVectorShapeNode(node3, context) {
106226
106573
  const { blocks, recordBlockKind, nextBlockId, positions } = context;
@@ -106242,7 +106589,7 @@ function handleShapeContainerNode(node3, context) {
106242
106589
  const { blocks, recordBlockKind, nextBlockId, positions } = context;
106243
106590
  const drawingBlock = shapeContainerNodeToDrawingBlock(node3, nextBlockId, positions);
106244
106591
  if (drawingBlock) {
106245
- blocks.push(drawingBlock);
106592
+ blocks.push(hydrateTextboxDrawingContent(node3, drawingBlock, context));
106246
106593
  recordBlockKind?.(drawingBlock.kind);
106247
106594
  }
106248
106595
  }
@@ -106250,7 +106597,7 @@ function handleShapeTextboxNode(node3, context) {
106250
106597
  const { blocks, recordBlockKind, nextBlockId, positions } = context;
106251
106598
  const drawingBlock = shapeTextboxNodeToDrawingBlock(node3, nextBlockId, positions);
106252
106599
  if (drawingBlock) {
106253
- blocks.push(drawingBlock);
106600
+ blocks.push(hydrateTextboxDrawingContent(node3, drawingBlock, context));
106254
106601
  recordBlockKind?.(drawingBlock.kind);
106255
106602
  }
106256
106603
  }
@@ -107007,8 +107354,14 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
107007
107354
  const converter = SHAPE_CONVERTERS_REGISTRY[node3.type];
107008
107355
  const drawingBlock = converter(node3, stableNextBlockId, positions);
107009
107356
  if (drawingBlock) {
107010
- attachInlineShapeGroupAlignment(drawingBlock);
107011
- blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
107357
+ const hydratedBlock = hydrateTextboxDrawingContent(node3, drawingBlock, {
107358
+ converterContext,
107359
+ converters: converters$1,
107360
+ nextBlockId: stableNextBlockId,
107361
+ positions
107362
+ });
107363
+ attachInlineShapeGroupAlignment(hydratedBlock);
107364
+ blocks.push(attachAnchorParagraphId(hydratedBlock, anchorParagraphId));
107012
107365
  }
107013
107366
  return;
107014
107367
  }
@@ -116166,7 +116519,7 @@ var isRegExp = (value) => {
116166
116519
  return attributes["w:rsidDel"];
116167
116520
  }, decode$52 = (attrs) => {
116168
116521
  return attrs.rsidDel;
116169
- }, attributes_default$4, STYLES_KEY = "word/styles.xml", XML_NODE_NAME$32 = "w:r", SD_KEY_NAME = "run", REFERENCE_RUN_STYLE_BY_XML_NAME, hasXmlNodeNamed = (node3, targetName) => {
116522
+ }, attributes_default$4, STYLES_KEY = "word/styles.xml", XML_NODE_NAME$32 = "w:r", SD_KEY_NAME = "run", REFERENCE_RUN_STYLE_BY_XML_NAME, BLOCK_HOIST_TYPES, hasXmlNodeNamed = (node3, targetName) => {
116170
116523
  if (!node3 || typeof node3 !== "object")
116171
116524
  return false;
116172
116525
  if (node3.name === targetName)
@@ -116299,6 +116652,11 @@ var isRegExp = (value) => {
116299
116652
  nodes: contentElements
116300
116653
  };
116301
116654
  const content$2 = nodeListHandler?.handler(childParams) || [];
116655
+ if (Array.isArray(content$2) && content$2.length > 0 && content$2.every((child) => BLOCK_HOIST_TYPES.has(child?.type)))
116656
+ return content$2.filter(Boolean).map((child) => ({
116657
+ ...child,
116658
+ marks: Array.isArray(child?.marks) ? child.marks : []
116659
+ }));
116302
116660
  const filtered = (Array.isArray(content$2) ? content$2 : []).map((child) => {
116303
116661
  if (!child || typeof child !== "object")
116304
116662
  return child;
@@ -122001,7 +122359,86 @@ var isRegExp = (value) => {
122001
122359
  i$1++;
122002
122360
  }
122003
122361
  return { processedNodes };
122004
- }, HEADER_FOOTER_FILENAME_PATTERN, CHART_TYPE_MAP, CHART_TYPE_NAMES, findChild$1 = (node3, name) => node3?.elements?.find((el) => el.name === name), findChildren$2 = (node3, name) => node3?.elements?.filter((el) => el.name === name) ?? [], getAttr = (node3, attr) => node3?.attributes?.[attr], DRAWING_XML_TAG = "w:drawing", SHAPE_URI = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", GROUP_URI = "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", SD_IMAGE_ID_NAMESPACE = "7c9e6679-7425-40de-944b-e07fc1f90ae7", normalizeTargetPath$1 = (targetPath = "") => {
122362
+ }, HEADER_FOOTER_FILENAME_PATTERN, CHART_TYPE_MAP, CHART_TYPE_NAMES, findChild$1 = (node3, name) => node3?.elements?.find((el) => el.name === name), findChildren$2 = (node3, name) => node3?.elements?.filter((el) => el.name === name) ?? [], getAttr = (node3, attr) => node3?.attributes?.[attr], PARAGRAPH_PROPERTIES_XML_NAME = "w:pPr", hasMeaningfulParagraphContent = (elements = []) => elements.some((element) => element?.name && element.name !== PARAGRAPH_PROPERTIES_XML_NAME), findParagraphProperties = (elements = []) => elements.find((element) => element?.name === PARAGRAPH_PROPERTIES_XML_NAME) ?? null, hasParagraphProperties = (elements = []) => elements.some((element) => element?.name === PARAGRAPH_PROPERTIES_XML_NAME), cloneParagraphPropertiesForRenderedResult = (paragraphProperties) => {
122363
+ const elements = (paragraphProperties.elements || []).filter((element) => element?.name !== "w:sectPr").map((element) => carbonCopy(element));
122364
+ if (elements.length === 0)
122365
+ return null;
122366
+ return {
122367
+ ...carbonCopy(paragraphProperties),
122368
+ elements
122369
+ };
122370
+ }, inheritWrapperParagraphProperties = (blockFieldElement, paragraphProperties) => {
122371
+ if (!paragraphProperties)
122372
+ return blockFieldElement;
122373
+ const fieldElements = Array.isArray(blockFieldElement?.elements) ? blockFieldElement.elements : [];
122374
+ const firstParagraphIndex = fieldElements.findIndex((element) => element?.name === "w:p");
122375
+ if (firstParagraphIndex < 0)
122376
+ return blockFieldElement;
122377
+ const firstParagraph = fieldElements[firstParagraphIndex];
122378
+ const firstParagraphElements = Array.isArray(firstParagraph.elements) ? firstParagraph.elements : [];
122379
+ if (hasParagraphProperties(firstParagraphElements))
122380
+ return blockFieldElement;
122381
+ const renderedParagraphProperties = cloneParagraphPropertiesForRenderedResult(paragraphProperties);
122382
+ const inheritedFirstParagraph = {
122383
+ ...firstParagraph,
122384
+ elements: renderedParagraphProperties ? [renderedParagraphProperties, ...firstParagraphElements] : firstParagraphElements
122385
+ };
122386
+ return {
122387
+ ...blockFieldElement,
122388
+ attributes: {
122389
+ ...blockFieldElement.attributes || {},
122390
+ wrapperParagraphProperties: carbonCopy(paragraphProperties)
122391
+ },
122392
+ elements: fieldElements.map((element, index2) => index2 === firstParagraphIndex ? inheritedFirstParagraph : element)
122393
+ };
122394
+ }, hoistBlockFieldNodes = (params3, paragraphNode) => {
122395
+ const paragraphElements = Array.isArray(paragraphNode?.elements) ? paragraphNode.elements : [];
122396
+ const blockFieldElements = paragraphElements.filter((element) => BLOCK_FIELD_XML_NAMES.has(element?.name));
122397
+ if (blockFieldElements.length === 0)
122398
+ return null;
122399
+ const nodes = [];
122400
+ const remainingElements = paragraphElements.filter((element) => !BLOCK_FIELD_XML_NAMES.has(element?.name));
122401
+ const wrapperParagraphProperties = findParagraphProperties(remainingElements);
122402
+ const shouldTransferWrapperProperties = !hasMeaningfulParagraphContent(remainingElements);
122403
+ if (hasMeaningfulParagraphContent(remainingElements)) {
122404
+ const paragraph2 = translator.encode({
122405
+ ...params3,
122406
+ nodes: [{
122407
+ ...paragraphNode,
122408
+ elements: remainingElements
122409
+ }]
122410
+ });
122411
+ if (paragraph2)
122412
+ nodes.push(paragraph2);
122413
+ }
122414
+ blockFieldElements.forEach((blockFieldElement) => {
122415
+ const fieldElement = shouldTransferWrapperProperties ? inheritWrapperParagraphProperties(blockFieldElement, wrapperParagraphProperties) : blockFieldElement;
122416
+ nodes.push(...params3.nodeListHandler.handler({
122417
+ ...params3,
122418
+ nodes: [fieldElement],
122419
+ path: [...params3.path || [], paragraphNode]
122420
+ }));
122421
+ });
122422
+ return nodes;
122423
+ }, handleParagraphNode$1 = (params3) => {
122424
+ const { nodes } = params3;
122425
+ if (nodes.length === 0 || nodes[0].name !== "w:p")
122426
+ return {
122427
+ nodes: [],
122428
+ consumed: 0
122429
+ };
122430
+ const hoistedNodes = hoistBlockFieldNodes(params3, nodes[0]);
122431
+ if (hoistedNodes)
122432
+ return {
122433
+ nodes: hoistedNodes,
122434
+ consumed: 1
122435
+ };
122436
+ const schemaNode = translator.encode(params3);
122437
+ return {
122438
+ nodes: Array.isArray(schemaNode) ? schemaNode : schemaNode ? [schemaNode] : [],
122439
+ consumed: 1
122440
+ };
122441
+ }, paragraphNodeHandlerEntity, DRAWING_XML_TAG = "w:drawing", SHAPE_URI = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", GROUP_URI = "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", SD_IMAGE_ID_NAMESPACE = "7c9e6679-7425-40de-944b-e07fc1f90ae7", normalizeTargetPath$1 = (targetPath = "") => {
122005
122442
  if (!targetPath)
122006
122443
  return targetPath;
122007
122444
  const trimmed = targetPath.replace(/^\/+/, "");
@@ -122104,6 +122541,35 @@ var isRegExp = (value) => {
122104
122541
  if (result)
122105
122542
  return result;
122106
122543
  }
122544
+ if (wsp.elements?.find((el) => el.name === "wps:cNvSpPr")?.attributes?.["txBox"] === "1" && textBoxContent) {
122545
+ const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
122546
+ const drawingNode = params3.nodes?.[0];
122547
+ const result = importDrawingMLTextbox({
122548
+ params: params3,
122549
+ drawingNode: drawingNode?.name === "w:drawing" ? drawingNode : null,
122550
+ textBoxContent,
122551
+ bodyPr,
122552
+ baseAttrs: {
122553
+ width: size2?.width,
122554
+ height: size2?.height,
122555
+ marginOffset,
122556
+ anchorData,
122557
+ wrap: wrap$1,
122558
+ isAnchor,
122559
+ isTextBox: true,
122560
+ originalAttributes: node3?.attributes,
122561
+ ...params3.nodes?.[0]?.name === "w:drawing" ? { drawingContent: params3.nodes[0] } : {}
122562
+ },
122563
+ paragraphImporter: params3?.nodeListHandler != null ? undefined : (paragraph2) => {
122564
+ const imported = paragraphToPmParagraph(paragraph2, params3);
122565
+ return Array.isArray(imported) ? imported : imported ? [imported] : [];
122566
+ }
122567
+ });
122568
+ if (result?.attrs && isHidden)
122569
+ result.attrs.hidden = true;
122570
+ if (result)
122571
+ return result;
122572
+ }
122107
122573
  const placeholder = buildShapePlaceholder(node3, size2, padding, marginOffset, textBoxContent ? "textbox" : "drawing");
122108
122574
  if (placeholder?.attrs && isHidden)
122109
122575
  placeholder.attrs.hidden = true;
@@ -128097,86 +128563,7 @@ var isRegExp = (value) => {
128097
128563
  nodes: [resultNode],
128098
128564
  consumed: 1
128099
128565
  };
128100
- }, textNodeHandlerEntity, PARAGRAPH_PROPERTIES_XML_NAME = "w:pPr", hasMeaningfulParagraphContent = (elements = []) => elements.some((element) => element?.name && element.name !== PARAGRAPH_PROPERTIES_XML_NAME), findParagraphProperties = (elements = []) => elements.find((element) => element?.name === PARAGRAPH_PROPERTIES_XML_NAME) ?? null, hasParagraphProperties = (elements = []) => elements.some((element) => element?.name === PARAGRAPH_PROPERTIES_XML_NAME), cloneParagraphPropertiesForRenderedResult = (paragraphProperties) => {
128101
- const elements = (paragraphProperties.elements || []).filter((element) => element?.name !== "w:sectPr").map((element) => carbonCopy(element));
128102
- if (elements.length === 0)
128103
- return null;
128104
- return {
128105
- ...carbonCopy(paragraphProperties),
128106
- elements
128107
- };
128108
- }, inheritWrapperParagraphProperties = (blockFieldElement, paragraphProperties) => {
128109
- if (!paragraphProperties)
128110
- return blockFieldElement;
128111
- const fieldElements = Array.isArray(blockFieldElement?.elements) ? blockFieldElement.elements : [];
128112
- const firstParagraphIndex = fieldElements.findIndex((element) => element?.name === "w:p");
128113
- if (firstParagraphIndex < 0)
128114
- return blockFieldElement;
128115
- const firstParagraph = fieldElements[firstParagraphIndex];
128116
- const firstParagraphElements = Array.isArray(firstParagraph.elements) ? firstParagraph.elements : [];
128117
- if (hasParagraphProperties(firstParagraphElements))
128118
- return blockFieldElement;
128119
- const renderedParagraphProperties = cloneParagraphPropertiesForRenderedResult(paragraphProperties);
128120
- const inheritedFirstParagraph = {
128121
- ...firstParagraph,
128122
- elements: renderedParagraphProperties ? [renderedParagraphProperties, ...firstParagraphElements] : firstParagraphElements
128123
- };
128124
- return {
128125
- ...blockFieldElement,
128126
- attributes: {
128127
- ...blockFieldElement.attributes || {},
128128
- wrapperParagraphProperties: carbonCopy(paragraphProperties)
128129
- },
128130
- elements: fieldElements.map((element, index2) => index2 === firstParagraphIndex ? inheritedFirstParagraph : element)
128131
- };
128132
- }, hoistBlockFieldNodes = (params3, paragraphNode) => {
128133
- const paragraphElements = Array.isArray(paragraphNode?.elements) ? paragraphNode.elements : [];
128134
- const blockFieldElements = paragraphElements.filter((element) => BLOCK_FIELD_XML_NAMES.has(element?.name));
128135
- if (blockFieldElements.length === 0)
128136
- return null;
128137
- const nodes = [];
128138
- const remainingElements = paragraphElements.filter((element) => !BLOCK_FIELD_XML_NAMES.has(element?.name));
128139
- const wrapperParagraphProperties = findParagraphProperties(remainingElements);
128140
- const shouldTransferWrapperProperties = !hasMeaningfulParagraphContent(remainingElements);
128141
- if (hasMeaningfulParagraphContent(remainingElements)) {
128142
- const paragraph2 = translator.encode({
128143
- ...params3,
128144
- nodes: [{
128145
- ...paragraphNode,
128146
- elements: remainingElements
128147
- }]
128148
- });
128149
- if (paragraph2)
128150
- nodes.push(paragraph2);
128151
- }
128152
- blockFieldElements.forEach((blockFieldElement) => {
128153
- const fieldElement = shouldTransferWrapperProperties ? inheritWrapperParagraphProperties(blockFieldElement, wrapperParagraphProperties) : blockFieldElement;
128154
- nodes.push(...params3.nodeListHandler.handler({
128155
- ...params3,
128156
- nodes: [fieldElement],
128157
- path: [...params3.path || [], paragraphNode]
128158
- }));
128159
- });
128160
- return nodes;
128161
- }, handleParagraphNode$1 = (params3) => {
128162
- const { nodes } = params3;
128163
- if (nodes.length === 0 || nodes[0].name !== "w:p")
128164
- return {
128165
- nodes: [],
128166
- consumed: 0
128167
- };
128168
- const hoistedNodes = hoistBlockFieldNodes(params3, nodes[0]);
128169
- if (hoistedNodes)
128170
- return {
128171
- nodes: hoistedNodes,
128172
- consumed: 1
128173
- };
128174
- const schemaNode = translator.encode(params3);
128175
- return {
128176
- nodes: Array.isArray(schemaNode) ? schemaNode : schemaNode ? [schemaNode] : [],
128177
- consumed: 1
128178
- };
128179
- }, paragraphNodeHandlerEntity, handleSdtNode = (params3) => {
128566
+ }, textNodeHandlerEntity, handleSdtNode = (params3) => {
128180
128567
  const { nodes } = params3;
128181
128568
  if (nodes.length === 0 || nodes[0].name !== "w:sdt")
128182
128569
  return {
@@ -133044,7 +133431,186 @@ var isRegExp = (value) => {
133044
133431
  if (toBoolean(attrs.hidden) === true)
133045
133432
  return true;
133046
133433
  return typeof attrs.visibility === "string" && attrs.visibility.toLowerCase() === "hidden";
133047
- }, normalizeWrapType$1 = (value) => {
133434
+ }, TEXTBOX_CONTAINER_TYPES, resolveTextFormattingFromMarks = (marks) => {
133435
+ if (!Array.isArray(marks) || marks.length === 0)
133436
+ return;
133437
+ const formatting = {};
133438
+ marks.forEach((mark) => {
133439
+ if (!mark || typeof mark.type !== "string")
133440
+ return;
133441
+ const attrs = isPlainObject3(mark.attrs) ? mark.attrs : {};
133442
+ if (mark.type === "bold")
133443
+ formatting.bold = true;
133444
+ if (mark.type === "italic")
133445
+ formatting.italic = true;
133446
+ const color2 = typeof attrs.color === "string" ? attrs.color.replace(/^#/, "") : undefined;
133447
+ if (color2)
133448
+ formatting.color = color2;
133449
+ const fontFamily = typeof attrs.fontFamily === "string" ? attrs.fontFamily : undefined;
133450
+ if (fontFamily)
133451
+ formatting.fontFamily = fontFamily;
133452
+ const fontSize = pickNumber(attrs.fontSize);
133453
+ if (fontSize != null)
133454
+ formatting.fontSize = fontSize;
133455
+ });
133456
+ return Object.keys(formatting).length > 0 ? formatting : undefined;
133457
+ }, pushTextPart = (parts, part) => {
133458
+ if (!part.text && !part.fieldType && !part.isLineBreak)
133459
+ return;
133460
+ parts.push(part);
133461
+ }, extractTextPartsFromTextboxInline = (node3, parts) => {
133462
+ if (!node3)
133463
+ return;
133464
+ const formatting = resolveTextFormattingFromMarks(node3.marks);
133465
+ if (typeof node3.text === "string") {
133466
+ pushTextPart(parts, {
133467
+ text: node3.text,
133468
+ ...formatting ? { formatting } : {}
133469
+ });
133470
+ return;
133471
+ }
133472
+ switch (node3.type) {
133473
+ case "text":
133474
+ pushTextPart(parts, {
133475
+ text: "",
133476
+ ...formatting ? { formatting } : {}
133477
+ });
133478
+ return;
133479
+ case "tab":
133480
+ pushTextPart(parts, {
133481
+ text: "\t",
133482
+ ...formatting ? { formatting } : {}
133483
+ });
133484
+ return;
133485
+ case "lineBreak":
133486
+ pushTextPart(parts, {
133487
+ text: `
133488
+ `,
133489
+ isLineBreak: true,
133490
+ ...formatting ? { formatting } : {}
133491
+ });
133492
+ return;
133493
+ case "page-number":
133494
+ pushTextPart(parts, {
133495
+ text: "",
133496
+ fieldType: "PAGE",
133497
+ pageNumberFormat: typeof node3.attrs?.pageNumberFormat === "string" ? node3.attrs.pageNumberFormat : undefined,
133498
+ ...formatting ? { formatting } : {}
133499
+ });
133500
+ return;
133501
+ case "total-page-number":
133502
+ pushTextPart(parts, {
133503
+ text: typeof node3.attrs?.resolvedText === "string" ? node3.attrs.resolvedText : typeof node3.attrs?.importedCachedText === "string" ? node3.attrs.importedCachedText : "",
133504
+ fieldType: "NUMPAGES",
133505
+ pageNumberFormat: typeof node3.attrs?.pageNumberFormat === "string" ? node3.attrs.pageNumberFormat : undefined,
133506
+ ...formatting ? { formatting } : {}
133507
+ });
133508
+ return;
133509
+ default:
133510
+ break;
133511
+ }
133512
+ if (Array.isArray(node3.content) && (TEXTBOX_CONTAINER_TYPES.has(node3.type) || node3.content.length > 0))
133513
+ node3.content.forEach((child) => extractTextPartsFromTextboxInline(child, parts));
133514
+ }, extractTextboxTextContent = (node3) => {
133515
+ if (!Array.isArray(node3.content) || node3.content.length === 0)
133516
+ return;
133517
+ const parts = [];
133518
+ let horizontalAlign;
133519
+ const paragraphs = node3.content.filter((child) => child?.type === "paragraph");
133520
+ const paragraphHasRenderableContent = (paragraph2) => Array.isArray(paragraph2.content) && paragraph2.content.length > 0;
133521
+ paragraphs.forEach((paragraph2, paragraphIndex) => {
133522
+ const justification = paragraph2.attrs?.paragraphProperties;
133523
+ if (!horizontalAlign && isPlainObject3(justification)) {
133524
+ const value = justification.justification;
133525
+ if (value === "left" || value === "center" || value === "right")
133526
+ horizontalAlign = value;
133527
+ }
133528
+ paragraph2.content?.forEach((child) => extractTextPartsFromTextboxInline(child, parts));
133529
+ if (paragraphIndex < paragraphs.length - 1) {
133530
+ const nextParagraph = paragraphs[paragraphIndex + 1];
133531
+ parts.push({
133532
+ text: `
133533
+ `,
133534
+ isLineBreak: true,
133535
+ isEmptyParagraph: !paragraphHasRenderableContent(paragraph2) || !paragraphHasRenderableContent(nextParagraph)
133536
+ });
133537
+ }
133538
+ });
133539
+ return parts.length > 0 ? {
133540
+ parts,
133541
+ ...horizontalAlign ? { horizontalAlign } : {}
133542
+ } : undefined;
133543
+ }, isParagraphNode = (node3) => node3?.type === "paragraph", toTextboxParagraphBlocks = (node3, context) => {
133544
+ const shapeTextboxNode = node3.type === "shapeTextbox" ? node3 : resolveNestedShapeTextboxNode(node3);
133545
+ const paragraphToFlowBlocks$1 = context.converters?.paragraphToFlowBlocks;
133546
+ if (!shapeTextboxNode || !paragraphToFlowBlocks$1 || !Array.isArray(shapeTextboxNode.content))
133547
+ return [];
133548
+ const textboxBlocks = [];
133549
+ for (const child of shapeTextboxNode.content) {
133550
+ if (!isParagraphNode(child))
133551
+ continue;
133552
+ const convertedBlocks = paragraphToFlowBlocks$1({
133553
+ para: child,
133554
+ nextBlockId: context.nextBlockId,
133555
+ positions: context.positions,
133556
+ storyKey: context.storyKey,
133557
+ trackedChangesConfig: context.trackedChangesConfig,
133558
+ bookmarks: context.bookmarks,
133559
+ hyperlinkConfig: context.hyperlinkConfig,
133560
+ themeColors: context.themeColors,
133561
+ converters: context.converters,
133562
+ converterContext: context.converterContext,
133563
+ enableComments: context.enableComments,
133564
+ previousParagraphFont: getLastParagraphFont(textboxBlocks)
133565
+ });
133566
+ textboxBlocks.push(...convertedBlocks);
133567
+ }
133568
+ return textboxBlocks.filter((block) => block.kind === "paragraph");
133569
+ }, parseTextboxInsetValue = (value) => {
133570
+ const trimmed = value.trim();
133571
+ if (!trimmed)
133572
+ return;
133573
+ if (trimmed.endsWith("pt"))
133574
+ return ptToPx(parseFloat(trimmed.slice(0, -2)));
133575
+ if (trimmed.endsWith("px"))
133576
+ return pickNumber(trimmed.slice(0, -2));
133577
+ if (trimmed.endsWith("in")) {
133578
+ const inches = parseFloat(trimmed.slice(0, -2));
133579
+ return Number.isFinite(inches) ? inches * 96 : undefined;
133580
+ }
133581
+ return pickNumber(trimmed);
133582
+ }, resolveTextboxInsetsFromAttrs = (attrs) => {
133583
+ const explicitInsets = normalizeTextInsets(attrs.textInsets);
133584
+ if (explicitInsets)
133585
+ return explicitInsets;
133586
+ const textboxAttrs = isPlainObject3(attrs.attributes) ? attrs.attributes : undefined;
133587
+ const inset = typeof textboxAttrs?.inset === "string" ? textboxAttrs.inset : undefined;
133588
+ if (!inset)
133589
+ return;
133590
+ const values = inset.split(",").map((entry) => parseTextboxInsetValue(entry));
133591
+ if (values.length !== 4 || values.some((entry) => entry == null))
133592
+ return;
133593
+ return {
133594
+ top: values[1],
133595
+ right: values[2],
133596
+ bottom: values[3],
133597
+ left: values[0]
133598
+ };
133599
+ }, resolveTextboxVerticalAlignFromAttrs = (attrs) => {
133600
+ const explicitAlign = normalizeTextVerticalAlign(attrs.textVerticalAlign);
133601
+ if (explicitAlign)
133602
+ return explicitAlign;
133603
+ const textboxAttrs = isPlainObject3(attrs.attributes) ? attrs.attributes : undefined;
133604
+ const style = typeof textboxAttrs?.style === "string" ? textboxAttrs.style : undefined;
133605
+ if (!style)
133606
+ return;
133607
+ const match = style.match(/v-text-anchor\s*:\s*(top|middle|bottom)/i);
133608
+ if (!match)
133609
+ return;
133610
+ if (match[1].toLowerCase() === "middle")
133611
+ return "center";
133612
+ return match[1].toLowerCase();
133613
+ }, resolveNestedShapeTextboxNode = (node3) => Array.isArray(node3.content) ? node3.content.find((child) => child?.type === "shapeTextbox") : undefined, normalizeWrapType$1 = (value) => {
133048
133614
  if (typeof value !== "string")
133049
133615
  return;
133050
133616
  return WRAP_TYPES$2.has(value) ? value : undefined;
@@ -133761,13 +134327,13 @@ var isRegExp = (value) => {
133761
134327
  if (childNode.type === "shapeContainer" && context.converters?.shapeContainerNodeToDrawingBlock) {
133762
134328
  const drawingBlock = context.converters.shapeContainerNodeToDrawingBlock(childNode, context.nextBlockId, context.positions);
133763
134329
  if (drawingBlock && drawingBlock.kind === "drawing")
133764
- blocks.push(drawingBlock);
134330
+ blocks.push(hydrateTextboxDrawingContent(childNode, drawingBlock, context));
133765
134331
  continue;
133766
134332
  }
133767
134333
  if (childNode.type === "shapeTextbox" && context.converters?.shapeTextboxNodeToDrawingBlock) {
133768
134334
  const drawingBlock = context.converters.shapeTextboxNodeToDrawingBlock(childNode, context.nextBlockId, context.positions);
133769
134335
  if (drawingBlock && drawingBlock.kind === "drawing")
133770
- blocks.push(drawingBlock);
134336
+ blocks.push(hydrateTextboxDrawingContent(childNode, drawingBlock, context));
133771
134337
  continue;
133772
134338
  }
133773
134339
  }
@@ -134327,7 +134893,7 @@ var isRegExp = (value) => {
134327
134893
  state.kern = kernNode.attributes["w:val"];
134328
134894
  }
134329
134895
  }, SuperConverter;
134330
- var init_SuperConverter_DBlOjc68_es = __esm(() => {
134896
+ var init_SuperConverter_kDrJISzz_es = __esm(() => {
134331
134897
  init_rolldown_runtime_Bg48TavK_es();
134332
134898
  init_jszip_C49i9kUs_es();
134333
134899
  init_xml_js_CqGKpaft_es();
@@ -151088,6 +151654,7 @@ var init_SuperConverter_DBlOjc68_es = __esm(() => {
151088
151654
  "w:footnoteReference": "FootnoteReference",
151089
151655
  "w:endnoteReference": "EndnoteReference"
151090
151656
  };
151657
+ BLOCK_HOIST_TYPES = new Set(["shapeContainer"]);
151091
151658
  COMPLEX_SCRIPT_CODEPOINT_RANGES = [
151092
151659
  [1424, 2303],
151093
151660
  [2304, 4255],
@@ -163173,6 +163740,10 @@ var init_SuperConverter_DBlOjc68_es = __esm(() => {
163173
163740
  "c:surface3DChart": "surfaceChart"
163174
163741
  };
163175
163742
  CHART_TYPE_NAMES = new Set(Object.keys(CHART_TYPE_MAP));
163743
+ paragraphNodeHandlerEntity = {
163744
+ handlerName: "paragraphNodeHandler",
163745
+ handler: handleParagraphNode$1
163746
+ };
163176
163747
  atomElements = /^(img|br|input|textarea|hr)$/i;
163177
163748
  nav = typeof navigator != "undefined" ? navigator : null;
163178
163749
  doc = typeof document != "undefined" ? document : null;
@@ -170909,10 +171480,6 @@ var init_SuperConverter_DBlOjc68_es = __esm(() => {
170909
171480
  handlerName: "textNodeHandler",
170910
171481
  handler: handleTextNode
170911
171482
  };
170912
- paragraphNodeHandlerEntity = {
170913
- handlerName: "paragraphNodeHandler",
170914
- handler: handleParagraphNode$1
170915
- };
170916
171483
  sdtNodeHandlerEntity = {
170917
171484
  handlerName: "sdtNodeHandler",
170918
171485
  handler: handleSdtNode
@@ -172693,7 +173260,8 @@ var init_SuperConverter_DBlOjc68_es = __esm(() => {
172693
173260
  weight: "bold",
172694
173261
  style: "normal",
172695
173262
  file: "PTSansNarrow-Bold.woff2"
172696
- }])
173263
+ }]),
173264
+ family("TeX Gyre Bonum", "TeXGyreBonum", "LicenseRef-GUST-Font-License-1.0")
172697
173265
  ]);
172698
173266
  SUBSTITUTION_EVIDENCE = SUBSTITUTION_EVIDENCE$1;
172699
173267
  bundledFamilies = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
@@ -172713,6 +173281,7 @@ var init_SuperConverter_DBlOjc68_es = __esm(() => {
172713
173281
  "Arial Black",
172714
173282
  "Arial Narrow",
172715
173283
  "Baskerville Old Face",
173284
+ "Bookman Old Style",
172716
173285
  "Brush Script MT",
172717
173286
  "Century",
172718
173287
  "Cooper Black",
@@ -173009,6 +173578,14 @@ var init_SuperConverter_DBlOjc68_es = __esm(() => {
173009
173578
  "center",
173010
173579
  "bottom"
173011
173580
  ]);
173581
+ TEXTBOX_CONTAINER_TYPES = new Set([
173582
+ "run",
173583
+ "link",
173584
+ "hyperlink",
173585
+ "structuredContent",
173586
+ "fieldAnnotation",
173587
+ "smartTag"
173588
+ ]);
173012
173589
  WRAP_TYPES$1 = new Set([
173013
173590
  "None",
173014
173591
  "Square",
@@ -174511,7 +175088,7 @@ var init_SuperConverter_DBlOjc68_es = __esm(() => {
174511
175088
  };
174512
175089
  });
174513
175090
 
174514
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DWyoHv_L.es.js
175091
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-D1v6sX42.es.js
174515
175092
  function parseSizeUnit(val = "0") {
174516
175093
  const length3 = val.toString() || "0";
174517
175094
  const value = Number.parseFloat(length3);
@@ -184906,8 +185483,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
184906
185483
  }
184907
185484
  };
184908
185485
  };
184909
- var init_create_headless_toolbar_DWyoHv_L_es = __esm(() => {
184910
- init_SuperConverter_DBlOjc68_es();
185486
+ var init_create_headless_toolbar_D1v6sX42_es = __esm(() => {
185487
+ init_SuperConverter_kDrJISzz_es();
184911
185488
  init_uuid_B2wVPhPi_es();
184912
185489
  init_constants_D9qj59G2_es();
184913
185490
  init_dist_B8HfvhaK_es();
@@ -234076,7 +234653,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
234076
234653
  init_remark_gfm_BhnWr3yf_es();
234077
234654
  });
234078
234655
 
234079
- // ../../packages/superdoc/dist/chunks/src-BnMjPHBh.es.js
234656
+ // ../../packages/superdoc/dist/chunks/src-C8MNSOR0.es.js
234080
234657
  function deleteProps(obj, propOrProps) {
234081
234658
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
234082
234659
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -275191,7 +275768,7 @@ function hasPageContextTokenInBlock(block) {
275191
275768
  return true;
275192
275769
  } else if (block.kind === "drawing") {
275193
275770
  const drawing = block;
275194
- if (drawing.drawingKind === "vectorShape")
275771
+ if (drawing.drawingKind === "vectorShape" || drawing.drawingKind === "textboxShape")
275195
275772
  return hasPageContextTokenInShapeText(drawing.textContent);
275196
275773
  if (drawing.drawingKind === "shapeGroup")
275197
275774
  return hasPageContextTokenInShapeGroup(drawing.shapes);
@@ -276848,6 +277425,18 @@ function computeParagraphLayoutStartY(input2) {
276848
277425
  const effectiveSpacingBefore = input2.suppressSpacingBefore ? 0 : input2.spacingBefore;
276849
277426
  return computeParagraphContentStartY(y$1, effectiveSpacingBefore, effectiveSpacingBefore === 0, trailingForCollapse);
276850
277427
  }
277428
+ function layoutTextboxContent(block, remeasureParagraph$1) {
277429
+ if (!Array.isArray(block.contentBlocks) || block.contentBlocks.length === 0)
277430
+ return [];
277431
+ const insets = block.textInsets ?? {
277432
+ top: 0,
277433
+ right: 0,
277434
+ bottom: 0,
277435
+ left: 0
277436
+ };
277437
+ const contentWidth = Math.max(1, block.geometry.width - insets.left - insets.right);
277438
+ return block.contentBlocks.map((paragraphBlock) => remeasureParagraph$1(paragraphBlock, contentWidth));
277439
+ }
276851
277440
  function describeCellRenderBlocks(cellMeasure, cellBlock, cellPadding) {
276852
277441
  const measuredBlocks = cellMeasure.blocks;
276853
277442
  const blockDataArray = cellBlock?.blocks;
@@ -278312,6 +278901,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
278312
278901
  fragment2.pmEnd = pmRange.pmEnd;
278313
278902
  state.page.fragments.push(fragment2);
278314
278903
  } else if (entry.block.kind === "drawing" && entry.measure.kind === "drawing") {
278904
+ const contentMeasures = entry.block.drawingKind === "textboxShape" && typeof remeasureParagraph$1 === "function" ? layoutTextboxContent(entry.block, remeasureParagraph$1) : undefined;
278315
278905
  const fragment2 = {
278316
278906
  kind: "drawing",
278317
278907
  blockId: entry.block.id,
@@ -278328,6 +278918,8 @@ function layoutParagraphBlock(ctx$1, anchors) {
278328
278918
  drawingContentId: entry.block.drawingContentId,
278329
278919
  sourceAnchor: entry.block.sourceAnchor
278330
278920
  };
278921
+ if (contentMeasures)
278922
+ fragment2.contentMeasures = contentMeasures;
278331
278923
  if (pmRange.pmStart != null)
278332
278924
  fragment2.pmStart = pmRange.pmStart;
278333
278925
  if (pmRange.pmEnd != null)
@@ -278736,7 +279328,7 @@ function layoutImageBlock({ block, measure, columns, ensurePage, advanceColumn,
278736
279328
  state.cursorY += requiredHeight;
278737
279329
  state.maxCursorY = Math.max(state.maxCursorY, state.cursorY);
278738
279330
  }
278739
- function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn, columnX }) {
279331
+ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn, columnX, textboxContentMeasures }) {
278740
279332
  if (block.anchor?.isAnchored)
278741
279333
  return;
278742
279334
  const marginTop = Math.max(0, block.margin?.top ?? 0);
@@ -278793,6 +279385,8 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
278793
279385
  pmEnd: pmRange.pmEnd,
278794
279386
  sourceAnchor: block.sourceAnchor
278795
279387
  };
279388
+ if (textboxContentMeasures)
279389
+ fragment2.contentMeasures = textboxContentMeasures;
278796
279390
  state.page.fragments.push(fragment2);
278797
279391
  state.cursorY += requiredHeight;
278798
279392
  state.maxCursorY = Math.max(state.maxCursorY, state.cursorY);
@@ -281226,6 +281820,7 @@ function layoutDocument(blocks2, measures, options = {}) {
281226
281820
  const state = paginator.ensurePage();
281227
281821
  const drawBlock = block;
281228
281822
  const drawMeasure = measure;
281823
+ const contentMeasures = drawBlock.drawingKind === "textboxShape" && typeof options.remeasureParagraph === "function" ? layoutTextboxContent(drawBlock, options.remeasureParagraph) : undefined;
281229
281824
  const fragment2 = {
281230
281825
  kind: "drawing",
281231
281826
  blockId: drawBlock.id,
@@ -281242,6 +281837,8 @@ function layoutDocument(blocks2, measures, options = {}) {
281242
281837
  drawingContentId: drawBlock.drawingContentId,
281243
281838
  sourceAnchor: drawBlock.sourceAnchor
281244
281839
  };
281840
+ if (contentMeasures)
281841
+ fragment2.contentMeasures = contentMeasures;
281245
281842
  const attrs = drawBlock.attrs;
281246
281843
  if (attrs?.pmStart != null)
281247
281844
  fragment2.pmStart = attrs.pmStart;
@@ -281257,7 +281854,8 @@ function layoutDocument(blocks2, measures, options = {}) {
281257
281854
  columns: getCurrentColumns(),
281258
281855
  ensurePage: paginator.ensurePage,
281259
281856
  advanceColumn: paginator.advanceColumn,
281260
- columnX
281857
+ columnX,
281858
+ textboxContentMeasures: block.drawingKind === "textboxShape" && typeof options.remeasureParagraph === "function" ? layoutTextboxContent(block, options.remeasureParagraph) : undefined
281261
281859
  });
281262
281860
  continue;
281263
281861
  }
@@ -281533,7 +282131,7 @@ function shouldExcludeFromMeasurement(fragment2, block, fragmentBottom, canvasHe
281533
282131
  return true;
281534
282132
  return false;
281535
282133
  }
281536
- function layoutHeaderFooter(blocks2, measures, constraints, kind) {
282134
+ function layoutHeaderFooter(blocks2, measures, constraints, kind, remeasureParagraph$1) {
281537
282135
  if (blocks2.length !== measures.length)
281538
282136
  throw new Error(`layoutHeaderFooter expected measures for every block (blocks=${blocks2.length}, measures=${measures.length})`);
281539
282137
  const width = Number(constraints?.width);
@@ -281557,7 +282155,8 @@ function layoutHeaderFooter(blocks2, measures, constraints, kind) {
281557
282155
  left: 0
281558
282156
  },
281559
282157
  allowParagraphlessAnchoredTableFallback: false,
281560
- allowSectionBreakOnlyPageFallback: false
282158
+ allowSectionBreakOnlyPageFallback: false,
282159
+ remeasureParagraph: remeasureParagraph$1
281561
282160
  });
281562
282161
  if (kind === "footer" && constraints.pageHeight != null)
281563
282162
  normalizeFragmentsForRegion(layout.pages, blocks2, measures, kind, constraints);
@@ -282336,7 +282935,7 @@ function hasPageNumberTokensRequiringPerPageLayout(blocks2) {
282336
282935
  }
282337
282936
  return false;
282338
282937
  }
282339
- async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1, cache$2 = sharedHeaderFooterCache, totalPages, pageResolver, kind, fontSignature = "") {
282938
+ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1, cache$2 = sharedHeaderFooterCache, totalPages, pageResolver, kind, fontSignature = "", remeasureParagraph$1) {
282340
282939
  const result = {};
282341
282940
  if (!pageResolver) {
282342
282941
  const numPages = totalPages ?? 1;
@@ -282349,7 +282948,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
282349
282948
  result[type] = {
282350
282949
  blocks: clonedBlocks,
282351
282950
  measures,
282352
- layout: layoutHeaderFooter(clonedBlocks, measures, constraints, kind)
282951
+ layout: layoutHeaderFooter(clonedBlocks, measures, constraints, kind, remeasureParagraph$1)
282353
282952
  };
282354
282953
  }
282355
282954
  return result;
@@ -282366,7 +282965,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
282366
282965
  result[type] = {
282367
282966
  blocks: blocks2,
282368
282967
  measures,
282369
- layout: layoutHeaderFooter(blocks2, measures, constraints, kind)
282968
+ layout: layoutHeaderFooter(blocks2, measures, constraints, kind, remeasureParagraph$1)
282370
282969
  };
282371
282970
  continue;
282372
282971
  }
@@ -282388,7 +282987,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
282388
282987
  const { displayText, displayNumber, totalPages: totalPagesForPage, sectionPageCount, pageFormat, chapterNumberText, chapterSeparator } = pageResolver(pageNum);
282389
282988
  resolveHeaderFooterTokens(clonedBlocks, pageNum, totalPagesForPage, displayText, displayNumber, sectionPageCount, pageFormat, chapterNumberText, chapterSeparator);
282390
282989
  const measures = await cache$2.measureBlocks(clonedBlocks, constraints, measureBlock$1, fontSignature);
282391
- const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints, kind);
282990
+ const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints, kind, remeasureParagraph$1);
282392
282991
  const measuresById = /* @__PURE__ */ new Map;
282393
282992
  for (let i4 = 0;i4 < clonedBlocks.length; i4 += 1)
282394
282993
  measuresById.set(clonedBlocks[i4].id, measures[i4]);
@@ -283251,7 +283850,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
283251
283850
  const blocks2 = blocksByRId.get(group.rId);
283252
283851
  if (!blocks2 || blocks2.length === 0)
283253
283852
  continue;
283254
- const layout$1 = (await layoutHeaderFooterWithCache({ default: blocks2 }, group.sectionConstraints, measureFn, headerMeasureCache, 1, pageResolver, kind)).default?.layout;
283853
+ const layout$1 = (await layoutHeaderFooterWithCache({ default: blocks2 }, group.sectionConstraints, measureFn, headerMeasureCache, 1, pageResolver, kind, undefined, (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent))).default?.layout;
283255
283854
  if (!layout$1 || !(layout$1.height > 0))
283256
283855
  continue;
283257
283856
  const nextHeight = Math.max(0, layout$1.height);
@@ -283268,7 +283867,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
283268
283867
  for (const [rId, blocks2] of blocksByRId) {
283269
283868
  if (!blocks2 || blocks2.length === 0)
283270
283869
  continue;
283271
- const layout$1 = (await layoutHeaderFooterWithCache({ default: blocks2 }, constraints, measureFn, headerMeasureCache, 1, pageResolver, kind)).default?.layout;
283870
+ const layout$1 = (await layoutHeaderFooterWithCache({ default: blocks2 }, constraints, measureFn, headerMeasureCache, 1, pageResolver, kind, undefined, (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent))).default?.layout;
283272
283871
  if (layout$1 && layout$1.height > 0)
283273
283872
  heightsByRId.set(rId, layout$1.height);
283274
283873
  }
@@ -283290,7 +283889,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
283290
283889
  };
283291
283890
  headerContentHeights = {};
283292
283891
  if (hasHeaderBlocks && headerFooter.headerBlocks) {
283293
- const preHeaderLayouts = await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, prelayoutPageResolver, "header", fontSignature);
283892
+ const preHeaderLayouts = await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, prelayoutPageResolver, "header", fontSignature, (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent));
283294
283893
  for (const [type, value] of Object.entries(preHeaderLayouts)) {
283295
283894
  if (!isValidHeaderType(type))
283296
283895
  continue;
@@ -283331,7 +283930,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
283331
283930
  footerContentHeights = {};
283332
283931
  try {
283333
283932
  if (hasFooterBlocks && headerFooter.footerBlocks) {
283334
- const preFooterLayouts = await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, prelayoutPageResolver, "footer", fontSignature);
283933
+ const preFooterLayouts = await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, prelayoutPageResolver, "footer", fontSignature, (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent));
283335
283934
  for (const [type, value] of Object.entries(preFooterLayouts)) {
283336
283935
  if (!isValidFooterType(type))
283337
283936
  continue;
@@ -283420,6 +284019,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
283420
284019
  console.warn(`[incrementalLayout] Page token resolution did not converge after ${maxIterations} iterations - stopping`);
283421
284020
  }
283422
284021
  }
284022
+ hydrateTableTextboxMeasures(currentBlocks, (block, maxWidth) => remeasureParagraph(block, maxWidth));
283423
284023
  const totalTokenTime = performance.now() - pageTokenStart;
283424
284024
  if (iteration > 0) {
283425
284025
  perfLog$1(`[Perf] 4.3 Total page token resolution time: ${totalTokenTime.toFixed(2)}ms`);
@@ -284431,10 +285031,17 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
284431
285031
  chapterSeparator: displayInfo?.chapterSeparator
284432
285032
  };
284433
285033
  } : undefined;
284434
- if (headerFooter.headerBlocks)
284435
- headers = serializeHeaderFooterResults("header", await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver, "header", fontSignature));
284436
- if (headerFooter.footerBlocks)
284437
- footers = serializeHeaderFooterResults("footer", await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver, "footer", fontSignature));
285034
+ const hfRemeasure = (block, maxWidth) => remeasureParagraph(block, maxWidth);
285035
+ if (headerFooter.headerBlocks) {
285036
+ for (const blocks2 of Object.values(headerFooter.headerBlocks))
285037
+ hydrateTableTextboxMeasures(blocks2, hfRemeasure);
285038
+ headers = serializeHeaderFooterResults("header", await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver, "header", fontSignature, (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)));
285039
+ }
285040
+ if (headerFooter.footerBlocks) {
285041
+ for (const blocks2 of Object.values(headerFooter.footerBlocks))
285042
+ hydrateTableTextboxMeasures(blocks2, hfRemeasure);
285043
+ footers = serializeHeaderFooterResults("footer", await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver, "footer", fontSignature, (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)));
285044
+ }
284438
285045
  perfLog$1(`[Perf] 4.4 Header/footer layout: ${(performance.now() - hfStart).toFixed(2)}ms`);
284439
285046
  const cacheStats = headerMeasureCache.getStats();
284440
285047
  globalMetrics.recordHeaderFooterCacheMetrics(cacheStats);
@@ -284450,6 +285057,19 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
284450
285057
  extraMeasures
284451
285058
  };
284452
285059
  }
285060
+ function hydrateTableTextboxMeasures(blocks2, remeasure) {
285061
+ for (const block of blocks2) {
285062
+ if (block.kind !== "table")
285063
+ continue;
285064
+ for (const row2 of block.rows ?? [])
285065
+ for (const cell2 of row2.cells ?? [])
285066
+ for (const cellBlock of cell2.blocks ?? [])
285067
+ if (cellBlock.kind === "drawing" && cellBlock.drawingKind === "textboxShape")
285068
+ cellBlock.contentMeasures = layoutTextboxContent(cellBlock, remeasure);
285069
+ else if (cellBlock.kind === "table")
285070
+ hydrateTableTextboxMeasures([cellBlock], remeasure);
285071
+ }
285072
+ }
284453
285073
  function rewriteSectionBreaksForSemanticFlow(blocks2, options) {
284454
285074
  const semanticPageSize = options.pageSize;
284455
285075
  const semanticMargins = options.margins;
@@ -284728,41 +285348,6 @@ async function remeasureAffectedBlocks(blocks2, measures, affectedBlockIds, perB
284728
285348
  }
284729
285349
  return updatedMeasures;
284730
285350
  }
284731
- function calculateSummary(samples) {
284732
- if (samples.length === 0)
284733
- return {
284734
- count: 0,
284735
- min: 0,
284736
- max: 0,
284737
- avg: 0,
284738
- p50: 0,
284739
- p95: 0,
284740
- p99: 0
284741
- };
284742
- const values = samples.map((s2) => s2.value).sort((a2, b$1) => a2 - b$1);
284743
- const count2 = values.length;
284744
- const sum = values.reduce((acc, v) => acc + v, 0);
284745
- return {
284746
- count: count2,
284747
- min: values[0],
284748
- max: values[count2 - 1],
284749
- avg: sum / count2,
284750
- p50: percentile(values, 0.5),
284751
- p95: percentile(values, 0.95),
284752
- p99: percentile(values, 0.99)
284753
- };
284754
- }
284755
- function percentile(sortedValues, p$12) {
284756
- if (sortedValues.length === 0)
284757
- return 0;
284758
- if (sortedValues.length === 1)
284759
- return sortedValues[0];
284760
- const index2 = (sortedValues.length - 1) * p$12;
284761
- const lower = Math.floor(index2);
284762
- const upper = Math.ceil(index2);
284763
- const weight = index2 - lower;
284764
- return sortedValues[lower] * (1 - weight) + sortedValues[upper] * weight;
284765
- }
284766
285351
  function resolveColumnsForHit(layout, page, fragmentY) {
284767
285352
  if (page === undefined)
284768
285353
  return layout.columns;
@@ -285058,6 +285643,54 @@ function clickToPositionGeometry(layout, blocks2, measures, containerPoint, opti
285058
285643
  lineIndex
285059
285644
  };
285060
285645
  }
285646
+ if (fragment2.kind === "drawing" && fragment2.drawingKind === "textboxShape" && block.kind === "drawing" && block.drawingKind === "textboxShape") {
285647
+ const textboxHit = resolveTextboxContentHit(fragment2, block, measure, pageIndex, pageRelativePoint);
285648
+ if (textboxHit) {
285649
+ const { contentBlock, contentMeasure, localX, localY, pageIndex: pageIndex$1, paragraphIndex } = textboxHit;
285650
+ const lineIndex = findLineIndexAtY(contentMeasure.lines, localY, 0, contentMeasure.lines.length);
285651
+ if (lineIndex != null) {
285652
+ const line = contentMeasure.lines[lineIndex];
285653
+ const isRTL = isRtlBlock(contentBlock);
285654
+ const indentLeft = typeof contentBlock.attrs?.indent?.left === "number" ? contentBlock.attrs.indent.left : 0;
285655
+ const indentRight = typeof contentBlock.attrs?.indent?.right === "number" ? contentBlock.attrs.indent.right : 0;
285656
+ const totalIndent = (Number.isFinite(indentLeft) ? indentLeft : 0) + (Number.isFinite(indentRight) ? indentRight : 0);
285657
+ const insets = textboxHit.block.textInsets ?? {
285658
+ top: 0,
285659
+ right: 0,
285660
+ bottom: 0,
285661
+ left: 0
285662
+ };
285663
+ let availableWidth = Math.max(0, textboxHit.fragment.width - insets.left - insets.right - totalIndent);
285664
+ if (totalIndent > textboxHit.fragment.width)
285665
+ console.warn(`[clickToPosition:textbox] Paragraph indents (${totalIndent}px) exceed fragment width (${textboxHit.fragment.width}px) for block ${textboxHit.fragment.blockId}. This may indicate a layout miscalculation. Available width clamped to 0.`);
285666
+ if (lineIndex === 0) {
285667
+ const suppressFLI = contentBlock.attrs?.suppressFirstLineIndent === true;
285668
+ const firstLineOffset = getFirstLineIndentOffset(contentBlock.attrs?.indent, suppressFLI);
285669
+ availableWidth = adjustAvailableWidthForTextIndent(availableWidth, firstLineOffset, line.maxWidth);
285670
+ }
285671
+ const pos = mapPointToPm(contentBlock, line, localX, isRTL, availableWidth);
285672
+ if (pos != null)
285673
+ return {
285674
+ pos,
285675
+ layoutEpoch,
285676
+ blockId: textboxHit.fragment.blockId,
285677
+ pageIndex: pageIndex$1,
285678
+ column: determineColumn(layout, textboxHit.fragment.x, layout.pages[pageIndex$1], textboxHit.fragment.y),
285679
+ lineIndex
285680
+ };
285681
+ }
285682
+ const firstRun = contentBlock.runs?.[0];
285683
+ if (firstRun && firstRun.pmStart != null)
285684
+ return {
285685
+ pos: firstRun.pmStart,
285686
+ layoutEpoch,
285687
+ blockId: textboxHit.fragment.blockId,
285688
+ pageIndex: pageIndex$1,
285689
+ column: determineColumn(layout, textboxHit.fragment.x, layout.pages[pageIndex$1], textboxHit.fragment.y),
285690
+ lineIndex: 0
285691
+ };
285692
+ }
285693
+ }
285061
285694
  if (isAtomicFragment(fragment2)) {
285062
285695
  const pmRange = getAtomicPmRange(fragment2, block);
285063
285696
  const pos = pmRange.pmStart ?? pmRange.pmEnd ?? null;
@@ -285135,6 +285768,41 @@ function clickToPositionGeometry(layout, blocks2, measures, containerPoint, opti
285135
285768
  }
285136
285769
  return null;
285137
285770
  }
285771
+ function calculateSummary(samples) {
285772
+ if (samples.length === 0)
285773
+ return {
285774
+ count: 0,
285775
+ min: 0,
285776
+ max: 0,
285777
+ avg: 0,
285778
+ p50: 0,
285779
+ p95: 0,
285780
+ p99: 0
285781
+ };
285782
+ const values = samples.map((s2) => s2.value).sort((a2, b$1) => a2 - b$1);
285783
+ const count2 = values.length;
285784
+ const sum = values.reduce((acc, v) => acc + v, 0);
285785
+ return {
285786
+ count: count2,
285787
+ min: values[0],
285788
+ max: values[count2 - 1],
285789
+ avg: sum / count2,
285790
+ p50: percentile(values, 0.5),
285791
+ p95: percentile(values, 0.95),
285792
+ p99: percentile(values, 0.99)
285793
+ };
285794
+ }
285795
+ function percentile(sortedValues, p$12) {
285796
+ if (sortedValues.length === 0)
285797
+ return 0;
285798
+ if (sortedValues.length === 1)
285799
+ return sortedValues[0];
285800
+ const index2 = (sortedValues.length - 1) * p$12;
285801
+ const lower = Math.floor(index2);
285802
+ const upper = Math.ceil(index2);
285803
+ const weight = index2 - lower;
285804
+ return sortedValues[lower] * (1 - weight) + sortedValues[upper] * weight;
285805
+ }
285138
285806
  function selectionToRects(layout, blocks2, measures, from$1, to, geometryHelper) {
285139
285807
  if (from$1 === to)
285140
285808
  return [];
@@ -288303,6 +288971,73 @@ function computeTableCaretLayoutRectFromDom({ viewportHost, visibleHost, zoom },
288303
288971
  }
288304
288972
  return null;
288305
288973
  }
288974
+ function findTextboxFragmentElement(viewportHost, blockId, pageIndex) {
288975
+ const pageEl = viewportHost.querySelector(`[data-page-index="${pageIndex}"]`) ?? viewportHost;
288976
+ return Array.from(pageEl.querySelectorAll("[data-block-id]")).find((el) => el.dataset.blockId === blockId) ?? null;
288977
+ }
288978
+ function computeTextboxCaretLayoutRectFromDom({ viewportHost, visibleHost, zoom }, pos, fragment2, _block, pageIndex) {
288979
+ const fragmentEl = findTextboxFragmentElement(viewportHost, fragment2.blockId, pageIndex);
288980
+ if (!fragmentEl)
288981
+ return null;
288982
+ const lineEls = Array.from(fragmentEl.querySelectorAll(".superdoc-line[data-pm-start][data-pm-end]"));
288983
+ if (lineEls.length === 0)
288984
+ return null;
288985
+ for (let lineIdx = 0;lineIdx < lineEls.length; lineIdx++) {
288986
+ const lineEl = lineEls[lineIdx];
288987
+ const pmStart = Number(lineEl.dataset.pmStart ?? "NaN");
288988
+ const pmEnd = Number(lineEl.dataset.pmEnd ?? "NaN");
288989
+ if (!Number.isFinite(pmStart) || !Number.isFinite(pmEnd))
288990
+ continue;
288991
+ const isLastLine = lineIdx === lineEls.length - 1;
288992
+ if (pos < pmStart || (isLastLine ? pos > pmEnd : pos >= pmEnd))
288993
+ continue;
288994
+ const spanEls = Array.from(lineEl.querySelectorAll("span[data-pm-start][data-pm-end]"));
288995
+ for (let spanIdx = 0;spanIdx < spanEls.length; spanIdx++) {
288996
+ const spanEl = spanEls[spanIdx];
288997
+ const spanStart = Number(spanEl.dataset.pmStart ?? "NaN");
288998
+ const spanEnd = Number(spanEl.dataset.pmEnd ?? "NaN");
288999
+ if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd))
289000
+ continue;
289001
+ const isLastSpan = spanIdx === spanEls.length - 1;
289002
+ if (pos < spanStart || (isLastSpan ? pos > spanEnd : pos >= spanEnd))
289003
+ continue;
289004
+ const textNode = spanEl.firstChild;
289005
+ if (!textNode || textNode.nodeType !== Node.TEXT_NODE) {
289006
+ const spanRect = spanEl.getBoundingClientRect();
289007
+ const viewportRect$2 = viewportHost.getBoundingClientRect();
289008
+ return {
289009
+ pageIndex,
289010
+ x: (spanRect.left - viewportRect$2.left + visibleHost.scrollLeft) / zoom,
289011
+ y: (spanRect.top - viewportRect$2.top + visibleHost.scrollTop) / zoom,
289012
+ height: spanRect.height / zoom
289013
+ };
289014
+ }
289015
+ const text5 = textNode.textContent ?? "";
289016
+ const charOffset = Math.max(0, Math.min(text5.length, pos - spanStart));
289017
+ const range = document.createRange();
289018
+ range.setStart(textNode, charOffset);
289019
+ range.setEnd(textNode, charOffset);
289020
+ const rangeRect = range.getBoundingClientRect();
289021
+ const viewportRect$1 = viewportHost.getBoundingClientRect();
289022
+ const lineRect$1 = lineEl.getBoundingClientRect();
289023
+ return {
289024
+ pageIndex,
289025
+ x: (rangeRect.left - viewportRect$1.left + visibleHost.scrollLeft) / zoom,
289026
+ y: (lineRect$1.top - viewportRect$1.top + visibleHost.scrollTop) / zoom,
289027
+ height: lineRect$1.height / zoom
289028
+ };
289029
+ }
289030
+ const lineRect = lineEl.getBoundingClientRect();
289031
+ const viewportRect = viewportHost.getBoundingClientRect();
289032
+ return {
289033
+ pageIndex,
289034
+ x: (lineRect.left - viewportRect.left + visibleHost.scrollLeft) / zoom,
289035
+ y: (lineRect.top - viewportRect.top + visibleHost.scrollTop) / zoom,
289036
+ height: lineRect.height / zoom
289037
+ };
289038
+ }
289039
+ return null;
289040
+ }
288306
289041
  function findLineContainingPos(block, measure, fromLine, toLine, pos) {
288307
289042
  if (measure.kind !== "paragraph" || block.kind !== "paragraph")
288308
289043
  return null;
@@ -288359,6 +289094,12 @@ function computeCaretLayoutRectGeometry({ layout, blocks: blocks2, measures, pai
288359
289094
  visibleHost,
288360
289095
  zoom
288361
289096
  }, effectivePos, hit.fragment, block, measure, hit.pageIndex);
289097
+ if (hit.fragment.kind === "drawing" && block?.kind === "drawing" && block.drawingKind === "textboxShape" && measure?.kind === "drawing")
289098
+ return computeTextboxCaretLayoutRectFromDom({
289099
+ viewportHost,
289100
+ visibleHost,
289101
+ zoom
289102
+ }, effectivePos, hit.fragment, block, hit.pageIndex);
288362
289103
  if (!block || block.kind !== "paragraph" || measure?.kind !== "paragraph")
288363
289104
  return null;
288364
289105
  if (hit.fragment.kind !== "para")
@@ -292980,7 +293721,7 @@ async function layoutBlocksByRId(kind, blocksByRId, referencedRIds, constraints,
292980
293721
  if (!blocks2 || blocks2.length === 0)
292981
293722
  continue;
292982
293723
  try {
292983
- const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, constraints, (block, c) => measureBlock(block, c, fontMeasureContext), undefined, undefined, pageResolver, kind, fontSignature);
293724
+ const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, constraints, (block, c) => measureBlock(block, c, fontMeasureContext), undefined, undefined, pageResolver, kind, fontSignature, (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent));
292984
293725
  if (batchResult.default)
292985
293726
  layoutsByRId.set(rId, {
292986
293727
  kind,
@@ -293040,7 +293781,7 @@ async function layoutWithPerSectionConstraints(kind, blocksByRId, sectionMetadat
293040
293781
  if (!blocks2 || blocks2.length === 0)
293041
293782
  continue;
293042
293783
  try {
293043
- const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, group.sectionConstraints, (block, c) => measureBlock(block, c, fontMeasureContext), undefined, undefined, pageResolver, kind, fontSignature);
293784
+ const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, group.sectionConstraints, (block, c) => measureBlock(block, c, fontMeasureContext), undefined, undefined, pageResolver, kind, fontSignature, (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent));
293044
293785
  if (batchResult.default)
293045
293786
  for (const sectionIndex of group.sectionIndices) {
293046
293787
  const contentWidth = buildSectionContentWidth(sectionMetadata.find((s2) => s2.sectionIndex === sectionIndex), fallbackConstraints);
@@ -317032,6 +317773,7 @@ menclose::after {
317032
317773
  drawingWrapper.style.flexShrink = "0";
317033
317774
  drawingWrapper.style.maxWidth = "100%";
317034
317775
  drawingWrapper.style.boxSizing = "border-box";
317776
+ drawingWrapper.dataset.blockId = block.id;
317035
317777
  applySdtDataset$1(drawingWrapper, block.attrs);
317036
317778
  const drawingInner = doc$12.createElement("div");
317037
317779
  drawingInner.classList.add("superdoc-table-drawing");
@@ -317201,6 +317943,7 @@ menclose::after {
317201
317943
  drawingWrapper.style.maxWidth = "100%";
317202
317944
  drawingWrapper.style.boxSizing = "border-box";
317203
317945
  drawingWrapper.style.zIndex = String(zIndex);
317946
+ drawingWrapper.dataset.blockId = anchoredBlock.id;
317204
317947
  applySdtDataset$1(drawingWrapper, anchoredBlock.attrs);
317205
317948
  const drawingInner = doc$12.createElement("div");
317206
317949
  drawingInner.classList.add("superdoc-table-drawing");
@@ -321240,17 +321983,19 @@ menclose::after {
321240
321983
  throw new Error("DomPainter: document is not available");
321241
321984
  if (block.drawingKind === "image")
321242
321985
  return createDrawingImageElement(this.doc, block, this.buildImageHyperlinkAnchor.bind(this));
321243
- if (block.drawingKind === "vectorShape")
321244
- return this.createVectorShapeElement(block, fragment2.geometry, false, 1, 1, context);
321986
+ if (block.drawingKind === "vectorShape" || block.drawingKind === "textboxShape")
321987
+ return this.createVectorShapeElement(block, fragment2.geometry, false, 1, 1, context, fragment2);
321245
321988
  if (block.drawingKind === "shapeGroup")
321246
321989
  return this.createShapeGroupElement(block, context);
321247
321990
  if (block.drawingKind === "chart")
321248
321991
  return this.createChartElement(block);
321249
321992
  return this.createDrawingPlaceholder();
321250
321993
  }
321251
- createVectorShapeElement(block, geometry, applyTransforms = false, groupScaleX = 1, groupScaleY = 1, context) {
321994
+ createVectorShapeElement(block, geometry, applyTransforms = false, groupScaleX = 1, groupScaleY = 1, context, fragment2) {
321252
321995
  const container = this.doc.createElement("div");
321253
321996
  container.classList.add("superdoc-vector-shape");
321997
+ if (block.drawingKind === "textboxShape")
321998
+ container.classList.add("superdoc-textbox-shape");
321254
321999
  container.style.width = "100%";
321255
322000
  container.style.height = "100%";
321256
322001
  container.style.position = "relative";
@@ -321281,8 +322026,8 @@ menclose::after {
321281
322026
  }
321282
322027
  this.applyLineEnds(svgElement, block);
321283
322028
  contentContainer.appendChild(svgElement);
321284
- if (this.hasShapeTextContent(block.textContent)) {
321285
- const textElement = this.createShapeTextElement(block, innerWidth, innerHeight2, groupScaleX, groupScaleY, context);
322029
+ if (block.drawingKind === "textboxShape" || this.hasShapeTextContent(block.textContent)) {
322030
+ const textElement = block.drawingKind === "textboxShape" ? this.createTextboxContentElement(block, fragment2, innerWidth, innerHeight2, context) : this.createShapeTextElement(block, innerWidth, innerHeight2, groupScaleX, groupScaleY, context);
321286
322031
  contentContainer.appendChild(textElement);
321287
322032
  }
321288
322033
  container.appendChild(contentContainer);
@@ -321290,8 +322035,8 @@ menclose::after {
321290
322035
  }
321291
322036
  }
321292
322037
  this.applyFallbackShapeStyle(contentContainer, block);
321293
- if (this.hasShapeTextContent(block.textContent)) {
321294
- const textElement = this.createShapeTextElement(block, innerWidth, innerHeight2, groupScaleX, groupScaleY, context);
322038
+ if (block.drawingKind === "textboxShape" || this.hasShapeTextContent(block.textContent)) {
322039
+ const textElement = block.drawingKind === "textboxShape" ? this.createTextboxContentElement(block, fragment2, innerWidth, innerHeight2, context) : this.createShapeTextElement(block, innerWidth, innerHeight2, groupScaleX, groupScaleY, context);
321295
322040
  contentContainer.appendChild(textElement);
321296
322041
  }
321297
322042
  container.appendChild(contentContainer);
@@ -321331,6 +322076,47 @@ menclose::after {
321331
322076
  return this.createWordArtTextElement(textContent$1, block.textAlign ?? "center", block.textInsets, width, height, context);
321332
322077
  return this.createFallbackTextElement(textContent$1, block.textAlign ?? "center", block.textVerticalAlign, block.textInsets, groupScaleX, groupScaleY, context);
321333
322078
  }
322079
+ createTextboxContentElement(block, fragment2, width, height, context) {
322080
+ const contentMeasures = fragment2?.contentMeasures ?? block.contentMeasures;
322081
+ if (!Array.isArray(contentMeasures) || contentMeasures.length === 0)
322082
+ return this.hasShapeTextContent(block.textContent) ? this.createShapeTextElement(block, width, height, 1, 1, context) : this.doc.createElement("div");
322083
+ const contentRoot = this.doc.createElement("div");
322084
+ contentRoot.style.position = "absolute";
322085
+ contentRoot.style.top = "0";
322086
+ contentRoot.style.left = "0";
322087
+ contentRoot.style.width = "100%";
322088
+ contentRoot.style.height = "100%";
322089
+ contentRoot.style.display = "flex";
322090
+ contentRoot.style.flexDirection = "column";
322091
+ contentRoot.style.boxSizing = "border-box";
322092
+ contentRoot.style.overflow = "hidden";
322093
+ const insets = block.textInsets ?? {
322094
+ top: 0,
322095
+ right: 0,
322096
+ bottom: 0,
322097
+ left: 0
322098
+ };
322099
+ contentRoot.style.padding = `${insets.top}px ${insets.right}px ${insets.bottom}px ${insets.left}px`;
322100
+ const verticalAlign = block.textVerticalAlign ?? "top";
322101
+ contentRoot.style.justifyContent = verticalAlign === "bottom" ? "flex-end" : verticalAlign === "center" ? "center" : "flex-start";
322102
+ const linesHost = this.doc.createElement("div");
322103
+ linesHost.style.display = "flex";
322104
+ linesHost.style.flexDirection = "column";
322105
+ linesHost.style.minWidth = "0";
322106
+ linesHost.style.width = "100%";
322107
+ const renderContext = context ?? this.defaultFragmentRenderContext();
322108
+ const availableWidth = Math.max(1, width - insets.left - insets.right);
322109
+ block.contentBlocks.forEach((paragraphBlock, paragraphIndex) => {
322110
+ const measure = contentMeasures[paragraphIndex];
322111
+ if (!measure?.lines)
322112
+ return;
322113
+ measure.lines.forEach((line, lineIndex) => {
322114
+ linesHost.appendChild(this.renderLine(paragraphBlock, line, renderContext, availableWidth, lineIndex));
322115
+ });
322116
+ });
322117
+ contentRoot.appendChild(linesHost);
322118
+ return contentRoot;
322119
+ }
321334
322120
  shouldUseWordArtTextRenderer(block) {
321335
322121
  return block.attrs?.isWordArt === true && this.hasShapeTextContent(block.textContent);
321336
322122
  }
@@ -321883,7 +322669,7 @@ menclose::after {
321883
322669
  return createDrawingImageElement(this.doc, block, this.buildImageHyperlinkAnchor.bind(this));
321884
322670
  if (block.drawingKind === "shapeGroup")
321885
322671
  return this.createShapeGroupElement(block, context);
321886
- if (block.drawingKind === "vectorShape")
322672
+ if (block.drawingKind === "vectorShape" || block.drawingKind === "textboxShape")
321887
322673
  return this.createVectorShapeElement(block, block.geometry, false, 1, 1, context);
321888
322674
  if (block.drawingKind === "chart")
321889
322675
  return this.createChartElement(block);
@@ -321968,6 +322754,13 @@ menclose::after {
321968
322754
  };
321969
322755
  return runContext;
321970
322756
  }
322757
+ defaultFragmentRenderContext() {
322758
+ return {
322759
+ pageNumber: 1,
322760
+ totalPages: 1,
322761
+ section: "body"
322762
+ };
322763
+ }
321971
322764
  updateFragmentElement(el, fragment2, section, resolvedItem) {
321972
322765
  const fragmentItem = resolvedItem?.kind === "fragment" ? resolvedItem : undefined;
321973
322766
  const story = resolveSectionStory(section);
@@ -322464,6 +323257,15 @@ menclose::after {
322464
323257
  if (!lum)
322465
323258
  return "";
322466
323259
  return [lum.bright ?? "", lum.contrast ?? ""].join(":");
323260
+ }, drawingTextVersion = (block) => {
323261
+ const textboxContentBlocks = "contentBlocks" in block && Array.isArray(block.contentBlocks) ? block.contentBlocks.map((contentBlock) => deriveBlockVersion(contentBlock)).join(";") : "";
323262
+ return JSON.stringify([
323263
+ block.textAlign ?? "",
323264
+ block.textVerticalAlign ?? "",
323265
+ block.textInsets ?? null,
323266
+ block.textContent ?? null,
323267
+ textboxContentBlocks
323268
+ ]);
322467
323269
  }, renderedBlockImageVersion = (image2) => [
322468
323270
  image2.src ?? "",
322469
323271
  image2.width ?? "",
@@ -322671,10 +323473,10 @@ menclose::after {
322671
323473
  if (block.kind === "drawing") {
322672
323474
  if (block.drawingKind === "image")
322673
323475
  return ["drawing:image", renderedBlockImageVersion(block)].join("|");
322674
- if (block.drawingKind === "vectorShape") {
323476
+ if (block.drawingKind === "vectorShape" || block.drawingKind === "textboxShape") {
322675
323477
  const vector = block;
322676
323478
  return [
322677
- "drawing:vector",
323479
+ block.drawingKind === "textboxShape" ? "drawing:textbox" : "drawing:vector",
322678
323480
  vector.shapeKind ?? "",
322679
323481
  vector.fillColor ?? "",
322680
323482
  vector.strokeColor ?? "",
@@ -322683,7 +323485,8 @@ menclose::after {
322683
323485
  vector.geometry.height,
322684
323486
  vector.geometry.rotation ?? 0,
322685
323487
  vector.geometry.flipH ? 1 : 0,
322686
- vector.geometry.flipV ? 1 : 0
323488
+ vector.geometry.flipV ? 1 : 0,
323489
+ drawingTextVersion(vector)
322687
323490
  ].join("|");
322688
323491
  }
322689
323492
  if (block.drawingKind === "shapeGroup") {
@@ -323379,6 +324182,23 @@ menclose::after {
323379
324182
  block.textVerticalAlign ?? "",
323380
324183
  JSON.stringify(block.textInsets ?? null)
323381
324184
  ].join(":");
324185
+ if (block.drawingKind === "textboxShape")
324186
+ return [
324187
+ "drawing:textbox",
324188
+ hashDrawingGeometry(block.geometry),
324189
+ block.shapeKind ?? "",
324190
+ JSON.stringify(block.fillColor ?? null),
324191
+ JSON.stringify(block.strokeColor ?? null),
324192
+ block.strokeWidth ?? "",
324193
+ JSON.stringify(block.customGeometry ?? null),
324194
+ JSON.stringify(block.lineEnds ?? null),
324195
+ JSON.stringify(block.effectExtent ?? null),
324196
+ JSON.stringify(block.textContent ?? null),
324197
+ block.textAlign ?? "",
324198
+ block.textVerticalAlign ?? "",
324199
+ JSON.stringify(block.textInsets ?? null),
324200
+ block.contentBlocks.map((contentBlock) => `${contentBlock.id}:${hashRuns(contentBlock)}`).join("|")
324201
+ ].join(":");
323382
324202
  if (block.drawingKind === "shapeGroup")
323383
324203
  return [
323384
324204
  "drawing:shapeGroup",
@@ -324413,8 +325233,10 @@ menclose::after {
324413
325233
  return false;
324414
325234
  if (a2.drawingKind === "image" && b$1.drawingKind === "image")
324415
325235
  return imageBlocksEqual(a2, b$1);
324416
- if (a2.drawingKind === "vectorShape" && b$1.drawingKind === "vectorShape")
324417
- return drawingGeometryEqual(a2.geometry, b$1.geometry) && a2.shapeKind === b$1.shapeKind && a2.fillColor === b$1.fillColor && a2.strokeColor === b$1.strokeColor && a2.strokeWidth === b$1.strokeWidth;
325236
+ if ((a2.drawingKind === "vectorShape" || a2.drawingKind === "textboxShape") && (b$1.drawingKind === "vectorShape" || b$1.drawingKind === "textboxShape")) {
325237
+ const textboxContentEqual = a2.drawingKind !== "textboxShape" || b$1.drawingKind !== "textboxShape" || jsonEqual(a2.contentBlocks, b$1.contentBlocks);
325238
+ return drawingGeometryEqual(a2.geometry, b$1.geometry) && a2.shapeKind === b$1.shapeKind && a2.fillColor === b$1.fillColor && a2.strokeColor === b$1.strokeColor && a2.strokeWidth === b$1.strokeWidth && a2.textAlign === b$1.textAlign && a2.textVerticalAlign === b$1.textVerticalAlign && jsonEqual(a2.textInsets, b$1.textInsets) && jsonEqual(a2.textContent, b$1.textContent) && jsonEqual(a2.customGeometry, b$1.customGeometry) && jsonEqual(a2.lineEnds, b$1.lineEnds) && jsonEqual(a2.effectExtent, b$1.effectExtent) && textboxContentEqual;
325239
+ }
324418
325240
  if (a2.drawingKind === "shapeGroup" && b$1.drawingKind === "shapeGroup")
324419
325241
  return drawingGeometryEqual(a2.geometry, b$1.geometry) && shapeGroupTransformEqual(a2.groupTransform, b$1.groupTransform) && shapeGroupSizeEqual(a2.size, b$1.size) && shapeGroupChildrenEqual(a2.shapes, b$1.shapes);
324420
325242
  if (a2.drawingKind === "chart" && b$1.drawingKind === "chart")
@@ -325238,7 +326060,329 @@ menclose::after {
325238
326060
  });
325239
326061
  });
325240
326062
  return results;
325241
- }, PRELAYOUT_CHAPTER_MARKER_SEPARATOR_RE, PRELAYOUT_MIN_PAGE_COMPONENT = 10, PageGeometryHelper = class {
326063
+ }, PRELAYOUT_CHAPTER_MARKER_SEPARATOR_RE, PRELAYOUT_MIN_PAGE_COMPONENT = 10, isAtomicFragment = (fragment2) => {
326064
+ return fragment2.kind === "drawing" || fragment2.kind === "image";
326065
+ }, blockPmRangeFromAttrs = (block) => {
326066
+ const attrs = block?.attrs;
326067
+ const pmStart = typeof attrs?.pmStart === "number" ? attrs.pmStart : undefined;
326068
+ return {
326069
+ pmStart,
326070
+ pmEnd: typeof attrs?.pmEnd === "number" ? attrs.pmEnd : pmStart != null ? pmStart + 1 : undefined
326071
+ };
326072
+ }, getAtomicPmRange = (fragment2, block) => {
326073
+ return {
326074
+ pmStart: typeof fragment2.pmStart === "number" ? fragment2.pmStart : blockPmRangeFromAttrs(block).pmStart,
326075
+ pmEnd: typeof fragment2.pmEnd === "number" ? fragment2.pmEnd : blockPmRangeFromAttrs(block).pmEnd
326076
+ };
326077
+ }, isRtlBlock = (block) => {
326078
+ if (block.kind !== "paragraph")
326079
+ return false;
326080
+ return getParagraphInlineDirection(block.attrs) === "rtl";
326081
+ }, determineColumn = (layout, fragmentX, page, fragmentY) => {
326082
+ const columns = resolveColumnsForHit(layout, page, fragmentY);
326083
+ if (!columns || columns.count <= 1)
326084
+ return 0;
326085
+ const pageWidth = page?.size?.w ?? layout.pageSize.w;
326086
+ const margins = page?.margins ?? layout.pages[0]?.margins;
326087
+ const marginLeft = Math.max(0, margins?.left ?? 0);
326088
+ const marginRight = Math.max(0, margins?.right ?? 0);
326089
+ return getColumnAtX(getColumnGeometry(normalizeColumnLayout(columns, Math.max(1, pageWidth - (marginLeft + marginRight)))), fragmentX, marginLeft);
326090
+ }, determineTableColumn = (layout, fragment2, page) => {
326091
+ if (typeof fragment2.columnIndex === "number") {
326092
+ const count2 = resolveColumnsForHit(layout, page, fragment2.y)?.count ?? 1;
326093
+ return Math.max(0, Math.min(Math.max(0, count2 - 1), fragment2.columnIndex));
326094
+ }
326095
+ return determineColumn(layout, fragment2.x, page, fragment2.y);
326096
+ }, findLineIndexAtY = (lines, offsetY, fromLine, toLine) => {
326097
+ if (!lines || lines.length === 0)
326098
+ return null;
326099
+ const lineCount = lines.length;
326100
+ if (fromLine < 0 || toLine > lineCount || fromLine >= toLine)
326101
+ return null;
326102
+ let cursor = 0;
326103
+ for (let i4 = fromLine;i4 < toLine; i4 += 1) {
326104
+ const line = lines[i4];
326105
+ if (!line)
326106
+ return null;
326107
+ const next2 = cursor + line.lineHeight;
326108
+ if (offsetY >= cursor && offsetY < next2)
326109
+ return i4;
326110
+ cursor = next2;
326111
+ }
326112
+ return toLine - 1;
326113
+ }, mapPointToPm = (block, line, x, isRTL, availableWidthOverride, alignmentOverride) => {
326114
+ if (block.kind !== "paragraph")
326115
+ return null;
326116
+ const range = computeLinePmRange(block, line);
326117
+ if (range.pmStart == null || range.pmEnd == null)
326118
+ return null;
326119
+ const result = findCharacterAtX(block, line, x, range.pmStart, availableWidthOverride, alignmentOverride);
326120
+ let pmPosition = result.pmPosition;
326121
+ if (isRTL) {
326122
+ const charOffset = result.charOffset;
326123
+ const charsInLine = Math.max(1, line.toChar - line.fromChar);
326124
+ pmPosition = charOffsetToPm(block, line, Math.max(0, Math.min(charsInLine, charsInLine - charOffset)), range.pmStart);
326125
+ }
326126
+ return pmPosition;
326127
+ }, calculatePageTopFallback = (layout, pageIndex) => {
326128
+ const pageGap = layout.pageGap ?? 0;
326129
+ let y$1 = 0;
326130
+ for (let i4 = 0;i4 < pageIndex; i4++) {
326131
+ const pageHeight = layout.pages[i4]?.size?.h ?? layout.pageSize.h;
326132
+ y$1 += pageHeight + pageGap;
326133
+ }
326134
+ return y$1;
326135
+ }, hitTestAtomicFragment = (pageHit, blocks2, measures, point5) => {
326136
+ for (const fragment2 of pageHit.page.fragments) {
326137
+ if (!isAtomicFragment(fragment2))
326138
+ continue;
326139
+ const withinX = point5.x >= fragment2.x && point5.x <= fragment2.x + fragment2.width;
326140
+ const withinY = point5.y >= fragment2.y && point5.y <= fragment2.y + fragment2.height;
326141
+ if (!withinX || !withinY)
326142
+ continue;
326143
+ const blockIndex = findBlockIndexByFragmentId(blocks2, fragment2.blockId);
326144
+ if (blockIndex === -1)
326145
+ continue;
326146
+ const block = blocks2[blockIndex];
326147
+ const measure = measures[blockIndex];
326148
+ if (!block || !measure)
326149
+ continue;
326150
+ return {
326151
+ fragment: fragment2,
326152
+ block,
326153
+ measure,
326154
+ pageIndex: pageHit.pageIndex,
326155
+ pageY: 0
326156
+ };
326157
+ }
326158
+ return null;
326159
+ }, hitTestTableFragment = (pageHit, blocks2, measures, point5) => {
326160
+ for (const fragment2 of pageHit.page.fragments) {
326161
+ if (fragment2.kind !== "table")
326162
+ continue;
326163
+ const tableFragment = fragment2;
326164
+ const withinX = point5.x >= tableFragment.x && point5.x <= tableFragment.x + tableFragment.width;
326165
+ const withinY = point5.y >= tableFragment.y && point5.y <= tableFragment.y + tableFragment.height;
326166
+ if (!withinX || !withinY)
326167
+ continue;
326168
+ const blockIndex = blocks2.findIndex((block$1) => block$1.id === tableFragment.blockId);
326169
+ if (blockIndex === -1)
326170
+ continue;
326171
+ const block = blocks2[blockIndex];
326172
+ const measure = measures[blockIndex];
326173
+ if (!block || block.kind !== "table" || !measure || measure.kind !== "table")
326174
+ continue;
326175
+ const tableBlock = block;
326176
+ const tableMeasure = measure;
326177
+ const localX = point5.x - tableFragment.x;
326178
+ const localY = point5.y - tableFragment.y;
326179
+ let rowY = 0;
326180
+ let rowIndex = -1;
326181
+ if (tableMeasure.rows.length === 0 || tableBlock.rows.length === 0)
326182
+ continue;
326183
+ for (let r$1 = tableFragment.fromRow;r$1 < tableFragment.toRow && r$1 < tableMeasure.rows.length; r$1++) {
326184
+ const rowMeasure$1 = tableMeasure.rows[r$1];
326185
+ if (localY >= rowY && localY < rowY + rowMeasure$1.height) {
326186
+ rowIndex = r$1;
326187
+ break;
326188
+ }
326189
+ rowY += rowMeasure$1.height;
326190
+ }
326191
+ if (rowIndex === -1) {
326192
+ rowIndex = Math.min(tableFragment.toRow - 1, tableMeasure.rows.length - 1);
326193
+ if (rowIndex < tableFragment.fromRow)
326194
+ continue;
326195
+ }
326196
+ const rowMeasure = tableMeasure.rows[rowIndex];
326197
+ const row2 = tableBlock.rows[rowIndex];
326198
+ if (!rowMeasure || !row2)
326199
+ continue;
326200
+ const firstCellGridStart = rowMeasure.cells[0]?.gridColumnStart ?? 0;
326201
+ let colX = 0;
326202
+ if (firstCellGridStart > 0 && tableMeasure.columnWidths)
326203
+ for (let col = 0;col < firstCellGridStart && col < tableMeasure.columnWidths.length; col++)
326204
+ colX += tableMeasure.columnWidths[col];
326205
+ const initialColX = colX;
326206
+ let colIndex = -1;
326207
+ if (rowMeasure.cells.length === 0 || row2.cells.length === 0)
326208
+ continue;
326209
+ for (let c = 0;c < rowMeasure.cells.length; c++) {
326210
+ const cellMeasure$1 = rowMeasure.cells[c];
326211
+ if (localX >= colX && localX < colX + cellMeasure$1.width) {
326212
+ colIndex = c;
326213
+ break;
326214
+ }
326215
+ colX += cellMeasure$1.width;
326216
+ }
326217
+ if (colIndex === -1) {
326218
+ if (localX < initialColX)
326219
+ colIndex = 0;
326220
+ else
326221
+ colIndex = rowMeasure.cells.length - 1;
326222
+ if (colIndex < 0)
326223
+ continue;
326224
+ }
326225
+ const cellMeasure = rowMeasure.cells[colIndex];
326226
+ const cell2 = row2.cells[colIndex];
326227
+ if (!cellMeasure || !cell2)
326228
+ continue;
326229
+ const cellBlocks = cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
326230
+ const rawMeasures = cellMeasure.blocks ?? (cellMeasure.paragraph ? [cellMeasure.paragraph] : []);
326231
+ const cellBlockMeasures = (Array.isArray(rawMeasures) ? rawMeasures : []).filter((m$1) => m$1 != null && typeof m$1 === "object" && ("kind" in m$1));
326232
+ let blockStartY = 0;
326233
+ let blockStartGlobalLines = 0;
326234
+ const getBlockHeight = (m$1) => {
326235
+ if (!m$1)
326236
+ return 0;
326237
+ if ("totalHeight" in m$1 && typeof m$1.totalHeight === "number")
326238
+ return m$1.totalHeight;
326239
+ if ("height" in m$1 && typeof m$1.height === "number")
326240
+ return m$1.height;
326241
+ return 0;
326242
+ };
326243
+ let nearestParagraphHit = null;
326244
+ for (let i4 = 0;i4 < cellBlocks.length && i4 < cellBlockMeasures.length; i4++) {
326245
+ const cellBlock = cellBlocks[i4];
326246
+ const cellBlockMeasure = cellBlockMeasures[i4];
326247
+ if (cellBlock?.kind !== "paragraph" || cellBlockMeasure?.kind !== "paragraph") {
326248
+ blockStartY += getBlockHeight(cellBlockMeasure);
326249
+ continue;
326250
+ }
326251
+ const blockHeight = getBlockHeight(cellBlockMeasure);
326252
+ const blockEndY = blockStartY + blockHeight;
326253
+ const padding = cell2.attrs?.padding ?? {
326254
+ top: 0,
326255
+ left: 4,
326256
+ right: 4,
326257
+ bottom: 0
326258
+ };
326259
+ const cellLocalX = localX - colX - (padding.left ?? 4);
326260
+ const cellLocalY = localY - rowY - (padding.top ?? 0);
326261
+ const paragraphBlock = cellBlock;
326262
+ const paragraphMeasure = cellBlockMeasure;
326263
+ if (cellLocalY >= blockStartY && cellLocalY < blockEndY) {
326264
+ const unclampedLocalY = cellLocalY - blockStartY;
326265
+ const localYWithinBlock = Math.max(0, Math.min(unclampedLocalY, Math.max(blockHeight, 0)));
326266
+ return {
326267
+ fragment: tableFragment,
326268
+ block: tableBlock,
326269
+ measure: tableMeasure,
326270
+ pageIndex: pageHit.pageIndex,
326271
+ cellRowIndex: rowIndex,
326272
+ cellColIndex: colIndex,
326273
+ cellBlock: paragraphBlock,
326274
+ cellMeasure: paragraphMeasure,
326275
+ localX: Math.max(0, cellLocalX),
326276
+ localY: Math.max(0, localYWithinBlock),
326277
+ blockStartGlobal: blockStartGlobalLines
326278
+ };
326279
+ }
326280
+ const distanceToBlock = cellLocalY < blockStartY ? blockStartY - cellLocalY : Math.max(0, cellLocalY - blockEndY);
326281
+ if (!nearestParagraphHit || distanceToBlock < nearestParagraphHit.distance) {
326282
+ const unclampedLocalY = cellLocalY - blockStartY;
326283
+ nearestParagraphHit = {
326284
+ cellBlock: paragraphBlock,
326285
+ cellMeasure: paragraphMeasure,
326286
+ localX: Math.max(0, cellLocalX),
326287
+ localY: Math.max(0, Math.min(unclampedLocalY, Math.max(blockHeight, 0))),
326288
+ blockStartGlobal: blockStartGlobalLines,
326289
+ distance: distanceToBlock
326290
+ };
326291
+ }
326292
+ blockStartY = blockEndY;
326293
+ blockStartGlobalLines += paragraphMeasure.lines.length;
326294
+ }
326295
+ if (nearestParagraphHit)
326296
+ return {
326297
+ fragment: tableFragment,
326298
+ block: tableBlock,
326299
+ measure: tableMeasure,
326300
+ pageIndex: pageHit.pageIndex,
326301
+ cellRowIndex: rowIndex,
326302
+ cellColIndex: colIndex,
326303
+ cellBlock: nearestParagraphHit.cellBlock,
326304
+ cellMeasure: nearestParagraphHit.cellMeasure,
326305
+ localX: nearestParagraphHit.localX,
326306
+ localY: nearestParagraphHit.localY,
326307
+ blockStartGlobal: nearestParagraphHit.blockStartGlobal
326308
+ };
326309
+ }
326310
+ return null;
326311
+ }, resolveTextboxContentHit = (fragment2, block, measure, pageIndex, point5) => {
326312
+ const fragmentWithContent = fragment2;
326313
+ const contentMeasures = Array.isArray(fragmentWithContent.contentMeasures) ? fragmentWithContent.contentMeasures : Array.isArray(block.contentMeasures) ? block.contentMeasures : [];
326314
+ const contentBlocks = Array.isArray(block.contentBlocks) ? block.contentBlocks : [];
326315
+ if (contentMeasures.length === 0 || contentBlocks.length === 0)
326316
+ return null;
326317
+ const insets = block.textInsets ?? {
326318
+ top: 0,
326319
+ right: 0,
326320
+ bottom: 0,
326321
+ left: 0
326322
+ };
326323
+ const localX = Math.max(0, point5.x - fragment2.x - insets.left);
326324
+ const rawLocalY = point5.y - fragment2.y - insets.top;
326325
+ const totalContentHeight = contentMeasures.reduce((sum, m$1) => sum + (m$1?.kind === "paragraph" ? m$1.totalHeight ?? 0 : 0), 0);
326326
+ const availableHeight = Math.max(0, fragment2.height - insets.top - insets.bottom);
326327
+ const verticalAlign = block.textVerticalAlign ?? "top";
326328
+ let contentOffset = 0;
326329
+ if (verticalAlign === "center")
326330
+ contentOffset = Math.max(0, (availableHeight - totalContentHeight) / 2);
326331
+ else if (verticalAlign === "bottom")
326332
+ contentOffset = Math.max(0, availableHeight - totalContentHeight);
326333
+ const localY = rawLocalY - contentOffset;
326334
+ let paragraphStartY = 0;
326335
+ let blockStartGlobal = 0;
326336
+ let nearestParagraphHit = null;
326337
+ for (let i4 = 0;i4 < contentBlocks.length && i4 < contentMeasures.length; i4 += 1) {
326338
+ const contentBlock = contentBlocks[i4];
326339
+ const contentMeasure = contentMeasures[i4];
326340
+ if (contentBlock?.kind !== "paragraph" || contentMeasure?.kind !== "paragraph")
326341
+ continue;
326342
+ const paragraphHeight = contentMeasure.totalHeight;
326343
+ const paragraphEndY = paragraphStartY + paragraphHeight;
326344
+ if (localY >= paragraphStartY && localY < paragraphEndY)
326345
+ return {
326346
+ fragment: fragment2,
326347
+ block,
326348
+ measure,
326349
+ pageIndex,
326350
+ contentBlock,
326351
+ contentMeasure,
326352
+ paragraphIndex: i4,
326353
+ localX,
326354
+ localY: Math.max(0, Math.min(localY - paragraphStartY, Math.max(paragraphHeight, 0))),
326355
+ blockStartGlobal
326356
+ };
326357
+ const distanceToParagraph = localY < paragraphStartY ? paragraphStartY - localY : Math.max(0, localY - paragraphEndY);
326358
+ if (!nearestParagraphHit || distanceToParagraph < nearestParagraphHit.distance)
326359
+ nearestParagraphHit = {
326360
+ contentBlock,
326361
+ contentMeasure,
326362
+ paragraphIndex: i4,
326363
+ localX,
326364
+ localY: Math.max(0, Math.min(localY - paragraphStartY, Math.max(paragraphHeight, 0))),
326365
+ blockStartGlobal,
326366
+ distance: distanceToParagraph
326367
+ };
326368
+ paragraphStartY = paragraphEndY;
326369
+ blockStartGlobal += contentMeasure.lines.length;
326370
+ }
326371
+ if (nearestParagraphHit)
326372
+ return {
326373
+ fragment: fragment2,
326374
+ block,
326375
+ measure,
326376
+ pageIndex,
326377
+ contentBlock: nearestParagraphHit.contentBlock,
326378
+ contentMeasure: nearestParagraphHit.contentMeasure,
326379
+ paragraphIndex: nearestParagraphHit.paragraphIndex,
326380
+ localX: nearestParagraphHit.localX,
326381
+ localY: nearestParagraphHit.localY,
326382
+ blockStartGlobal: nearestParagraphHit.blockStartGlobal
326383
+ };
326384
+ return null;
326385
+ }, PageGeometryHelper = class {
325242
326386
  constructor(config2) {
325243
326387
  this.cache = null;
325244
326388
  this.config = config2;
@@ -325453,254 +326597,6 @@ menclose::after {
325453
326597
  for (const metric of Object.keys(this.metrics))
325454
326598
  this.metrics[metric] = [];
325455
326599
  }
325456
- }, isAtomicFragment = (fragment2) => {
325457
- return fragment2.kind === "drawing" || fragment2.kind === "image";
325458
- }, blockPmRangeFromAttrs = (block) => {
325459
- const attrs = block?.attrs;
325460
- const pmStart = typeof attrs?.pmStart === "number" ? attrs.pmStart : undefined;
325461
- return {
325462
- pmStart,
325463
- pmEnd: typeof attrs?.pmEnd === "number" ? attrs.pmEnd : pmStart != null ? pmStart + 1 : undefined
325464
- };
325465
- }, getAtomicPmRange = (fragment2, block) => {
325466
- return {
325467
- pmStart: typeof fragment2.pmStart === "number" ? fragment2.pmStart : blockPmRangeFromAttrs(block).pmStart,
325468
- pmEnd: typeof fragment2.pmEnd === "number" ? fragment2.pmEnd : blockPmRangeFromAttrs(block).pmEnd
325469
- };
325470
- }, isRtlBlock = (block) => {
325471
- if (block.kind !== "paragraph")
325472
- return false;
325473
- return getParagraphInlineDirection(block.attrs) === "rtl";
325474
- }, determineColumn = (layout, fragmentX, page, fragmentY) => {
325475
- const columns = resolveColumnsForHit(layout, page, fragmentY);
325476
- if (!columns || columns.count <= 1)
325477
- return 0;
325478
- const pageWidth = page?.size?.w ?? layout.pageSize.w;
325479
- const margins = page?.margins ?? layout.pages[0]?.margins;
325480
- const marginLeft = Math.max(0, margins?.left ?? 0);
325481
- const marginRight = Math.max(0, margins?.right ?? 0);
325482
- return getColumnAtX(getColumnGeometry(normalizeColumnLayout(columns, Math.max(1, pageWidth - (marginLeft + marginRight)))), fragmentX, marginLeft);
325483
- }, determineTableColumn = (layout, fragment2, page) => {
325484
- if (typeof fragment2.columnIndex === "number") {
325485
- const count2 = resolveColumnsForHit(layout, page, fragment2.y)?.count ?? 1;
325486
- return Math.max(0, Math.min(Math.max(0, count2 - 1), fragment2.columnIndex));
325487
- }
325488
- return determineColumn(layout, fragment2.x, page, fragment2.y);
325489
- }, findLineIndexAtY = (lines, offsetY, fromLine, toLine) => {
325490
- if (!lines || lines.length === 0)
325491
- return null;
325492
- const lineCount = lines.length;
325493
- if (fromLine < 0 || toLine > lineCount || fromLine >= toLine)
325494
- return null;
325495
- let cursor = 0;
325496
- for (let i4 = fromLine;i4 < toLine; i4 += 1) {
325497
- const line = lines[i4];
325498
- if (!line)
325499
- return null;
325500
- const next2 = cursor + line.lineHeight;
325501
- if (offsetY >= cursor && offsetY < next2)
325502
- return i4;
325503
- cursor = next2;
325504
- }
325505
- return toLine - 1;
325506
- }, mapPointToPm = (block, line, x, isRTL, availableWidthOverride, alignmentOverride) => {
325507
- if (block.kind !== "paragraph")
325508
- return null;
325509
- const range = computeLinePmRange(block, line);
325510
- if (range.pmStart == null || range.pmEnd == null)
325511
- return null;
325512
- const result = findCharacterAtX(block, line, x, range.pmStart, availableWidthOverride, alignmentOverride);
325513
- let pmPosition = result.pmPosition;
325514
- if (isRTL) {
325515
- const charOffset = result.charOffset;
325516
- const charsInLine = Math.max(1, line.toChar - line.fromChar);
325517
- pmPosition = charOffsetToPm(block, line, Math.max(0, Math.min(charsInLine, charsInLine - charOffset)), range.pmStart);
325518
- }
325519
- return pmPosition;
325520
- }, calculatePageTopFallback = (layout, pageIndex) => {
325521
- const pageGap = layout.pageGap ?? 0;
325522
- let y$1 = 0;
325523
- for (let i4 = 0;i4 < pageIndex; i4++) {
325524
- const pageHeight = layout.pages[i4]?.size?.h ?? layout.pageSize.h;
325525
- y$1 += pageHeight + pageGap;
325526
- }
325527
- return y$1;
325528
- }, hitTestAtomicFragment = (pageHit, blocks2, measures, point5) => {
325529
- for (const fragment2 of pageHit.page.fragments) {
325530
- if (!isAtomicFragment(fragment2))
325531
- continue;
325532
- const withinX = point5.x >= fragment2.x && point5.x <= fragment2.x + fragment2.width;
325533
- const withinY = point5.y >= fragment2.y && point5.y <= fragment2.y + fragment2.height;
325534
- if (!withinX || !withinY)
325535
- continue;
325536
- const blockIndex = findBlockIndexByFragmentId(blocks2, fragment2.blockId);
325537
- if (blockIndex === -1)
325538
- continue;
325539
- const block = blocks2[blockIndex];
325540
- const measure = measures[blockIndex];
325541
- if (!block || !measure)
325542
- continue;
325543
- return {
325544
- fragment: fragment2,
325545
- block,
325546
- measure,
325547
- pageIndex: pageHit.pageIndex,
325548
- pageY: 0
325549
- };
325550
- }
325551
- return null;
325552
- }, hitTestTableFragment = (pageHit, blocks2, measures, point5) => {
325553
- for (const fragment2 of pageHit.page.fragments) {
325554
- if (fragment2.kind !== "table")
325555
- continue;
325556
- const tableFragment = fragment2;
325557
- const withinX = point5.x >= tableFragment.x && point5.x <= tableFragment.x + tableFragment.width;
325558
- const withinY = point5.y >= tableFragment.y && point5.y <= tableFragment.y + tableFragment.height;
325559
- if (!withinX || !withinY)
325560
- continue;
325561
- const blockIndex = blocks2.findIndex((block$1) => block$1.id === tableFragment.blockId);
325562
- if (blockIndex === -1)
325563
- continue;
325564
- const block = blocks2[blockIndex];
325565
- const measure = measures[blockIndex];
325566
- if (!block || block.kind !== "table" || !measure || measure.kind !== "table")
325567
- continue;
325568
- const tableBlock = block;
325569
- const tableMeasure = measure;
325570
- const localX = point5.x - tableFragment.x;
325571
- const localY = point5.y - tableFragment.y;
325572
- let rowY = 0;
325573
- let rowIndex = -1;
325574
- if (tableMeasure.rows.length === 0 || tableBlock.rows.length === 0)
325575
- continue;
325576
- for (let r$1 = tableFragment.fromRow;r$1 < tableFragment.toRow && r$1 < tableMeasure.rows.length; r$1++) {
325577
- const rowMeasure$1 = tableMeasure.rows[r$1];
325578
- if (localY >= rowY && localY < rowY + rowMeasure$1.height) {
325579
- rowIndex = r$1;
325580
- break;
325581
- }
325582
- rowY += rowMeasure$1.height;
325583
- }
325584
- if (rowIndex === -1) {
325585
- rowIndex = Math.min(tableFragment.toRow - 1, tableMeasure.rows.length - 1);
325586
- if (rowIndex < tableFragment.fromRow)
325587
- continue;
325588
- }
325589
- const rowMeasure = tableMeasure.rows[rowIndex];
325590
- const row2 = tableBlock.rows[rowIndex];
325591
- if (!rowMeasure || !row2)
325592
- continue;
325593
- const firstCellGridStart = rowMeasure.cells[0]?.gridColumnStart ?? 0;
325594
- let colX = 0;
325595
- if (firstCellGridStart > 0 && tableMeasure.columnWidths)
325596
- for (let col = 0;col < firstCellGridStart && col < tableMeasure.columnWidths.length; col++)
325597
- colX += tableMeasure.columnWidths[col];
325598
- const initialColX = colX;
325599
- let colIndex = -1;
325600
- if (rowMeasure.cells.length === 0 || row2.cells.length === 0)
325601
- continue;
325602
- for (let c = 0;c < rowMeasure.cells.length; c++) {
325603
- const cellMeasure$1 = rowMeasure.cells[c];
325604
- if (localX >= colX && localX < colX + cellMeasure$1.width) {
325605
- colIndex = c;
325606
- break;
325607
- }
325608
- colX += cellMeasure$1.width;
325609
- }
325610
- if (colIndex === -1) {
325611
- if (localX < initialColX)
325612
- colIndex = 0;
325613
- else
325614
- colIndex = rowMeasure.cells.length - 1;
325615
- if (colIndex < 0)
325616
- continue;
325617
- }
325618
- const cellMeasure = rowMeasure.cells[colIndex];
325619
- const cell2 = row2.cells[colIndex];
325620
- if (!cellMeasure || !cell2)
325621
- continue;
325622
- const cellBlocks = cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
325623
- const rawMeasures = cellMeasure.blocks ?? (cellMeasure.paragraph ? [cellMeasure.paragraph] : []);
325624
- const cellBlockMeasures = (Array.isArray(rawMeasures) ? rawMeasures : []).filter((m$1) => m$1 != null && typeof m$1 === "object" && ("kind" in m$1));
325625
- let blockStartY = 0;
325626
- let blockStartGlobalLines = 0;
325627
- const getBlockHeight = (m$1) => {
325628
- if (!m$1)
325629
- return 0;
325630
- if ("totalHeight" in m$1 && typeof m$1.totalHeight === "number")
325631
- return m$1.totalHeight;
325632
- if ("height" in m$1 && typeof m$1.height === "number")
325633
- return m$1.height;
325634
- return 0;
325635
- };
325636
- let nearestParagraphHit = null;
325637
- for (let i4 = 0;i4 < cellBlocks.length && i4 < cellBlockMeasures.length; i4++) {
325638
- const cellBlock = cellBlocks[i4];
325639
- const cellBlockMeasure = cellBlockMeasures[i4];
325640
- if (cellBlock?.kind !== "paragraph" || cellBlockMeasure?.kind !== "paragraph") {
325641
- blockStartY += getBlockHeight(cellBlockMeasure);
325642
- continue;
325643
- }
325644
- const blockHeight = getBlockHeight(cellBlockMeasure);
325645
- const blockEndY = blockStartY + blockHeight;
325646
- const padding = cell2.attrs?.padding ?? {
325647
- top: 0,
325648
- left: 4,
325649
- right: 4,
325650
- bottom: 0
325651
- };
325652
- const cellLocalX = localX - colX - (padding.left ?? 4);
325653
- const cellLocalY = localY - rowY - (padding.top ?? 0);
325654
- const paragraphBlock = cellBlock;
325655
- const paragraphMeasure = cellBlockMeasure;
325656
- if (cellLocalY >= blockStartY && cellLocalY < blockEndY) {
325657
- const unclampedLocalY = cellLocalY - blockStartY;
325658
- const localYWithinBlock = Math.max(0, Math.min(unclampedLocalY, Math.max(blockHeight, 0)));
325659
- return {
325660
- fragment: tableFragment,
325661
- block: tableBlock,
325662
- measure: tableMeasure,
325663
- pageIndex: pageHit.pageIndex,
325664
- cellRowIndex: rowIndex,
325665
- cellColIndex: colIndex,
325666
- cellBlock: paragraphBlock,
325667
- cellMeasure: paragraphMeasure,
325668
- localX: Math.max(0, cellLocalX),
325669
- localY: Math.max(0, localYWithinBlock),
325670
- blockStartGlobal: blockStartGlobalLines
325671
- };
325672
- }
325673
- const distanceToBlock = cellLocalY < blockStartY ? blockStartY - cellLocalY : Math.max(0, cellLocalY - blockEndY);
325674
- if (!nearestParagraphHit || distanceToBlock < nearestParagraphHit.distance) {
325675
- const unclampedLocalY = cellLocalY - blockStartY;
325676
- nearestParagraphHit = {
325677
- cellBlock: paragraphBlock,
325678
- cellMeasure: paragraphMeasure,
325679
- localX: Math.max(0, cellLocalX),
325680
- localY: Math.max(0, Math.min(unclampedLocalY, Math.max(blockHeight, 0))),
325681
- blockStartGlobal: blockStartGlobalLines,
325682
- distance: distanceToBlock
325683
- };
325684
- }
325685
- blockStartY = blockEndY;
325686
- blockStartGlobalLines += paragraphMeasure.lines.length;
325687
- }
325688
- if (nearestParagraphHit)
325689
- return {
325690
- fragment: tableFragment,
325691
- block: tableBlock,
325692
- measure: tableMeasure,
325693
- pageIndex: pageHit.pageIndex,
325694
- cellRowIndex: rowIndex,
325695
- cellColIndex: colIndex,
325696
- cellBlock: nearestParagraphHit.cellBlock,
325697
- cellMeasure: nearestParagraphHit.cellMeasure,
325698
- localX: nearestParagraphHit.localX,
325699
- localY: nearestParagraphHit.localY,
325700
- blockStartGlobal: nearestParagraphHit.blockStartGlobal
325701
- };
325702
- }
325703
- return null;
325704
326600
  }, logSelectionMapDebug = (payload) => {}, rangesOverlap2 = (startA, endA, startB, endB) => {
325705
326601
  if (startA == null)
325706
326602
  return false;
@@ -327618,10 +328514,15 @@ menclose::after {
327618
328514
  this.#focusEditorAtFirstPosition();
327619
328515
  }
327620
328516
  #handleClickInHeaderFooterMode(event, x, y$1, pageIndex, pageLocalY) {
327621
- const activeSurfaceSelector = this.#deps?.getHeaderFooterSession()?.session?.mode === "footer" ? ".superdoc-page-footer" : ".superdoc-page-header";
328517
+ const session = this.#deps?.getHeaderFooterSession();
328518
+ const activeSurfaceSelector = session?.session?.mode === "footer" ? ".superdoc-page-footer" : ".superdoc-page-header";
327622
328519
  const visiblePointerSurface = resolveVisibleSurfaceAtPointer(event.target, event.clientX, event.clientY);
327623
328520
  const clickedInsideVisibleActiveSurface = visiblePointerSurface?.kind === "headerFooter" && visiblePointerSurface.surface.closest(activeSurfaceSelector) != null;
327624
328521
  if (visiblePointerSurface?.kind === "bodyContent") {
328522
+ const behindDocSection = (event.target instanceof Element ? event.target.closest("[data-behind-doc-section]") : null)?.dataset.behindDocSection;
328523
+ const sessionMode = session?.session?.mode;
328524
+ if (behindDocSection && behindDocSection === sessionMode)
328525
+ return false;
327625
328526
  this.#callbacks.exitHeaderFooterMode?.();
327626
328527
  return false;
327627
328528
  }
@@ -327717,6 +328618,8 @@ menclose::after {
327717
328618
  return false;
327718
328619
  if (fragmentHit.fragment.kind !== "image" && fragmentHit.fragment.kind !== "drawing")
327719
328620
  return false;
328621
+ if (fragmentHit.fragment.kind === "drawing" && fragmentHit.fragment.drawingKind === "textboxShape")
328622
+ return false;
327720
328623
  const editor = this.#deps?.getEditor();
327721
328624
  try {
327722
328625
  const tr = editor.state.tr.setSelection(NodeSelection.create(doc$12, hit.pos));
@@ -330570,7 +331473,8 @@ menclose::after {
330570
331473
  const surfaceElement = pageElement.querySelector(surfaceSelector);
330571
331474
  if (!surfaceElement)
330572
331475
  return null;
330573
- const entry = findSurfaceEntryAtPos(buildSurfacePmEntries(surfaceElement), pos);
331476
+ const behindDocFragments = Array.from(pageElement.querySelectorAll(`[data-behind-doc-section="${this.#session.mode}"]`));
331477
+ const entry = findSurfaceEntryAtPos([...buildSurfacePmEntries(surfaceElement), ...behindDocFragments.flatMap((frag) => buildSurfacePmEntries(frag))].sort((a2, b$1) => a2.pmStart - b$1.pmStart || a2.pmEnd - b$1.pmEnd), pos);
330574
331478
  if (!entry)
330575
331479
  return null;
330576
331480
  const pageRect = pageElement.getBoundingClientRect();
@@ -331734,13 +332638,13 @@ menclose::after {
331734
332638
  return;
331735
332639
  console.log(...args$1);
331736
332640
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
331737
- var init_src_BnMjPHBh_es = __esm(() => {
332641
+ var init_src_C8MNSOR0_es = __esm(() => {
331738
332642
  init_rolldown_runtime_Bg48TavK_es();
331739
- init_SuperConverter_DBlOjc68_es();
332643
+ init_SuperConverter_kDrJISzz_es();
331740
332644
  init_jszip_C49i9kUs_es();
331741
332645
  init_xml_js_CqGKpaft_es();
331742
332646
  init_uuid_B2wVPhPi_es();
331743
- init_create_headless_toolbar_DWyoHv_L_es();
332647
+ init_create_headless_toolbar_D1v6sX42_es();
331744
332648
  init_constants_D9qj59G2_es();
331745
332649
  init_dist_B8HfvhaK_es();
331746
332650
  init_unified_Dsuw2be5_es();
@@ -338991,7 +339895,89 @@ ${err.toString()}`);
338991
339895
  return { style: attrs.style };
338992
339896
  } },
338993
339897
  wrapAttributes: { rendered: false },
338994
- attributes: { rendered: false }
339898
+ anchorData: { rendered: false },
339899
+ marginOffset: { rendered: false },
339900
+ attributes: { rendered: false },
339901
+ kind: {
339902
+ default: null,
339903
+ rendered: false
339904
+ },
339905
+ width: {
339906
+ default: null,
339907
+ renderDOM: (attrs) => {
339908
+ if (attrs.width == null)
339909
+ return {};
339910
+ return { "data-width": attrs.width };
339911
+ }
339912
+ },
339913
+ height: {
339914
+ default: null,
339915
+ renderDOM: (attrs) => {
339916
+ if (attrs.height == null)
339917
+ return {};
339918
+ return { "data-height": attrs.height };
339919
+ }
339920
+ },
339921
+ fillColor: {
339922
+ default: null,
339923
+ rendered: false
339924
+ },
339925
+ strokeColor: {
339926
+ default: null,
339927
+ rendered: false
339928
+ },
339929
+ strokeWidth: {
339930
+ default: null,
339931
+ rendered: false
339932
+ },
339933
+ rotation: {
339934
+ default: 0,
339935
+ rendered: false
339936
+ },
339937
+ flipH: {
339938
+ default: false,
339939
+ rendered: false
339940
+ },
339941
+ flipV: {
339942
+ default: false,
339943
+ rendered: false
339944
+ },
339945
+ wrap: {
339946
+ default: null,
339947
+ rendered: false
339948
+ },
339949
+ isAnchor: {
339950
+ default: false,
339951
+ rendered: false
339952
+ },
339953
+ drawingContent: {
339954
+ default: null,
339955
+ rendered: false
339956
+ },
339957
+ originalAttributes: {
339958
+ default: null,
339959
+ rendered: false
339960
+ },
339961
+ effectExtent: {
339962
+ default: null,
339963
+ rendered: false
339964
+ },
339965
+ lineEnds: {
339966
+ default: null,
339967
+ rendered: false
339968
+ },
339969
+ hidden: {
339970
+ default: false,
339971
+ rendered: false
339972
+ },
339973
+ isTextBox: {
339974
+ default: false,
339975
+ rendered: false
339976
+ },
339977
+ isWordArt: {
339978
+ default: false,
339979
+ rendered: false
339980
+ }
338995
339981
  };
338996
339982
  },
338997
339983
  parseDOM() {
@@ -339026,7 +340012,15 @@ ${err.toString()}`);
339026
340012
  return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
339027
340013
  }
339028
340014
  },
339029
- attributes: { rendered: false }
340015
+ attributes: { rendered: false },
340016
+ textInsets: {
340017
+ default: null,
340018
+ rendered: false
340019
+ },
340020
+ textVerticalAlign: {
340021
+ default: null,
340022
+ rendered: false
340023
+ }
339030
340024
  };
339031
340025
  },
339032
340026
  parseDOM() {
@@ -362433,14 +363427,21 @@ function print() { __p += __j.call(arguments, '') }
362433
363427
  return null;
362434
363428
  const localX = normalized.x - context.region.localX;
362435
363429
  const localY = (normalized.pageLocalY ?? normalized.y - context.region.pageIndex * (bodyPageHeight + pageGap)) - context.region.localY;
363430
+ const domHit = this.#resolveHeaderFooterDomHit(context, clientX, clientY);
363431
+ if (domHit) {
363432
+ const doc$3 = this.getActiveEditor().state?.doc;
363433
+ return {
363434
+ ...domHit,
363435
+ pos: doc$3 ? Math.max(0, Math.min(domHit.pos, doc$3.content.size)) : domHit.pos
363436
+ };
363437
+ }
362436
363438
  if (localX < 0 || localY < 0 || localX > context.region.width || localY > context.region.height)
362437
363439
  return null;
362438
363440
  const headerPoint = {
362439
363441
  x: localX,
362440
363442
  y: localY
362441
363443
  };
362442
- const geometryHit = clickToPositionGeometry(context.layout, context.blocks, context.measures, headerPoint) ?? null;
362443
- const hit = this.#resolveHeaderFooterDomHit(context, clientX, clientY) ?? geometryHit;
363444
+ const hit = clickToPositionGeometry(context.layout, context.blocks, context.measures, headerPoint) ?? null;
362444
363445
  if (!hit)
362445
363446
  return null;
362446
363447
  const doc$2 = this.getActiveEditor().state?.doc;
@@ -367411,11 +368412,11 @@ function print() { __p += __j.call(arguments, '') }
367411
368412
  ]);
367412
368413
  });
367413
368414
 
367414
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-Bw8pGh5l.es.js
368415
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-G-_4_UF5.es.js
367415
368416
  var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS, FONT_SIZE_OPTIONS;
367416
- var init_create_super_doc_ui_Bw8pGh5l_es = __esm(() => {
367417
- init_SuperConverter_DBlOjc68_es();
367418
- init_create_headless_toolbar_DWyoHv_L_es();
368417
+ var init_create_super_doc_ui_G__4_UF5_es = __esm(() => {
368418
+ init_SuperConverter_kDrJISzz_es();
368419
+ init_create_headless_toolbar_D1v6sX42_es();
367419
368420
  DEFAULT_TEXT_ALIGN_OPTIONS = [
367420
368421
  {
367421
368422
  label: "Left",
@@ -367706,16 +368707,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
367706
368707
 
367707
368708
  // ../../packages/superdoc/dist/super-editor.es.js
367708
368709
  var init_super_editor_es = __esm(() => {
367709
- init_src_BnMjPHBh_es();
367710
- init_SuperConverter_DBlOjc68_es();
368710
+ init_src_C8MNSOR0_es();
368711
+ init_SuperConverter_kDrJISzz_es();
367711
368712
  init_jszip_C49i9kUs_es();
367712
368713
  init_xml_js_CqGKpaft_es();
367713
- init_create_headless_toolbar_DWyoHv_L_es();
368714
+ init_create_headless_toolbar_D1v6sX42_es();
367714
368715
  init_constants_D9qj59G2_es();
367715
368716
  init_dist_B8HfvhaK_es();
367716
368717
  init_unified_Dsuw2be5_es();
367717
368718
  init_DocxZipper_FUsfThjV_es();
367718
- init_create_super_doc_ui_Bw8pGh5l_es();
368719
+ init_create_super_doc_ui_G__4_UF5_es();
367719
368720
  init_ui_C5PAS9hY_es();
367720
368721
  init_eventemitter3_BnGqBE_Q_es();
367721
368722
  init_errors_CNaD6vcg_es();