oasis-editor 0.0.160 → 0.0.161

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.
@@ -11,5 +11,14 @@ declare module "./nodes.js" {
11
11
  /** Enclosing cell-level `w:sdt` content controls, outermost first. */
12
12
  sdtWrappers?: EditorSdtBlockWrapper[];
13
13
  }
14
+ interface EditorSdtPr {
15
+ /** Word 2013 `w15:repeatingSection` settings. */
16
+ repeatingSectionProperties?: {
17
+ /** `w15:sectionTitle/@w15:val`. */
18
+ sectionTitle?: string;
19
+ /** Presence/value of `w15:doNotAllowInsertDeleteSection`. */
20
+ doNotAllowInsertDeleteSection?: boolean;
21
+ };
22
+ }
14
23
  }
15
24
  export {};
@@ -1,10 +1,3 @@
1
1
  import { EditorSdtPr } from '../../../core/model.js';
2
2
 
3
- /**
4
- * `<w:sdtPr>` requires its subtype element to be the final named child per schema
5
- * order, with `appearance`, `showingPlcHdr`, `color` trailing as extension-like
6
- * properties. The exact ordering used by Word is: rPr, alias, tag, id, lock,
7
- * placeholder, dataBinding, temporary, subtype, appearance, showingPlcHdr,
8
- * color, extension. We mirror that so we round-trip as schema-valid.
9
- */
10
3
  export declare function serializeSdtPrXml(sdtPr: EditorSdtPr): string;
@@ -1,9 +1,4 @@
1
1
  import { Element as XmlElement } from '@xmldom/xmldom';
2
2
  import { EditorSdtPr } from '../../core/model.js';
3
3
 
4
- /**
5
- * Parse a `<w:sdtPr>` element into the typed model. Returns `{}` (empty) when
6
- * `sdtPr` is null or has no recognized children; the caller still attaches an
7
- * empty wrapper so the round-trip emits an empty `<w:sdtPr/>`.
8
- */
9
4
  export declare function parseSdtPr(sdtPr: XmlElement | null): EditorSdtPr;
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
2863
2863
  onCleanup(() => {
2864
2864
  cancelled = true;
2865
2865
  });
2866
- import("./OasisEditorApp-xJcUlIac.js").then((m) => {
2866
+ import("./OasisEditorApp-CZ4smGNO.js").then((m) => {
2867
2867
  cancelled = true;
2868
2868
  setProgress(1);
2869
2869
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -35962,14 +35962,14 @@ 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
+ const WORD15_NS$3 = "http://schemas.microsoft.com/office/word/2012/wordml";
35966
35966
  const WORD14_MARKUP_COMPATIBILITY_CAPABILITIES = extendMarkupCompatibilityCapabilities(
35967
35967
  DEFAULT_MARKUP_COMPATIBILITY_CAPABILITIES,
35968
35968
  WORD14_NS$1
35969
35969
  );
35970
- extendMarkupCompatibilityCapabilities(
35970
+ const WORD15_MARKUP_COMPATIBILITY_CAPABILITIES = extendMarkupCompatibilityCapabilities(
35971
35971
  DEFAULT_MARKUP_COMPATIBILITY_CAPABILITIES,
35972
- WORD15_NS$2
35972
+ WORD15_NS$3
35973
35973
  );
35974
35974
  function getChildrenByTagNameNS(element, namespace, localName) {
35975
35975
  if (!element) {
@@ -36003,11 +36003,22 @@ function getFirstW14Child(element, localName) {
36003
36003
  (child2) => child2.namespaceURI === WORD14_NS$1 && child2.localName === localName
36004
36004
  ) ?? null;
36005
36005
  }
36006
+ function getFirstW15Child(element, localName) {
36007
+ if (!element) {
36008
+ return null;
36009
+ }
36010
+ return getMarkupCompatibleChildren(
36011
+ element,
36012
+ WORD15_MARKUP_COMPATIBILITY_CAPABILITIES
36013
+ ).find(
36014
+ (child2) => child2.namespaceURI === WORD15_NS$3 && child2.localName === localName
36015
+ ) ?? null;
36016
+ }
36006
36017
  function getAttributeValue(element, localName) {
36007
36018
  if (!element) {
36008
36019
  return null;
36009
36020
  }
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);
36021
+ return element.getAttributeNS(WORD_NS$3, localName) ?? element.getAttributeNS(WORD14_NS$1, localName) ?? element.getAttributeNS(WORD15_NS$3, localName) ?? element.getAttribute(`w:${localName}`) ?? element.getAttribute(`w14:${localName}`) ?? element.getAttribute(`w15:${localName}`) ?? element.getAttribute(localName);
36011
36022
  }
36012
36023
  function findElementDeep(element, localName) {
36013
36024
  for (let index = 0; index < element.childNodes.length; index += 1) {
@@ -38888,7 +38899,7 @@ function parseMathExpression(element) {
38888
38899
  sourceXml: serializer.serializeToString(element)
38889
38900
  };
38890
38901
  }
38891
- const RECOGNIZED_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38902
+ const RECOGNIZED_WORD_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38892
38903
  "alias",
38893
38904
  "tag",
38894
38905
  "id",
@@ -38905,6 +38916,8 @@ const RECOGNIZED_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38905
38916
  "comboBox",
38906
38917
  "dropDownList",
38907
38918
  "date",
38919
+ // Keep accepting the old namespace form for compatibility with Oasis files
38920
+ // produced before the w15 correction.
38908
38921
  "repeatingSection",
38909
38922
  "repeatingSectionItem",
38910
38923
  "group",
@@ -38912,6 +38925,10 @@ const RECOGNIZED_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38912
38925
  "citation",
38913
38926
  "bibliography"
38914
38927
  ]);
38928
+ const RECOGNIZED_WORD15_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38929
+ "repeatingSection",
38930
+ "repeatingSectionItem"
38931
+ ]);
38915
38932
  function parseSdtPr(sdtPr) {
38916
38933
  if (!sdtPr) {
38917
38934
  return {};
@@ -38920,37 +38937,27 @@ function parseSdtPr(sdtPr) {
38920
38937
  const aliasEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "alias");
38921
38938
  if (aliasEl) {
38922
38939
  const alias = getAttributeValue(aliasEl, "val");
38923
- if (alias !== null) {
38924
- result.alias = alias;
38925
- }
38940
+ if (alias !== null) result.alias = alias;
38926
38941
  }
38927
38942
  const tagEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "tag");
38928
38943
  if (tagEl) {
38929
38944
  const tag = getAttributeValue(tagEl, "val");
38930
- if (tag !== null) {
38931
- result.tag = tag;
38932
- }
38945
+ if (tag !== null) result.tag = tag;
38933
38946
  }
38934
38947
  const idEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "id");
38935
38948
  if (idEl) {
38936
38949
  const id = getAttributeValue(idEl, "val");
38937
- if (id !== null) {
38938
- result.id = id;
38939
- }
38950
+ if (id !== null) result.id = id;
38940
38951
  }
38941
38952
  const lockEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "lock");
38942
38953
  if (lockEl) {
38943
38954
  const lock = getAttributeValue(lockEl, "val");
38944
- if (lock !== null) {
38945
- result.lock = lock;
38946
- }
38955
+ if (lock !== null) result.lock = lock;
38947
38956
  }
38948
38957
  const appearanceEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "appearance");
38949
38958
  if (appearanceEl) {
38950
38959
  const appearance = getAttributeValue(appearanceEl, "val");
38951
- if (appearance !== null) {
38952
- result.appearance = appearance;
38953
- }
38960
+ if (appearance !== null) result.appearance = appearance;
38954
38961
  }
38955
38962
  const showingPlcHdrEl = getFirstChildByTagNameNS(
38956
38963
  sdtPr,
@@ -38969,74 +38976,77 @@ function parseSdtPr(sdtPr) {
38969
38976
  const colorEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "color");
38970
38977
  if (colorEl) {
38971
38978
  const color = getAttributeValue(colorEl, "val");
38972
- if (color !== null) {
38973
- result.color = color;
38974
- }
38979
+ if (color !== null) result.color = color;
38975
38980
  }
38976
38981
  const placeholderEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "placeholder");
38977
38982
  if (placeholderEl) {
38978
38983
  const docPart = getFirstChildByTagNameNS(placeholderEl, WORD_NS$3, "docPart");
38979
38984
  if (docPart) {
38980
38985
  const docPartVal = getAttributeValue(docPart, "val");
38981
- if (docPartVal !== null) {
38982
- result.placeholderDocPart = docPartVal;
38983
- }
38986
+ if (docPartVal !== null) result.placeholderDocPart = docPartVal;
38984
38987
  }
38985
38988
  }
38986
38989
  const dataBindingEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "dataBinding");
38987
38990
  if (dataBindingEl) {
38988
38991
  const dataBinding = parseSdtDataBinding(dataBindingEl);
38989
- if (dataBinding) {
38990
- result.dataBinding = dataBinding;
38991
- }
38992
+ if (dataBinding) result.dataBinding = dataBinding;
38992
38993
  }
38993
38994
  const subtype = parseSdtSubtype(sdtPr);
38994
38995
  if (subtype) {
38995
38996
  result.subtype = subtype;
38997
+ if (subtype.kind === "repeatingSection") {
38998
+ const repeating = getFirstW15Child(sdtPr, "repeatingSection") ?? getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "repeatingSection");
38999
+ if (repeating) {
39000
+ const sectionTitle = getFirstW15Child(repeating, "sectionTitle");
39001
+ const noInsertDelete = getFirstW15Child(
39002
+ repeating,
39003
+ "doNotAllowInsertDeleteSection"
39004
+ );
39005
+ const properties = {};
39006
+ const title = getAttributeValue(sectionTitle, "val");
39007
+ if (title !== null) properties.sectionTitle = title;
39008
+ if (noInsertDelete) {
39009
+ const raw = getAttributeValue(noInsertDelete, "val");
39010
+ properties.doNotAllowInsertDeleteSection = raw === null ? true : isWordTrue(raw);
39011
+ }
39012
+ if (Object.keys(properties).length > 0) {
39013
+ result.repeatingSectionProperties = properties;
39014
+ }
39015
+ }
39016
+ }
38996
39017
  }
38997
39018
  const unknownXml = serializeUnknownSdtPrChildren(sdtPr);
38998
- if (unknownXml.length > 0) {
38999
- result.unknownXml = unknownXml;
39000
- }
39019
+ if (unknownXml.length > 0) result.unknownXml = unknownXml;
39001
39020
  return result;
39002
39021
  }
39003
39022
  function parseSdtDataBinding(el) {
39004
- const prefixMappingsEl = getFirstChildByTagNameNS(
39005
- el,
39006
- WORD_NS$3,
39007
- "prefixMappings"
39008
- );
39009
- const xpathEl = getFirstChildByTagNameNS(el, WORD_NS$3, "xpath");
39010
- const storeItemIDEl = getFirstChildByTagNameNS(el, WORD_NS$3, "storeItemID");
39011
39023
  const dataBinding = {};
39012
- if (prefixMappingsEl) {
39013
- const val = getAttributeValue(prefixMappingsEl, "val");
39014
- if (val !== null) {
39015
- dataBinding.prefixMappings = val;
39016
- }
39017
- }
39018
- if (xpathEl) {
39019
- const val = getAttributeValue(xpathEl, "val");
39020
- if (val !== null) {
39021
- dataBinding.xpath = val;
39022
- }
39023
- }
39024
- if (storeItemIDEl) {
39025
- const val = getAttributeValue(storeItemIDEl, "val");
39026
- if (val !== null) {
39027
- dataBinding.storeItemID = val;
39028
- }
39029
- }
39030
- if (dataBinding.prefixMappings === void 0 && dataBinding.xpath === void 0 && dataBinding.storeItemID === void 0) {
39031
- return null;
39032
- }
39033
- return dataBinding;
39024
+ const prefixMappings = getAttributeValue(el, "prefixMappings");
39025
+ const xpath = getAttributeValue(el, "xpath");
39026
+ const storeItemID = getAttributeValue(el, "storeItemID");
39027
+ if (prefixMappings !== null) dataBinding.prefixMappings = prefixMappings;
39028
+ if (xpath !== null) dataBinding.xpath = xpath;
39029
+ if (storeItemID !== null) dataBinding.storeItemID = storeItemID;
39030
+ if (dataBinding.prefixMappings === void 0) {
39031
+ const legacy = getFirstChildByTagNameNS(el, WORD_NS$3, "prefixMappings");
39032
+ const value2 = getAttributeValue(legacy, "val");
39033
+ if (value2 !== null) dataBinding.prefixMappings = value2;
39034
+ }
39035
+ if (dataBinding.xpath === void 0) {
39036
+ const legacy = getFirstChildByTagNameNS(el, WORD_NS$3, "xpath");
39037
+ const value2 = getAttributeValue(legacy, "val");
39038
+ if (value2 !== null) dataBinding.xpath = value2;
39039
+ }
39040
+ if (dataBinding.storeItemID === void 0) {
39041
+ const legacy = getFirstChildByTagNameNS(el, WORD_NS$3, "storeItemID");
39042
+ const value2 = getAttributeValue(legacy, "val");
39043
+ if (value2 !== null) dataBinding.storeItemID = value2;
39044
+ }
39045
+ return dataBinding.prefixMappings === void 0 && dataBinding.xpath === void 0 && dataBinding.storeItemID === void 0 ? null : dataBinding;
39034
39046
  }
39035
39047
  function parseSdtListItems(parent) {
39036
39048
  const items = getChildrenByTagNameNS(parent, WORD_NS$3, "listItem");
39037
- if (items.length === 0) {
39038
- return void 0;
39039
- }
39049
+ if (items.length === 0) return void 0;
39040
39050
  return items.map(
39041
39051
  (item) => ({
39042
39052
  displayText: getAttributeValue(item, "displayText") ?? void 0,
@@ -39100,22 +39110,22 @@ function parseSdtSubtype(parent) {
39100
39110
  };
39101
39111
  }
39102
39112
  const textEl = getFirstChildByTagNameNS(parent, WORD_NS$3, "text");
39103
- if (textEl) {
39104
- return { kind: "text" };
39105
- }
39113
+ if (textEl) return { kind: "text" };
39106
39114
  for (const kind of [
39107
39115
  "richText",
39108
39116
  "picture",
39109
39117
  "group",
39110
39118
  "equation",
39111
39119
  "citation",
39112
- "bibliography",
39113
- "repeatingSection",
39114
- "repeatingSectionItem"
39120
+ "bibliography"
39115
39121
  ]) {
39116
- if (getFirstChildByTagNameNS(parent, WORD_NS$3, kind)) {
39117
- return { kind };
39118
- }
39122
+ if (getFirstChildByTagNameNS(parent, WORD_NS$3, kind)) return { kind };
39123
+ }
39124
+ if (getFirstW15Child(parent, "repeatingSection") || getFirstChildByTagNameNS(parent, WORD_NS$3, "repeatingSection")) {
39125
+ return { kind: "repeatingSection" };
39126
+ }
39127
+ if (getFirstW15Child(parent, "repeatingSectionItem") || getFirstChildByTagNameNS(parent, WORD_NS$3, "repeatingSectionItem")) {
39128
+ return { kind: "repeatingSectionItem" };
39119
39129
  }
39120
39130
  const w14CheckboxEl = getFirstW14Child(parent, "checkbox");
39121
39131
  if (w14CheckboxEl) {
@@ -39154,13 +39164,11 @@ function serializeUnknownSdtPrChildren(sdtPr) {
39154
39164
  let out = "";
39155
39165
  for (let i = 0; i < sdtPr.childNodes.length; i += 1) {
39156
39166
  const node = sdtPr.childNodes[i];
39157
- if ((node == null ? void 0 : node.nodeType) !== node.ELEMENT_NODE) {
39158
- continue;
39159
- }
39167
+ if ((node == null ? void 0 : node.nodeType) !== node.ELEMENT_NODE) continue;
39160
39168
  const el = node;
39161
- if (el.localName && el.namespaceURI === WORD_NS$3 && RECOGNIZED_SDT_PR_CHILDREN.has(el.localName)) {
39162
- continue;
39163
- }
39169
+ const recognizedWord = el.localName && el.namespaceURI === WORD_NS$3 && RECOGNIZED_WORD_SDT_PR_CHILDREN.has(el.localName);
39170
+ const recognizedWord15 = el.localName && el.namespaceURI === WORD15_NS$3 && RECOGNIZED_WORD15_SDT_PR_CHILDREN.has(el.localName);
39171
+ if (recognizedWord || recognizedWord15) continue;
39164
39172
  out += new XMLSerializer().serializeToString(el);
39165
39173
  }
39166
39174
  return out;
@@ -41467,7 +41475,7 @@ function extractCommentRangesFromSections(sections) {
41467
41475
  }
41468
41476
  return ranges;
41469
41477
  }
41470
- const WORD15_NS$1 = "http://schemas.microsoft.com/office/word/2012/wordml";
41478
+ const WORD15_NS$2 = "http://schemas.microsoft.com/office/word/2012/wordml";
41471
41479
  const WORD16DU_NS$1 = "http://schemas.microsoft.com/office/word/2023/wordml/word16du";
41472
41480
  function flattenCommentText(element) {
41473
41481
  let out = "";
@@ -41512,12 +41520,12 @@ function parseCommentsExtended(xml) {
41512
41520
  if (!root) {
41513
41521
  return done;
41514
41522
  }
41515
- for (const ex of getChildrenByTagNameNS(root, WORD15_NS$1, "commentEx")) {
41516
- const paraId = ex.getAttributeNS(WORD15_NS$1, "paraId");
41523
+ for (const ex of getChildrenByTagNameNS(root, WORD15_NS$2, "commentEx")) {
41524
+ const paraId = ex.getAttributeNS(WORD15_NS$2, "paraId");
41517
41525
  if (!paraId) {
41518
41526
  continue;
41519
41527
  }
41520
- const isDone = ex.getAttributeNS(WORD15_NS$1, "done");
41528
+ const isDone = ex.getAttributeNS(WORD15_NS$2, "done");
41521
41529
  done.set(paraId, isDone === "1" || isDone === "true");
41522
41530
  }
41523
41531
  return done;
@@ -42377,7 +42385,7 @@ function serializeBookmarkEvent(event) {
42377
42385
  event.name ?? ""
42378
42386
  )}"${col}/>`;
42379
42387
  }
42380
- const WORD15_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
42388
+ const WORD15_NS$1 = "http://schemas.microsoft.com/office/word/2012/wordml";
42381
42389
  const WORD16DU_NS = "http://schemas.microsoft.com/office/word/2023/wordml/word16du";
42382
42390
  function buildCommentExportPlan(document2) {
42383
42391
  const registry2 = document2.comments;
@@ -42454,7 +42462,7 @@ function serializeCommentRangeEvent(event) {
42454
42462
  return `<w:r><w:commentReference w:id="${event.wId}"/></w:r>`;
42455
42463
  }
42456
42464
  }
42457
- const COMMENTS_XMLNS = `xmlns:w="${WORD_NS$1}" xmlns:w14="${WORD14_NS}" xmlns:w15="${WORD15_NS}" xmlns:w16du="${WORD16DU_NS}"`;
42465
+ const COMMENTS_XMLNS = `xmlns:w="${WORD_NS$1}" xmlns:w14="${WORD14_NS}" xmlns:w15="${WORD15_NS$1}" xmlns:w16du="${WORD16DU_NS}"`;
42458
42466
  function serializeCommentBody(text2) {
42459
42467
  const lines = text2.split("\n");
42460
42468
  const runs = lines.map((line, i) => {
@@ -43005,11 +43013,11 @@ function serializeTableXml(table, serializeBlockXml) {
43005
43013
  ).join("")}</w:tblGrid></w:tblGridChange>` : ""}</w:tblGrid>` : "";
43006
43014
  return `<w:tbl>${serializeTableProperties(table)}${gridXml}${rowsXml}</w:tbl>`;
43007
43015
  }
43016
+ const WORD15_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
43017
+ const WORD15_XMLNS = `xmlns:w15="${WORD15_NS}"`;
43008
43018
  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
- }
43019
+ 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.repeatingSectionProperties !== void 0 || (sdtPr.unknownXml ?? "").length > 0;
43020
+ if (!hasAnyField) return "<w:sdtPr/>";
43013
43021
  let inner = "";
43014
43022
  if (sdtPr.alias !== void 0) {
43015
43023
  inner += `<w:alias w:val="${escapeXml(sdtPr.alias)}"/>`;
@@ -43035,7 +43043,10 @@ function serializeSdtPrXml(sdtPr) {
43035
43043
  inner += `<w:temporary w:val="${sdtPr.temporary ? "true" : "false"}"/>`;
43036
43044
  }
43037
43045
  if (sdtPr.subtype !== void 0) {
43038
- inner += serializeSdtSubtypeXml(sdtPr.subtype);
43046
+ inner += serializeSdtSubtypeXml(
43047
+ sdtPr.subtype,
43048
+ sdtPr.repeatingSectionProperties
43049
+ );
43039
43050
  }
43040
43051
  if (sdtPr.appearance !== void 0) {
43041
43052
  inner += `<w:appearance w:val="${escapeXml(sdtPr.appearance)}"/>`;
@@ -43046,32 +43057,38 @@ function serializeSdtPrXml(sdtPr) {
43046
43057
  if (sdtPr.color !== void 0) {
43047
43058
  inner += `<w:color w:val="${escapeXml(sdtPr.color)}"/>`;
43048
43059
  }
43049
- if (sdtPr.unknownXml) {
43050
- inner += sdtPr.unknownXml;
43051
- }
43060
+ if (sdtPr.unknownXml) inner += sdtPr.unknownXml;
43052
43061
  return `<w:sdtPr>${inner}</w:sdtPr>`;
43053
43062
  }
43054
43063
  function serializeSdtDataBindingXml(dataBinding) {
43055
- let inner = "";
43064
+ const attrs = [];
43056
43065
  if (dataBinding.prefixMappings !== void 0) {
43057
- inner += `<w:prefixMappings w:val="${escapeXml(
43058
- dataBinding.prefixMappings
43059
- )}"/>`;
43066
+ attrs.push(`w:prefixMappings="${escapeXml(dataBinding.prefixMappings)}"`);
43060
43067
  }
43061
43068
  if (dataBinding.xpath !== void 0) {
43062
- inner += `<w:xpath w:val="${escapeXml(dataBinding.xpath)}"/>`;
43069
+ attrs.push(`w:xpath="${escapeXml(dataBinding.xpath)}"`);
43063
43070
  }
43064
43071
  if (dataBinding.storeItemID !== void 0) {
43065
- inner += `<w:storeItemID w:val="${escapeXml(dataBinding.storeItemID)}"/>`;
43072
+ attrs.push(`w:storeItemID="${escapeXml(dataBinding.storeItemID)}"`);
43066
43073
  }
43067
- return inner ? `<w:dataBinding>${inner}</w:dataBinding>` : "";
43074
+ return attrs.length > 0 ? `<w:dataBinding ${attrs.join(" ")}/>` : "";
43068
43075
  }
43069
43076
  function serializeSdtListItemXml(item) {
43070
43077
  const displayTextAttr = item.displayText !== void 0 ? ` w:displayText="${escapeXml(item.displayText)}"` : "";
43071
43078
  const valueAttr = item.value !== void 0 ? ` w:value="${escapeXml(item.value)}"` : "";
43072
43079
  return `<w:listItem${displayTextAttr}${valueAttr}/>`;
43073
43080
  }
43074
- function serializeSdtSubtypeXml(subtype) {
43081
+ function serializeRepeatingSectionXml(properties) {
43082
+ let children2 = "";
43083
+ if ((properties == null ? void 0 : properties.sectionTitle) !== void 0) {
43084
+ children2 += `<w15:sectionTitle w15:val="${escapeXml(properties.sectionTitle)}"/>`;
43085
+ }
43086
+ if ((properties == null ? void 0 : properties.doNotAllowInsertDeleteSection) !== void 0) {
43087
+ children2 += `<w15:doNotAllowInsertDeleteSection w15:val="${properties.doNotAllowInsertDeleteSection ? "1" : "0"}"/>`;
43088
+ }
43089
+ return children2 ? `<w15:repeatingSection ${WORD15_XMLNS}>${children2}</w15:repeatingSection>` : `<w15:repeatingSection ${WORD15_XMLNS}/>`;
43090
+ }
43091
+ function serializeSdtSubtypeXml(subtype, repeatingSectionProperties) {
43075
43092
  switch (subtype.kind) {
43076
43093
  case "text":
43077
43094
  return "<w:text/>";
@@ -43088,9 +43105,9 @@ function serializeSdtSubtypeXml(subtype) {
43088
43105
  case "bibliography":
43089
43106
  return "<w:bibliography/>";
43090
43107
  case "repeatingSection":
43091
- return "<w:repeatingSection/>";
43108
+ return serializeRepeatingSectionXml(repeatingSectionProperties);
43092
43109
  case "repeatingSectionItem":
43093
- return "<w:repeatingSectionItem/>";
43110
+ return `<w15:repeatingSectionItem ${WORD15_XMLNS}/>`;
43094
43111
  case "comboBox":
43095
43112
  case "dropDownList": {
43096
43113
  const items = (subtype.listItems ?? []).map(serializeSdtListItemXml).join("");
@@ -45528,29 +45545,26 @@ function overlayEditorParagraphOnOoxmlSource(paragraph, generatedParagraphProper
45528
45545
  function isSplittableTextRun(run) {
45529
45546
  return run.kind === "text" || run.kind === "sym";
45530
45547
  }
45531
- function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, styles) {
45548
+ function serializeRunsWithInlineSdtsAndBoundaries(runs, tokens, context2, paragraphStyleId, styles) {
45532
45549
  const sorted = [...tokens].sort(
45533
45550
  (a, b) => a.offset - b.offset || a.seq - b.seq
45534
45551
  );
45535
- let ei = 0;
45536
- let pos = 0;
45537
- let out = "";
45538
- const flushUpTo = (limit) => {
45539
- while (ei < sorted.length && sorted[ei].offset <= limit) {
45540
- out += sorted[ei].xml;
45541
- ei += 1;
45542
- }
45543
- };
45544
- for (const run of runs) {
45545
- const runStart = pos;
45552
+ let eventIndex = 0;
45553
+ let position2 = 0;
45554
+ const serializeLeafRun = (run) => {
45555
+ let out2 = "";
45556
+ const runStart = position2;
45546
45557
  const runEnd = runStart + run.text.length;
45547
- flushUpTo(runStart);
45558
+ while (eventIndex < sorted.length && sorted[eventIndex].offset <= runStart) {
45559
+ out2 += sorted[eventIndex].xml;
45560
+ eventIndex += 1;
45561
+ }
45548
45562
  if (isSplittableTextRun(run) && run.text.length > 0) {
45549
45563
  let cursor = runStart;
45550
- while (ei < sorted.length && sorted[ei].offset < runEnd) {
45551
- const token = sorted[ei];
45564
+ while (eventIndex < sorted.length && sorted[eventIndex].offset < runEnd) {
45565
+ const token = sorted[eventIndex];
45552
45566
  if (token.offset > cursor) {
45553
- out += serializeRunWithRelationships(
45567
+ out2 += serializeRunWithRelationships(
45554
45568
  {
45555
45569
  ...run,
45556
45570
  text: run.text.slice(cursor - runStart, token.offset - runStart)
@@ -45561,12 +45575,12 @@ function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, s
45561
45575
  serializeBlocksXml
45562
45576
  );
45563
45577
  }
45564
- out += token.xml;
45565
- ei += 1;
45578
+ out2 += token.xml;
45579
+ eventIndex += 1;
45566
45580
  cursor = token.offset;
45567
45581
  }
45568
45582
  if (cursor < runEnd) {
45569
- out += serializeRunWithRelationships(
45583
+ out2 += serializeRunWithRelationships(
45570
45584
  { ...run, text: run.text.slice(cursor - runStart) },
45571
45585
  context2,
45572
45586
  paragraphStyleId,
@@ -45575,7 +45589,7 @@ function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, s
45575
45589
  );
45576
45590
  }
45577
45591
  } else {
45578
- out += serializeRunWithRelationships(
45592
+ out2 += serializeRunWithRelationships(
45579
45593
  run,
45580
45594
  context2,
45581
45595
  paragraphStyleId,
@@ -45583,9 +45597,14 @@ function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, s
45583
45597
  serializeBlocksXml
45584
45598
  );
45585
45599
  }
45586
- pos = runEnd;
45600
+ position2 = runEnd;
45601
+ return out2;
45602
+ };
45603
+ let out = serializeRunsWithInlineSdts(runs, serializeLeafRun);
45604
+ while (eventIndex < sorted.length) {
45605
+ out += sorted[eventIndex].xml;
45606
+ eventIndex += 1;
45587
45607
  }
45588
- flushUpTo(Number.POSITIVE_INFINITY);
45589
45608
  return out;
45590
45609
  }
45591
45610
  function blockHasGeneratedBoundaryTokens(block, context2) {
@@ -45701,9 +45720,7 @@ function serializeParagraphXml(paragraph, context2, styles, overrides) {
45701
45720
  hasOverrides: Boolean(overrides),
45702
45721
  hasBoundaryTokens: boundaryTokens.length > 0
45703
45722
  });
45704
- if (reusableParagraphXml) {
45705
- return reusableParagraphXml;
45706
- }
45723
+ if (reusableParagraphXml) return reusableParagraphXml;
45707
45724
  const serializeCanonicalRun = (run) => {
45708
45725
  var _a3;
45709
45726
  return serializeRunWithRelationships(
@@ -45718,7 +45735,7 @@ function serializeParagraphXml(paragraph, context2, styles, overrides) {
45718
45735
  const runsXml = boundaryTokens.length === 0 ? serializeRunsWithInlineSdts(
45719
45736
  runs,
45720
45737
  serializeCanonicalRun
45721
- ) : serializeRunsWithBoundaries(
45738
+ ) : serializeRunsWithInlineSdtsAndBoundaries(
45722
45739
  runs,
45723
45740
  boundaryTokens,
45724
45741
  context2,
@@ -45748,9 +45765,7 @@ function serializeParagraphXml(paragraph, context2, styles, overrides) {
45748
45765
  hasBoundaryTokens: false
45749
45766
  }
45750
45767
  );
45751
- if (overlaidParagraphXml) {
45752
- return overlaidParagraphXml;
45753
- }
45768
+ if (overlaidParagraphXml) return overlaidParagraphXml;
45754
45769
  }
45755
45770
  return `${dropCapFrame}<w:p${paragraphAttributes}>${paragraphProperties}${runsXml}</w:p>`;
45756
45771
  }
@@ -47553,7 +47568,7 @@ async function importDocxInWorker(buffer, options = {}) {
47553
47568
  const worker = new Worker(
47554
47569
  new URL(
47555
47570
  /* @vite-ignore */
47556
- "" + new URL("assets/importDocxWorker-DIzjAlvN.js", import.meta.url).href,
47571
+ "" + new URL("assets/importDocxWorker-CyAWuOO6.js", import.meta.url).href,
47557
47572
  import.meta.url
47558
47573
  ),
47559
47574
  {
@@ -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-BR6GooGM.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-BXPaFnv7.js";
2
2
  export {
3
3
  dK as ActionRow,
4
4
  ah as BalloonShell,