@harbour-enterprises/superdoc 1.0.0-beta.40 → 1.0.0-beta.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/chunks/{PdfViewer-B5MRM8r_.es.js → PdfViewer-D_U-y4Wi.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-IpSRU3o0.cjs → PdfViewer-qBKjClah.cjs} +1 -1
  3. package/dist/chunks/{index-B9PZ8RCF.cjs → index-BKvAeQdF.cjs} +3 -3
  4. package/dist/chunks/{index-Dx9W6Dsv-D4FIlgW4.cjs → index-t8thQIOL-CV8VTGI4.cjs} +1 -1
  5. package/dist/chunks/{index-Dx9W6Dsv-DbYj9Ur7.es.js → index-t8thQIOL-vW80ABaR.es.js} +1 -1
  6. package/dist/chunks/{index-CJeY9b_E.es.js → index-to6_YLa7.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-C7wUYMFI.cjs → super-editor.es-BMiadG4G.cjs} +510 -180
  8. package/dist/chunks/{super-editor.es-CGmPt3mY.es.js → super-editor.es-xpC1DWhM.es.js} +510 -180
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-D6IUdu7s.js → converter-OoT4LYwQ.js} +294 -79
  11. package/dist/super-editor/chunks/{docx-zipper-C1WNNxUr.js → docx-zipper-Cf_hIcjC.js} +15 -11
  12. package/dist/super-editor/chunks/{editor-DNmem5Gg.js → editor-CqbtudGQ.js} +204 -93
  13. package/dist/super-editor/chunks/{index-Dx9W6Dsv.js → index-t8thQIOL.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CHc2RUXU.js → toolbar-BsfRAJ0o.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +512 -182
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -18043,7 +18043,7 @@
18043
18043
  encode: encode$Q,
18044
18044
  decode: decode$S
18045
18045
  });
18046
- const validXmlAttributes$j = [attrConfig$s, attrConfig$r];
18046
+ const validXmlAttributes$h = [attrConfig$s, attrConfig$r];
18047
18047
  const XML_NODE_NAME$q = "w:br";
18048
18048
  const SD_NODE_NAME$k = "lineBreak";
18049
18049
  const encode$P = (_2, encodedAttrs) => {
@@ -18079,7 +18079,7 @@
18079
18079
  type: NodeTranslator.translatorTypes.NODE,
18080
18080
  encode: encode$P,
18081
18081
  decode: decode$R,
18082
- attributes: validXmlAttributes$j
18082
+ attributes: validXmlAttributes$h
18083
18083
  };
18084
18084
  const translator$23 = NodeTranslator.from(config$p);
18085
18085
  const encode$O = (attributes) => attributes?.["w:val"];
@@ -18090,7 +18090,7 @@
18090
18090
  encode: encode$O,
18091
18091
  decode: decode$Q
18092
18092
  });
18093
- const validXmlAttributes$i = [attrConfig$q];
18093
+ const validXmlAttributes$g = [attrConfig$q];
18094
18094
  const XML_NODE_NAME$p = "w:highlight";
18095
18095
  const SD_ATTR_KEY$4 = "highlight";
18096
18096
  const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
@@ -18141,7 +18141,7 @@
18141
18141
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
18142
18142
  encode: encode$N,
18143
18143
  decode: decode$P,
18144
- attributes: validXmlAttributes$i
18144
+ attributes: validXmlAttributes$g
18145
18145
  };
18146
18146
  const translator$22 = NodeTranslator.from(config$o);
18147
18147
  const encode$M = (attributes) => {
@@ -18184,7 +18184,7 @@
18184
18184
  encode: encode$K,
18185
18185
  decode: decode$M
18186
18186
  });
18187
- const validXmlAttributes$h = [attrConfig$p, attrConfig$n, attrConfig$o];
18187
+ const validXmlAttributes$f = [attrConfig$p, attrConfig$n, attrConfig$o];
18188
18188
  const XML_NODE_NAME$o = "w:tab";
18189
18189
  const SD_NODE_NAME$j = "tab";
18190
18190
  const encode$J = (_2, encodedAttrs = {}) => {
@@ -18220,7 +18220,7 @@
18220
18220
  type: NodeTranslator.translatorTypes.NODE,
18221
18221
  encode: encode$J,
18222
18222
  decode: decode$L,
18223
- attributes: validXmlAttributes$h
18223
+ attributes: validXmlAttributes$f
18224
18224
  };
18225
18225
  const translator$21 = NodeTranslator.from(config$n);
18226
18226
  const carbonCopy = (obj) => {
@@ -18591,7 +18591,7 @@
18591
18591
  encode: encode$E,
18592
18592
  decode: decode$G
18593
18593
  });
18594
- const validXmlAttributes$g = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
18594
+ const validXmlAttributes$e = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
18595
18595
  const XML_NODE_NAME$n = "w:u";
18596
18596
  const SD_ATTR_KEY$3 = "underline";
18597
18597
  const encode$D = (params2, encodedAttrs = {}) => {
@@ -18643,7 +18643,7 @@
18643
18643
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
18644
18644
  encode: encode$D,
18645
18645
  decode: decode$F,
18646
- attributes: validXmlAttributes$g
18646
+ attributes: validXmlAttributes$e
18647
18647
  };
18648
18648
  const translator$1Z = NodeTranslator.from(config$m);
18649
18649
  const translator$1Y = NodeTranslator.from(createSingleBooleanPropertyHandler("w:strike"));
@@ -18777,7 +18777,7 @@
18777
18777
  ]);
18778
18778
  const XML_NODE_NAME$m = "mc:AlternateContent";
18779
18779
  const SD_NODE_NAME$i = [];
18780
- const validXmlAttributes$f = [];
18780
+ const validXmlAttributes$d = [];
18781
18781
  function encode$C(params2) {
18782
18782
  const { nodeListHandler } = params2;
18783
18783
  const { node: node2 } = params2.extraParams;
@@ -18817,7 +18817,7 @@
18817
18817
  type: NodeTranslator.translatorTypes.NODE,
18818
18818
  encode: encode$C,
18819
18819
  decode: decode$E,
18820
- attributes: validXmlAttributes$f
18820
+ attributes: validXmlAttributes$d
18821
18821
  };
18822
18822
  function selectAlternateContentElements(node2) {
18823
18823
  if (!node2?.elements?.length) {
@@ -18957,7 +18957,7 @@
18957
18957
  };
18958
18958
  const XML_NODE_NAME$l = "w:ins";
18959
18959
  const SD_ATTR_KEY$2 = "trackInsert";
18960
- const validXmlAttributes$e = [
18960
+ const validXmlAttributes$c = [
18961
18961
  createAttributeHandler("w:id", "id"),
18962
18962
  createAttributeHandler("w:date", "date"),
18963
18963
  createAttributeHandler("w:author", "author"),
@@ -19017,7 +19017,7 @@
19017
19017
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
19018
19018
  encode: encode$B,
19019
19019
  decode: decode$D,
19020
- attributes: validXmlAttributes$e
19020
+ attributes: validXmlAttributes$c
19021
19021
  };
19022
19022
  const translator$1w = NodeTranslator.from(config$k);
19023
19023
  const translator$1v = NodeTranslator.from(createSingleIntegerPropertyHandler("w:numId"));
@@ -19211,11 +19211,12 @@
19211
19211
  }
19212
19212
  if (isListNumber) {
19213
19213
  let numberingProps = {};
19214
- if (resolvedPpr?.numberingProperties?.numId != null) {
19214
+ const numId = resolvedPpr?.numberingProperties?.numId;
19215
+ if (numId != null && numId !== 0 && numId !== "0") {
19215
19216
  numberingProps = getNumberingProperties(
19216
19217
  params2,
19217
19218
  resolvedPpr.numberingProperties.ilvl ?? 0,
19218
- resolvedPpr.numberingProperties.numId,
19219
+ numId,
19219
19220
  translator$1N
19220
19221
  );
19221
19222
  }
@@ -19253,9 +19254,13 @@
19253
19254
  let styleProps = inlineProps?.styleId ? resolveStyleChain$1(params2, inlineProps?.styleId, translator$12) : {};
19254
19255
  let numberingProps = {};
19255
19256
  let ilvl = inlineProps?.numberingProperties?.ilvl ?? styleProps?.numberingProperties?.ilvl;
19256
- const numId = inlineProps?.numberingProperties?.numId ?? styleProps?.numberingProperties?.numId;
19257
+ let numId = inlineProps?.numberingProperties?.numId ?? styleProps?.numberingProperties?.numId;
19257
19258
  let numberingDefinedInline = inlineProps?.numberingProperties?.numId != null;
19258
- const isList2 = numId != null;
19259
+ const inlineNumIdDisablesNumbering = inlineProps?.numberingProperties?.numId === 0 || inlineProps?.numberingProperties?.numId === "0";
19260
+ if (inlineNumIdDisablesNumbering) {
19261
+ numId = null;
19262
+ }
19263
+ const isList2 = numId != null && numId !== 0 && numId !== "0";
19259
19264
  if (isList2) {
19260
19265
  ilvl = ilvl != null ? ilvl : 0;
19261
19266
  numberingProps = getNumberingProperties(params2, ilvl, numId, translator$12);
@@ -20396,7 +20401,7 @@
20396
20401
  encode: encode$u,
20397
20402
  decode: decode$w
20398
20403
  });
20399
- const validXmlAttributes$d = [
20404
+ const validXmlAttributes$b = [
20400
20405
  attrConfig$c,
20401
20406
  attrConfig$b,
20402
20407
  attrConfig$f,
@@ -20429,7 +20434,7 @@
20429
20434
  type: NodeTranslator.translatorTypes.NODE,
20430
20435
  encode: encode$t,
20431
20436
  decode: decode$v,
20432
- attributes: validXmlAttributes$d
20437
+ attributes: validXmlAttributes$b
20433
20438
  };
20434
20439
  const translator$11 = NodeTranslator.from(config$j);
20435
20440
  const EAST_ASIAN_CHARACTER_REGEX = /[\u1100-\u11FF\u2E80-\u2EFF\u2F00-\u2FDF\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31BF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u;
@@ -20612,7 +20617,7 @@
20612
20617
  encode: (attributes) => attributes[xmlName],
20613
20618
  decode: (attributes) => attributes[sdName]
20614
20619
  });
20615
- const validXmlAttributes$c = [
20620
+ const validXmlAttributes$a = [
20616
20621
  _createAttributeHandler("w:anchor", "anchor"),
20617
20622
  _createAttributeHandler("w:docLocation", "docLocation"),
20618
20623
  {
@@ -20714,7 +20719,7 @@
20714
20719
  type: NodeTranslator.translatorTypes.NODE,
20715
20720
  encode: encode$s,
20716
20721
  decode: decode$u,
20717
- attributes: validXmlAttributes$c
20722
+ attributes: validXmlAttributes$a
20718
20723
  };
20719
20724
  const translator$10 = NodeTranslator.from(config$i);
20720
20725
  const encode$r = (attributes) => {
@@ -20753,7 +20758,7 @@
20753
20758
  encode: encode$p,
20754
20759
  decode: decode$r
20755
20760
  });
20756
- const validXmlAttributes$b = [attrConfig$a, attrConfig$9, attrConfig$8];
20761
+ const validXmlAttributes$9 = [attrConfig$a, attrConfig$9, attrConfig$8];
20757
20762
  const XML_NODE_NAME$i = "w:r";
20758
20763
  const SD_KEY_NAME = "run";
20759
20764
  const encode$o = (params2, encodedAttrs = {}) => {
@@ -20900,7 +20905,7 @@
20900
20905
  type: NodeTranslator.translatorTypes.NODE,
20901
20906
  encode: encode$o,
20902
20907
  decode: decode$q,
20903
- attributes: validXmlAttributes$b
20908
+ attributes: validXmlAttributes$9
20904
20909
  };
20905
20910
  const translator$$ = NodeTranslator.from(config$h);
20906
20911
  const translator$_ = NodeTranslator.from(createMeasurementPropertyHandler("w:tcW", "cellWidth"));
@@ -21330,7 +21335,7 @@
21330
21335
  }
21331
21336
  const XML_NODE_NAME$h = "w:tc";
21332
21337
  const SD_NODE_NAME$f = "tableCell";
21333
- const validXmlAttributes$a = [];
21338
+ const validXmlAttributes$8 = [];
21334
21339
  function encode$n(params2, encodedAttrs) {
21335
21340
  const {
21336
21341
  node: node2,
@@ -21371,7 +21376,7 @@
21371
21376
  type: NodeTranslator.translatorTypes.NODE,
21372
21377
  encode: encode$n,
21373
21378
  decode: decode$p,
21374
- attributes: validXmlAttributes$a
21379
+ attributes: validXmlAttributes$8
21375
21380
  };
21376
21381
  const translator$G = NodeTranslator.from(config$g);
21377
21382
  const translator$F = NodeTranslator.from({
@@ -21525,7 +21530,7 @@
21525
21530
  };
21526
21531
  const XML_NODE_NAME$g = "w:tr";
21527
21532
  const SD_NODE_NAME$e = "tableRow";
21528
- const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
21533
+ const validXmlAttributes$7 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
21529
21534
  (xmlName) => createAttributeHandler(xmlName)
21530
21535
  );
21531
21536
  const encode$m = (params2, encodedAttrs) => {
@@ -21662,7 +21667,7 @@
21662
21667
  type: NodeTranslator.translatorTypes.NODE,
21663
21668
  encode: encode$m,
21664
21669
  decode: decode$o,
21665
- attributes: validXmlAttributes$9
21670
+ attributes: validXmlAttributes$7
21666
21671
  };
21667
21672
  const translator$v = NodeTranslator.from(config$f);
21668
21673
  function parseTagValueJSON(json) {
@@ -30441,6 +30446,7 @@
30441
30446
  if (!node2) return null;
30442
30447
  const { docx, filename, converter } = params2;
30443
30448
  const attributes = node2?.attributes || {};
30449
+ const { order: order2, originalChildren } = collectPreservedDrawingChildren(node2);
30444
30450
  const padding = {
30445
30451
  top: emuToPixels(attributes?.["distT"]),
30446
30452
  bottom: emuToPixels(attributes?.["distB"]),
@@ -30636,6 +30642,7 @@
30636
30642
  }
30637
30643
  const wrapValue = wrap2;
30638
30644
  const nodeAttrs = {
30645
+ // originalXml: carbonCopy(node),
30639
30646
  src: finalSrc,
30640
30647
  alt: isMetafileExtension(extension) && !wasConverted ? "Unable to render EMF/WMF image" : docPr?.attributes?.name || "Image",
30641
30648
  extension: finalExtension,
@@ -30670,7 +30677,9 @@
30670
30677
  distR: attributes["distR"]
30671
30678
  },
30672
30679
  originalAttributes: node2.attributes,
30673
- rId: relAttributes["Id"]
30680
+ rId: relAttributes["Id"],
30681
+ ...order2.length ? { drawingChildOrder: order2 } : {},
30682
+ ...originalChildren.length ? { originalDrawingChildren: originalChildren } : {}
30674
30683
  };
30675
30684
  return {
30676
30685
  type: "image",
@@ -30695,6 +30704,23 @@
30695
30704
  const fallbackType = textBoxContent ? "textbox" : "drawing";
30696
30705
  return buildShapePlaceholder(node2, size2, padding, marginOffset, fallbackType);
30697
30706
  };
30707
+ function collectPreservedDrawingChildren(node2) {
30708
+ const order2 = [];
30709
+ const original = [];
30710
+ if (!Array.isArray(node2?.elements)) {
30711
+ return { order: order2, originalChildren: original };
30712
+ }
30713
+ node2.elements.forEach((child, index2) => {
30714
+ if (!child) return;
30715
+ const name = child.name ?? null;
30716
+ order2.push(name);
30717
+ original.push({
30718
+ index: index2,
30719
+ xml: carbonCopy(child)
30720
+ });
30721
+ });
30722
+ return { order: order2, originalChildren: original };
30723
+ }
30698
30724
  const handleShapeGroup = (params2, node2, graphicData, size2, padding, marginOffset, anchorData, wrap2) => {
30699
30725
  const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
30700
30726
  if (!wgp) {
@@ -33463,7 +33489,7 @@
33463
33489
  }
33464
33490
  tr.setNodeMarkup(pos, null, newAttrs);
33465
33491
  }
33466
- const generateNewListDefinition = ({ numId, listType, level, start: start2, text: text2, fmt, editor }) => {
33492
+ const generateNewListDefinition = ({ numId, listType, level, start: start2, text: text2, fmt, editor, markerFontFamily }) => {
33467
33493
  if (typeof listType !== "string") listType = listType.name;
33468
33494
  const definition2 = listType === "orderedList" ? baseOrderedListDef : baseBulletList;
33469
33495
  const numbering = editor.converter.numbering;
@@ -33517,6 +33543,29 @@
33517
33543
  }
33518
33544
  }
33519
33545
  ];
33546
+ if (markerFontFamily) {
33547
+ const rPrIndex = levelProps.elements.findIndex((el) => el.name === "w:rPr");
33548
+ let rPr = levelProps.elements[rPrIndex];
33549
+ if (!rPr) {
33550
+ rPr = {
33551
+ type: "element",
33552
+ name: "w:rPr",
33553
+ elements: []
33554
+ };
33555
+ levelProps.elements.push(rPr);
33556
+ }
33557
+ rPr.elements = rPr.elements.filter((el) => el.name !== "w:rFonts");
33558
+ rPr.elements.push({
33559
+ type: "element",
33560
+ name: "w:rFonts",
33561
+ attributes: {
33562
+ "w:ascii": markerFontFamily,
33563
+ "w:hAnsi": markerFontFamily,
33564
+ "w:eastAsia": markerFontFamily,
33565
+ "w:cs": markerFontFamily
33566
+ }
33567
+ });
33568
+ }
33520
33569
  }
33521
33570
  if (!skipAddingNewAbstract) newNumbering.abstracts[newAbstractId] = newAbstractDef;
33522
33571
  const newNumDef = getBasicNumIdTag(numId, newAbstractId);
@@ -33783,8 +33832,8 @@
33783
33832
  }
33784
33833
  return styleMap;
33785
33834
  };
33786
- const extractParagraphStyles = (cssText, className) => {
33787
- const pattern = new RegExp(`\\.(${className})\\s*\\{([^}]+)\\}`, "i");
33835
+ const extractParagraphStyles = (cssText, selector) => {
33836
+ const pattern = new RegExp(`(${selector})\\s*\\{([^}]+)\\}`, "i");
33788
33837
  const match = cssText.match(pattern);
33789
33838
  if (!match) return null;
33790
33839
  const rawStyles = match[2].split(";").map((line) => line.trim()).filter(Boolean);
@@ -33899,7 +33948,7 @@
33899
33948
  cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
33900
33949
  const tempDiv = document.createElement("div");
33901
33950
  tempDiv.innerHTML = cleanedHtml;
33902
- const data = tempDiv.querySelectorAll("p, li");
33951
+ const data = tempDiv.querySelectorAll("p, li, " + [1, 2, 3, 4, 5, 6, 7, 8, 9].map((n) => `h${n}`).join(", "));
33903
33952
  const startMap = {};
33904
33953
  data.forEach((item) => {
33905
33954
  let type2;
@@ -33911,13 +33960,24 @@
33911
33960
  const styleAttr = item.getAttribute("style") || "";
33912
33961
  const msoListMatch = styleAttr.match(/mso-list:\s*l(\d+)\s+level(\d+)\s+lfo(\d+)/);
33913
33962
  const css = tempDiv.querySelector("style").innerHTML;
33914
- const normalStyles = extractParagraphStyles(css, "MsoNormal");
33915
- const paragraphStyles = extractParagraphStyles(css, item.getAttribute("class"));
33916
- let styleChain = { ...normalStyles, ...paragraphStyles };
33963
+ const normalStyles = extractParagraphStyles(css, ".MsoNormal");
33964
+ let styleId = item.getAttribute("class");
33965
+ let charStyles = {};
33966
+ if (item.localName.startsWith("h") && !styleId) {
33967
+ styleId = item.localName;
33968
+ const level = styleId.substring(1);
33969
+ charStyles = extractParagraphStyles(css, `.Heading${level}Char`);
33970
+ } else if (styleId) {
33971
+ styleId = `.${styleId}`;
33972
+ }
33973
+ const paragraphStyles = extractParagraphStyles(css, styleId);
33974
+ let styleChain = { ...normalStyles, ...paragraphStyles, ...charStyles };
33917
33975
  const numberingDefinedInline = !paragraphStyles || !paragraphStyles["mso-list"];
33918
33976
  if (msoListMatch) {
33919
33977
  const [, abstractId, level, numId] = msoListMatch;
33920
33978
  const numberingStyles = extractListLevelStyles(css, abstractId, level, numId) || {};
33979
+ const markerFontFamily = numberingStyles?.["font-family"] ?? normalStyles?.["font-family"];
33980
+ delete numberingStyles["font-family"];
33921
33981
  if (numberingDefinedInline) {
33922
33982
  styleChain = { ...normalStyles, ...paragraphStyles, ...numberingStyles };
33923
33983
  } else {
@@ -33940,6 +34000,7 @@
33940
34000
  if (!startMap[numId]) startMap[numId] = startGetter(item.children[0]?.innerText || "1");
33941
34001
  start2 = startMap[numId];
33942
34002
  }
34003
+ item.setAttribute("data-marker-font-family", markerFontFamily);
33943
34004
  item.setAttribute("data-num-id", numId);
33944
34005
  item.setAttribute("data-list-level", parseInt(level) - 1);
33945
34006
  item.setAttribute("data-start", start2);
@@ -33988,6 +34049,24 @@
33988
34049
  }
33989
34050
  });
33990
34051
  item.setAttribute("data-text-styles", JSON.stringify(textStyles));
34052
+ for (const child of item.children) {
34053
+ if (child.style) {
34054
+ Object.keys(textStyles).forEach((key2) => {
34055
+ const styleValue = textStyles[key2];
34056
+ if (styleValue) {
34057
+ child.style[key2] = styleValue;
34058
+ }
34059
+ });
34060
+ }
34061
+ }
34062
+ }
34063
+ if (resolvedStyle["font-weight"] === "bold") {
34064
+ item.style.fontWeight = "bold";
34065
+ for (const child of item.children) {
34066
+ if (child.style) {
34067
+ child.style.fontWeight = "bold";
34068
+ }
34069
+ }
33991
34070
  }
33992
34071
  extractAndRemoveConditionalPrefix(item);
33993
34072
  });
@@ -34031,6 +34110,7 @@
34031
34110
  const numFmt = item.getAttribute("data-num-fmt");
34032
34111
  const start2 = item.getAttribute("data-start");
34033
34112
  const lvlText = item.getAttribute("data-lvl-text");
34113
+ const markerFontFamily = item.getAttribute("data-marker-font-family");
34034
34114
  const importedId = item.getAttribute("data-num-id");
34035
34115
  if (!mappedLists[importedId]) mappedLists[importedId] = ListHelpers.getNewListId(editor);
34036
34116
  const id = mappedLists[importedId];
@@ -34042,7 +34122,8 @@
34042
34122
  start: start2,
34043
34123
  fmt: numFmt,
34044
34124
  text: lvlText,
34045
- editor
34125
+ editor,
34126
+ markerFontFamily
34046
34127
  });
34047
34128
  if (!lists[id]) lists[id] = { levels: {} };
34048
34129
  const currentListByNumId = lists[id];
@@ -34075,6 +34156,11 @@
34075
34156
  const styleValue = textStyles[key2];
34076
34157
  if (styleValue) {
34077
34158
  pElement.style[key2] = styleValue;
34159
+ for (const child of pElement.children) {
34160
+ if (child.style) {
34161
+ child.style[key2] = styleValue;
34162
+ }
34163
+ }
34078
34164
  }
34079
34165
  });
34080
34166
  }
@@ -36408,11 +36494,71 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36408
36494
  elements: []
36409
36495
  });
36410
36496
  }
36497
+ function mergeDrawingChildren({ order: order2, generated, original }) {
36498
+ const genQueues = groupByName(generated);
36499
+ const originalsByIndex = groupByIndex(original);
36500
+ return mergeWithOrder(order2, genQueues, originalsByIndex);
36501
+ }
36502
+ function groupByIndex(entries = []) {
36503
+ const map2 = /* @__PURE__ */ new Map();
36504
+ entries.forEach((entry) => {
36505
+ if (!entry) return;
36506
+ const { index: index2, xml: xml2 } = entry;
36507
+ if (typeof index2 === "number" && xml2 && xml2.name !== "wp:extent") {
36508
+ map2.set(index2, carbonCopy(xml2));
36509
+ }
36510
+ });
36511
+ return map2;
36512
+ }
36513
+ function mergeWithOrder(order2 = [], genQueues, originalsByIndex) {
36514
+ const out = [];
36515
+ const namesInOrder = new Set(order2);
36516
+ order2.forEach((name, idx) => {
36517
+ if (name === "wp:extent") {
36518
+ const queue3 = genQueues.get("wp:extent") || [];
36519
+ if (queue3.length) {
36520
+ out.push(queue3.shift());
36521
+ if (!queue3.length) genQueues.delete("wp:extent");
36522
+ }
36523
+ return;
36524
+ }
36525
+ if (originalsByIndex.has(idx)) {
36526
+ out.push(originalsByIndex.get(idx));
36527
+ originalsByIndex.delete(idx);
36528
+ if (genQueues.has(name)) {
36529
+ genQueues.delete(name);
36530
+ }
36531
+ return;
36532
+ }
36533
+ const queue2 = genQueues.get(name) || [];
36534
+ if (queue2.length) {
36535
+ out.push(queue2.shift());
36536
+ if (!queue2.length) genQueues.delete(name);
36537
+ }
36538
+ });
36539
+ originalsByIndex.forEach((xml2) => out.push(xml2));
36540
+ genQueues.forEach((queue2, name) => {
36541
+ if (namesInOrder.has(name)) return;
36542
+ queue2.forEach((el) => out.push(el));
36543
+ });
36544
+ return out;
36545
+ }
36546
+ function groupByName(nodes = []) {
36547
+ const map2 = /* @__PURE__ */ new Map();
36548
+ nodes.forEach((el) => {
36549
+ if (!el?.name) return;
36550
+ const list2 = map2.get(el.name) || [];
36551
+ list2.push(carbonCopy(el));
36552
+ map2.set(el.name, list2);
36553
+ });
36554
+ return map2;
36555
+ }
36411
36556
  function translateAnchorNode(params2) {
36412
36557
  const { attrs } = params2.node;
36413
36558
  const anchorElements = [];
36414
- const hasSimplePos = attrs.simplePos || attrs.originalAttributes?.simplePos;
36415
- if (hasSimplePos) {
36559
+ const useOriginalChildren = Array.isArray(attrs.originalDrawingChildren) && attrs.originalDrawingChildren.length > 0;
36560
+ const hasSimplePos = attrs.simplePos !== void 0 || attrs.originalAttributes?.simplePos !== void 0;
36561
+ if (!useOriginalChildren && hasSimplePos) {
36416
36562
  anchorElements.push({
36417
36563
  name: "wp:simplePos",
36418
36564
  attributes: {
@@ -36421,7 +36567,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36421
36567
  }
36422
36568
  });
36423
36569
  }
36424
- if (attrs.anchorData) {
36570
+ if (!useOriginalChildren && attrs.anchorData) {
36425
36571
  const hElements = [];
36426
36572
  if (attrs.marginOffset.horizontal !== void 0) {
36427
36573
  hElements.push({
@@ -36467,25 +36613,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36467
36613
  if (inlineAttrs.relativeHeight == null) {
36468
36614
  inlineAttrs.relativeHeight = 1;
36469
36615
  }
36470
- if (attrs.originalAttributes?.simplePos !== void 0) {
36471
- inlineAttrs.simplePos = attrs.originalAttributes.simplePos;
36472
- } else if (hasSimplePos) {
36616
+ if (attrs.originalAttributes?.simplePos === void 0 && hasSimplePos) {
36473
36617
  inlineAttrs.simplePos = "1";
36474
36618
  }
36475
- if (attrs.originalAttributes?.locked !== void 0) {
36476
- inlineAttrs.locked = attrs.originalAttributes.locked;
36477
- }
36478
- if (attrs.originalAttributes?.layoutInCell !== void 0) {
36479
- inlineAttrs.layoutInCell = attrs.originalAttributes.layoutInCell;
36480
- }
36481
- if (attrs.originalAttributes?.allowOverlap !== void 0) {
36482
- inlineAttrs.allowOverlap = attrs.originalAttributes.allowOverlap;
36483
- }
36484
36619
  const wrapElement = {
36485
36620
  name: `wp:wrap${attrs.wrap?.type || "None"}`
36486
36621
  // Important: wp:anchor will break if no wrapping is specified. We need to use wrapNone.
36487
36622
  };
36488
- switch (attrs.wrap?.type) {
36623
+ switch (useOriginalChildren ? void 0 : attrs.wrap?.type) {
36489
36624
  case "Square":
36490
36625
  wrapElement.attributes = {
36491
36626
  wrapText: attrs.wrap.attrs.wrapText
@@ -36565,15 +36700,33 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36565
36700
  wrapElement,
36566
36701
  ...nodeElements.elements.slice(effectIndex + 1)
36567
36702
  ];
36703
+ const mergedElements = mergeDrawingChildren({
36704
+ order: attrs.drawingChildOrder || [],
36705
+ original: attrs.originalDrawingChildren || [],
36706
+ generated: [...anchorElements, ...elementsWithWrap]
36707
+ });
36568
36708
  return {
36569
36709
  name: "wp:anchor",
36570
36710
  attributes: inlineAttrs,
36571
- elements: [...anchorElements, ...elementsWithWrap]
36711
+ elements: mergedElements
36572
36712
  };
36573
36713
  }
36574
36714
  const XML_NODE_NAME$f = "wp:anchor";
36575
36715
  const SD_NODE_NAME$d = ["image", "shapeGroup", "vectorShape", "contentBlock"];
36576
- const validXmlAttributes$8 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
36716
+ const validXmlAttributes$6 = [
36717
+ "distT",
36718
+ "distB",
36719
+ "distL",
36720
+ "distR",
36721
+ "allowOverlap",
36722
+ "behindDoc",
36723
+ "layoutInCell",
36724
+ "locked",
36725
+ "relativeHeight",
36726
+ "simplePos",
36727
+ "wp14:anchorId",
36728
+ "wp14:editId"
36729
+ ].map((xmlName) => createAttributeHandler(xmlName));
36577
36730
  function encode$l(params2) {
36578
36731
  const { node: node2 } = params2.extraParams;
36579
36732
  if (!node2 || !node2.name) {
@@ -36594,7 +36747,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36594
36747
  type: NodeTranslator.translatorTypes.NODE,
36595
36748
  encode: encode$l,
36596
36749
  decode: decode$n,
36597
- attributes: validXmlAttributes$8
36750
+ attributes: validXmlAttributes$6
36598
36751
  };
36599
36752
  const translator$u = NodeTranslator.from(config$e);
36600
36753
  function handleInlineNode(params2) {
@@ -36605,16 +36758,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36605
36758
  return handleImageNode$1(node2, params2, false);
36606
36759
  }
36607
36760
  function translateInlineNode(params2) {
36761
+ const { attrs } = params2.node;
36608
36762
  const nodeElements = translateImageNode(params2);
36763
+ const inlineAttrs = {
36764
+ ...attrs.originalAttributes || {},
36765
+ ...nodeElements.attributes || {}
36766
+ };
36767
+ const generatedElements = nodeElements?.elements || [];
36768
+ const mergedElements = mergeDrawingChildren({
36769
+ order: params2.node?.attrs?.drawingChildOrder || [],
36770
+ original: params2.node?.attrs?.originalDrawingChildren || [],
36771
+ generated: generatedElements
36772
+ });
36609
36773
  return {
36610
36774
  name: "wp:inline",
36611
- attributes: nodeElements.attributes,
36612
- elements: nodeElements.elements
36775
+ attributes: inlineAttrs,
36776
+ elements: mergedElements
36613
36777
  };
36614
36778
  }
36615
36779
  const XML_NODE_NAME$e = "wp:inline";
36616
36780
  const SD_NODE_NAME$c = ["image", "shapeGroup", "vectorShape", "contentBlock"];
36617
- const validXmlAttributes$7 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
36781
+ const validXmlAttributes$5 = ["distT", "distB", "distL", "distR", "wp14:anchorId", "wp14:editId"].map(
36782
+ (xmlName) => createAttributeHandler(xmlName)
36783
+ );
36618
36784
  function encode$k(params2) {
36619
36785
  const { node: node2 } = params2.extraParams;
36620
36786
  if (!node2 || !node2.name) {
@@ -36635,12 +36801,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36635
36801
  type: NodeTranslator.translatorTypes.NODE,
36636
36802
  encode: encode$k,
36637
36803
  decode: decode$m,
36638
- attributes: validXmlAttributes$7
36804
+ attributes: validXmlAttributes$5
36639
36805
  };
36640
36806
  const translator$t = NodeTranslator.from(config$d);
36641
36807
  const XML_NODE_NAME$d = "w:drawing";
36642
36808
  const SD_NODE_NAME$b = [];
36643
- const validXmlAttributes$6 = [];
36809
+ const validXmlAttributes$4 = [];
36644
36810
  function encode$j(params2) {
36645
36811
  const nodes = params2.nodes;
36646
36812
  const node2 = nodes[0];
@@ -36648,14 +36814,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36648
36814
  "wp:anchor": translator$u,
36649
36815
  "wp:inline": translator$t
36650
36816
  };
36651
- const result = node2.elements.reduce((acc, child) => {
36817
+ const result = (node2.elements || []).reduce((acc, child) => {
36652
36818
  if (acc) return acc;
36653
36819
  const translator2 = translatorByChildName[child.name];
36654
36820
  if (!translator2) return acc;
36655
36821
  const childResult = translator2.encode({ ...params2, extraParams: { node: child } });
36656
36822
  return childResult || acc;
36657
36823
  }, null);
36658
- return result;
36824
+ if (result) return result;
36825
+ return {
36826
+ type: "passthroughBlock",
36827
+ attrs: {
36828
+ originalName: "w:drawing",
36829
+ originalXml: carbonCopy(node2)
36830
+ }
36831
+ };
36659
36832
  }
36660
36833
  function decode$l(params2) {
36661
36834
  const { node: node2 } = params2;
@@ -36678,7 +36851,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36678
36851
  type: NodeTranslator.translatorTypes.NODE,
36679
36852
  encode: encode$j,
36680
36853
  decode: decode$l,
36681
- attributes: validXmlAttributes$6
36854
+ attributes: validXmlAttributes$4
36682
36855
  };
36683
36856
  const translator$s = NodeTranslator.from(config$c);
36684
36857
  function getTextNodeForExport(text2, marks, params2) {
@@ -37509,7 +37682,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37509
37682
  }
37510
37683
  const XML_NODE_NAME$c = "w:sdt";
37511
37684
  const SD_NODE_NAME$a = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
37512
- const validXmlAttributes$5 = [];
37685
+ const validXmlAttributes$3 = [];
37513
37686
  function encode$i(params2) {
37514
37687
  const nodes = params2.nodes;
37515
37688
  const node2 = nodes[0];
@@ -37544,7 +37717,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37544
37717
  type: NodeTranslator.translatorTypes.NODE,
37545
37718
  encode: encode$i,
37546
37719
  decode: decode$k,
37547
- attributes: validXmlAttributes$5
37720
+ attributes: validXmlAttributes$3
37548
37721
  };
37549
37722
  const translator$r = NodeTranslator.from(config$b);
37550
37723
  function preProcessVerticalMergeCells(table2, { editorSchema }) {
@@ -38179,7 +38352,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38179
38352
  encode: encode$b,
38180
38353
  decode: decode$d
38181
38354
  });
38182
- const validXmlAttributes$4 = [attrConfig$7, attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3];
38355
+ const bookmarkStartAttrConfigs = [attrConfig$7, attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3];
38183
38356
  const XML_NODE_NAME$9 = "w:bookmarkStart";
38184
38357
  const SD_NODE_NAME$8 = "bookmarkStart";
38185
38358
  const encode$a = (params2, encodedAttrs = {}) => {
@@ -38204,7 +38377,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38204
38377
  type: NodeTranslator.translatorTypes.NODE,
38205
38378
  encode: encode$a,
38206
38379
  decode: decode$c,
38207
- attributes: validXmlAttributes$4
38380
+ attributes: bookmarkStartAttrConfigs
38208
38381
  };
38209
38382
  const translator$8 = NodeTranslator.from(config$8);
38210
38383
  const encode$9 = (attributes) => {
@@ -38231,7 +38404,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38231
38404
  encode: encode$8,
38232
38405
  decode: decode$a
38233
38406
  });
38234
- const validXmlAttributes$3 = [attrConfig$2, attrConfig$1];
38407
+ const bookmarkEndAttrConfigs = [attrConfig$2, attrConfig$1];
38235
38408
  const XML_NODE_NAME$8 = "w:bookmarkEnd";
38236
38409
  const SD_NODE_NAME$7 = "bookmarkEnd";
38237
38410
  const encode$7 = (params2, encodedAttrs = {}) => {
@@ -38256,7 +38429,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38256
38429
  type: NodeTranslator.translatorTypes.NODE,
38257
38430
  encode: encode$7,
38258
38431
  decode: decode$9,
38259
- attributes: validXmlAttributes$3
38432
+ attributes: bookmarkEndAttrConfigs
38260
38433
  };
38261
38434
  const translator$7 = NodeTranslator.from(config$7);
38262
38435
  const decode$8 = (attrs) => attrs?.["w:id"];
@@ -39222,7 +39395,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39222
39395
  ]);
39223
39396
  const BLOCK_BOUNDARY_NAMES = /* @__PURE__ */ new Set(["w:body", "w:tbl", "w:tc", "w:tr"]);
39224
39397
  const isInlineContext = (path2 = [], currentNodeName) => {
39225
- if (currentNodeName && INLINE_NODE_NAMES.has(currentNodeName)) {
39398
+ const immediateName = currentNodeName ?? path2[path2.length - 1]?.name;
39399
+ if (immediateName && INLINE_NODE_NAMES.has(immediateName)) {
39226
39400
  return true;
39227
39401
  }
39228
39402
  if (!Array.isArray(path2) || path2.length === 0) return false;
@@ -40085,27 +40259,28 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40085
40259
  const fldCharEl = node2.elements?.find((el) => el.name === "w:fldChar");
40086
40260
  const fldType = fldCharEl?.attributes?.["w:fldCharType"];
40087
40261
  const instrTextEl = node2.elements?.find((el) => el.name === "w:instrText");
40262
+ const rawNode = carbonCopy(node2);
40088
40263
  collecting = collectedNodesStack.length > 0;
40089
40264
  if (fldType === "begin") {
40090
40265
  collectedNodesStack.push([]);
40091
- rawCollectedNodesStack.push([node2]);
40266
+ rawCollectedNodesStack.push([rawNode]);
40092
40267
  currentFieldStack.push({ instrText: "" });
40093
40268
  continue;
40094
40269
  }
40095
40270
  if (instrTextEl && collecting && currentFieldStack.length > 0) {
40096
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node2);
40271
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40097
40272
  currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
40098
40273
  continue;
40099
40274
  }
40100
40275
  if (fldType === "end") {
40101
40276
  if (collecting) {
40102
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node2);
40277
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40103
40278
  }
40104
40279
  finalizeField();
40105
40280
  continue;
40106
40281
  } else if (fldType === "separate") {
40107
40282
  if (collecting) {
40108
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node2);
40283
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40109
40284
  }
40110
40285
  continue;
40111
40286
  }
@@ -40116,21 +40291,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40116
40291
  childResult.unpairedBegin.forEach((pendingField) => {
40117
40292
  currentFieldStack.push(pendingField.fieldInfo);
40118
40293
  collectedNodesStack.push([node2]);
40119
- rawCollectedNodesStack.push([node2]);
40294
+ rawCollectedNodesStack.push([rawNode]);
40120
40295
  });
40121
40296
  } else if (childResult.unpairedEnd) {
40122
40297
  collectedNodesStack[collectedNodesStack.length - 1].push(node2);
40123
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node2);
40298
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40124
40299
  finalizeField();
40125
40300
  } else if (collecting) {
40126
40301
  collectedNodesStack[collectedNodesStack.length - 1].push(node2);
40127
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node2);
40302
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40128
40303
  } else {
40129
40304
  processedNodes.push(node2);
40130
40305
  }
40131
40306
  } else if (collecting) {
40132
40307
  collectedNodesStack[collectedNodesStack.length - 1].push(node2);
40133
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node2);
40308
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40134
40309
  } else {
40135
40310
  processedNodes.push(node2);
40136
40311
  }
@@ -40735,8 +40910,48 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40735
40910
  "commentReference",
40736
40911
  "structuredContent"
40737
40912
  ]);
40738
- return content2.filter((node2) => node2 && typeof node2.type === "string" && !INLINE_TYPES.has(node2.type));
40913
+ const PRESERVABLE_INLINE_XML_NAMES = {
40914
+ bookmarkStart: "w:bookmarkStart",
40915
+ bookmarkEnd: "w:bookmarkEnd"
40916
+ };
40917
+ const result = [];
40918
+ content2.forEach((node2) => {
40919
+ if (!node2 || typeof node2.type !== "string") return;
40920
+ const type2 = node2.type;
40921
+ const preservableNodeName = PRESERVABLE_INLINE_XML_NAMES[type2];
40922
+ if (!INLINE_TYPES.has(type2)) {
40923
+ result.push(node2);
40924
+ } else if (preservableNodeName) {
40925
+ const originalXml = buildOriginalXml(type2, node2.attrs, PRESERVABLE_INLINE_XML_NAMES);
40926
+ result.push({
40927
+ type: "passthroughBlock",
40928
+ attrs: {
40929
+ originalName: preservableNodeName,
40930
+ ...originalXml ? { originalXml } : {}
40931
+ }
40932
+ });
40933
+ }
40934
+ });
40935
+ return result;
40739
40936
  }
40937
+ const buildOriginalXml = (type2, attrs, preservableTags) => {
40938
+ const attrConfigsByType = {
40939
+ bookmarkStart: bookmarkStartAttrConfigs,
40940
+ bookmarkEnd: bookmarkEndAttrConfigs
40941
+ };
40942
+ const configs = attrConfigsByType[type2];
40943
+ if (!configs) return null;
40944
+ const xmlAttrs = {};
40945
+ configs.forEach((cfg) => {
40946
+ const val = cfg.decode(attrs || {});
40947
+ if (val !== void 0) {
40948
+ xmlAttrs[cfg.xmlName] = val;
40949
+ }
40950
+ });
40951
+ const attributes = Object.keys(xmlAttrs).length ? xmlAttrs : void 0;
40952
+ const name = preservableTags[type2];
40953
+ return { name, ...attributes ? { attributes } : {}, elements: [] };
40954
+ };
40740
40955
  function collapseWhitespaceNextToInlinePassthrough(content2 = []) {
40741
40956
  if (!Array.isArray(content2) || content2.length === 0) return;
40742
40957
  const sequence = collectInlineSequence(content2);
@@ -41868,7 +42083,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41868
42083
  static getStoredSuperdocVersion(docx) {
41869
42084
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
41870
42085
  }
41871
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.40") {
42086
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.54") {
41872
42087
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
41873
42088
  }
41874
42089
  /**
@@ -44941,19 +45156,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
44941
45156
  const u8 = await zipEntry.async("uint8array");
44942
45157
  const content2 = ensureXmlString(u8);
44943
45158
  this.files.push({ name, content: content2 });
44944
- } else if (name.startsWith("word/media") && name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/" || name.startsWith("media") && name !== "media/") {
45159
+ } else if (name.startsWith("word/media") && name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/" || name.startsWith("media") && name !== "media/" || name.startsWith("word/embeddings") && name !== "word/embeddings/") {
44945
45160
  if (isNode2) {
44946
45161
  const buffer2 = await zipEntry.async("nodebuffer");
44947
45162
  const fileBase64 = buffer2.toString("base64");
44948
45163
  this.mediaFiles[name] = fileBase64;
44949
45164
  } else {
44950
- const blob = await zipEntry.async("blob");
44951
- const extension = this.getFileExtension(name);
44952
45165
  const fileBase64 = await zipEntry.async("base64");
44953
- this.mediaFiles[name] = `data:image/${extension};base64,${fileBase64}`;
44954
- const fileObj = new File([blob], name, { type: blob.type });
44955
- const imageUrl = URL.createObjectURL(fileObj);
44956
- this.media[name] = imageUrl;
45166
+ const extension = this.getFileExtension(name)?.toLowerCase();
45167
+ const imageTypes = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "bmp", "tiff", "emf", "wmf", "svg", "webp"]);
45168
+ if (imageTypes.has(extension)) {
45169
+ this.mediaFiles[name] = `data:image/${extension};base64,${fileBase64}`;
45170
+ const blob = await zipEntry.async("blob");
45171
+ const fileObj = new File([blob], name, { type: blob.type });
45172
+ const imageUrl = URL.createObjectURL(fileObj);
45173
+ this.media[name] = imageUrl;
45174
+ } else {
45175
+ this.mediaFiles[name] = fileBase64;
45176
+ }
44957
45177
  }
44958
45178
  } else if (name.startsWith("word/fonts") && name !== "word/fonts/") {
44959
45179
  const uint8array = await zipEntry.async("uint8array");
@@ -44972,9 +45192,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
44972
45192
  */
44973
45193
  async updateContentTypes(docx, media2, fromJson, updatedDocs = {}) {
44974
45194
  const additionalPartNames = Object.keys(updatedDocs || {});
44975
- const newMediaTypes = Object.keys(media2).map((name) => {
44976
- return this.getFileExtension(name);
44977
- }).filter(Boolean);
45195
+ const imageExts = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "bmp", "tiff", "emf", "wmf", "svg", "webp"]);
45196
+ const newMediaTypes = Object.keys(media2).map((name) => this.getFileExtension(name)).filter((ext) => ext && imageExts.has(ext));
44978
45197
  const contentTypesPath = "[Content_Types].xml";
44979
45198
  let contentTypesXml;
44980
45199
  if (fromJson) {
@@ -66903,7 +67122,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66903
67122
  const shouldSkipNodeView = (editor) => {
66904
67123
  return isHeadless(editor);
66905
67124
  };
66906
- const summaryVersion = "1.0.0-beta.40";
67125
+ const summaryVersion = "1.0.0-beta.54";
66907
67126
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
66908
67127
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
66909
67128
  function mapAttributes(attrs) {
@@ -67692,7 +67911,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67692
67911
  { default: remarkStringify2 },
67693
67912
  { default: remarkGfm2 }
67694
67913
  ] = await Promise.all([
67695
- Promise.resolve().then(() => indexDx9W6Dsv),
67914
+ Promise.resolve().then(() => indexT8thQIOL),
67696
67915
  Promise.resolve().then(() => indexDRCvimau),
67697
67916
  Promise.resolve().then(() => indexC_x_N6Uh),
67698
67917
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -67897,7 +68116,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67897
68116
  * Process collaboration migrations
67898
68117
  */
67899
68118
  processCollaborationMigrations() {
67900
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.40");
68119
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.54");
67901
68120
  if (!this.options.ydoc) return;
67902
68121
  const metaMap = this.options.ydoc.getMap("meta");
67903
68122
  let docVersion = metaMap.get("version");
@@ -70356,8 +70575,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70356
70575
  const hanging = ptToPx(indent2.hanging);
70357
70576
  if (left2 != null && left2 !== 0) result.left = left2;
70358
70577
  if (right2 != null && right2 !== 0) result.right = right2;
70359
- if (firstLine != null && firstLine !== 0) result.firstLine = firstLine;
70360
- if (hanging != null && hanging !== 0) result.hanging = hanging;
70578
+ if (firstLine != null) result.firstLine = firstLine;
70579
+ if (hanging != null) result.hanging = hanging;
70361
70580
  return Object.keys(result).length > 0 ? result : void 0;
70362
70581
  };
70363
70582
  const normalizeAlignment = (value) => {
@@ -70444,7 +70663,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70444
70663
  }
70445
70664
  });
70446
70665
  if (!values.length) return void 0;
70447
- const looksLikeTwips = values.some((val) => val >= 50 || Math.abs(val % 15) < 1e-6);
70666
+ const looksLikeTwips = values.some((val) => val >= 50 || val !== 0 && Math.abs(val % 15) < 1e-6);
70448
70667
  if (looksLikeTwips) {
70449
70668
  return void 0;
70450
70669
  }
@@ -71329,6 +71548,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71329
71548
  const firstLinePx = indent2.firstLine;
71330
71549
  const defaultTabIntervalPx = resolveDefaultTabIntervalPx(paragraph2.tabIntervalTwips, docDefaults);
71331
71550
  const tabsPx = tabs.map((tab) => tab.position);
71551
+ const hasFirstLineIndent = indent2.firstLine != null && Number.isFinite(indent2.firstLine) && indent2.firstLine > 0 && !indent2.hanging;
71332
71552
  const layout = {
71333
71553
  indentLeftPx,
71334
71554
  hangingPx: Math.max(hangingPxRaw, 0),
@@ -71352,9 +71572,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71352
71572
  });
71353
71573
  const markerText = numbering.markerText ?? formatMarkerText(numbering);
71354
71574
  const glyphWidthPx = measurement?.measureText && markerText ? measurement.measureText(markerText, buildFontCss(markerRun), { letterSpacing: markerRun.letterSpacing }) : void 0;
71355
- const markerBoxWidthPx = resolveMarkerBoxWidth(hangingPxRaw, glyphWidthPx);
71356
- const markerX = indentLeftPx - markerBoxWidthPx;
71357
- layout.hangingPx = markerBoxWidthPx;
71575
+ let markerBoxWidthPx;
71576
+ let markerX;
71577
+ if (hasFirstLineIndent) {
71578
+ markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$2 : DEFAULT_LIST_HANGING_PX$1;
71579
+ markerX = indentLeftPx + (firstLinePx ?? 0);
71580
+ layout.textStartPx = markerX + markerBoxWidthPx;
71581
+ layout.hangingPx = 0;
71582
+ layout.firstLineIndentMode = true;
71583
+ } else {
71584
+ markerBoxWidthPx = resolveMarkerBoxWidth(hangingPxRaw, glyphWidthPx);
71585
+ markerX = indentLeftPx - markerBoxWidthPx;
71586
+ layout.hangingPx = markerBoxWidthPx;
71587
+ }
71358
71588
  layout.marker = buildMarkerLayout({
71359
71589
  numbering,
71360
71590
  markerText,
@@ -71946,6 +72176,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71946
72176
  };
71947
72177
  const { resolveSpacingIndent } = Engines;
71948
72178
  const DEFAULT_DECIMAL_SEPARATOR$2 = ".";
72179
+ const isValidNumberingId = (numId) => {
72180
+ return numId != null && numId !== 0 && numId !== "0";
72181
+ };
71949
72182
  const asOoxmlElement = (value) => {
71950
72183
  if (!value || typeof value !== "object") return void 0;
71951
72184
  const element2 = value;
@@ -72438,9 +72671,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72438
72671
  let effectiveIndent = paragraphAttrs.indent;
72439
72672
  if (numberingProps?.resolvedLevelIndent) {
72440
72673
  const resolvedIndentPx = convertIndentTwipsToPx(numberingProps.resolvedLevelIndent);
72674
+ const numberingIndent = resolvedIndentPx ?? numberingProps.resolvedLevelIndent;
72441
72675
  effectiveIndent = {
72442
- ...paragraphAttrs.indent,
72443
- ...resolvedIndentPx ?? numberingProps.resolvedLevelIndent
72676
+ ...numberingIndent,
72677
+ ...paragraphAttrs.indent
72444
72678
  };
72445
72679
  }
72446
72680
  const resolvedTabs = toResolvedTabStops(paragraphAttrs.tabs);
@@ -72602,11 +72836,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72602
72836
  } else if (computed2.paragraph.alignment) {
72603
72837
  paragraphAttrs.alignment = computed2.paragraph.alignment;
72604
72838
  }
72605
- const isJustified = paragraphAttrs.alignment === "justify";
72606
- const hasFirstLineIndent = normalizedIndent?.firstLine && normalizedIndent.firstLine > 0;
72607
- if (isJustified && hasFirstLineIndent) {
72608
- paragraphAttrs.suppressFirstLineIndent = true;
72609
- }
72610
72839
  const spacingPx = spacingPtToPx(spacing, normalizedSpacing);
72611
72840
  if (spacingPx) paragraphAttrs.spacing = spacingPx;
72612
72841
  if (normalizedSpacing?.beforeAutospacing != null || normalizedSpacing?.afterAutospacing != null) {
@@ -72745,7 +72974,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72745
72974
  }
72746
72975
  const numberingSource = attrs.numberingProperties ?? paragraphProps.numberingProperties ?? hydrated?.numberingProperties;
72747
72976
  const rawNumberingProps = toAdapterNumberingProps(numberingSource);
72748
- if (rawNumberingProps) {
72977
+ const hasValidNumbering = rawNumberingProps && isValidNumberingId(rawNumberingProps.numId);
72978
+ if (hasValidNumbering) {
72749
72979
  const numberingProps = rawNumberingProps;
72750
72980
  const numId = numberingProps.numId;
72751
72981
  const ilvl = Number.isFinite(numberingProps.ilvl) ? Math.max(0, Math.floor(Number(numberingProps.ilvl))) : 0;
@@ -79043,6 +79273,50 @@ ${l}
79043
79273
  const hasPmEnd = fragment.pmEnd != null;
79044
79274
  globalValidationStats.record(hasPmStart, hasPmEnd);
79045
79275
  }
79276
+ function isMinimalWordLayout(value) {
79277
+ if (typeof value !== "object" || value === null) {
79278
+ return false;
79279
+ }
79280
+ const obj = value;
79281
+ if (obj.marker !== void 0) {
79282
+ if (typeof obj.marker !== "object" || obj.marker === null) {
79283
+ return false;
79284
+ }
79285
+ const marker = obj.marker;
79286
+ if (marker.markerX !== void 0 && typeof marker.markerX !== "number") {
79287
+ return false;
79288
+ }
79289
+ if (marker.textStartX !== void 0 && typeof marker.textStartX !== "number") {
79290
+ return false;
79291
+ }
79292
+ }
79293
+ if (obj.indentLeftPx !== void 0) {
79294
+ if (typeof obj.indentLeftPx !== "number") {
79295
+ return false;
79296
+ }
79297
+ }
79298
+ if (obj.firstLineIndentMode !== void 0) {
79299
+ if (typeof obj.firstLineIndentMode !== "boolean") {
79300
+ return false;
79301
+ }
79302
+ }
79303
+ if (obj.textStartPx !== void 0) {
79304
+ if (typeof obj.textStartPx !== "number") {
79305
+ return false;
79306
+ }
79307
+ }
79308
+ if (obj.tabsPx !== void 0) {
79309
+ if (!Array.isArray(obj.tabsPx)) {
79310
+ return false;
79311
+ }
79312
+ for (const tab of obj.tabsPx) {
79313
+ if (typeof tab !== "number") {
79314
+ return false;
79315
+ }
79316
+ }
79317
+ }
79318
+ return true;
79319
+ }
79046
79320
  const LIST_MARKER_GAP$1 = 8;
79047
79321
  const DEFAULT_TAB_INTERVAL_PX$1 = 48;
79048
79322
  const COMMENT_EXTERNAL_COLOR = "#B1124B";
@@ -79804,7 +80078,7 @@ ${l}
79804
80078
  }
79805
80079
  const block = lookup2.block;
79806
80080
  const measure = lookup2.measure;
79807
- const wordLayout = block.attrs?.wordLayout;
80081
+ const wordLayout = isMinimalWordLayout(block.attrs?.wordLayout) ? block.attrs.wordLayout : void 0;
79808
80082
  const fragmentEl = this.doc.createElement("div");
79809
80083
  fragmentEl.classList.add(CLASS_NAMES$1.fragment);
79810
80084
  const isTocEntry = block.attrs?.isTocEntry;
@@ -79845,11 +80119,11 @@ ${l}
79845
80119
  const paraIndentRight = paraIndent?.right ?? 0;
79846
80120
  const suppressFirstLineIndent = block.attrs?.suppressFirstLineIndent === true;
79847
80121
  const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
79848
- const isListParagraph = !!(fragment.markerWidth && wordLayout?.marker);
79849
80122
  const lastRun = block.runs.length > 0 ? block.runs[block.runs.length - 1] : null;
79850
80123
  const paragraphEndsWithLineBreak = lastRun?.kind === "lineBreak";
79851
80124
  lines.forEach((line, index2) => {
79852
- const availableWidthOverride = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
80125
+ const fallbackAvailableWidth = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
80126
+ const availableWidthOverride = line.maxWidth ?? fallbackAvailableWidth;
79853
80127
  const isLastLineOfFragment = index2 === lines.length - 1;
79854
80128
  const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
79855
80129
  const shouldSkipJustifyForLastLine = isLastLineOfParagraph && !paragraphEndsWithLineBreak;
@@ -79859,7 +80133,7 @@ ${l}
79859
80133
  context,
79860
80134
  availableWidthOverride,
79861
80135
  fragment.fromLine + index2,
79862
- isListParagraph || shouldSkipJustifyForLastLine
80136
+ shouldSkipJustifyForLastLine
79863
80137
  );
79864
80138
  const isListFirstLine = index2 === 0 && !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
79865
80139
  const hasExplicitSegmentPositioning = line.segments?.some((seg) => seg.x !== void 0);
@@ -79883,8 +80157,17 @@ ${l}
79883
80157
  lineEl.style.textIndent = "0px";
79884
80158
  }
79885
80159
  if (isListFirstLine && wordLayout?.marker && fragment.markerWidth) {
79886
- const markerStartPos = paraIndentLeft - (paraIndent?.hanging ?? 0);
79887
- lineEl.style.paddingLeft = `${markerStartPos}px`;
80160
+ const isFirstLineIndentMode = wordLayout.firstLineIndentMode === true;
80161
+ let markerStartPos;
80162
+ if (isFirstLineIndentMode && wordLayout.marker.markerX !== void 0 && Number.isFinite(wordLayout.marker.markerX)) {
80163
+ markerStartPos = wordLayout.marker.markerX;
80164
+ } else if (isFirstLineIndentMode) {
80165
+ markerStartPos = paraIndentLeft + (paraIndent?.firstLine ?? 0);
80166
+ } else {
80167
+ markerStartPos = paraIndentLeft - (paraIndent?.hanging ?? 0);
80168
+ }
80169
+ const validMarkerStartPos = Number.isFinite(markerStartPos) ? markerStartPos : 0;
80170
+ lineEl.style.paddingLeft = `${validMarkerStartPos}px`;
79888
80171
  const markerContainer = this.doc.createElement("span");
79889
80172
  markerContainer.style.display = "inline-block";
79890
80173
  const markerEl = this.doc.createElement("span");
@@ -79900,7 +80183,7 @@ ${l}
79900
80183
  if (markerJustification === "left") {
79901
80184
  markerContainer.style.position = "relative";
79902
80185
  } else {
79903
- const markerLeftX = markerStartPos - fragment.markerWidth;
80186
+ const markerLeftX = validMarkerStartPos - fragment.markerWidth;
79904
80187
  markerContainer.style.position = "absolute";
79905
80188
  markerContainer.style.left = `${markerLeftX}px`;
79906
80189
  markerContainer.style.top = "0";
@@ -79925,12 +80208,36 @@ ${l}
79925
80208
  const markerBoxWidth = fragment.markerWidth;
79926
80209
  const markerTextWidth = fragment.markerTextWidth != null && isFinite(fragment.markerTextWidth) && fragment.markerTextWidth >= 0 ? fragment.markerTextWidth : markerBoxWidth;
79927
80210
  if ((wordLayout.marker.justification ?? "left") === "left") {
79928
- const currentPos = markerStartPos + markerTextWidth;
79929
- const implicitTabStop = paraIndentLeft;
79930
- tabWidth = implicitTabStop - currentPos;
79931
- if (tabWidth < 1) {
79932
- tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
79933
- if (tabWidth === 0) tabWidth = DEFAULT_TAB_INTERVAL_PX$1;
80211
+ const currentPos = validMarkerStartPos + markerTextWidth;
80212
+ if (isFirstLineIndentMode) {
80213
+ const explicitTabs = wordLayout.tabsPx;
80214
+ let targetTabStop;
80215
+ if (Array.isArray(explicitTabs) && explicitTabs.length > 0) {
80216
+ for (const tab of explicitTabs) {
80217
+ if (typeof tab === "number" && tab > currentPos) {
80218
+ targetTabStop = tab;
80219
+ break;
80220
+ }
80221
+ }
80222
+ }
80223
+ const textStartTarget = wordLayout.marker.textStartX !== void 0 && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : wordLayout.textStartPx;
80224
+ if (targetTabStop !== void 0) {
80225
+ tabWidth = targetTabStop - currentPos;
80226
+ } else if (textStartTarget !== void 0 && Number.isFinite(textStartTarget) && textStartTarget > currentPos) {
80227
+ tabWidth = textStartTarget - currentPos;
80228
+ } else {
80229
+ tabWidth = LIST_MARKER_GAP$1;
80230
+ }
80231
+ if (tabWidth < LIST_MARKER_GAP$1) {
80232
+ tabWidth = LIST_MARKER_GAP$1;
80233
+ }
80234
+ } else {
80235
+ const implicitTabStop = paraIndentLeft;
80236
+ tabWidth = implicitTabStop - currentPos;
80237
+ if (tabWidth < 1) {
80238
+ tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
80239
+ if (tabWidth === 0) tabWidth = DEFAULT_TAB_INTERVAL_PX$1;
80240
+ }
79934
80241
  }
79935
80242
  } else {
79936
80243
  tabWidth = fragment.markerGutter != null && isFinite(fragment.markerGutter) ? fragment.markerGutter : typeof wordLayout.marker.gutterWidthPx === "number" && isFinite(wordLayout.marker.gutterWidthPx) && wordLayout.marker.gutterWidthPx > 0 ? wordLayout.marker.gutterWidthPx : LIST_MARKER_GAP$1;
@@ -83902,8 +84209,13 @@ ${l}
83902
84209
  toLineByCell.push(cutLine);
83903
84210
  heightByCell.push(cumulativeHeight);
83904
84211
  }
83905
- const positiveHeights = heightByCell.filter((h2) => h2 > 0);
83906
- const minHeight = positiveHeights.length > 0 ? Math.min(...positiveHeights) : 0;
84212
+ const allCellsCompleteInFirstPass = toLineByCell.every((cutLine, idx) => {
84213
+ const totalLines = getCellTotalLines(row2.cells[idx]);
84214
+ return cutLine >= totalLines;
84215
+ });
84216
+ const lineAdvancements = toLineByCell.map((cutLine, idx) => cutLine - (startLines[idx] || 0));
84217
+ const positiveAdvancements = lineAdvancements.filter((adv) => adv > 0);
84218
+ const minLineAdvancement = positiveAdvancements.length > 0 ? Math.min(...positiveAdvancements) : 0;
83907
84219
  let actualPartialHeight = 0;
83908
84220
  let maxPaddingTotal = 0;
83909
84221
  for (let cellIdx = 0; cellIdx < cellCount; cellIdx++) {
@@ -83913,18 +84225,17 @@ ${l}
83913
84225
  const cellPadding = cellPaddings[cellIdx];
83914
84226
  const paddingTotal = cellPadding.top + cellPadding.bottom;
83915
84227
  maxPaddingTotal = Math.max(maxPaddingTotal, paddingTotal);
83916
- let cumulativeHeight = 0;
83917
- let cutLine = startLine;
83918
- for (let i2 = startLine; i2 < lines.length; i2++) {
83919
- const lineHeight2 = lines[i2].lineHeight || 0;
83920
- if (cumulativeHeight + lineHeight2 > minHeight) {
83921
- break;
84228
+ if (allCellsCompleteInFirstPass) {
84229
+ actualPartialHeight = Math.max(actualPartialHeight, heightByCell[cellIdx] + paddingTotal);
84230
+ } else {
84231
+ const targetLine = Math.min(startLine + minLineAdvancement, lines.length);
84232
+ let cumulativeHeight = 0;
84233
+ for (let i2 = startLine; i2 < targetLine; i2++) {
84234
+ cumulativeHeight += lines[i2].lineHeight || 0;
83922
84235
  }
83923
- cumulativeHeight += lineHeight2;
83924
- cutLine = i2 + 1;
84236
+ toLineByCell[cellIdx] = targetLine;
84237
+ actualPartialHeight = Math.max(actualPartialHeight, cumulativeHeight + paddingTotal);
83925
84238
  }
83926
- toLineByCell[cellIdx] = cutLine;
83927
- actualPartialHeight = Math.max(actualPartialHeight, cumulativeHeight + paddingTotal);
83928
84239
  }
83929
84240
  const madeProgress = toLineByCell.some((cutLine, idx) => cutLine > (startLines[idx] || 0));
83930
84241
  const isFirstPart = startLines.every((l) => l === 0);
@@ -84152,7 +84463,6 @@ ${l}
84152
84463
  } else if (!madeProgress && hadRemainingLinesBefore) {
84153
84464
  state2 = advanceColumn(state2);
84154
84465
  } else {
84155
- state2 = advanceColumn(state2);
84156
84466
  pendingPartialRow = continuationPartialRow;
84157
84467
  }
84158
84468
  isTableContinuation = true;
@@ -98912,6 +99222,52 @@ ${l}
98912
99222
  }
98913
99223
  });
98914
99224
  }
99225
+ function parseAttrs(node2) {
99226
+ const numberingProperties = {};
99227
+ let indent2, spacing;
99228
+ const { styleid: styleId, ...extraAttrs } = Array.from(node2.attributes).reduce((acc, attr) => {
99229
+ if (attr.name === "data-num-id") {
99230
+ numberingProperties.numId = parseInt(attr.value);
99231
+ } else if (attr.name === "data-level") {
99232
+ numberingProperties.ilvl = parseInt(attr.value);
99233
+ } else if (attr.name === "data-indent") {
99234
+ try {
99235
+ indent2 = JSON.parse(attr.value);
99236
+ Object.keys(indent2).forEach((key2) => {
99237
+ indent2[key2] = Number(indent2[key2]);
99238
+ });
99239
+ } catch {
99240
+ }
99241
+ } else if (attr.name === "data-spacing") {
99242
+ try {
99243
+ spacing = JSON.parse(attr.value);
99244
+ Object.keys(spacing).forEach((key2) => {
99245
+ spacing[key2] = Number(spacing[key2]);
99246
+ });
99247
+ } catch {
99248
+ }
99249
+ } else {
99250
+ acc[attr.name] = attr.value;
99251
+ }
99252
+ return acc;
99253
+ }, {});
99254
+ let attrs = {
99255
+ paragraphProperties: {
99256
+ styleId: styleId || null
99257
+ },
99258
+ extraAttrs
99259
+ };
99260
+ if (indent2 && Object.keys(indent2).length > 0) {
99261
+ attrs.paragraphProperties.indent = indent2;
99262
+ }
99263
+ if (spacing && Object.keys(spacing).length > 0) {
99264
+ attrs.paragraphProperties.spacing = spacing;
99265
+ }
99266
+ if (Object.keys(numberingProperties).length > 0) {
99267
+ attrs.paragraphProperties.numberingProperties = numberingProperties;
99268
+ }
99269
+ return attrs;
99270
+ }
98915
99271
  const bulletInputRegex = /^\s*([-+*])\s$/;
98916
99272
  const orderedInputRegex = /^(\d+)\.\s$/;
98917
99273
  const Paragraph = OxmlNode.create({
@@ -98981,50 +99337,7 @@ ${l}
98981
99337
  return [
98982
99338
  {
98983
99339
  tag: "p",
98984
- getAttrs: (node2) => {
98985
- const numberingProperties = {};
98986
- let indent2, spacing;
98987
- const { styleid: styleId, ...extraAttrs } = Array.from(node2.attributes).reduce((acc, attr) => {
98988
- if (attr.name === "data-num-id") {
98989
- numberingProperties.numId = parseInt(attr.value);
98990
- } else if (attr.name === "data-level") {
98991
- numberingProperties.ilvl = parseInt(attr.value);
98992
- } else if (attr.name === "data-indent") {
98993
- try {
98994
- indent2 = JSON.parse(attr.value);
98995
- Object.keys(indent2).forEach((key2) => {
98996
- indent2[key2] = Number(indent2[key2]);
98997
- });
98998
- } catch {
98999
- }
99000
- } else if (attr.name === "data-spacing") {
99001
- try {
99002
- spacing = JSON.parse(attr.value);
99003
- Object.keys(spacing).forEach((key2) => {
99004
- spacing[key2] = Number(spacing[key2]);
99005
- });
99006
- } catch {
99007
- }
99008
- } else {
99009
- acc[attr.name] = attr.value;
99010
- }
99011
- return acc;
99012
- }, {});
99013
- if (Object.keys(numberingProperties).length > 0) {
99014
- return {
99015
- paragraphProperties: {
99016
- numberingProperties,
99017
- indent: indent2,
99018
- spacing,
99019
- styleId: styleId || null
99020
- },
99021
- extraAttrs
99022
- };
99023
- }
99024
- return {
99025
- extraAttrs
99026
- };
99027
- }
99340
+ getAttrs: parseAttrs
99028
99341
  },
99029
99342
  {
99030
99343
  tag: "div",
@@ -99042,7 +99355,16 @@ ${l}
99042
99355
  },
99043
99356
  ...this.options.headingLevels.map((level) => ({
99044
99357
  tag: `h${level}`,
99045
- attrs: { level, paragraphProperties: { styleId: `Heading${level}` } }
99358
+ getAttrs: (node2) => {
99359
+ let attrs = parseAttrs(node2);
99360
+ return {
99361
+ ...attrs,
99362
+ paragraphProperties: {
99363
+ ...attrs.paragraphProperties,
99364
+ styleId: `Heading${level}`
99365
+ }
99366
+ };
99367
+ }
99046
99368
  }))
99047
99369
  ];
99048
99370
  },
@@ -105533,6 +105855,14 @@ ${l}
105533
105855
  if (!style2) return {};
105534
105856
  return { style: style2 };
105535
105857
  }
105858
+ },
105859
+ drawingChildOrder: {
105860
+ default: null,
105861
+ rendered: false
105862
+ },
105863
+ originalDrawingChildren: {
105864
+ default: null,
105865
+ rendered: false
105536
105866
  }
105537
105867
  };
105538
105868
  },
@@ -110147,11 +110477,11 @@ ${l}
110147
110477
  break;
110148
110478
  }
110149
110479
  const [left2, right2] = direction < 0 ? [neighbor, currentChange] : [currentChange, neighbor];
110150
- if (!areDirectlyConnected(left2, right2)) {
110151
- break;
110152
- }
110153
110480
  const sharesId = neighbor.mark.attrs.id === matchingId;
110154
110481
  const complementary = isComplementaryPair(currentChange.mark.type.name, neighbor.mark.type.name);
110482
+ if (!sharesId && !areDirectlyConnected(left2, right2)) {
110483
+ break;
110484
+ }
110155
110485
  if (!sharesId && !complementary) {
110156
110486
  break;
110157
110487
  }
@@ -148333,7 +148663,7 @@ ${style2}
148333
148663
  this.config.colors = shuffleArray(this.config.colors);
148334
148664
  this.userColorMap = /* @__PURE__ */ new Map();
148335
148665
  this.colorIndex = 0;
148336
- this.version = "1.0.0-beta.40";
148666
+ this.version = "1.0.0-beta.54";
148337
148667
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
148338
148668
  this.superdocId = config2.superdocId || v4();
148339
148669
  this.colors = this.config.colors;
@@ -150799,7 +151129,7 @@ ${style2}
150799
151129
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
150800
151130
  );
150801
151131
  }
150802
- const indexDx9W6Dsv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
151132
+ const indexT8thQIOL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
150803
151133
  __proto__: null,
150804
151134
  unified
150805
151135
  }, Symbol.toStringTag, { value: "Module" }));