oasis-editor 0.0.158 → 0.0.160

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.
@@ -3,5 +3,13 @@ declare module "./nodes.js" {
3
3
  /** Enclosing inline `w:sdt` content controls, outermost first. */
4
4
  sdtWrappers?: EditorSdtBlockWrapper[];
5
5
  }
6
+ interface EditorTableRowNode {
7
+ /** Enclosing row-level `w:sdt` content controls, outermost first. */
8
+ sdtWrappers?: EditorSdtBlockWrapper[];
9
+ }
10
+ interface EditorTableCellNode {
11
+ /** Enclosing cell-level `w:sdt` content controls, outermost first. */
12
+ sdtWrappers?: EditorSdtBlockWrapper[];
13
+ }
6
14
  }
7
15
  export {};
@@ -1,10 +1,4 @@
1
1
  import { EditorTableNode } from '../../core/model.js';
2
2
  import { SerializeTableParagraphXml } from './tableXml.js';
3
3
 
4
- /**
5
- * Serializes a table canonically and then overlays source-backed table, row and
6
- * cell property containers. Text/content stays authoritative from the editor;
7
- * source attributes, extension children and unknown property children survive
8
- * while relationship-bearing fragments continue to use the conservative path.
9
- */
10
4
  export declare function serializeTableXmlPreservingSource(table: EditorTableNode, serializeParagraphXml: SerializeTableParagraphXml): string;
@@ -0,0 +1,9 @@
1
+ import { Element as XmlElement } from '@xmldom/xmldom';
2
+ import { EditorTableNode } from '../../core/model.js';
3
+
4
+ /**
5
+ * Rebuilds row-level and cell-level `w:sdt` envelopes after canonical table
6
+ * serialization and source-property overlay have completed. Structural wrappers
7
+ * therefore do not interfere with the existing row/cell property pipeline.
8
+ */
9
+ export declare function wrapTableStructuralSdts(table: EditorTableNode, tableElement: XmlElement): void;
@@ -0,0 +1,13 @@
1
+ import { Element as XmlElement } from '@xmldom/xmldom';
2
+ import { EditorSdtBlockWrapper } from '../../core/model.js';
3
+
4
+ export interface SdtWrappedWordChild {
5
+ element: XmlElement;
6
+ sdtWrappers?: EditorSdtBlockWrapper[];
7
+ }
8
+ /**
9
+ * Collects direct Word children while transparently unwrapping any intervening
10
+ * `w:sdt/w:sdtContent` containers. Wrapper metadata is returned outermost-first
11
+ * so the canonical exporter can rebuild nested structural content controls.
12
+ */
13
+ export declare function collectSdtWrappedWordChildren(container: XmlElement, localName: string): SdtWrappedWordChild[];
@@ -4,23 +4,16 @@ export declare const WORD_NS = "http://schemas.openxmlformats.org/wordprocessing
4
4
  export declare const DRAWINGML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
5
5
  export declare const OFFICE_REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
6
6
  export declare const WORD14_NS = "http://schemas.microsoft.com/office/word/2010/wordml";
7
+ export declare const WORD15_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
7
8
  export declare function getChildrenByTagNameNS(element: XmlElement | null | undefined, namespace: string, localName: string): XmlElement[];
8
9
  export type DocxTextDirection = "lrTb" | "tbRl" | "btLr" | "lrTbV" | "tbRlV";
9
- /** Validate a raw `w:textDirection/@w:val` token, or return undefined. */
10
10
  export declare function parseTextDirection(value: string | null | undefined): DocxTextDirection | undefined;
11
11
  export declare function getFirstChildByTagNameNS(element: XmlElement | null | undefined, namespace: string, localName: string): XmlElement | null;
12
- /**
13
- * Finds a direct `w14:localName` child using a Markup Compatibility capability
14
- * profile that explicitly understands the w14 namespace. The generic child
15
- * helpers remain conservative and continue to consume mc:Fallback instead.
16
- */
17
12
  export declare function getFirstW14Child(element: XmlElement | null | undefined, localName: string): XmlElement | null;
13
+ /** Finds a direct Word 2013 (`w15`) child while honoring MC choice semantics. */
14
+ export declare function getFirstW15Child(element: XmlElement | null | undefined, localName: string): XmlElement | null;
18
15
  export declare function getAttributeValue(element: XmlElement | null, localName: string): string | null;
19
16
  export declare function findElementDeep(element: XmlElement, localName: string): XmlElement | null;
20
- /**
21
- * Collects non-WORD_NS extension attributes (e.g. `w14:paraId`, `w15:*`) from
22
- * a table/row/cell element for round-trip preservation.
23
- */
24
17
  export declare function collectExtAttributes(element: XmlElement): Record<string, string> | undefined;
25
18
  export declare function isWordTrue(value: string | null | undefined): boolean;
26
19
  export declare function parseOnOffProperty(parent: XmlElement, localName: string): boolean | undefined;
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
2863
2863
  onCleanup(() => {
2864
2864
  cancelled = true;
2865
2865
  });
2866
- import("./OasisEditorApp-D8XC2a93.js").then((m) => {
2866
+ import("./OasisEditorApp-xJcUlIac.js").then((m) => {
2867
2867
  cancelled = true;
2868
2868
  setProgress(1);
2869
2869
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -35962,10 +35962,15 @@ const WORD_NS$3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
35962
35962
  const DRAWINGML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
35963
35963
  const OFFICE_REL_NS$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
35964
35964
  const WORD14_NS$1 = "http://schemas.microsoft.com/office/word/2010/wordml";
35965
+ const WORD15_NS$2 = "http://schemas.microsoft.com/office/word/2012/wordml";
35965
35966
  const WORD14_MARKUP_COMPATIBILITY_CAPABILITIES = extendMarkupCompatibilityCapabilities(
35966
35967
  DEFAULT_MARKUP_COMPATIBILITY_CAPABILITIES,
35967
35968
  WORD14_NS$1
35968
35969
  );
35970
+ extendMarkupCompatibilityCapabilities(
35971
+ DEFAULT_MARKUP_COMPATIBILITY_CAPABILITIES,
35972
+ WORD15_NS$2
35973
+ );
35969
35974
  function getChildrenByTagNameNS(element, namespace, localName) {
35970
35975
  if (!element) {
35971
35976
  return [];
@@ -36002,7 +36007,7 @@ function getAttributeValue(element, localName) {
36002
36007
  if (!element) {
36003
36008
  return null;
36004
36009
  }
36005
- return element.getAttributeNS(WORD_NS$3, localName) ?? element.getAttributeNS(WORD14_NS$1, localName) ?? element.getAttribute(`w:${localName}`) ?? element.getAttribute(`w14:${localName}`) ?? element.getAttribute(localName);
36010
+ return element.getAttributeNS(WORD_NS$3, localName) ?? element.getAttributeNS(WORD14_NS$1, localName) ?? element.getAttributeNS(WORD15_NS$2, localName) ?? element.getAttribute(`w:${localName}`) ?? element.getAttribute(`w14:${localName}`) ?? element.getAttribute(`w15:${localName}`) ?? element.getAttribute(localName);
36006
36011
  }
36007
36012
  function findElementDeep(element, localName) {
36008
36013
  for (let index = 0; index < element.childNodes.length; index += 1) {
@@ -40224,7 +40229,7 @@ function stableSemanticString(value2) {
40224
40229
  function hasRelationshipReference$4(xml) {
40225
40230
  return /\br:(?:id|embed|link)\s*=/.test(xml);
40226
40231
  }
40227
- function directWordChildren$1(element, localName) {
40232
+ function directWordChildren$2(element, localName) {
40228
40233
  const children2 = [];
40229
40234
  for (let index = 0; index < element.childNodes.length; index += 1) {
40230
40235
  const child2 = element.childNodes[index];
@@ -40235,7 +40240,7 @@ function directWordChildren$1(element, localName) {
40235
40240
  return children2;
40236
40241
  }
40237
40242
  function firstDirectWordChild$1(element, localName) {
40238
- return directWordChildren$1(element, localName)[0];
40243
+ return directWordChildren$2(element, localName)[0];
40239
40244
  }
40240
40245
  function serializeElement$1(element) {
40241
40246
  return element ? new XMLSerializer().serializeToString(element) : void 0;
@@ -40385,7 +40390,7 @@ function captureGranularTableSources(table, tableElement) {
40385
40390
  const tableGridXml = serializeElement$1(
40386
40391
  firstDirectWordChild$1(tableElement, "tblGrid")
40387
40392
  );
40388
- const rowElements = directWordChildren$1(tableElement, "tr");
40393
+ const rowElements = directWordChildren$2(tableElement, "tr");
40389
40394
  if (rowElements.length === table.rows.length) {
40390
40395
  rowElements.forEach((rowElement, rowIndex) => {
40391
40396
  const row = table.rows[rowIndex];
@@ -40397,7 +40402,7 @@ function captureGranularTableSources(table, tableElement) {
40397
40402
  firstDirectWordChild$1(rowElement, "tblPrEx")
40398
40403
  )
40399
40404
  });
40400
- const cellElements = directWordChildren$1(rowElement, "tc");
40405
+ const cellElements = directWordChildren$2(rowElement, "tc");
40401
40406
  if (cellElements.length !== row.cells.length) {
40402
40407
  return;
40403
40408
  }
@@ -40748,6 +40753,45 @@ function parseTableLook(tblPr) {
40748
40753
  noVBand: attr2("noVBand") ?? bit(1024) ?? false
40749
40754
  };
40750
40755
  }
40756
+ function collectSdtWrappedWordChildrenImpl(container, localName, inheritedWrappers, result) {
40757
+ for (const child2 of getMarkupCompatibleChildren(container)) {
40758
+ if (child2.namespaceURI !== WORD_NS$3) {
40759
+ continue;
40760
+ }
40761
+ if (child2.localName === localName) {
40762
+ result.push({
40763
+ element: child2,
40764
+ ...inheritedWrappers.length > 0 ? { sdtWrappers: inheritedWrappers } : {}
40765
+ });
40766
+ continue;
40767
+ }
40768
+ if (child2.localName !== "sdt") {
40769
+ continue;
40770
+ }
40771
+ const content2 = getFirstChildByTagNameNS(child2, WORD_NS$3, "sdtContent");
40772
+ if (!content2) {
40773
+ continue;
40774
+ }
40775
+ const properties = getFirstChildByTagNameNS(child2, WORD_NS$3, "sdtPr");
40776
+ const endProperties = getFirstChildByTagNameNS(child2, WORD_NS$3, "sdtEndPr");
40777
+ const wrapper = {
40778
+ groupId: createEditorNodeId("sdt"),
40779
+ sdtPr: parseSdtPr(properties),
40780
+ ...endProperties ? { sdtEndPrXml: new XMLSerializer().serializeToString(endProperties) } : {}
40781
+ };
40782
+ collectSdtWrappedWordChildrenImpl(
40783
+ content2,
40784
+ localName,
40785
+ [...inheritedWrappers, wrapper],
40786
+ result
40787
+ );
40788
+ }
40789
+ }
40790
+ function collectSdtWrappedWordChildren(container, localName) {
40791
+ const result = [];
40792
+ collectSdtWrappedWordChildrenImpl(container, localName, [], result);
40793
+ return result;
40794
+ }
40751
40795
  function collapseCellAutospacing(paragraphs, flags) {
40752
40796
  var _a2, _b2;
40753
40797
  const styleOf = (paragraph) => paragraph.style ?? (paragraph.style = {});
@@ -40793,6 +40837,7 @@ function applyCellParagraphAutospacing(cellNode, blocks) {
40793
40837
  );
40794
40838
  }
40795
40839
  async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks, _styles) {
40840
+ var _a2, _b2;
40796
40841
  const gridCols = [];
40797
40842
  const tblGrid = getFirstChildByTagNameNS(tableNode, WORD_NS$3, "tblGrid");
40798
40843
  if (tblGrid) {
@@ -40816,16 +40861,18 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
40816
40861
  );
40817
40862
  const directTableStyle = parseTableStyle(tblPr, tableStyleId ?? void 0);
40818
40863
  const look = parseTableLook(tblPr);
40819
- const rowNodes = getChildrenByTagNameNS(tableNode, WORD_NS$3, "tr");
40864
+ const rowEntries = collectSdtWrappedWordChildren(tableNode, "tr");
40820
40865
  const rows = [];
40821
- for (let rowIndex = 0; rowIndex < rowNodes.length; rowIndex += 1) {
40822
- const rowNode = rowNodes[rowIndex];
40866
+ for (let rowIndex = 0; rowIndex < rowEntries.length; rowIndex += 1) {
40867
+ const rowEntry = rowEntries[rowIndex];
40868
+ const rowNode = rowEntry.element;
40823
40869
  const rowProperties = getFirstChildByTagNameNS(rowNode, WORD_NS$3, "trPr");
40824
40870
  const rowConditionalStyle = parseTableConditionalFlags(rowProperties);
40825
- const cellNodes = getChildrenByTagNameNS(rowNode, WORD_NS$3, "tc");
40871
+ const cellEntries = collectSdtWrappedWordChildren(rowNode, "tc");
40826
40872
  const cells = [];
40827
- for (let colIndex = 0; colIndex < cellNodes.length; colIndex += 1) {
40828
- const cellNode = cellNodes[colIndex];
40873
+ for (let colIndex = 0; colIndex < cellEntries.length; colIndex += 1) {
40874
+ const cellEntry = cellEntries[colIndex];
40875
+ const cellNode = cellEntry.element;
40829
40876
  const cellProperties = getFirstChildByTagNameNS(
40830
40877
  cellNode,
40831
40878
  WORD_NS$3,
@@ -40853,6 +40900,9 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
40853
40900
  );
40854
40901
  if (cellStyle) cell.style = cellStyle;
40855
40902
  cell.conditionalStyle = parseTableConditionalFlags(cellProperties);
40903
+ if ((_a2 = cellEntry.sdtWrappers) == null ? void 0 : _a2.length) {
40904
+ cell.sdtWrappers = [...cellEntry.sdtWrappers];
40905
+ }
40856
40906
  const cellExtAttrs = collectExtAttributes(cellNode);
40857
40907
  if (cellExtAttrs) cell.extAttributes = cellExtAttrs;
40858
40908
  if (vMerge === "continue") {
@@ -40869,6 +40919,9 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
40869
40919
  row.style = rowStyle;
40870
40920
  }
40871
40921
  row.conditionalStyle = rowConditionalStyle;
40922
+ if ((_b2 = rowEntry.sdtWrappers) == null ? void 0 : _b2.length) {
40923
+ row.sdtWrappers = [...rowEntry.sdtWrappers];
40924
+ }
40872
40925
  const rowExtAttrs = collectExtAttributes(rowNode);
40873
40926
  if (rowExtAttrs) row.extAttributes = rowExtAttrs;
40874
40927
  const tblPrEx = getFirstChildByTagNameNS(rowNode, WORD_NS$3, "tblPrEx");
@@ -42952,6 +43005,240 @@ function serializeTableXml(table, serializeBlockXml) {
42952
43005
  ).join("")}</w:tblGrid></w:tblGridChange>` : ""}</w:tblGrid>` : "";
42953
43006
  return `<w:tbl>${serializeTableProperties(table)}${gridXml}${rowsXml}</w:tbl>`;
42954
43007
  }
43008
+ function serializeSdtPrXml(sdtPr) {
43009
+ const hasAnyField = sdtPr.alias !== void 0 || sdtPr.tag !== void 0 || sdtPr.id !== void 0 || sdtPr.lock !== void 0 || sdtPr.appearance !== void 0 || sdtPr.showingPlcHdr !== void 0 || sdtPr.temporary !== void 0 || sdtPr.color !== void 0 || sdtPr.placeholderDocPart !== void 0 || sdtPr.dataBinding !== void 0 || sdtPr.subtype !== void 0 || (sdtPr.unknownXml ?? "").length > 0;
43010
+ if (!hasAnyField) {
43011
+ return "<w:sdtPr/>";
43012
+ }
43013
+ let inner = "";
43014
+ if (sdtPr.alias !== void 0) {
43015
+ inner += `<w:alias w:val="${escapeXml(sdtPr.alias)}"/>`;
43016
+ }
43017
+ if (sdtPr.tag !== void 0) {
43018
+ inner += `<w:tag w:val="${escapeXml(sdtPr.tag)}"/>`;
43019
+ }
43020
+ if (sdtPr.id !== void 0) {
43021
+ inner += `<w:id w:val="${escapeXml(sdtPr.id)}"/>`;
43022
+ }
43023
+ if (sdtPr.lock !== void 0) {
43024
+ inner += `<w:lock w:val="${escapeXml(sdtPr.lock)}"/>`;
43025
+ }
43026
+ if (sdtPr.placeholderDocPart !== void 0) {
43027
+ inner += `<w:placeholder><w:docPart w:val="${escapeXml(
43028
+ sdtPr.placeholderDocPart
43029
+ )}"/></w:placeholder>`;
43030
+ }
43031
+ if (sdtPr.dataBinding !== void 0) {
43032
+ inner += serializeSdtDataBindingXml(sdtPr.dataBinding);
43033
+ }
43034
+ if (sdtPr.temporary !== void 0) {
43035
+ inner += `<w:temporary w:val="${sdtPr.temporary ? "true" : "false"}"/>`;
43036
+ }
43037
+ if (sdtPr.subtype !== void 0) {
43038
+ inner += serializeSdtSubtypeXml(sdtPr.subtype);
43039
+ }
43040
+ if (sdtPr.appearance !== void 0) {
43041
+ inner += `<w:appearance w:val="${escapeXml(sdtPr.appearance)}"/>`;
43042
+ }
43043
+ if (sdtPr.showingPlcHdr !== void 0) {
43044
+ inner += `<w:showingPlcHdr w:val="${sdtPr.showingPlcHdr ? "true" : "false"}"/>`;
43045
+ }
43046
+ if (sdtPr.color !== void 0) {
43047
+ inner += `<w:color w:val="${escapeXml(sdtPr.color)}"/>`;
43048
+ }
43049
+ if (sdtPr.unknownXml) {
43050
+ inner += sdtPr.unknownXml;
43051
+ }
43052
+ return `<w:sdtPr>${inner}</w:sdtPr>`;
43053
+ }
43054
+ function serializeSdtDataBindingXml(dataBinding) {
43055
+ let inner = "";
43056
+ if (dataBinding.prefixMappings !== void 0) {
43057
+ inner += `<w:prefixMappings w:val="${escapeXml(
43058
+ dataBinding.prefixMappings
43059
+ )}"/>`;
43060
+ }
43061
+ if (dataBinding.xpath !== void 0) {
43062
+ inner += `<w:xpath w:val="${escapeXml(dataBinding.xpath)}"/>`;
43063
+ }
43064
+ if (dataBinding.storeItemID !== void 0) {
43065
+ inner += `<w:storeItemID w:val="${escapeXml(dataBinding.storeItemID)}"/>`;
43066
+ }
43067
+ return inner ? `<w:dataBinding>${inner}</w:dataBinding>` : "";
43068
+ }
43069
+ function serializeSdtListItemXml(item) {
43070
+ const displayTextAttr = item.displayText !== void 0 ? ` w:displayText="${escapeXml(item.displayText)}"` : "";
43071
+ const valueAttr = item.value !== void 0 ? ` w:value="${escapeXml(item.value)}"` : "";
43072
+ return `<w:listItem${displayTextAttr}${valueAttr}/>`;
43073
+ }
43074
+ function serializeSdtSubtypeXml(subtype) {
43075
+ switch (subtype.kind) {
43076
+ case "text":
43077
+ return "<w:text/>";
43078
+ case "richText":
43079
+ return "<w:richText/>";
43080
+ case "picture":
43081
+ return "<w:picture/>";
43082
+ case "group":
43083
+ return "<w:group/>";
43084
+ case "equation":
43085
+ return "<w:equation/>";
43086
+ case "citation":
43087
+ return "<w:citation/>";
43088
+ case "bibliography":
43089
+ return "<w:bibliography/>";
43090
+ case "repeatingSection":
43091
+ return "<w:repeatingSection/>";
43092
+ case "repeatingSectionItem":
43093
+ return "<w:repeatingSectionItem/>";
43094
+ case "comboBox":
43095
+ case "dropDownList": {
43096
+ const items = (subtype.listItems ?? []).map(serializeSdtListItemXml).join("");
43097
+ const lastSelected = subtype.lastSelectedValue !== void 0 ? `<w:lastSelectedValue w:val="${escapeXml(
43098
+ subtype.lastSelectedValue
43099
+ )}"/>` : "";
43100
+ return `<w:${subtype.kind}>${items}${lastSelected}</w:${subtype.kind}>`;
43101
+ }
43102
+ case "date": {
43103
+ const fullDateAttr = subtype.fullDate !== void 0 ? ` w:fullDate="${escapeXml(subtype.fullDate)}"` : "";
43104
+ let children2 = "";
43105
+ if (subtype.dateFormat !== void 0) {
43106
+ children2 += `<w:dateFormat w:val="${escapeXml(subtype.dateFormat)}"/>`;
43107
+ }
43108
+ if (subtype.lid !== void 0) {
43109
+ children2 += `<w:lid w:val="${escapeXml(subtype.lid)}"/>`;
43110
+ }
43111
+ if (subtype.calendar !== void 0) {
43112
+ children2 += `<w:calendar w:val="${escapeXml(subtype.calendar)}"/>`;
43113
+ }
43114
+ if (subtype.storeMappedDataAs !== void 0) {
43115
+ children2 += `<w:storeMappedDataAs w:val="${escapeXml(
43116
+ subtype.storeMappedDataAs
43117
+ )}"/>`;
43118
+ }
43119
+ return `<w:date${fullDateAttr}>${children2}</w:date>`;
43120
+ }
43121
+ case "checkbox": {
43122
+ let children2 = "";
43123
+ if (subtype.checked !== void 0) {
43124
+ children2 += `<w14:checked w14:val="${subtype.checked ? "1" : "0"}"/>`;
43125
+ }
43126
+ if (subtype.checkedStateFont !== void 0 || subtype.checkedStateChar !== void 0) {
43127
+ const fontAttr = subtype.checkedStateFont !== void 0 ? ` w14:font="${escapeXml(subtype.checkedStateFont)}"` : "";
43128
+ const charAttr = subtype.checkedStateChar !== void 0 ? ` w14:char="${escapeXml(subtype.checkedStateChar)}"` : "";
43129
+ children2 += `<w14:checkedState${fontAttr}${charAttr}/>`;
43130
+ }
43131
+ if (subtype.uncheckedStateFont !== void 0 || subtype.uncheckedStateChar !== void 0) {
43132
+ const fontAttr = subtype.uncheckedStateFont !== void 0 ? ` w14:font="${escapeXml(subtype.uncheckedStateFont)}"` : "";
43133
+ const charAttr = subtype.uncheckedStateChar !== void 0 ? ` w14:char="${escapeXml(subtype.uncheckedStateChar)}"` : "";
43134
+ children2 += `<w14:uncheckedState${fontAttr}${charAttr}/>`;
43135
+ }
43136
+ return `<w14:checkbox>${children2}</w14:checkbox>`;
43137
+ }
43138
+ default: {
43139
+ const _exhaustive = subtype;
43140
+ return _exhaustive;
43141
+ }
43142
+ }
43143
+ }
43144
+ function directWordChildren$1(parent, localName) {
43145
+ const result = [];
43146
+ for (let index = 0; index < parent.childNodes.length; index += 1) {
43147
+ const node = parent.childNodes[index];
43148
+ if ((node == null ? void 0 : node.nodeType) === node.ELEMENT_NODE && node.namespaceURI === WORD_NS$1 && node.localName === localName) {
43149
+ result.push(node);
43150
+ }
43151
+ }
43152
+ return result;
43153
+ }
43154
+ function parseWordFragment$1(xml, expectedLocalName) {
43155
+ const wrapper = new DOMParser$1().parseFromString(
43156
+ `<oasis:root xmlns:oasis="urn:oasis:docx" xmlns:w="${WORD_NS$1}" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml">${xml}</oasis:root>`,
43157
+ "application/xml"
43158
+ ).documentElement;
43159
+ if (!wrapper) return void 0;
43160
+ for (let index = 0; index < wrapper.childNodes.length; index += 1) {
43161
+ const node = wrapper.childNodes[index];
43162
+ if ((node == null ? void 0 : node.nodeType) === node.ELEMENT_NODE && node.namespaceURI === WORD_NS$1 && node.localName === expectedLocalName) {
43163
+ return node;
43164
+ }
43165
+ }
43166
+ return void 0;
43167
+ }
43168
+ function createSdtEnvelope(parent, wrapper) {
43169
+ const document2 = parent.ownerDocument;
43170
+ if (!document2) return null;
43171
+ const sdt = document2.createElementNS(WORD_NS$1, "w:sdt");
43172
+ const properties = parseWordFragment$1(serializeSdtPrXml(wrapper.sdtPr), "sdtPr");
43173
+ if (properties) {
43174
+ sdt.appendChild(properties.cloneNode(true));
43175
+ }
43176
+ if (wrapper.sdtEndPrXml) {
43177
+ const endProperties = parseWordFragment$1(wrapper.sdtEndPrXml, "sdtEndPr");
43178
+ if (endProperties) {
43179
+ sdt.appendChild(endProperties.cloneNode(true));
43180
+ }
43181
+ }
43182
+ const content2 = document2.createElementNS(WORD_NS$1, "w:sdtContent");
43183
+ sdt.appendChild(content2);
43184
+ return { sdt, content: content2 };
43185
+ }
43186
+ function wrapSequence(parent, entries2) {
43187
+ var _a2;
43188
+ let index = 0;
43189
+ while (index < entries2.length) {
43190
+ const wrapper = entries2[index].wrappers[0];
43191
+ if (!wrapper) {
43192
+ index += 1;
43193
+ continue;
43194
+ }
43195
+ let end = index + 1;
43196
+ while (end < entries2.length && ((_a2 = entries2[end].wrappers[0]) == null ? void 0 : _a2.groupId) === wrapper.groupId) {
43197
+ end += 1;
43198
+ }
43199
+ const envelope = createSdtEnvelope(parent, wrapper);
43200
+ if (!envelope) {
43201
+ index = end;
43202
+ continue;
43203
+ }
43204
+ parent.insertBefore(envelope.sdt, entries2[index].element);
43205
+ const nestedEntries = [];
43206
+ for (let cursor = index; cursor < end; cursor += 1) {
43207
+ const entry = entries2[cursor];
43208
+ envelope.content.appendChild(entry.element);
43209
+ nestedEntries.push({
43210
+ element: entry.element,
43211
+ wrappers: entry.wrappers.slice(1)
43212
+ });
43213
+ }
43214
+ wrapSequence(envelope.content, nestedEntries);
43215
+ index = end;
43216
+ }
43217
+ }
43218
+ function wrapTableStructuralSdts(table, tableElement) {
43219
+ const rowElements = directWordChildren$1(tableElement, "tr");
43220
+ if (rowElements.length !== table.rows.length) return;
43221
+ for (let rowIndex = 0; rowIndex < rowElements.length; rowIndex += 1) {
43222
+ const rowElement = rowElements[rowIndex];
43223
+ const row = table.rows[rowIndex];
43224
+ const cellElements = directWordChildren$1(rowElement, "tc");
43225
+ if (cellElements.length !== row.cells.length) continue;
43226
+ wrapSequence(
43227
+ rowElement,
43228
+ cellElements.map((element, cellIndex) => ({
43229
+ element,
43230
+ wrappers: row.cells[cellIndex].sdtWrappers ?? []
43231
+ }))
43232
+ );
43233
+ }
43234
+ wrapSequence(
43235
+ tableElement,
43236
+ rowElements.map((element, rowIndex) => ({
43237
+ element,
43238
+ wrappers: table.rows[rowIndex].sdtWrappers ?? []
43239
+ }))
43240
+ );
43241
+ }
42955
43242
  function elementChildren(node) {
42956
43243
  const children2 = [];
42957
43244
  for (let index = 0; index < node.childNodes.length; index += 1) {
@@ -43321,6 +43608,9 @@ function parseWordFragment(xml, expectedLocalName) {
43321
43608
  `<oasis:root xmlns:oasis="urn:oasis:docx" xmlns:w="${WORD_NS$1}">${xml}</oasis:root>`,
43322
43609
  "application/xml"
43323
43610
  ).documentElement;
43611
+ if (!wrapper) {
43612
+ return void 0;
43613
+ }
43324
43614
  const element = wrapper ? directElementChildren$3(wrapper).find(
43325
43615
  (child2) => child2.namespaceURI === WORD_NS$1 && child2.localName === expectedLocalName
43326
43616
  ) : void 0;
@@ -43534,6 +43824,7 @@ function serializeTableXmlPreservingSource(table, serializeParagraphXml2) {
43534
43824
  overlayTableProperties(table, tableElement);
43535
43825
  overlayRowAndCellProperties(table, tableElement);
43536
43826
  ensureTerminalCellParagraphs(tableElement);
43827
+ wrapTableStructuralSdts(table, tableElement);
43537
43828
  const serialized = new XMLSerializer().serializeToString(tableElement);
43538
43829
  return serialized.replace(`<w:tbl xmlns:w="${WORD_NS$1}"`, "<w:tbl");
43539
43830
  }
@@ -44897,142 +45188,6 @@ function serializeRunWithRelationships(run, context2, paragraphStyleId, styles,
44897
45188
  }
44898
45189
  return wrapRunWithHyperlink(runXml, href, context2);
44899
45190
  }
44900
- function serializeSdtPrXml(sdtPr) {
44901
- const hasAnyField = sdtPr.alias !== void 0 || sdtPr.tag !== void 0 || sdtPr.id !== void 0 || sdtPr.lock !== void 0 || sdtPr.appearance !== void 0 || sdtPr.showingPlcHdr !== void 0 || sdtPr.temporary !== void 0 || sdtPr.color !== void 0 || sdtPr.placeholderDocPart !== void 0 || sdtPr.dataBinding !== void 0 || sdtPr.subtype !== void 0 || (sdtPr.unknownXml ?? "").length > 0;
44902
- if (!hasAnyField) {
44903
- return "<w:sdtPr/>";
44904
- }
44905
- let inner = "";
44906
- if (sdtPr.alias !== void 0) {
44907
- inner += `<w:alias w:val="${escapeXml(sdtPr.alias)}"/>`;
44908
- }
44909
- if (sdtPr.tag !== void 0) {
44910
- inner += `<w:tag w:val="${escapeXml(sdtPr.tag)}"/>`;
44911
- }
44912
- if (sdtPr.id !== void 0) {
44913
- inner += `<w:id w:val="${escapeXml(sdtPr.id)}"/>`;
44914
- }
44915
- if (sdtPr.lock !== void 0) {
44916
- inner += `<w:lock w:val="${escapeXml(sdtPr.lock)}"/>`;
44917
- }
44918
- if (sdtPr.placeholderDocPart !== void 0) {
44919
- inner += `<w:placeholder><w:docPart w:val="${escapeXml(
44920
- sdtPr.placeholderDocPart
44921
- )}"/></w:placeholder>`;
44922
- }
44923
- if (sdtPr.dataBinding !== void 0) {
44924
- inner += serializeSdtDataBindingXml(sdtPr.dataBinding);
44925
- }
44926
- if (sdtPr.temporary !== void 0) {
44927
- inner += `<w:temporary w:val="${sdtPr.temporary ? "true" : "false"}"/>`;
44928
- }
44929
- if (sdtPr.subtype !== void 0) {
44930
- inner += serializeSdtSubtypeXml(sdtPr.subtype);
44931
- }
44932
- if (sdtPr.appearance !== void 0) {
44933
- inner += `<w:appearance w:val="${escapeXml(sdtPr.appearance)}"/>`;
44934
- }
44935
- if (sdtPr.showingPlcHdr !== void 0) {
44936
- inner += `<w:showingPlcHdr w:val="${sdtPr.showingPlcHdr ? "true" : "false"}"/>`;
44937
- }
44938
- if (sdtPr.color !== void 0) {
44939
- inner += `<w:color w:val="${escapeXml(sdtPr.color)}"/>`;
44940
- }
44941
- if (sdtPr.unknownXml) {
44942
- inner += sdtPr.unknownXml;
44943
- }
44944
- return `<w:sdtPr>${inner}</w:sdtPr>`;
44945
- }
44946
- function serializeSdtDataBindingXml(dataBinding) {
44947
- let inner = "";
44948
- if (dataBinding.prefixMappings !== void 0) {
44949
- inner += `<w:prefixMappings w:val="${escapeXml(
44950
- dataBinding.prefixMappings
44951
- )}"/>`;
44952
- }
44953
- if (dataBinding.xpath !== void 0) {
44954
- inner += `<w:xpath w:val="${escapeXml(dataBinding.xpath)}"/>`;
44955
- }
44956
- if (dataBinding.storeItemID !== void 0) {
44957
- inner += `<w:storeItemID w:val="${escapeXml(dataBinding.storeItemID)}"/>`;
44958
- }
44959
- return inner ? `<w:dataBinding>${inner}</w:dataBinding>` : "";
44960
- }
44961
- function serializeSdtListItemXml(item) {
44962
- const displayTextAttr = item.displayText !== void 0 ? ` w:displayText="${escapeXml(item.displayText)}"` : "";
44963
- const valueAttr = item.value !== void 0 ? ` w:value="${escapeXml(item.value)}"` : "";
44964
- return `<w:listItem${displayTextAttr}${valueAttr}/>`;
44965
- }
44966
- function serializeSdtSubtypeXml(subtype) {
44967
- switch (subtype.kind) {
44968
- case "text":
44969
- return "<w:text/>";
44970
- case "richText":
44971
- return "<w:richText/>";
44972
- case "picture":
44973
- return "<w:picture/>";
44974
- case "group":
44975
- return "<w:group/>";
44976
- case "equation":
44977
- return "<w:equation/>";
44978
- case "citation":
44979
- return "<w:citation/>";
44980
- case "bibliography":
44981
- return "<w:bibliography/>";
44982
- case "repeatingSection":
44983
- return "<w:repeatingSection/>";
44984
- case "repeatingSectionItem":
44985
- return "<w:repeatingSectionItem/>";
44986
- case "comboBox":
44987
- case "dropDownList": {
44988
- const items = (subtype.listItems ?? []).map(serializeSdtListItemXml).join("");
44989
- const lastSelected = subtype.lastSelectedValue !== void 0 ? `<w:lastSelectedValue w:val="${escapeXml(
44990
- subtype.lastSelectedValue
44991
- )}"/>` : "";
44992
- return `<w:${subtype.kind}>${items}${lastSelected}</w:${subtype.kind}>`;
44993
- }
44994
- case "date": {
44995
- const fullDateAttr = subtype.fullDate !== void 0 ? ` w:fullDate="${escapeXml(subtype.fullDate)}"` : "";
44996
- let children2 = "";
44997
- if (subtype.dateFormat !== void 0) {
44998
- children2 += `<w:dateFormat w:val="${escapeXml(subtype.dateFormat)}"/>`;
44999
- }
45000
- if (subtype.lid !== void 0) {
45001
- children2 += `<w:lid w:val="${escapeXml(subtype.lid)}"/>`;
45002
- }
45003
- if (subtype.calendar !== void 0) {
45004
- children2 += `<w:calendar w:val="${escapeXml(subtype.calendar)}"/>`;
45005
- }
45006
- if (subtype.storeMappedDataAs !== void 0) {
45007
- children2 += `<w:storeMappedDataAs w:val="${escapeXml(
45008
- subtype.storeMappedDataAs
45009
- )}"/>`;
45010
- }
45011
- return `<w:date${fullDateAttr}>${children2}</w:date>`;
45012
- }
45013
- case "checkbox": {
45014
- let children2 = "";
45015
- if (subtype.checked !== void 0) {
45016
- children2 += `<w14:checked w14:val="${subtype.checked ? "1" : "0"}"/>`;
45017
- }
45018
- if (subtype.checkedStateFont !== void 0 || subtype.checkedStateChar !== void 0) {
45019
- const fontAttr = subtype.checkedStateFont !== void 0 ? ` w14:font="${escapeXml(subtype.checkedStateFont)}"` : "";
45020
- const charAttr = subtype.checkedStateChar !== void 0 ? ` w14:char="${escapeXml(subtype.checkedStateChar)}"` : "";
45021
- children2 += `<w14:checkedState${fontAttr}${charAttr}/>`;
45022
- }
45023
- if (subtype.uncheckedStateFont !== void 0 || subtype.uncheckedStateChar !== void 0) {
45024
- const fontAttr = subtype.uncheckedStateFont !== void 0 ? ` w14:font="${escapeXml(subtype.uncheckedStateFont)}"` : "";
45025
- const charAttr = subtype.uncheckedStateChar !== void 0 ? ` w14:char="${escapeXml(subtype.uncheckedStateChar)}"` : "";
45026
- children2 += `<w14:uncheckedState${fontAttr}${charAttr}/>`;
45027
- }
45028
- return `<w14:checkbox>${children2}</w14:checkbox>`;
45029
- }
45030
- default: {
45031
- const _exhaustive = subtype;
45032
- return _exhaustive;
45033
- }
45034
- }
45035
- }
45036
45191
  function serializeRunsWithInlineSdts(runs, serializeRun2) {
45037
45192
  var _a2, _b2, _c;
45038
45193
  let out = "";
@@ -47398,7 +47553,7 @@ async function importDocxInWorker(buffer, options = {}) {
47398
47553
  const worker = new Worker(
47399
47554
  new URL(
47400
47555
  /* @vite-ignore */
47401
- "" + new URL("assets/importDocxWorker-CEVODY5C.js", import.meta.url).href,
47556
+ "" + new URL("assets/importDocxWorker-DIzjAlvN.js", import.meta.url).href,
47402
47557
  import.meta.url
47403
47558
  ),
47404
47559
  {
@@ -1,4 +1,4 @@
1
- import { dK, ah, aw, aM, aG, dL, dM, dN, aA, dO, ai, dP, dt, aN, dQ, dR, aL, aD, dS, dT, dU, ag, dV, dr, aP, dW, dX, dY, dZ, d_, dF, d$, e0, e1, aU, aT, e2, aE, e3, e4, e5, e6, e7, e8, aI, aF, e9, b3, aO, b2, aV, az, aK, dE, ea, dL as dL2, dS as dS2, dV as dV2, e2 as e22, e3 as e32, e8 as e82, eb, ec, dv, dq, ed, ee, ef, eg, eh, ei, ej, ds, ek, el, em, du, en } from "./index-0LIU1rxH.js";
1
+ import { dK, ah, aw, aM, aG, dL, dM, dN, aA, dO, ai, dP, dt, aN, dQ, dR, aL, aD, dS, dT, dU, ag, dV, dr, aP, dW, dX, dY, dZ, d_, dF, d$, e0, e1, aU, aT, e2, aE, e3, e4, e5, e6, e7, e8, aI, aF, e9, b3, aO, b2, aV, az, aK, dE, ea, dL as dL2, dS as dS2, dV as dV2, e2 as e22, e3 as e32, e8 as e82, eb, ec, dv, dq, ed, ee, ef, eg, eh, ei, ej, ds, ek, el, em, du, en } from "./index-BR6GooGM.js";
2
2
  export {
3
3
  dK as ActionRow,
4
4
  ah as BalloonShell,