@superdoc-dev/cli 0.7.0-next.21 → 0.7.0-next.23

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 +557 -159
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -65501,7 +65501,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65501
65501
  emptyOptions2 = {};
65502
65502
  });
65503
65503
 
65504
- // ../../packages/superdoc/dist/chunks/SuperConverter-BgwP1GeS.es.js
65504
+ // ../../packages/superdoc/dist/chunks/SuperConverter-B4pTwmbr.es.js
65505
65505
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65506
65506
  const fieldValue = extension$1.config[field];
65507
65507
  if (typeof fieldValue === "function")
@@ -78803,12 +78803,15 @@ function getVectorShape({ params: params3, node: node3, graphicData, size: size2
78803
78803
  const effectExtent = extractEffectExtent(node3);
78804
78804
  const textBoxContent = wsp.elements?.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
78805
78805
  const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
78806
+ const nonVisualShapeProps = wsp.elements?.find((el) => el.name === "wps:cNvSpPr");
78806
78807
  let textContent = null;
78807
78808
  let textAlign = "left";
78808
78809
  if (textBoxContent) {
78809
78810
  textContent = extractTextFromTextBox(textBoxContent, bodyPr, params3);
78810
78811
  textAlign = textContent?.horizontalAlign || "left";
78811
78812
  }
78813
+ const isWordArt = bodyPr?.attributes?.["fromWordArt"] === "1";
78814
+ const isTextBox = nonVisualShapeProps?.attributes?.["txBox"] === "1";
78812
78815
  return {
78813
78816
  type: "vectorShape",
78814
78817
  attrs: {
@@ -78831,6 +78834,8 @@ function getVectorShape({ params: params3, node: node3, graphicData, size: size2
78831
78834
  textAlign,
78832
78835
  textVerticalAlign: textContent?.verticalAlign,
78833
78836
  textInsets: textContent?.insets,
78837
+ isWordArt,
78838
+ isTextBox,
78834
78839
  originalAttributes: node3?.attributes
78835
78840
  }
78836
78841
  };
@@ -93267,9 +93272,9 @@ function importCommentData({ docx, editor, converter }) {
93267
93272
  comments: allComments.map((el) => {
93268
93273
  const { attributes } = el;
93269
93274
  const importedId = attributes["w:id"];
93270
- const authorName = attributes["w:author"];
93271
- const authorEmail = attributes["w:email"];
93272
- const initials = attributes["w:initials"];
93275
+ const authorName = readCommentAttribute(attributes, "w:author", "custom:author");
93276
+ const authorEmail = readCommentAttribute(attributes, "w:email", "custom:email");
93277
+ const initials = readCommentAttribute(attributes, "w:initials", "custom:initials");
93273
93278
  const createdDate = attributes["w:date"];
93274
93279
  const internalId = attributes["custom:internalId"];
93275
93280
  const trackedChange = attributes["custom:trackedChange"] === "true";
@@ -95143,7 +95148,8 @@ function translatePassthroughNode(params3) {
95143
95148
  return carbonCopy(original);
95144
95149
  }
95145
95150
  function translateBodyNode(params3) {
95146
- let sectPr = params3.bodyNode?.elements?.find((n) => n.name === "w:sectPr");
95151
+ const liveSectPr = params3.converter?.bodySectPr;
95152
+ let sectPr = (liveSectPr && typeof liveSectPr === "object" ? carbonCopy(liveSectPr) : null) || params3.bodyNode?.elements?.find((n) => n.name === "w:sectPr");
95147
95153
  if (!sectPr)
95148
95154
  sectPr = {
95149
95155
  type: "element",
@@ -115390,7 +115396,11 @@ var isRegExp = (value) => {
115390
115396
  nodes: resultNodes,
115391
115397
  consumed: 1
115392
115398
  };
115393
- }, pictNodeHandlerEntity, generateCommentsWithExtendedData = ({ docx, comments, converter, threadingProfile }) => {
115399
+ }, pictNodeHandlerEntity, readCommentAttribute = (attributes, primaryName, fallbackName) => {
115400
+ if (!attributes)
115401
+ return;
115402
+ return attributes[primaryName] ?? attributes[fallbackName];
115403
+ }, generateCommentsWithExtendedData = ({ docx, comments, converter, threadingProfile }) => {
115394
115404
  if (!comments?.length)
115395
115405
  return [];
115396
115406
  const rangeData = extractCommentRangesFromDocument(docx, converter);
@@ -116797,13 +116807,13 @@ var isRegExp = (value) => {
116797
116807
  additions.push(rel);
116798
116808
  });
116799
116809
  return additions.length ? [...existingRelationships, ...additions] : existingRelationships;
116800
- }, RELS_XMLNS$1 = "http://schemas.openxmlformats.org/package/2006/relationships", FOOTNOTES_RELS_PATH = "word/_rels/footnotes.xml.rels", paragraphHasFootnoteRef = (node3) => {
116810
+ }, RELS_XMLNS$1 = "http://schemas.openxmlformats.org/package/2006/relationships", FOOTNOTES_RELS_PATH = "word/_rels/footnotes.xml.rels", ENDNOTES_RELS_PATH = "word/_rels/endnotes.xml.rels", FOOTNOTES_CONFIG$1, ENDNOTES_CONFIG$1, paragraphHasFootnoteRef = (node3) => {
116801
116811
  if (!node3)
116802
116812
  return false;
116803
- if (node3.name === "w:footnoteRef")
116813
+ if (node3.name === "w:footnoteRef" || node3.name === "w:endnoteRef")
116804
116814
  return true;
116805
116815
  return (Array.isArray(node3.elements) ? node3.elements : []).some((child) => paragraphHasFootnoteRef(child));
116806
- }, insertFootnoteRefIntoParagraph = (paragraph2) => {
116816
+ }, insertFootnoteRefIntoParagraph = (paragraph2, config$40) => {
116807
116817
  if (!paragraph2 || paragraph2.name !== "w:p")
116808
116818
  return;
116809
116819
  if (!Array.isArray(paragraph2.elements))
@@ -116812,7 +116822,7 @@ var isRegExp = (value) => {
116812
116822
  return;
116813
116823
  const footnoteRef = {
116814
116824
  type: "element",
116815
- name: "w:footnoteRef",
116825
+ name: config$40.refName,
116816
116826
  elements: []
116817
116827
  };
116818
116828
  const footnoteRefRun = {
@@ -116824,7 +116834,7 @@ var isRegExp = (value) => {
116824
116834
  elements: [{
116825
116835
  type: "element",
116826
116836
  name: "w:rStyle",
116827
- attributes: { "w:val": "FootnoteReference" }
116837
+ attributes: { "w:val": config$40.refStyle }
116828
116838
  }, {
116829
116839
  type: "element",
116830
116840
  name: "w:vertAlign",
@@ -116835,12 +116845,12 @@ var isRegExp = (value) => {
116835
116845
  const pPrIndex = paragraph2.elements.findIndex((el) => el?.name === "w:pPr");
116836
116846
  const insertAt = pPrIndex >= 0 ? pPrIndex + 1 : 0;
116837
116847
  paragraph2.elements.splice(insertAt, 0, footnoteRefRun);
116838
- }, ensureFootnoteRefMarker = (elements) => {
116848
+ }, ensureFootnoteRefMarker = (elements, config$40) => {
116839
116849
  if (!Array.isArray(elements))
116840
116850
  return;
116841
116851
  const firstParagraphIndex = elements.findIndex((el) => el?.name === "w:p");
116842
116852
  if (firstParagraphIndex >= 0) {
116843
- insertFootnoteRefIntoParagraph(elements[firstParagraphIndex]);
116853
+ insertFootnoteRefIntoParagraph(elements[firstParagraphIndex], config$40);
116844
116854
  return;
116845
116855
  }
116846
116856
  const paragraph2 = {
@@ -116848,7 +116858,7 @@ var isRegExp = (value) => {
116848
116858
  name: "w:p",
116849
116859
  elements: []
116850
116860
  };
116851
- insertFootnoteRefIntoParagraph(paragraph2);
116861
+ insertFootnoteRefIntoParagraph(paragraph2, config$40);
116852
116862
  elements.unshift(paragraph2);
116853
116863
  }, translateFootnoteContent = (content$2, exportContext) => {
116854
116864
  if (!Array.isArray(content$2) || content$2.length === 0)
@@ -116869,7 +116879,7 @@ var isRegExp = (value) => {
116869
116879
  translated.push(result);
116870
116880
  });
116871
116881
  return translated;
116872
- }, createFootnoteElement = (footnote, exportContext) => {
116882
+ }, createFootnoteElement = (footnote, exportContext, config$40 = FOOTNOTES_CONFIG$1) => {
116873
116883
  if (!footnote)
116874
116884
  return null;
116875
116885
  const { id: id2, content: content$2, type, originalXml } = footnote;
@@ -116880,10 +116890,10 @@ var isRegExp = (value) => {
116880
116890
  attributes["w:type"] = type;
116881
116891
  const translatedContent = translateFootnoteContent(content$2, exportContext);
116882
116892
  if (originalXml ? paragraphHasFootnoteRef(originalXml) : true)
116883
- ensureFootnoteRefMarker(translatedContent);
116893
+ ensureFootnoteRefMarker(translatedContent, config$40);
116884
116894
  const base$1 = originalXml ? carbonCopy(originalXml) : {
116885
116895
  type: "element",
116886
- name: "w:footnote",
116896
+ name: config$40.noteName,
116887
116897
  attributes: {},
116888
116898
  elements: []
116889
116899
  };
@@ -116930,10 +116940,10 @@ var isRegExp = (value) => {
116930
116940
  ...convertedXml,
116931
116941
  "word/settings.xml": updatedSettings
116932
116942
  };
116933
- }, buildFootnotesRelsXml = (converter, convertedXml, relationships) => {
116943
+ }, buildFootnotesRelsXml = (converter, convertedXml, relationships, relsPath = FOOTNOTES_RELS_PATH) => {
116934
116944
  if (!relationships.length)
116935
116945
  return null;
116936
- const existingRels = convertedXml[FOOTNOTES_RELS_PATH];
116946
+ const existingRels = convertedXml[relsPath];
116937
116947
  const existingRoot = existingRels?.elements?.find((el) => el.name === "Relationships");
116938
116948
  const merged = mergeRelationshipElements(Array.isArray(existingRoot?.elements) ? existingRoot.elements : [], relationships);
116939
116949
  const declaration = existingRels?.declaration ?? converter?.initialJSON?.declaration;
@@ -116945,10 +116955,18 @@ var isRegExp = (value) => {
116945
116955
  elements: merged
116946
116956
  }]
116947
116957
  };
116948
- }, prepareFootnotesXmlForExport = ({ footnotes, editor, converter, convertedXml }) => {
116949
- let updatedXml = applyFootnotePropertiesToSettings(converter, convertedXml);
116950
- updatedXml = applyViewSettingToSettings(converter, updatedXml);
116951
- if (!footnotes || !Array.isArray(footnotes) || footnotes.length === 0)
116958
+ }, createNotesXmlDefinition = (config$40) => {
116959
+ const base$1 = carbonCopy(FOOTNOTES_XML_DEF);
116960
+ if (base$1.elements?.[0])
116961
+ base$1.elements[0].name = config$40.rootName;
116962
+ return base$1;
116963
+ }, prepareNotesXmlForExport = ({ notes, editor, converter, convertedXml, config: config$40 }) => {
116964
+ let updatedXml = convertedXml;
116965
+ if (config$40.applySettingsSideEffects) {
116966
+ updatedXml = applyFootnotePropertiesToSettings(converter, updatedXml);
116967
+ updatedXml = applyViewSettingToSettings(converter, updatedXml);
116968
+ }
116969
+ if (!notes || !Array.isArray(notes) || notes.length === 0)
116952
116970
  return {
116953
116971
  updatedXml,
116954
116972
  relationships: [],
@@ -116963,45 +116981,58 @@ var isRegExp = (value) => {
116963
116981
  relationships: footnoteRelationships,
116964
116982
  media: footnoteMedia
116965
116983
  };
116966
- const footnoteElements = footnotes.map((fn) => createFootnoteElement(fn, exportContext)).filter(Boolean);
116984
+ const footnoteElements = notes.map((fn) => createFootnoteElement(fn, exportContext, config$40)).filter(Boolean);
116967
116985
  if (footnoteElements.length === 0)
116968
116986
  return {
116969
116987
  updatedXml,
116970
116988
  relationships: [],
116971
116989
  media: footnoteMedia
116972
116990
  };
116973
- let footnotesXml = updatedXml["word/footnotes.xml"];
116991
+ let footnotesXml = updatedXml[config$40.notesPath];
116974
116992
  if (!footnotesXml)
116975
- footnotesXml = carbonCopy(FOOTNOTES_XML_DEF);
116993
+ footnotesXml = createNotesXmlDefinition(config$40);
116976
116994
  else
116977
116995
  footnotesXml = carbonCopy(footnotesXml);
116978
116996
  if (footnotesXml.elements && footnotesXml.elements[0])
116979
116997
  footnotesXml.elements[0].elements = footnoteElements;
116980
116998
  updatedXml = {
116981
116999
  ...updatedXml,
116982
- "word/footnotes.xml": footnotesXml
117000
+ [config$40.notesPath]: footnotesXml
116983
117001
  };
116984
117002
  if (footnoteRelationships.length > 0) {
116985
- const footnotesRelsXml = buildFootnotesRelsXml(converter, updatedXml, footnoteRelationships);
117003
+ const footnotesRelsXml = buildFootnotesRelsXml(converter, updatedXml, footnoteRelationships, config$40.relsPath);
116986
117004
  if (footnotesRelsXml)
116987
117005
  updatedXml = {
116988
117006
  ...updatedXml,
116989
- [FOOTNOTES_RELS_PATH]: footnotesRelsXml
117007
+ [config$40.relsPath]: footnotesRelsXml
116990
117008
  };
116991
117009
  }
117010
+ const relationships = [{
117011
+ type: "element",
117012
+ name: "Relationship",
117013
+ attributes: {
117014
+ Type: config$40.relationshipType,
117015
+ Target: config$40.relationshipTarget
117016
+ }
117017
+ }];
116992
117018
  return {
116993
117019
  updatedXml,
116994
- relationships: [{
116995
- type: "element",
116996
- name: "Relationship",
116997
- attributes: {
116998
- Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",
116999
- Target: "footnotes.xml"
117000
- }
117001
- }],
117020
+ relationships,
117002
117021
  media: footnoteMedia
117003
117022
  };
117004
- }, APP_XML_PATH = "docProps/app.xml", EP_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", BODY_STORY_KEY = "body", DEFAULT_CAPACITY = 10, StoryRuntimeCache = class {
117023
+ }, prepareFootnotesXmlForExport = ({ footnotes, editor, converter, convertedXml }) => prepareNotesXmlForExport({
117024
+ notes: footnotes,
117025
+ editor,
117026
+ converter,
117027
+ convertedXml,
117028
+ config: FOOTNOTES_CONFIG$1
117029
+ }), prepareEndnotesXmlForExport = ({ endnotes, editor, converter, convertedXml }) => prepareNotesXmlForExport({
117030
+ notes: endnotes,
117031
+ editor,
117032
+ converter,
117033
+ convertedXml,
117034
+ config: ENDNOTES_CONFIG$1
117035
+ }), APP_XML_PATH = "docProps/app.xml", EP_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", BODY_STORY_KEY = "body", DEFAULT_CAPACITY = 10, StoryRuntimeCache = class {
117005
117036
  constructor(capacity = DEFAULT_CAPACITY) {
117006
117037
  this.map = /* @__PURE__ */ new Map;
117007
117038
  this.capacity = Math.max(1, capacity);
@@ -117219,7 +117250,7 @@ var isRegExp = (value) => {
117219
117250
  state.kern = kernNode.attributes["w:val"];
117220
117251
  }
117221
117252
  }, SuperConverter;
117222
- var init_SuperConverter_BgwP1GeS_es = __esm(() => {
117253
+ var init_SuperConverter_B4pTwmbr_es = __esm(() => {
117223
117254
  init_rolldown_runtime_Bg48TavK_es();
117224
117255
  init_jszip_C49i9kUs_es();
117225
117256
  init_xml_js_CqGKpaft_es();
@@ -153190,6 +153221,28 @@ var init_SuperConverter_BgwP1GeS_es = __esm(() => {
153190
153221
  });
153191
153222
  ALL_COMMENT_TARGETS = COMMENT_FILE_BASENAMES;
153192
153223
  REL_ID_NUMERIC_PATTERN = /rId|mi/g;
153224
+ FOOTNOTES_CONFIG$1 = {
153225
+ notesPath: "word/footnotes.xml",
153226
+ relsPath: FOOTNOTES_RELS_PATH,
153227
+ rootName: "w:footnotes",
153228
+ noteName: "w:footnote",
153229
+ refName: "w:footnoteRef",
153230
+ refStyle: "FootnoteReference",
153231
+ relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",
153232
+ relationshipTarget: "footnotes.xml",
153233
+ applySettingsSideEffects: true
153234
+ };
153235
+ ENDNOTES_CONFIG$1 = {
153236
+ notesPath: "word/endnotes.xml",
153237
+ relsPath: ENDNOTES_RELS_PATH,
153238
+ rootName: "w:endnotes",
153239
+ noteName: "w:endnote",
153240
+ refName: "w:endnoteRef",
153241
+ refStyle: "EndnoteReference",
153242
+ relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",
153243
+ relationshipTarget: "endnotes.xml",
153244
+ applySettingsSideEffects: false
153245
+ };
153193
153246
  DocumentApiAdapterError = class DocumentApiAdapterError2 extends Error {
153194
153247
  constructor(code$1, message, details) {
153195
153248
  super(message);
@@ -154138,10 +154191,21 @@ var init_SuperConverter_BgwP1GeS_es = __esm(() => {
154138
154191
  ...this.convertedXml,
154139
154192
  ...footnotesUpdatedXml
154140
154193
  };
154194
+ const { updatedXml: endnotesUpdatedXml, relationships: endnotesRels, media: endnotesMedia } = prepareEndnotesXmlForExport({
154195
+ endnotes: this.endnotes,
154196
+ editor,
154197
+ converter: this,
154198
+ convertedXml: this.convertedXml
154199
+ });
154200
+ this.convertedXml = {
154201
+ ...this.convertedXml,
154202
+ ...endnotesUpdatedXml
154203
+ };
154141
154204
  await this.#exportProcessMediaFiles({
154142
154205
  ...documentMedia,
154143
154206
  ...params3.media,
154144
154207
  ...footnotesMedia,
154208
+ ...endnotesMedia,
154145
154209
  ...this.media
154146
154210
  }, editor);
154147
154211
  const { documentXml, relationships: commentsRels, removedTargets } = this.#prepareCommentsXmlFilesForExport({
@@ -154165,6 +154229,7 @@ var init_SuperConverter_BgwP1GeS_es = __esm(() => {
154165
154229
  ...params3.relationships,
154166
154230
  ...commentsRels,
154167
154231
  ...footnotesRels,
154232
+ ...endnotesRels,
154168
154233
  ...headFootRels
154169
154234
  ]);
154170
154235
  if (removedTargets?.length)
@@ -154465,7 +154530,7 @@ var init_SuperConverter_BgwP1GeS_es = __esm(() => {
154465
154530
  };
154466
154531
  });
154467
154532
 
154468
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-Dcw4Hyt2.es.js
154533
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-C636gY8A.es.js
154469
154534
  function parseSizeUnit(val = "0") {
154470
154535
  const length3 = val.toString() || "0";
154471
154536
  const value = Number.parseFloat(length3);
@@ -157057,8 +157122,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
157057
157122
  }
157058
157123
  };
157059
157124
  };
157060
- var init_create_headless_toolbar_Dcw4Hyt2_es = __esm(() => {
157061
- init_SuperConverter_BgwP1GeS_es();
157125
+ var init_create_headless_toolbar_C636gY8A_es = __esm(() => {
157126
+ init_SuperConverter_B4pTwmbr_es();
157062
157127
  init_constants_CGhJRd87_es();
157063
157128
  init_dist_B8HfvhaK_es();
157064
157129
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -158505,7 +158570,7 @@ var init_decrypt_docx_Bs1PbPQR_es = __esm(() => {
158505
158570
  ]);
158506
158571
  });
158507
158572
 
158508
- // ../../packages/superdoc/dist/chunks/DocxZipper-CaIWmehq.es.js
158573
+ // ../../packages/superdoc/dist/chunks/DocxZipper-BBjEXAFw.es.js
158509
158574
  function sniffEncoding(u8) {
158510
158575
  if (u8.length >= 2) {
158511
158576
  const b0 = u8[0], b1 = u8[1];
@@ -158950,11 +159015,17 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
158950
159015
  typesString += commentsExtendedDef;
158951
159016
  }
158952
159017
  const hasFootnotes = types3.elements?.some((el) => el.name === "Override" && el.attributes.PartName === "/word/footnotes.xml");
159018
+ const hasEndnotes = types3.elements?.some((el) => el.name === "Override" && el.attributes.PartName === "/word/endnotes.xml");
158953
159019
  if (hasFile("word/footnotes.xml")) {
158954
159020
  const footnotesDef = `<Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" />`;
158955
159021
  if (!hasFootnotes)
158956
159022
  typesString += footnotesDef;
158957
159023
  }
159024
+ if (hasFile("word/endnotes.xml")) {
159025
+ const endnotesDef = `<Override PartName="/word/endnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" />`;
159026
+ if (!hasEndnotes)
159027
+ typesString += endnotesDef;
159028
+ }
158958
159029
  for (const entry of MANAGED_DOCUMENT_PARTS)
158959
159030
  if (hasFile(entry.zipPath) && !hasPartOverride(`/${entry.zipPath}`))
158960
159031
  typesString += `<Override PartName="/${entry.zipPath}" ContentType="${entry.contentType}" />`;
@@ -159150,7 +159221,7 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
159150
159221
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
159151
159222
  }
159152
159223
  }, DocxZipper_default;
159153
- var init_DocxZipper_CaIWmehq_es = __esm(() => {
159224
+ var init_DocxZipper_BBjEXAFw_es = __esm(() => {
159154
159225
  init_rolldown_runtime_Bg48TavK_es();
159155
159226
  init_jszip_C49i9kUs_es();
159156
159227
  init_xml_js_CqGKpaft_es();
@@ -205496,7 +205567,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
205496
205567
  init_remark_gfm_BhnWr3yf_es();
205497
205568
  });
205498
205569
 
205499
- // ../../packages/superdoc/dist/chunks/src-DlMaB1h-.es.js
205570
+ // ../../packages/superdoc/dist/chunks/src-BvQy1mGL.es.js
205500
205571
  function deleteProps(obj, propOrProps) {
205501
205572
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
205502
205573
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -245254,7 +245325,7 @@ function renderBars(doc$12, svg2, series, layout) {
245254
245325
  const barHeight = Math.abs(value / valueRange) * plotHeight;
245255
245326
  const x = CHART_PADDING.left + ci * groupWidth + barGap + si * barWidth;
245256
245327
  const y$1 = value >= 0 ? baselineY - barHeight : baselineY;
245257
- const rect = doc$12.createElementNS(SVG_NS, "rect");
245328
+ const rect = doc$12.createElementNS(SVG_NS$1, "rect");
245258
245329
  rect.setAttribute("x", String(x));
245259
245330
  rect.setAttribute("y", String(y$1));
245260
245331
  rect.setAttribute("width", String(barWidth));
@@ -245266,7 +245337,7 @@ function renderBars(doc$12, svg2, series, layout) {
245266
245337
  }
245267
245338
  function renderAxes(doc$12, svg2, layout) {
245268
245339
  const { plotWidth, plotHeight, baselineY } = layout;
245269
- const vAxis = doc$12.createElementNS(SVG_NS, "line");
245340
+ const vAxis = doc$12.createElementNS(SVG_NS$1, "line");
245270
245341
  vAxis.setAttribute("x1", String(CHART_PADDING.left));
245271
245342
  vAxis.setAttribute("y1", String(CHART_PADDING.top));
245272
245343
  vAxis.setAttribute("x2", String(CHART_PADDING.left));
@@ -245274,7 +245345,7 @@ function renderAxes(doc$12, svg2, layout) {
245274
245345
  vAxis.setAttribute("stroke", AXIS_COLOR);
245275
245346
  vAxis.setAttribute("stroke-width", "1");
245276
245347
  svg2.appendChild(vAxis);
245277
- const hAxis = doc$12.createElementNS(SVG_NS, "line");
245348
+ const hAxis = doc$12.createElementNS(SVG_NS$1, "line");
245278
245349
  hAxis.setAttribute("x1", String(CHART_PADDING.left));
245279
245350
  hAxis.setAttribute("y1", String(baselineY));
245280
245351
  hAxis.setAttribute("x2", String(CHART_PADDING.left + plotWidth));
@@ -245289,7 +245360,7 @@ function renderCategoryLabels(doc$12, svg2, categories, layout, width) {
245289
245360
  const fontSize = Math.max(8, Math.min(12, width / categoryCount / 5));
245290
245361
  for (let ci = 0;ci < categories.length; ci++) {
245291
245362
  const labelX = CHART_PADDING.left + ci * groupWidth + groupWidth / 2;
245292
- const label = doc$12.createElementNS(SVG_NS, "text");
245363
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245293
245364
  label.setAttribute("x", String(labelX));
245294
245365
  label.setAttribute("y", String(CHART_PADDING.top + plotHeight + 16));
245295
245366
  label.setAttribute("text-anchor", "middle");
@@ -245307,7 +245378,7 @@ function renderValueTicks(doc$12, svg2, layout, height) {
245307
245378
  for (let i4 = 0;i4 <= VALUE_TICK_COUNT; i4++) {
245308
245379
  const tickValue = minValue + tickStep * i4;
245309
245380
  const tickY = CHART_PADDING.top + plotHeight - plotHeight * (tickValue - minValue) / valueRange;
245310
- const label = doc$12.createElementNS(SVG_NS, "text");
245381
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245311
245382
  label.setAttribute("x", String(CHART_PADDING.left - 6));
245312
245383
  label.setAttribute("y", String(tickY + 3));
245313
245384
  label.setAttribute("text-anchor", "end");
@@ -245317,7 +245388,7 @@ function renderValueTicks(doc$12, svg2, layout, height) {
245317
245388
  label.textContent = formatTickValue(tickValue);
245318
245389
  svg2.appendChild(label);
245319
245390
  if (i4 > 0 && i4 < VALUE_TICK_COUNT) {
245320
- const gridLine = doc$12.createElementNS(SVG_NS, "line");
245391
+ const gridLine = doc$12.createElementNS(SVG_NS$1, "line");
245321
245392
  gridLine.setAttribute("x1", String(CHART_PADDING.left));
245322
245393
  gridLine.setAttribute("y1", String(tickY));
245323
245394
  gridLine.setAttribute("x2", String(CHART_PADDING.left + plotWidth));
@@ -245334,14 +245405,14 @@ function renderLegend(doc$12, svg2, series, height) {
245334
245405
  for (let si = 0;si < series.length; si++) {
245335
245406
  const s2 = series[si];
245336
245407
  const color2 = SERIES_COLORS[si % SERIES_COLORS.length];
245337
- const swatch = doc$12.createElementNS(SVG_NS, "rect");
245408
+ const swatch = doc$12.createElementNS(SVG_NS$1, "rect");
245338
245409
  swatch.setAttribute("x", String(legendX));
245339
245410
  swatch.setAttribute("y", String(legendY - 8));
245340
245411
  swatch.setAttribute("width", "10");
245341
245412
  swatch.setAttribute("height", "10");
245342
245413
  swatch.setAttribute("fill", color2);
245343
245414
  svg2.appendChild(swatch);
245344
- const label = doc$12.createElementNS(SVG_NS, "text");
245415
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245345
245416
  label.setAttribute("x", String(legendX + 14));
245346
245417
  label.setAttribute("y", String(legendY));
245347
245418
  label.setAttribute("font-size", "10");
@@ -245353,7 +245424,7 @@ function renderLegend(doc$12, svg2, series, height) {
245353
245424
  }
245354
245425
  }
245355
245426
  function renderTruncationIndicator(doc$12, svg2, width) {
245356
- const indicator = doc$12.createElementNS(SVG_NS, "text");
245427
+ const indicator = doc$12.createElementNS(SVG_NS$1, "text");
245357
245428
  indicator.setAttribute("x", String(width - 8));
245358
245429
  indicator.setAttribute("y", "14");
245359
245430
  indicator.setAttribute("text-anchor", "end");
@@ -245401,7 +245472,7 @@ function pointY(layout, value) {
245401
245472
  return CHART_PADDING.top + layout.plotHeight - (value - layout.minValue) / layout.valueRange * layout.plotHeight;
245402
245473
  }
245403
245474
  function renderCartesianAxes(doc$12, svg2, layout) {
245404
- const vAxis = doc$12.createElementNS(SVG_NS, "line");
245475
+ const vAxis = doc$12.createElementNS(SVG_NS$1, "line");
245405
245476
  vAxis.setAttribute("x1", String(CHART_PADDING.left));
245406
245477
  vAxis.setAttribute("y1", String(CHART_PADDING.top));
245407
245478
  vAxis.setAttribute("x2", String(CHART_PADDING.left));
@@ -245409,7 +245480,7 @@ function renderCartesianAxes(doc$12, svg2, layout) {
245409
245480
  vAxis.setAttribute("stroke", AXIS_COLOR);
245410
245481
  vAxis.setAttribute("stroke-width", "1");
245411
245482
  svg2.appendChild(vAxis);
245412
- const hAxis = doc$12.createElementNS(SVG_NS, "line");
245483
+ const hAxis = doc$12.createElementNS(SVG_NS$1, "line");
245413
245484
  hAxis.setAttribute("x1", String(CHART_PADDING.left));
245414
245485
  hAxis.setAttribute("y1", String(layout.baselineY));
245415
245486
  hAxis.setAttribute("x2", String(CHART_PADDING.left + layout.plotWidth));
@@ -245423,7 +245494,7 @@ function renderPointCategoryLabels(doc$12, svg2, categories, layout, width) {
245423
245494
  const categoryCount = Math.max(1, labels.length);
245424
245495
  const fontSize = Math.max(8, Math.min(12, width / categoryCount / 4));
245425
245496
  for (let i4 = 0;i4 < labels.length; i4++) {
245426
- const label = doc$12.createElementNS(SVG_NS, "text");
245497
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245427
245498
  label.setAttribute("x", String(pointX(layout, i4)));
245428
245499
  label.setAttribute("y", String(CHART_PADDING.top + layout.plotHeight + 16));
245429
245500
  label.setAttribute("text-anchor", "middle");
@@ -245440,7 +245511,7 @@ function renderCartesianValueTicks(doc$12, svg2, layout, height) {
245440
245511
  for (let i4 = 0;i4 <= VALUE_TICK_COUNT; i4++) {
245441
245512
  const tickValue = layout.minValue + tickStep * i4;
245442
245513
  const tickY = CHART_PADDING.top + layout.plotHeight - layout.plotHeight * (tickValue - layout.minValue) / layout.valueRange;
245443
- const label = doc$12.createElementNS(SVG_NS, "text");
245514
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245444
245515
  label.setAttribute("x", String(CHART_PADDING.left - 6));
245445
245516
  label.setAttribute("y", String(tickY + 3));
245446
245517
  label.setAttribute("text-anchor", "end");
@@ -245450,7 +245521,7 @@ function renderCartesianValueTicks(doc$12, svg2, layout, height) {
245450
245521
  label.textContent = formatTickValue(tickValue);
245451
245522
  svg2.appendChild(label);
245452
245523
  if (i4 > 0 && i4 < VALUE_TICK_COUNT) {
245453
- const grid = doc$12.createElementNS(SVG_NS, "line");
245524
+ const grid = doc$12.createElementNS(SVG_NS$1, "line");
245454
245525
  grid.setAttribute("x1", String(CHART_PADDING.left));
245455
245526
  grid.setAttribute("y1", String(tickY));
245456
245527
  grid.setAttribute("x2", String(CHART_PADDING.left + layout.plotWidth));
@@ -245528,7 +245599,7 @@ function xyToSvgY(layout, yValue) {
245528
245599
  return CHART_PADDING.top + layout.plotHeight - (yValue - layout.minY) / layout.yRange * layout.plotHeight;
245529
245600
  }
245530
245601
  function renderXYAxes(doc$12, svg2, layout) {
245531
- const yAxis = doc$12.createElementNS(SVG_NS, "line");
245602
+ const yAxis = doc$12.createElementNS(SVG_NS$1, "line");
245532
245603
  yAxis.setAttribute("x1", String(layout.axisX));
245533
245604
  yAxis.setAttribute("y1", String(CHART_PADDING.top));
245534
245605
  yAxis.setAttribute("x2", String(layout.axisX));
@@ -245536,7 +245607,7 @@ function renderXYAxes(doc$12, svg2, layout) {
245536
245607
  yAxis.setAttribute("stroke", AXIS_COLOR);
245537
245608
  yAxis.setAttribute("stroke-width", "1");
245538
245609
  svg2.appendChild(yAxis);
245539
- const xAxis = doc$12.createElementNS(SVG_NS, "line");
245610
+ const xAxis = doc$12.createElementNS(SVG_NS$1, "line");
245540
245611
  xAxis.setAttribute("x1", String(CHART_PADDING.left));
245541
245612
  xAxis.setAttribute("y1", String(layout.axisY));
245542
245613
  xAxis.setAttribute("x2", String(CHART_PADDING.left + layout.plotWidth));
@@ -245551,7 +245622,7 @@ function renderXYTicks(doc$12, svg2, layout, height) {
245551
245622
  const tickRatio = i4 / VALUE_TICK_COUNT;
245552
245623
  const yValue = layout.minY + layout.yRange * tickRatio;
245553
245624
  const y$1 = CHART_PADDING.top + layout.plotHeight - layout.plotHeight * tickRatio;
245554
- const yLabel = doc$12.createElementNS(SVG_NS, "text");
245625
+ const yLabel = doc$12.createElementNS(SVG_NS$1, "text");
245555
245626
  yLabel.setAttribute("x", String(CHART_PADDING.left - 6));
245556
245627
  yLabel.setAttribute("y", String(y$1 + 3));
245557
245628
  yLabel.setAttribute("text-anchor", "end");
@@ -245561,7 +245632,7 @@ function renderXYTicks(doc$12, svg2, layout, height) {
245561
245632
  yLabel.textContent = formatTickValue(yValue);
245562
245633
  svg2.appendChild(yLabel);
245563
245634
  if (i4 > 0 && i4 < VALUE_TICK_COUNT) {
245564
- const grid = doc$12.createElementNS(SVG_NS, "line");
245635
+ const grid = doc$12.createElementNS(SVG_NS$1, "line");
245565
245636
  grid.setAttribute("x1", String(CHART_PADDING.left));
245566
245637
  grid.setAttribute("y1", String(y$1));
245567
245638
  grid.setAttribute("x2", String(CHART_PADDING.left + layout.plotWidth));
@@ -245572,7 +245643,7 @@ function renderXYTicks(doc$12, svg2, layout, height) {
245572
245643
  }
245573
245644
  const xValue = layout.minX + layout.xRange * tickRatio;
245574
245645
  const x = CHART_PADDING.left + layout.plotWidth * tickRatio;
245575
- const xLabel = doc$12.createElementNS(SVG_NS, "text");
245646
+ const xLabel = doc$12.createElementNS(SVG_NS$1, "text");
245576
245647
  xLabel.setAttribute("x", String(x));
245577
245648
  xLabel.setAttribute("y", String(CHART_PADDING.top + layout.plotHeight + 16));
245578
245649
  xLabel.setAttribute("text-anchor", "middle");
@@ -245603,7 +245674,7 @@ function renderScatterChart(doc$12, container, chart, geometry) {
245603
245674
  if (estimated > SVG_ELEMENT_BUDGET)
245604
245675
  return createChartPlaceholder(doc$12, container, `Chart too complex for inline rendering (${estimated} elements)`);
245605
245676
  const layout = toXYLayout(width, height, allPoints, false);
245606
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
245677
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245607
245678
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245608
245679
  svg2.setAttribute("width", "100%");
245609
245680
  svg2.setAttribute("height", "100%");
@@ -245614,7 +245685,7 @@ function renderScatterChart(doc$12, container, chart, geometry) {
245614
245685
  const points = pointsBySeries[si];
245615
245686
  const color2 = SERIES_COLORS[si % SERIES_COLORS.length];
245616
245687
  for (const point5 of points) {
245617
- const marker = doc$12.createElementNS(SVG_NS, "circle");
245688
+ const marker = doc$12.createElementNS(SVG_NS$1, "circle");
245618
245689
  marker.setAttribute("cx", String(xyToSvgX(layout, point5.x)));
245619
245690
  marker.setAttribute("cy", String(xyToSvgY(layout, point5.y)));
245620
245691
  marker.setAttribute("r", "3");
@@ -245644,7 +245715,7 @@ function renderBubbleChart(doc$12, container, chart, geometry) {
245644
245715
  const layout = toXYLayout(width, height, allPoints, false);
245645
245716
  const allSizes = allPoints.map((point5) => point5.size).filter((size$1) => size$1 != null && size$1 > 0);
245646
245717
  const maxBubbleSize = allSizes.length ? Math.max(...allSizes) : 1;
245647
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
245718
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245648
245719
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245649
245720
  svg2.setAttribute("width", "100%");
245650
245721
  svg2.setAttribute("height", "100%");
@@ -245657,7 +245728,7 @@ function renderBubbleChart(doc$12, container, chart, geometry) {
245657
245728
  for (const point5 of points) {
245658
245729
  const size$1 = point5.size && point5.size > 0 ? point5.size : maxBubbleSize * 0.5;
245659
245730
  const radius = maxBubbleSize > 0 ? 4 + size$1 / maxBubbleSize * 10 : 6;
245660
- const bubble = doc$12.createElementNS(SVG_NS, "circle");
245731
+ const bubble = doc$12.createElementNS(SVG_NS$1, "circle");
245661
245732
  bubble.setAttribute("cx", String(xyToSvgX(layout, point5.x)));
245662
245733
  bubble.setAttribute("cy", String(xyToSvgY(layout, point5.y)));
245663
245734
  bubble.setAttribute("r", String(Math.max(2, radius)));
@@ -245695,7 +245766,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245695
245766
  const maxValue = allValues.length ? Math.max(...allValues) : 1;
245696
245767
  const minValue = allValues.length ? Math.min(...allValues) : 0;
245697
245768
  const valueRange = Math.max(1, maxValue - Math.min(0, minValue));
245698
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
245769
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245699
245770
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245700
245771
  svg2.setAttribute("width", "100%");
245701
245772
  svg2.setAttribute("height", "100%");
@@ -245712,7 +245783,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245712
245783
  const angle = -Math.PI / 2 + i4 * Math.PI * 2 / categoryCount;
245713
245784
  ringPoints.push(`${centerX + ringRadius * Math.cos(angle)},${centerY + ringRadius * Math.sin(angle)}`);
245714
245785
  }
245715
- const polygon = doc$12.createElementNS(SVG_NS, "polygon");
245786
+ const polygon = doc$12.createElementNS(SVG_NS$1, "polygon");
245716
245787
  polygon.setAttribute("points", ringPoints.join(" "));
245717
245788
  polygon.setAttribute("fill", "none");
245718
245789
  polygon.setAttribute("stroke", GRID_COLOR);
@@ -245723,7 +245794,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245723
245794
  const angle = -Math.PI / 2 + i4 * Math.PI * 2 / categoryCount;
245724
245795
  const x = centerX + radius * Math.cos(angle);
245725
245796
  const y$1 = centerY + radius * Math.sin(angle);
245726
- const spoke = doc$12.createElementNS(SVG_NS, "line");
245797
+ const spoke = doc$12.createElementNS(SVG_NS$1, "line");
245727
245798
  spoke.setAttribute("x1", String(centerX));
245728
245799
  spoke.setAttribute("y1", String(centerY));
245729
245800
  spoke.setAttribute("x2", String(x));
@@ -245734,7 +245805,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245734
245805
  const labelRadius = radius + 14;
245735
245806
  const labelX = centerX + labelRadius * Math.cos(angle);
245736
245807
  const labelY = centerY + labelRadius * Math.sin(angle);
245737
- const label = doc$12.createElementNS(SVG_NS, "text");
245808
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245738
245809
  label.setAttribute("x", String(labelX));
245739
245810
  label.setAttribute("y", String(labelY));
245740
245811
  label.setAttribute("font-size", "10");
@@ -245763,7 +245834,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245763
245834
  });
245764
245835
  }
245765
245836
  if (points.length > 0) {
245766
- const polygon = doc$12.createElementNS(SVG_NS, "polygon");
245837
+ const polygon = doc$12.createElementNS(SVG_NS$1, "polygon");
245767
245838
  polygon.setAttribute("points", points.join(" "));
245768
245839
  polygon.setAttribute("fill", color2);
245769
245840
  polygon.setAttribute("fill-opacity", "0.18");
@@ -245772,7 +245843,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245772
245843
  svg2.appendChild(polygon);
245773
245844
  }
245774
245845
  for (const point5 of pointPositions) {
245775
- const marker = doc$12.createElementNS(SVG_NS, "circle");
245846
+ const marker = doc$12.createElementNS(SVG_NS$1, "circle");
245776
245847
  marker.setAttribute("cx", String(point5.x));
245777
245848
  marker.setAttribute("cy", String(point5.y));
245778
245849
  marker.setAttribute("r", "2.5");
@@ -245827,7 +245898,7 @@ function renderPieSlices(doc$12, svg2, slices, centerX, centerY, radius) {
245827
245898
  continue;
245828
245899
  const sweep = slice2.value / total * Math.PI * 2;
245829
245900
  if (sweep >= Math.PI * 2 - 0.0001) {
245830
- const full = doc$12.createElementNS(SVG_NS, "circle");
245901
+ const full = doc$12.createElementNS(SVG_NS$1, "circle");
245831
245902
  full.setAttribute("cx", String(centerX));
245832
245903
  full.setAttribute("cy", String(centerY));
245833
245904
  full.setAttribute("r", String(radius));
@@ -245843,7 +245914,7 @@ function renderPieSlices(doc$12, svg2, slices, centerX, centerY, radius) {
245843
245914
  const x2 = centerX + radius * Math.cos(end$1);
245844
245915
  const y2 = centerY + radius * Math.sin(end$1);
245845
245916
  const largeArc = sweep > Math.PI ? 1 : 0;
245846
- const path2 = doc$12.createElementNS(SVG_NS, "path");
245917
+ const path2 = doc$12.createElementNS(SVG_NS$1, "path");
245847
245918
  path2.setAttribute("d", `M ${centerX} ${centerY} L ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} Z`);
245848
245919
  path2.setAttribute("fill", slice2.color);
245849
245920
  path2.setAttribute("stroke", "#fff");
@@ -245857,14 +245928,14 @@ function renderPieLegend(doc$12, svg2, slices, width, height) {
245857
245928
  let legendX = Math.max(10, (width - totalWidth) / 2);
245858
245929
  const legendY = height - 14;
245859
245930
  for (const slice2 of slices) {
245860
- const swatch = doc$12.createElementNS(SVG_NS, "rect");
245931
+ const swatch = doc$12.createElementNS(SVG_NS$1, "rect");
245861
245932
  swatch.setAttribute("x", String(legendX));
245862
245933
  swatch.setAttribute("y", String(legendY - 8));
245863
245934
  swatch.setAttribute("width", "10");
245864
245935
  swatch.setAttribute("height", "10");
245865
245936
  swatch.setAttribute("fill", slice2.color);
245866
245937
  svg2.appendChild(swatch);
245867
- const label = doc$12.createElementNS(SVG_NS, "text");
245938
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245868
245939
  label.setAttribute("x", String(legendX + 14));
245869
245940
  label.setAttribute("y", String(legendY));
245870
245941
  label.setAttribute("font-size", "10");
@@ -245895,13 +245966,13 @@ function renderPieChart(doc$12, container, chart, geometry) {
245895
245966
  const centerX = width / 2;
245896
245967
  const centerY = titleSpace + plotHeight / 2;
245897
245968
  const radius = Math.max(8, Math.min(plotWidth, plotHeight) * 0.45);
245898
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
245969
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245899
245970
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245900
245971
  svg2.setAttribute("width", "100%");
245901
245972
  svg2.setAttribute("height", "100%");
245902
245973
  svg2.style.display = "block";
245903
245974
  if (hasTitle) {
245904
- const titleEl = doc$12.createElementNS(SVG_NS, "text");
245975
+ const titleEl = doc$12.createElementNS(SVG_NS$1, "text");
245905
245976
  titleEl.setAttribute("x", String(centerX));
245906
245977
  titleEl.setAttribute("y", "24");
245907
245978
  titleEl.setAttribute("text-anchor", "middle");
@@ -245928,7 +245999,7 @@ function renderLineChart(doc$12, container, chart, geometry) {
245928
245999
  if (estimated > SVG_ELEMENT_BUDGET)
245929
246000
  return createChartPlaceholder(doc$12, container, `Chart too complex for inline rendering (${estimated} elements)`);
245930
246001
  const layout = toCartesianLayout(width, height, series, false);
245931
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
246002
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245932
246003
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245933
246004
  svg2.setAttribute("width", "100%");
245934
246005
  svg2.setAttribute("height", "100%");
@@ -245947,14 +246018,14 @@ function renderLineChart(doc$12, container, chart, geometry) {
245947
246018
  }
245948
246019
  if (points.length === 0)
245949
246020
  continue;
245950
- const line = doc$12.createElementNS(SVG_NS, "polyline");
246021
+ const line = doc$12.createElementNS(SVG_NS$1, "polyline");
245951
246022
  line.setAttribute("points", points.join(" "));
245952
246023
  line.setAttribute("fill", "none");
245953
246024
  line.setAttribute("stroke", color2);
245954
246025
  line.setAttribute("stroke-width", "2");
245955
246026
  svg2.appendChild(line);
245956
246027
  for (let i4 = 0;i4 < s2.values.length; i4++) {
245957
- const marker = doc$12.createElementNS(SVG_NS, "circle");
246028
+ const marker = doc$12.createElementNS(SVG_NS$1, "circle");
245958
246029
  marker.setAttribute("cx", String(pointX(layout, i4)));
245959
246030
  marker.setAttribute("cy", String(pointY(layout, s2.values[i4] ?? 0)));
245960
246031
  marker.setAttribute("r", "2.5");
@@ -245978,7 +246049,7 @@ function renderAreaChart(doc$12, container, chart, geometry) {
245978
246049
  if (estimated > SVG_ELEMENT_BUDGET)
245979
246050
  return createChartPlaceholder(doc$12, container, `Chart too complex for inline rendering (${estimated} elements)`);
245980
246051
  const layout = toCartesianLayout(width, height, series, true);
245981
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
246052
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245982
246053
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245983
246054
  svg2.setAttribute("width", "100%");
245984
246055
  svg2.setAttribute("height", "100%");
@@ -245996,7 +246067,7 @@ function renderAreaChart(doc$12, container, chart, geometry) {
245996
246067
  pathParts.push(`L ${pointX(layout, i4)} ${pointY(layout, s2.values[i4] ?? 0)}`);
245997
246068
  const lastX = pointX(layout, Math.max(0, s2.values.length - 1));
245998
246069
  pathParts.push(`L ${lastX} ${layout.baselineY} Z`);
245999
- const area = doc$12.createElementNS(SVG_NS, "path");
246070
+ const area = doc$12.createElementNS(SVG_NS$1, "path");
246000
246071
  area.setAttribute("d", pathParts.join(" "));
246001
246072
  area.setAttribute("fill", color2);
246002
246073
  area.setAttribute("fill-opacity", "0.35");
@@ -246021,7 +246092,7 @@ function renderDoughnutSlices(doc$12, svg2, slices, centerX, centerY, outerRadiu
246021
246092
  continue;
246022
246093
  const sweep = slice2.value / total * Math.PI * 2;
246023
246094
  if (sweep >= Math.PI * 2 - 0.0001) {
246024
- const ring = doc$12.createElementNS(SVG_NS, "circle");
246095
+ const ring = doc$12.createElementNS(SVG_NS$1, "circle");
246025
246096
  ring.setAttribute("cx", String(centerX));
246026
246097
  ring.setAttribute("cy", String(centerY));
246027
246098
  ring.setAttribute("r", String((outerRadius + innerRadius) / 2));
@@ -246041,7 +246112,7 @@ function renderDoughnutSlices(doc$12, svg2, slices, centerX, centerY, outerRadiu
246041
246112
  const ix2 = centerX + innerRadius * Math.cos(end$1);
246042
246113
  const iy2 = centerY + innerRadius * Math.sin(end$1);
246043
246114
  const largeArc = sweep > Math.PI ? 1 : 0;
246044
- const path2 = doc$12.createElementNS(SVG_NS, "path");
246115
+ const path2 = doc$12.createElementNS(SVG_NS$1, "path");
246045
246116
  path2.setAttribute("d", `M ${x1} ${y1} A ${outerRadius} ${outerRadius} 0 ${largeArc} 1 ${x2} ${y2} L ${ix2} ${iy2} A ${innerRadius} ${innerRadius} 0 ${largeArc} 0 ${ix1} ${iy1} Z`);
246046
246117
  path2.setAttribute("fill", slice2.color);
246047
246118
  path2.setAttribute("stroke", "#fff");
@@ -246071,13 +246142,13 @@ function renderDoughnutChart(doc$12, container, chart, geometry) {
246071
246142
  const centerY = titleSpace + plotHeight / 2;
246072
246143
  const outerRadius = Math.max(8, Math.min(plotWidth, plotHeight) * 0.45);
246073
246144
  const innerRadius = Math.max(2, outerRadius * 0.58);
246074
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
246145
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
246075
246146
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
246076
246147
  svg2.setAttribute("width", "100%");
246077
246148
  svg2.setAttribute("height", "100%");
246078
246149
  svg2.style.display = "block";
246079
246150
  if (hasTitle) {
246080
- const titleEl = doc$12.createElementNS(SVG_NS, "text");
246151
+ const titleEl = doc$12.createElementNS(SVG_NS$1, "text");
246081
246152
  titleEl.setAttribute("x", String(centerX));
246082
246153
  titleEl.setAttribute("y", "24");
246083
246154
  titleEl.setAttribute("text-anchor", "middle");
@@ -246111,7 +246182,7 @@ function renderBarChart(doc$12, container, chart, geometry) {
246111
246182
  const estimated = estimateSvgElements(series, categories, hasLegend);
246112
246183
  if (estimated > SVG_ELEMENT_BUDGET)
246113
246184
  return createChartPlaceholder(doc$12, container, `Chart too complex for inline rendering (${estimated} elements)`);
246114
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
246185
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
246115
246186
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
246116
246187
  svg2.setAttribute("width", "100%");
246117
246188
  svg2.setAttribute("height", "100%");
@@ -248737,6 +248808,9 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
248737
248808
  const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
248738
248809
  const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
248739
248810
  const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
248811
+ const rawWrap = attrs?.wrap;
248812
+ const isInlineShapeGroup = block.drawingKind === "shapeGroup" && rawWrap?.type === "Inline";
248813
+ const inlineParagraphAlignment = attrs?.inlineParagraphAlignment === "center" || attrs?.inlineParagraphAlignment === "right" ? attrs.inlineParagraphAlignment : undefined;
248740
248814
  if (width > maxWidthForBlock && maxWidthForBlock > 0) {
248741
248815
  const scale = maxWidthForBlock / width;
248742
248816
  width = maxWidthForBlock;
@@ -248753,11 +248827,19 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
248753
248827
  if (state.cursorY + requiredHeight > state.contentBottom && state.cursorY > state.topMargin)
248754
248828
  state = advanceColumn(state);
248755
248829
  const pmRange = extractBlockPmRange(block);
248830
+ let x = columnX(state.columnIndex) + marginLeft + indentLeft;
248831
+ if (isInlineShapeGroup && inlineParagraphAlignment) {
248832
+ const pIndentLeft = typeof attrs?.paragraphIndentLeft === "number" ? attrs.paragraphIndentLeft : 0;
248833
+ const pIndentRight = typeof attrs?.paragraphIndentRight === "number" ? attrs.paragraphIndentRight : 0;
248834
+ const alignBox = Math.max(0, maxWidthForBlock - pIndentLeft - pIndentRight);
248835
+ const extra = Math.max(0, alignBox - width);
248836
+ x += pIndentLeft + (inlineParagraphAlignment === "center" ? extra / 2 : extra);
248837
+ }
248756
248838
  const fragment2 = {
248757
248839
  kind: "drawing",
248758
248840
  blockId: block.id,
248759
248841
  drawingKind: block.drawingKind,
248760
- x: columnX(state.columnIndex) + marginLeft + indentLeft,
248842
+ x,
248761
248843
  y: state.cursorY + marginTop,
248762
248844
  width,
248763
248845
  height,
@@ -251699,7 +251781,21 @@ function computeFragmentBottom(fragment2, block, measure) {
251699
251781
  }
251700
251782
  return bottom$1;
251701
251783
  }
251702
- function shouldExcludeFromMeasurement(fragment2, block, canvasHeight) {
251784
+ function rangesIntersect(startA, endA, startB, endB) {
251785
+ return endA > startB && startA < endB;
251786
+ }
251787
+ function getPageRelativeMeasurementBand(kind, constraints) {
251788
+ if (!kind || !constraints.margins)
251789
+ return null;
251790
+ const bandSize = kind === "header" ? constraints.margins.top : constraints.margins.bottom;
251791
+ if (!Number.isFinite(bandSize) || bandSize == null || bandSize <= 0)
251792
+ return null;
251793
+ return {
251794
+ start: 0,
251795
+ end: bandSize
251796
+ };
251797
+ }
251798
+ function shouldExcludeFromMeasurement(fragment2, block, fragmentBottom, canvasHeight, kind, constraints) {
251703
251799
  if (!((fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true))
251704
251800
  return false;
251705
251801
  if (block.kind !== "image" && block.kind !== "drawing")
@@ -251708,9 +251804,13 @@ function shouldExcludeFromMeasurement(fragment2, block, canvasHeight) {
251708
251804
  if (anchoredBlock.anchor?.behindDoc)
251709
251805
  return true;
251710
251806
  if (isPageRelativeAnchor(anchoredBlock)) {
251711
- const fragmentHeight = fragment2.height ?? 0;
251712
251807
  const fragmentTop = fragment2.y;
251713
- if (fragment2.y + fragmentHeight <= 0 || fragmentTop >= canvasHeight)
251808
+ if (fragmentBottom <= 0 || fragmentTop >= canvasHeight)
251809
+ return true;
251810
+ }
251811
+ if (anchoredBlock.anchor?.vRelativeFrom === "page") {
251812
+ const measurementBand = getPageRelativeMeasurementBand(kind, constraints);
251813
+ if (measurementBand && !rangesIntersect(fragment2.y, fragmentBottom, measurementBand.start, measurementBand.end))
251714
251814
  return true;
251715
251815
  }
251716
251816
  return false;
@@ -251762,7 +251862,7 @@ function layoutHeaderFooter(blocks2, measures, constraints, kind) {
251762
251862
  renderMinY = fragment2.y;
251763
251863
  if (bottom$1 > renderMaxY)
251764
251864
  renderMaxY = bottom$1;
251765
- if (shouldExcludeFromMeasurement(fragment2, block, height))
251865
+ if (shouldExcludeFromMeasurement(fragment2, block, bottom$1, height, kind, constraints))
251766
251866
  continue;
251767
251867
  if (fragment2.y < measureMinY)
251768
251868
  measureMinY = fragment2.y;
@@ -252818,14 +252918,23 @@ function computeSectionMetadataHash(sections) {
252818
252918
  return parts.join("|");
252819
252919
  }
252820
252920
  function computeConstraintsHash(constraints) {
252821
- const { width, height, pageWidth, margins, overflowBaseHeight } = constraints;
252921
+ const { width, height, pageWidth, pageHeight, margins, overflowBaseHeight } = constraints;
252822
252922
  const parts = [`w:${width}`, `h:${height}`];
252823
252923
  if (pageWidth !== undefined)
252824
252924
  parts.push(`pw:${pageWidth}`);
252925
+ if (pageHeight !== undefined)
252926
+ parts.push(`ph:${pageHeight}`);
252825
252927
  if (overflowBaseHeight !== undefined)
252826
252928
  parts.push(`obh:${overflowBaseHeight}`);
252827
- if (margins)
252929
+ if (margins) {
252828
252930
  parts.push(`ml:${margins.left}`, `mr:${margins.right}`);
252931
+ if (margins.top !== undefined)
252932
+ parts.push(`mt:${margins.top}`);
252933
+ if (margins.bottom !== undefined)
252934
+ parts.push(`mb:${margins.bottom}`);
252935
+ if (margins.header !== undefined)
252936
+ parts.push(`mh:${margins.header}`);
252937
+ }
252829
252938
  return parts.join("|");
252830
252939
  }
252831
252940
  function invalidateHeaderFooterCache(cache$2, cacheState, headerBlocks, footerBlocks, constraints, sections) {
@@ -257882,6 +257991,26 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, trackedChangesCon
257882
257991
  blockWithAttrs.attrs.anchorParagraphId = anchorParagraphId;
257883
257992
  return blockWithAttrs;
257884
257993
  };
257994
+ const attachInlineShapeGroupAlignment = (block) => {
257995
+ if (block.kind !== "drawing")
257996
+ return block;
257997
+ const drawingBlock = block;
257998
+ const rawWrap = drawingBlock.attrs?.wrap;
257999
+ if (drawingBlock.drawingKind !== "shapeGroup" || rawWrap?.type !== "Inline")
258000
+ return block;
258001
+ const effectiveAlignment = resolvedParagraphProperties.justification === "distribute" ? "center" : paragraphAttrs.alignment;
258002
+ if (effectiveAlignment === "center" || effectiveAlignment === "right") {
258003
+ if (!drawingBlock.attrs)
258004
+ drawingBlock.attrs = {};
258005
+ drawingBlock.attrs.inlineParagraphAlignment = effectiveAlignment;
258006
+ const indent2 = paragraphAttrs.indent;
258007
+ if (typeof indent2?.left === "number")
258008
+ drawingBlock.attrs.paragraphIndentLeft = indent2.left;
258009
+ if (typeof indent2?.right === "number")
258010
+ drawingBlock.attrs.paragraphIndentRight = indent2.right;
258011
+ }
258012
+ return block;
258013
+ };
257885
258014
  const flushParagraph = () => {
257886
258015
  if (currentRuns.length === 0)
257887
258016
  return;
@@ -257963,10 +258092,12 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, trackedChangesCon
257963
258092
  });
257964
258093
  if (block) {
257965
258094
  attachAnchorParagraphId(block, anchorParagraphId);
258095
+ attachInlineShapeGroupAlignment(block);
257966
258096
  blocks2.push(block);
257967
258097
  } else if (newBlocks.length > 0)
257968
258098
  newBlocks.forEach((b$1) => {
257969
258099
  attachAnchorParagraphId(b$1, anchorParagraphId);
258100
+ attachInlineShapeGroupAlignment(b$1);
257970
258101
  blocks2.push(b$1);
257971
258102
  });
257972
258103
  } else
@@ -257979,8 +258110,10 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, trackedChangesCon
257979
258110
  flushParagraph();
257980
258111
  const converter = SHAPE_CONVERTERS_REGISTRY[node3.type];
257981
258112
  const drawingBlock = converter(node3, stableNextBlockId, positions);
257982
- if (drawingBlock)
258113
+ if (drawingBlock) {
258114
+ attachInlineShapeGroupAlignment(drawingBlock);
257983
258115
  blocks2.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
258116
+ }
257984
258117
  return;
257985
258118
  }
257986
258119
  };
@@ -276663,7 +276796,7 @@ var Node$13 = class Node$14 {
276663
276796
  if (current.trim())
276664
276797
  parts.push(current.trim());
276665
276798
  return parts;
276666
- }, MAX_RENDERED_SERIES = 20, MAX_POINTS_PER_SERIES = 500, SVG_ELEMENT_BUDGET = 5000, SERIES_COLORS, AXIS_COLOR = "#595959", GRID_COLOR = "#E0E0E0", LABEL_COLOR = "#333", TICK_LABEL_COLOR = "#666", FONT_FAMILY = "Calibri, Arial, sans-serif", PLACEHOLDER_BG = "#f8f9fa", PLACEHOLDER_BORDER = "#dee2e6", PLACEHOLDER_TEXT_COLOR = "#6c757d", SVG_NS = "http://www.w3.org/2000/svg", CHART_PADDING, VALUE_TICK_COUNT = 5, hashParagraphBorder$1 = (border) => {
276799
+ }, MAX_RENDERED_SERIES = 20, MAX_POINTS_PER_SERIES = 500, SVG_ELEMENT_BUDGET = 5000, SERIES_COLORS, AXIS_COLOR = "#595959", GRID_COLOR = "#E0E0E0", LABEL_COLOR = "#333", TICK_LABEL_COLOR = "#666", FONT_FAMILY = "Calibri, Arial, sans-serif", PLACEHOLDER_BG = "#f8f9fa", PLACEHOLDER_BORDER = "#dee2e6", PLACEHOLDER_TEXT_COLOR = "#6c757d", SVG_NS$1 = "http://www.w3.org/2000/svg", CHART_PADDING, VALUE_TICK_COUNT = 5, hashParagraphBorder$1 = (border) => {
276667
276800
  const parts = [];
276668
276801
  if (border.style !== undefined)
276669
276802
  parts.push(`s:${border.style}`);
@@ -279168,7 +279301,7 @@ var Node$13 = class Node$14 {
279168
279301
  mtable.appendChild(mtr);
279169
279302
  }
279170
279303
  return mtable.childNodes.length > 0 ? mtable : null;
279171
- }, MATHML_NS = "http://www.w3.org/1998/Math/MathML", MATH_OBJECT_REGISTRY, ARGUMENT_ELEMENTS, LIST_MARKER_GAP$1 = 8, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, LINK_DATASET_KEYS, MAX_HREF_LENGTH = 2048, SAFE_ANCHOR_PATTERN, MAX_DATA_URL_LENGTH, VALID_IMAGE_DATA_URL, MAX_RESIZE_MULTIPLIER = 3, FALLBACK_MAX_DIMENSION = 1000, MIN_IMAGE_DIMENSION = 20, AMBIGUOUS_LINK_PATTERNS, linkMetrics, TRACK_CHANGE_BASE_CLASS, TRACK_CHANGE_MODIFIER_CLASS, LINK_TARGET_SET, normalizeAnchor$1 = (value) => {
279304
+ }, MATHML_NS = "http://www.w3.org/1998/Math/MathML", MATH_OBJECT_REGISTRY, ARGUMENT_ELEMENTS, LIST_MARKER_GAP$1 = 8, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, LINK_DATASET_KEYS, MAX_HREF_LENGTH = 2048, SAFE_ANCHOR_PATTERN, MAX_DATA_URL_LENGTH, VALID_IMAGE_DATA_URL, SVG_NS = "http://www.w3.org/2000/svg", WORDART_LINE_FILL_RATIO = 0.9, MAX_RESIZE_MULTIPLIER = 3, FALLBACK_MAX_DIMENSION = 1000, MIN_IMAGE_DIMENSION = 20, AMBIGUOUS_LINK_PATTERNS, linkMetrics, TRACK_CHANGE_BASE_CLASS, TRACK_CHANGE_MODIFIER_CLASS, LINK_TARGET_SET, normalizeAnchor$1 = (value) => {
279172
279305
  if (typeof value !== "string")
279173
279306
  return null;
279174
279307
  const trimmed = value.trim();
@@ -279710,7 +279843,8 @@ var Node$13 = class Node$14 {
279710
279843
  hash$3 = hashString(hash$3, getRunStringProp(run2, "vertAlign"));
279711
279844
  hash$3 = hashNumber(hash$3, getRunNumberProp(run2, "baselineShift"));
279712
279845
  }
279713
- }
279846
+ } else if (cellBlock?.kind)
279847
+ hash$3 = hashString(hash$3, deriveBlockVersion(cellBlock));
279714
279848
  }
279715
279849
  }
279716
279850
  }
@@ -280576,6 +280710,83 @@ var Node$13 = class Node$14 {
280576
280710
  if (frame.vAnchor !== undefined)
280577
280711
  parts.push(`va:${frame.vAnchor}`);
280578
280712
  return parts.join(",");
280713
+ }, getTableCellBlocks = (cell2) => {
280714
+ return cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
280715
+ }, readBlockClipPath = (block) => {
280716
+ if (typeof block.clipPath === "string")
280717
+ return block.clipPath;
280718
+ if (typeof block.attrs?.clipPath === "string")
280719
+ return block.attrs.clipPath;
280720
+ return "";
280721
+ }, hashDrawingGeometry = (geometry) => {
280722
+ return [
280723
+ geometry.width,
280724
+ geometry.height,
280725
+ geometry.rotation ?? 0,
280726
+ geometry.flipH ? 1 : 0,
280727
+ geometry.flipV ? 1 : 0
280728
+ ].join(":");
280729
+ }, hashImageLikeBlock = (block) => {
280730
+ return [
280731
+ block.src.slice(0, 50),
280732
+ block.width ?? "",
280733
+ block.height ?? "",
280734
+ block.alt ?? "",
280735
+ block.title ?? "",
280736
+ block.objectFit ?? "",
280737
+ readBlockClipPath(block),
280738
+ block.rotation ?? "",
280739
+ block.flipH ? 1 : 0,
280740
+ block.flipV ? 1 : 0
280741
+ ].join(":");
280742
+ }, hashListBlock = (block) => {
280743
+ return block.items.map((item) => `${item.id}:${item.marker.text}:${hashRuns(item.paragraph)}`).join("|");
280744
+ }, hashDrawingBlock = (block) => {
280745
+ if (block.drawingKind === "image")
280746
+ return `drawing:image:${hashImageLikeBlock(block)}`;
280747
+ if (block.drawingKind === "vectorShape")
280748
+ return [
280749
+ "drawing:vector",
280750
+ hashDrawingGeometry(block.geometry),
280751
+ block.shapeKind ?? "",
280752
+ JSON.stringify(block.fillColor ?? null),
280753
+ JSON.stringify(block.strokeColor ?? null),
280754
+ block.strokeWidth ?? "",
280755
+ JSON.stringify(block.customGeometry ?? null),
280756
+ JSON.stringify(block.lineEnds ?? null),
280757
+ JSON.stringify(block.effectExtent ?? null),
280758
+ JSON.stringify(block.textContent ?? null),
280759
+ block.textAlign ?? "",
280760
+ block.textVerticalAlign ?? "",
280761
+ JSON.stringify(block.textInsets ?? null)
280762
+ ].join(":");
280763
+ if (block.drawingKind === "shapeGroup")
280764
+ return [
280765
+ "drawing:shapeGroup",
280766
+ hashDrawingGeometry(block.geometry),
280767
+ JSON.stringify(block.groupTransform ?? null),
280768
+ JSON.stringify(block.shapes),
280769
+ block.size?.width ?? "",
280770
+ block.size?.height ?? ""
280771
+ ].join(":");
280772
+ return [
280773
+ "drawing:chart",
280774
+ hashDrawingGeometry(block.geometry),
280775
+ block.chartData?.chartType ?? "",
280776
+ block.chartData?.subType ?? "",
280777
+ JSON.stringify(block.chartData?.series ?? []),
280778
+ block.chartRelId ?? ""
280779
+ ].join(":");
280780
+ }, hashNonParagraphCellBlock = (block) => {
280781
+ if (block.kind === "table")
280782
+ return `table:${hashRuns(block)}`;
280783
+ if (block.kind === "image")
280784
+ return `image:${hashImageLikeBlock(block)}`;
280785
+ if (block.kind === "drawing")
280786
+ return hashDrawingBlock(block);
280787
+ if (block.kind === "list")
280788
+ return `list:${hashListBlock(block)}`;
280789
+ return `${block.kind}:${block.id}`;
280579
280790
  }, hashRuns = (block) => {
280580
280791
  if (block.kind === "table") {
280581
280792
  const tableBlock = block;
@@ -280602,8 +280813,12 @@ var Node$13 = class Node$14 {
280602
280813
  if (cellAttrParts.length > 0)
280603
280814
  cellHashes.push(`ca:${cellAttrParts.join(":")}`);
280604
280815
  }
280605
- const cellBlocks = cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
280816
+ const cellBlocks = getTableCellBlocks(cell2);
280606
280817
  for (const cellBlock of cellBlocks) {
280818
+ if (cellBlock.kind !== "paragraph") {
280819
+ cellHashes.push(`nb:${hashNonParagraphCellBlock(cellBlock)}`);
280820
+ continue;
280821
+ }
280607
280822
  const paragraphBlock = cellBlock;
280608
280823
  if (!paragraphBlock.runs)
280609
280824
  continue;
@@ -286219,7 +286434,8 @@ var Node$13 = class Node$14 {
286219
286434
  try {
286220
286435
  const sdtBlock = clickDepth === 1 ? this.#findStructuredContentBlockAtPos(doc$12, hit.pos) : null;
286221
286436
  let nextSelection;
286222
- if (sdtBlock)
286437
+ const insideTableInSdt = !!sdtBlock && this.#isInsideTableWithinStructuredContentBlock(doc$12, hit.pos, sdtBlock.pos);
286438
+ if (sdtBlock && !insideTableInSdt)
286223
286439
  nextSelection = NodeSelection.create(doc$12, sdtBlock.pos);
286224
286440
  else {
286225
286441
  nextSelection = TextSelection.create(doc$12, hit.pos);
@@ -286449,6 +286665,29 @@ var Node$13 = class Node$14 {
286449
286665
  }
286450
286666
  return null;
286451
286667
  }
286668
+ #isInsideTableWithinStructuredContentBlock(doc$12, pos, sdtPos) {
286669
+ if (!Number.isFinite(pos) || !Number.isFinite(sdtPos))
286670
+ return false;
286671
+ try {
286672
+ const $pos = doc$12.resolve(pos);
286673
+ let tableDepth = -1;
286674
+ let blockDepth = -1;
286675
+ for (let depth = $pos.depth;depth > 0; depth--) {
286676
+ const nodeName = $pos.node(depth)?.type?.name;
286677
+ if (tableDepth === -1 && nodeName === "table")
286678
+ tableDepth = depth;
286679
+ if (nodeName === "structuredContentBlock") {
286680
+ if ($pos.before(depth) === sdtPos) {
286681
+ blockDepth = depth;
286682
+ break;
286683
+ }
286684
+ }
286685
+ }
286686
+ return tableDepth !== -1 && blockDepth !== -1 && tableDepth > blockDepth;
286687
+ } catch {
286688
+ return false;
286689
+ }
286690
+ }
286452
286691
  #findStructuredContentBlockById(doc$12, id2) {
286453
286692
  let found2 = null;
286454
286693
  doc$12.descendants((node3, pos) => {
@@ -289283,18 +289522,18 @@ var Node$13 = class Node$14 {
289283
289522
  return;
289284
289523
  console.log(...args$1);
289285
289524
  }, 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;
289286
- var init_src_DlMaB1h_es = __esm(() => {
289525
+ var init_src_BvQy1mGL_es = __esm(() => {
289287
289526
  init_rolldown_runtime_Bg48TavK_es();
289288
- init_SuperConverter_BgwP1GeS_es();
289527
+ init_SuperConverter_B4pTwmbr_es();
289289
289528
  init_jszip_C49i9kUs_es();
289290
289529
  init_uuid_qzgm05fK_es();
289291
- init_create_headless_toolbar_Dcw4Hyt2_es();
289530
+ init_create_headless_toolbar_C636gY8A_es();
289292
289531
  init_constants_CGhJRd87_es();
289293
289532
  init_dist_B8HfvhaK_es();
289294
289533
  init_unified_Dsuw2be5_es();
289295
289534
  init_remark_gfm_BhnWr3yf_es();
289296
289535
  init_remark_stringify_6MMJfY0k_es();
289297
- init_DocxZipper_CaIWmehq_es();
289536
+ init_DocxZipper_BBjEXAFw_es();
289298
289537
  init__plugin_vue_export_helper_HmhZBO0u_es();
289299
289538
  init_eventemitter3_BdNugZrm_es();
289300
289539
  init_errors_CtyzHiH4_es();
@@ -314138,6 +314377,12 @@ function print() { __p += __j.call(arguments, '') }
314138
314377
  const footnotesXml = footnotesData?.elements?.[0] ? this.converter.schemaToXml(footnotesData.elements[0]) : null;
314139
314378
  const footnotesRelsData = this.converter.convertedXml["word/_rels/footnotes.xml.rels"];
314140
314379
  const footnotesRelsXml = footnotesRelsData?.elements?.[0] ? this.converter.schemaToXml(footnotesRelsData.elements[0]) : null;
314380
+ const endnotesData = this.converter.convertedXml["word/endnotes.xml"];
314381
+ const endnotesXml = endnotesData?.elements?.[0] ? this.converter.schemaToXml(endnotesData.elements[0]) : null;
314382
+ const endnotesRelsData = this.converter.convertedXml["word/_rels/endnotes.xml.rels"];
314383
+ const endnotesRelsXml = endnotesRelsData?.elements?.[0] ? this.converter.schemaToXml(endnotesRelsData.elements[0]) : null;
314384
+ const settingsRelsData = this.converter.convertedXml["word/_rels/settings.xml.rels"];
314385
+ const settingsRelsXml = settingsRelsData?.elements?.[0] ? this.converter.schemaToXml(settingsRelsData.elements[0]) : null;
314141
314386
  const media2 = this.converter.addedMedia;
314142
314387
  const updatedHeadersFooters = {};
314143
314388
  Object.entries(this.converter.convertedXml).forEach(([name, json$1]) => {
@@ -314164,12 +314409,22 @@ function print() { __p += __j.call(arguments, '') }
314164
314409
  ...appXml ? { "docProps/app.xml": String(appXml) } : {},
314165
314410
  ...coreXml ? { "docProps/core.xml": String(coreXml) } : {}
314166
314411
  };
314167
- if (hasCustomSettings)
314168
- updatedDocs["word/settings.xml"] = String(customSettings);
314412
+ if (hasCustomSettings) {
314413
+ let settingsXml = String(customSettings);
314414
+ if (settingsRelsXml)
314415
+ updatedDocs["word/_rels/settings.xml.rels"] = String(settingsRelsXml);
314416
+ else if (/<\w+:attachedTemplate\b/i.test(settingsXml))
314417
+ settingsXml = settingsXml.replace(/<\w+:attachedTemplate\b[^>]*\/?>/gi, "");
314418
+ updatedDocs["word/settings.xml"] = settingsXml;
314419
+ }
314169
314420
  if (footnotesXml)
314170
314421
  updatedDocs["word/footnotes.xml"] = String(footnotesXml);
314171
314422
  if (footnotesRelsXml)
314172
314423
  updatedDocs["word/_rels/footnotes.xml.rels"] = String(footnotesRelsXml);
314424
+ if (endnotesXml)
314425
+ updatedDocs["word/endnotes.xml"] = String(endnotesXml);
314426
+ if (endnotesRelsXml)
314427
+ updatedDocs["word/_rels/endnotes.xml.rels"] = String(endnotesRelsXml);
314173
314428
  const commentFiles = COMMENT_FILE_BASENAMES.map((name) => `word/${name}`);
314174
314429
  for (const path2 of commentFiles) {
314175
314430
  const data = this.converter.convertedXml[path2];
@@ -314184,6 +314439,17 @@ function print() { __p += __j.call(arguments, '') }
314184
314439
  if (partData?.elements?.[0])
314185
314440
  updatedDocs[path2] = String(this.converter.schemaToXml(partData.elements[0]));
314186
314441
  }
314442
+ for (const path2 of Object.keys(this.converter.convertedXml)) {
314443
+ if (!path2.startsWith("customXml/"))
314444
+ continue;
314445
+ if (!path2.endsWith(".xml") && !path2.endsWith(".rels"))
314446
+ continue;
314447
+ if (Object.prototype.hasOwnProperty.call(updatedDocs, path2))
314448
+ continue;
314449
+ const partData = this.converter.convertedXml[path2];
314450
+ if (partData?.elements?.[0])
314451
+ updatedDocs[path2] = String(this.converter.schemaToXml(partData.elements[0]));
314452
+ }
314187
314453
  const zipper = new DocxZipper_default;
314188
314454
  if (getUpdatedDocs) {
314189
314455
  updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes({ files: this.options.content }, media2, true, updatedDocs, this.options.fonts);
@@ -315845,7 +316111,7 @@ function print() { __p += __j.call(arguments, '') }
315845
316111
  const fragment2 = data.fragments[fi];
315846
316112
  let isBehindDoc = false;
315847
316113
  if (fragment2.kind === "image" || fragment2.kind === "drawing")
315848
- isBehindDoc = fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0;
316114
+ isBehindDoc = fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0 || this.shouldRenderBehindPageContent(fragment2, kind);
315849
316115
  if (isBehindDoc)
315850
316116
  behindDocFragments.push({
315851
316117
  fragment: fragment2,
@@ -316631,26 +316897,13 @@ function print() { __p += __j.call(arguments, '') }
316631
316897
  img2.style.objectPosition = "left top";
316632
316898
  applyImageClipPath(img2, resolveBlockClipPath(block), { clipContainer: fragmentEl });
316633
316899
  img2.style.display = block.display === "inline" ? "inline-block" : "block";
316634
- const transforms = [];
316635
- if (block.rotation != null && block.rotation !== 0) {
316636
- const angleRad = block.rotation * Math.PI / 180;
316637
- const w = block.width ?? fragment2.width;
316638
- const h$2 = block.height ?? fragment2.height;
316639
- const cosA = Math.cos(angleRad);
316640
- const sinA = Math.sin(angleRad);
316641
- const newTopLeftX = w / 2 * (1 - cosA) + h$2 / 2 * sinA;
316642
- const newTopLeftY = w / 2 * sinA + h$2 / 2 * (1 - cosA);
316643
- transforms.push(`translate(${-newTopLeftX}px, ${-newTopLeftY}px)`);
316644
- transforms.push(`rotate(${block.rotation}deg)`);
316645
- }
316646
- if (block.flipH)
316647
- transforms.push("scaleX(-1)");
316648
- if (block.flipV)
316649
- transforms.push("scaleY(-1)");
316650
- if (transforms.length > 0) {
316651
- img2.style.transform = transforms.join(" ");
316652
- img2.style.transformOrigin = "center";
316653
- }
316900
+ this.applyImageGeometryTransform(fragmentEl, {
316901
+ width: block.width ?? fragment2.width,
316902
+ height: block.height ?? fragment2.height,
316903
+ rotation: block.rotation,
316904
+ flipH: block.flipH,
316905
+ flipV: block.flipV
316906
+ });
316654
316907
  const filters = buildImageFilters(block);
316655
316908
  if (filters.length > 0)
316656
316909
  img2.style.filter = filters.join(" ");
@@ -316665,6 +316918,30 @@ function print() { __p += __j.call(arguments, '') }
316665
316918
  return this.createErrorPlaceholder(fragment2.blockId, error3);
316666
316919
  }
316667
316920
  }
316921
+ buildImageGeometryTransform(attrs) {
316922
+ const transforms = [];
316923
+ if (attrs.rotation != null && attrs.rotation !== 0) {
316924
+ const angleRad = attrs.rotation * Math.PI / 180;
316925
+ const cosA = Math.cos(angleRad);
316926
+ const sinA = Math.sin(angleRad);
316927
+ const newTopLeftX = attrs.width / 2 * (1 - cosA) + attrs.height / 2 * sinA;
316928
+ const newTopLeftY = attrs.width / 2 * sinA + attrs.height / 2 * (1 - cosA);
316929
+ transforms.push(`translate(${-newTopLeftX}px, ${-newTopLeftY}px)`);
316930
+ transforms.push(`rotate(${attrs.rotation}deg)`);
316931
+ }
316932
+ if (attrs.flipH)
316933
+ transforms.push("scaleX(-1)");
316934
+ if (attrs.flipV)
316935
+ transforms.push("scaleY(-1)");
316936
+ return transforms.join(" ");
316937
+ }
316938
+ applyImageGeometryTransform(target, attrs) {
316939
+ const transform = this.buildImageGeometryTransform(attrs);
316940
+ if (!transform)
316941
+ return;
316942
+ target.style.transform = transform;
316943
+ target.style.transformOrigin = "center";
316944
+ }
316668
316945
  buildImageHyperlinkAnchor(imageEl, hyperlink, display) {
316669
316946
  if (!hyperlink?.url || !this.doc)
316670
316947
  return imageEl;
@@ -316706,7 +316983,6 @@ function print() { __p += __j.call(arguments, '') }
316706
316983
  })();
316707
316984
  if (!this.doc)
316708
316985
  throw new Error("DomPainter: document is not available");
316709
- const isVectorShapeBlock = block.kind === "drawing" && block.drawingKind === "vectorShape";
316710
316986
  const fragmentEl = this.doc.createElement("div");
316711
316987
  fragmentEl.classList.add(CLASS_NAMES$1.fragment, "superdoc-drawing-fragment");
316712
316988
  applyStyles(fragmentEl, fragmentStyles);
@@ -316729,11 +317005,9 @@ function print() { __p += __j.call(arguments, '') }
316729
317005
  innerWrapper.style.transformOrigin = "center";
316730
317006
  const scale = fragment2.scale ?? 1;
316731
317007
  const transforms = ["translate(-50%, -50%)"];
316732
- if (!isVectorShapeBlock) {
316733
- transforms.push(`rotate(${fragment2.geometry.rotation ?? 0}deg)`);
316734
- transforms.push(`scaleX(${fragment2.geometry.flipH ? -1 : 1})`);
316735
- transforms.push(`scaleY(${fragment2.geometry.flipV ? -1 : 1})`);
316736
- }
317008
+ transforms.push(`rotate(${fragment2.geometry.rotation ?? 0}deg)`);
317009
+ transforms.push(`scaleX(${fragment2.geometry.flipH ? -1 : 1})`);
317010
+ transforms.push(`scaleY(${fragment2.geometry.flipV ? -1 : 1})`);
316737
317011
  transforms.push(`scale(${scale})`);
316738
317012
  innerWrapper.style.transform = transforms.join(" ");
316739
317013
  innerWrapper.appendChild(this.renderDrawingContent(block, fragment2, context));
@@ -316753,7 +317027,7 @@ function print() { __p += __j.call(arguments, '') }
316753
317027
  if (block.drawingKind === "image")
316754
317028
  return this.createDrawingImageElement(block);
316755
317029
  if (block.drawingKind === "vectorShape")
316756
- return this.createVectorShapeElement(block, fragment2.geometry, true, 1, 1, context);
317030
+ return this.createVectorShapeElement(block, fragment2.geometry, false, 1, 1, context);
316757
317031
  if (block.drawingKind === "shapeGroup")
316758
317032
  return this.createShapeGroupElement(block, context);
316759
317033
  if (block.drawingKind === "chart")
@@ -316790,6 +317064,8 @@ function print() { __p += __j.call(arguments, '') }
316790
317064
  contentContainer.style.top = `${offsetY}px`;
316791
317065
  contentContainer.style.width = `${innerWidth}px`;
316792
317066
  contentContainer.style.height = `${innerHeight2}px`;
317067
+ if (applyTransforms && geometry)
317068
+ this.applyVectorShapeTransforms(contentContainer, geometry);
316793
317069
  const customGeomSvg = block.customGeometry ? this.tryCreateCustomGeometrySvg(block, innerWidth, innerHeight2) : null;
316794
317070
  const svgMarkup = !customGeomSvg && block.shapeKind ? this.tryCreatePresetSvg(block, innerWidth, innerHeight2) : null;
316795
317071
  const resolvedSvgMarkup = customGeomSvg || svgMarkup;
@@ -316806,24 +317082,20 @@ function print() { __p += __j.call(arguments, '') }
316806
317082
  applyAlphaToSVG(svgElement, block.fillColor);
316807
317083
  }
316808
317084
  this.applyLineEnds(svgElement, block);
316809
- if (applyTransforms && geometry)
316810
- this.applyVectorShapeTransforms(svgElement, geometry);
316811
317085
  contentContainer.appendChild(svgElement);
316812
- if (block.textContent && block.textContent.parts.length > 0) {
316813
- const textDiv = this.createFallbackTextElement(block.textContent, block.textAlign ?? "center", block.textVerticalAlign, block.textInsets, groupScaleX, groupScaleY, context);
316814
- contentContainer.appendChild(textDiv);
317086
+ if (this.hasShapeTextContent(block.textContent)) {
317087
+ const textElement = this.createShapeTextElement(block, innerWidth, innerHeight2, groupScaleX, groupScaleY, context);
317088
+ contentContainer.appendChild(textElement);
316815
317089
  }
316816
317090
  container.appendChild(contentContainer);
316817
317091
  return container;
316818
317092
  }
316819
317093
  }
316820
317094
  this.applyFallbackShapeStyle(contentContainer, block);
316821
- if (block.textContent && block.textContent.parts.length > 0) {
316822
- const textDiv = this.createFallbackTextElement(block.textContent, block.textAlign ?? "center", block.textVerticalAlign, block.textInsets, groupScaleX, groupScaleY, context);
316823
- contentContainer.appendChild(textDiv);
317095
+ if (this.hasShapeTextContent(block.textContent)) {
317096
+ const textElement = this.createShapeTextElement(block, innerWidth, innerHeight2, groupScaleX, groupScaleY, context);
317097
+ contentContainer.appendChild(textElement);
316824
317098
  }
316825
- if (applyTransforms && geometry)
316826
- this.applyVectorShapeTransforms(contentContainer, geometry);
316827
317099
  container.appendChild(contentContainer);
316828
317100
  return container;
316829
317101
  }
@@ -316850,6 +317122,125 @@ function print() { __p += __j.call(arguments, '') }
316850
317122
  } else
316851
317123
  container.style.border = "1px solid rgba(15, 23, 42, 0.3)";
316852
317124
  }
317125
+ hasShapeTextContent(textContent$1) {
317126
+ return Array.isArray(textContent$1?.parts) && textContent$1.parts.length > 0;
317127
+ }
317128
+ createShapeTextElement(block, width, height, groupScaleX = 1, groupScaleY = 1, context) {
317129
+ const textContent$1 = block.textContent;
317130
+ if (!this.hasShapeTextContent(textContent$1))
317131
+ return this.doc.createElement("div");
317132
+ if (this.shouldUseWordArtTextRenderer(block))
317133
+ return this.createWordArtTextElement(textContent$1, block.textAlign ?? "center", block.textInsets, width, height, context);
317134
+ return this.createFallbackTextElement(textContent$1, block.textAlign ?? "center", block.textVerticalAlign, block.textInsets, groupScaleX, groupScaleY, context);
317135
+ }
317136
+ shouldUseWordArtTextRenderer(block) {
317137
+ return block.attrs?.isWordArt === true && this.hasShapeTextContent(block.textContent);
317138
+ }
317139
+ createWordArtTextElement(textContent$1, textAlign, textInsets, width, height, context) {
317140
+ const svg2 = this.doc.createElementNS(SVG_NS, "svg");
317141
+ svg2.classList.add("superdoc-wordart-text");
317142
+ svg2.setAttribute("xmlns", SVG_NS);
317143
+ svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
317144
+ svg2.setAttribute("preserveAspectRatio", "none");
317145
+ svg2.style.position = "absolute";
317146
+ svg2.style.left = "0";
317147
+ svg2.style.top = "0";
317148
+ svg2.style.width = "100%";
317149
+ svg2.style.height = "100%";
317150
+ svg2.style.overflow = "visible";
317151
+ svg2.style.pointerEvents = "none";
317152
+ const insets = textInsets ?? {
317153
+ top: 0,
317154
+ right: 0,
317155
+ bottom: 0,
317156
+ left: 0
317157
+ };
317158
+ const availableWidth = Math.max(1, width - insets.left - insets.right);
317159
+ const availableHeight = Math.max(1, height - insets.top - insets.bottom);
317160
+ const lines = this.buildWordArtLines(textContent$1, context);
317161
+ const lineHeight = availableHeight / Math.max(lines.length, 1);
317162
+ const fontSize = Math.max(1, lineHeight * WORDART_LINE_FILL_RATIO);
317163
+ const textAnchor = this.getWordArtTextAnchor(textAlign);
317164
+ const textX = this.getWordArtTextX(textAlign, insets.left, availableWidth);
317165
+ lines.forEach((parts, lineIndex) => {
317166
+ if (parts.length === 0)
317167
+ return;
317168
+ const textEl = this.doc.createElementNS(SVG_NS, "text");
317169
+ textEl.setAttribute("xml:space", "preserve");
317170
+ textEl.setAttribute("x", String(textX));
317171
+ textEl.setAttribute("y", String(insets.top + lineHeight * (lineIndex + 0.5)));
317172
+ textEl.setAttribute("text-anchor", textAnchor);
317173
+ textEl.setAttribute("dominant-baseline", "middle");
317174
+ textEl.setAttribute("font-size", String(fontSize));
317175
+ textEl.setAttribute("textLength", String(availableWidth));
317176
+ textEl.setAttribute("lengthAdjust", "spacingAndGlyphs");
317177
+ parts.forEach((part) => {
317178
+ const tspan = this.doc.createElementNS(SVG_NS, "tspan");
317179
+ tspan.setAttribute("xml:space", "preserve");
317180
+ tspan.textContent = part.text;
317181
+ this.applyWordArtTextFormatting(tspan, part.formatting);
317182
+ textEl.appendChild(tspan);
317183
+ });
317184
+ svg2.appendChild(textEl);
317185
+ });
317186
+ return svg2;
317187
+ }
317188
+ buildWordArtLines(textContent$1, context) {
317189
+ const lines = [[]];
317190
+ textContent$1.parts.forEach((part) => {
317191
+ if (part.isLineBreak) {
317192
+ lines.push([]);
317193
+ return;
317194
+ }
317195
+ const resolvedText = this.resolveShapeTextPartText(part, context);
317196
+ if (!resolvedText)
317197
+ return;
317198
+ lines[lines.length - 1].push({
317199
+ text: resolvedText,
317200
+ formatting: part.formatting
317201
+ });
317202
+ });
317203
+ const nonEmptyLines = lines.filter((line) => line.length > 0);
317204
+ return nonEmptyLines.length > 0 ? nonEmptyLines : [[]];
317205
+ }
317206
+ resolveShapeTextPartText(part, context) {
317207
+ if (part.fieldType === "PAGE")
317208
+ return context?.pageNumberText ?? String(context?.pageNumber ?? 1);
317209
+ if (part.fieldType === "NUMPAGES")
317210
+ return String(context?.totalPages ?? 1);
317211
+ return part.text;
317212
+ }
317213
+ getWordArtTextAnchor(textAlign) {
317214
+ if (textAlign === "right" || textAlign === "r")
317215
+ return "end";
317216
+ if (textAlign === "center")
317217
+ return "middle";
317218
+ return "start";
317219
+ }
317220
+ getWordArtTextX(textAlign, leftInset, availableWidth) {
317221
+ if (textAlign === "right" || textAlign === "r")
317222
+ return leftInset + availableWidth;
317223
+ if (textAlign === "center")
317224
+ return leftInset + availableWidth / 2;
317225
+ return leftInset;
317226
+ }
317227
+ applyWordArtTextFormatting(element3, formatting) {
317228
+ if (!formatting)
317229
+ return;
317230
+ if (formatting.bold)
317231
+ element3.setAttribute("font-weight", "bold");
317232
+ if (formatting.italic)
317233
+ element3.setAttribute("font-style", "italic");
317234
+ if (formatting.fontFamily)
317235
+ element3.setAttribute("font-family", formatting.fontFamily);
317236
+ if (formatting.color) {
317237
+ const validatedColor = validateHexColor(formatting.color);
317238
+ if (validatedColor)
317239
+ element3.setAttribute("fill", validatedColor);
317240
+ }
317241
+ if (formatting.letterSpacing != null)
317242
+ element3.setAttribute("letter-spacing", String(formatting.letterSpacing));
317243
+ }
316853
317244
  createFallbackTextElement(textContent$1, textAlign, textVerticalAlign, textInsets, groupScaleX = 1, groupScaleY = 1, context) {
316854
317245
  const textDiv = this.doc.createElement("div");
316855
317246
  textDiv.style.position = "absolute";
@@ -316887,13 +317278,6 @@ function print() { __p += __j.call(arguments, '') }
316887
317278
  currentParagraph.style.width = "100%";
316888
317279
  currentParagraph.style.minWidth = "0";
316889
317280
  currentParagraph.style.whiteSpace = "normal";
316890
- const resolvePartText = (part) => {
316891
- if (part.fieldType === "PAGE")
316892
- return context?.pageNumberText ?? String(context?.pageNumber ?? 1);
316893
- if (part.fieldType === "NUMPAGES")
316894
- return String(context?.totalPages ?? 1);
316895
- return part.text;
316896
- };
316897
317281
  textContent$1.parts.forEach((part) => {
316898
317282
  if (part.isLineBreak) {
316899
317283
  textDiv.appendChild(currentParagraph);
@@ -316905,7 +317289,7 @@ function print() { __p += __j.call(arguments, '') }
316905
317289
  currentParagraph.style.minHeight = "1em";
316906
317290
  } else {
316907
317291
  const span = this.doc.createElement("span");
316908
- span.textContent = resolvePartText(part);
317292
+ span.textContent = this.resolveShapeTextPartText(part, context);
316909
317293
  if (part.formatting) {
316910
317294
  if (part.formatting.bold)
316911
317295
  span.style.fontWeight = "bold";
@@ -318460,6 +318844,20 @@ function print() { __p += __j.call(arguments, '') }
318460
318844
  isAnchoredMediaFragment(fragment2) {
318461
318845
  return (fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true;
318462
318846
  }
318847
+ shouldRenderBehindPageContent(fragment2, section) {
318848
+ if (fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0)
318849
+ return true;
318850
+ return section === "header" && fragment2.kind === "drawing" && this.isHeaderWordArtWatermark(fragment2);
318851
+ }
318852
+ isHeaderWordArtWatermark(fragment2) {
318853
+ const lookup3 = this.blockLookup.get(fragment2.blockId);
318854
+ if (!lookup3 || lookup3.block.kind !== "drawing" || lookup3.block.drawingKind !== "vectorShape")
318855
+ return false;
318856
+ const block = lookup3.block;
318857
+ const attrs = block.attrs ?? {};
318858
+ const hasTextContent = Array.isArray(block.textContent?.parts) && block.textContent.parts.length > 0;
318859
+ return attrs.isWordArt === true && attrs.isTextBox === true && hasTextContent && block.anchor?.isAnchored === true && block.anchor.hRelativeFrom === "page" && block.anchor.alignH === "center" && block.anchor.vRelativeFrom === "page" && block.anchor.alignV === "center" && block.wrap?.type === "None";
318860
+ }
318463
318861
  resolveFragmentWrapperZIndex(fragment2, resolvedZIndex) {
318464
318862
  if (!this.isAnchoredMediaFragment(fragment2))
318465
318863
  return "";
@@ -323901,15 +324299,15 @@ var init_zipper_DbkgrypV_es = __esm(() => {
323901
324299
 
323902
324300
  // ../../packages/superdoc/dist/super-editor.es.js
323903
324301
  var init_super_editor_es = __esm(() => {
323904
- init_src_DlMaB1h_es();
323905
- init_SuperConverter_BgwP1GeS_es();
324302
+ init_src_BvQy1mGL_es();
324303
+ init_SuperConverter_B4pTwmbr_es();
323906
324304
  init_jszip_C49i9kUs_es();
323907
324305
  init_xml_js_CqGKpaft_es();
323908
- init_create_headless_toolbar_Dcw4Hyt2_es();
324306
+ init_create_headless_toolbar_C636gY8A_es();
323909
324307
  init_constants_CGhJRd87_es();
323910
324308
  init_dist_B8HfvhaK_es();
323911
324309
  init_unified_Dsuw2be5_es();
323912
- init_DocxZipper_CaIWmehq_es();
324310
+ init_DocxZipper_BBjEXAFw_es();
323913
324311
  init_eventemitter3_BdNugZrm_es();
323914
324312
  init_errors_CtyzHiH4_es();
323915
324313
  init_zipper_DbkgrypV_es();