oasis-editor 0.0.160 → 0.0.162

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.
@@ -1,3 +1,9 @@
1
+ declare module "./primitives.js" {
2
+ interface EditorRevision {
3
+ /** Word tracked-move semantics layered over delete/insert revisions. */
4
+ move?: "from" | "to";
5
+ }
6
+ }
1
7
  declare module "./nodes.js" {
2
8
  interface EditorRunBase {
3
9
  /** Enclosing inline `w:sdt` content controls, outermost first. */
@@ -11,5 +17,14 @@ declare module "./nodes.js" {
11
17
  /** Enclosing cell-level `w:sdt` content controls, outermost first. */
12
18
  sdtWrappers?: EditorSdtBlockWrapper[];
13
19
  }
20
+ interface EditorSdtPr {
21
+ /** Word 2013 `w15:repeatingSection` settings. */
22
+ repeatingSectionProperties?: {
23
+ /** `w15:sectionTitle/@w15:val`. */
24
+ sectionTitle?: string;
25
+ /** Presence/value of `w15:doNotAllowInsertDeleteSection`. */
26
+ doNotAllowInsertDeleteSection?: boolean;
27
+ };
28
+ }
14
29
  }
15
30
  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;
@@ -1,5 +1,5 @@
1
1
  import { Element as XmlElement } from '@xmldom/xmldom';
2
- import { EditorBlockNode, EditorTextStyle, EditorImageRunData, EditorTextBoxData, EditorMathExpression, EditorSdtBlockWrapper } from '../../../core/model.js';
2
+ import { EditorBlockNode, EditorTextStyle, EditorImageRunData, EditorTextBoxData, EditorMathExpression, EditorRevision, EditorSdtBlockWrapper } from '../../../core/model.js';
3
3
 
4
4
  export type ParseNestedBlocks = (container: XmlElement) => Promise<EditorBlockNode[]>;
5
5
  /**
@@ -28,6 +28,8 @@ export interface ImportedRun {
28
28
  image?: EditorImageRunData;
29
29
  textBox?: EditorTextBoxData;
30
30
  styles?: EditorTextStyle;
31
+ /** Tracked insertion/deletion, optionally paired as a Word move. */
32
+ revision?: EditorRevision;
31
33
  /** Enclosing inline `w:sdt` wrappers, outermost first. */
32
34
  sdtWrappers?: EditorSdtBlockWrapper[];
33
35
  field?: {
@@ -39,7 +41,7 @@ export interface ImportedRun {
39
41
  fieldLock?: boolean;
40
42
  dirty?: boolean;
41
43
  };
42
- /** Preserved `w:instrText`. Zero-length marker. */
44
+ /** Preserved `w:instrText` / `w:delInstrText`. Zero-length marker. */
43
45
  fieldInstruction?: string;
44
46
  footnoteReference?: {
45
47
  docxId: string;
@@ -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-1SLQ3toO.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;
@@ -40529,6 +40537,9 @@ function importedRunToEditorRun(run) {
40529
40537
  if (run.styles) {
40530
40538
  base.styles = { ...run.styles };
40531
40539
  }
40540
+ if (run.revision) {
40541
+ base.revision = { ...run.revision };
40542
+ }
40532
40543
  if ((_a2 = run.sdtWrappers) == null ? void 0 : _a2.length) {
40533
40544
  base.sdtWrappers = [...run.sdtWrappers];
40534
40545
  }
@@ -41467,7 +41478,7 @@ function extractCommentRangesFromSections(sections) {
41467
41478
  }
41468
41479
  return ranges;
41469
41480
  }
41470
- const WORD15_NS$1 = "http://schemas.microsoft.com/office/word/2012/wordml";
41481
+ const WORD15_NS$2 = "http://schemas.microsoft.com/office/word/2012/wordml";
41471
41482
  const WORD16DU_NS$1 = "http://schemas.microsoft.com/office/word/2023/wordml/word16du";
41472
41483
  function flattenCommentText(element) {
41473
41484
  let out = "";
@@ -41512,12 +41523,12 @@ function parseCommentsExtended(xml) {
41512
41523
  if (!root) {
41513
41524
  return done;
41514
41525
  }
41515
- for (const ex of getChildrenByTagNameNS(root, WORD15_NS$1, "commentEx")) {
41516
- const paraId = ex.getAttributeNS(WORD15_NS$1, "paraId");
41526
+ for (const ex of getChildrenByTagNameNS(root, WORD15_NS$2, "commentEx")) {
41527
+ const paraId = ex.getAttributeNS(WORD15_NS$2, "paraId");
41517
41528
  if (!paraId) {
41518
41529
  continue;
41519
41530
  }
41520
- const isDone = ex.getAttributeNS(WORD15_NS$1, "done");
41531
+ const isDone = ex.getAttributeNS(WORD15_NS$2, "done");
41521
41532
  done.set(paraId, isDone === "1" || isDone === "true");
41522
41533
  }
41523
41534
  return done;
@@ -42377,7 +42388,7 @@ function serializeBookmarkEvent(event) {
42377
42388
  event.name ?? ""
42378
42389
  )}"${col}/>`;
42379
42390
  }
42380
- const WORD15_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
42391
+ const WORD15_NS$1 = "http://schemas.microsoft.com/office/word/2012/wordml";
42381
42392
  const WORD16DU_NS = "http://schemas.microsoft.com/office/word/2023/wordml/word16du";
42382
42393
  function buildCommentExportPlan(document2) {
42383
42394
  const registry2 = document2.comments;
@@ -42454,7 +42465,7 @@ function serializeCommentRangeEvent(event) {
42454
42465
  return `<w:r><w:commentReference w:id="${event.wId}"/></w:r>`;
42455
42466
  }
42456
42467
  }
42457
- const COMMENTS_XMLNS = `xmlns:w="${WORD_NS$1}" xmlns:w14="${WORD14_NS}" xmlns:w15="${WORD15_NS}" xmlns:w16du="${WORD16DU_NS}"`;
42468
+ const COMMENTS_XMLNS = `xmlns:w="${WORD_NS$1}" xmlns:w14="${WORD14_NS}" xmlns:w15="${WORD15_NS$1}" xmlns:w16du="${WORD16DU_NS}"`;
42458
42469
  function serializeCommentBody(text2) {
42459
42470
  const lines = text2.split("\n");
42460
42471
  const runs = lines.map((line, i) => {
@@ -43005,11 +43016,11 @@ function serializeTableXml(table, serializeBlockXml) {
43005
43016
  ).join("")}</w:tblGrid></w:tblGridChange>` : ""}</w:tblGrid>` : "";
43006
43017
  return `<w:tbl>${serializeTableProperties(table)}${gridXml}${rowsXml}</w:tbl>`;
43007
43018
  }
43019
+ const WORD15_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
43020
+ const WORD15_XMLNS = `xmlns:w15="${WORD15_NS}"`;
43008
43021
  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
- }
43022
+ 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;
43023
+ if (!hasAnyField) return "<w:sdtPr/>";
43013
43024
  let inner = "";
43014
43025
  if (sdtPr.alias !== void 0) {
43015
43026
  inner += `<w:alias w:val="${escapeXml(sdtPr.alias)}"/>`;
@@ -43035,7 +43046,10 @@ function serializeSdtPrXml(sdtPr) {
43035
43046
  inner += `<w:temporary w:val="${sdtPr.temporary ? "true" : "false"}"/>`;
43036
43047
  }
43037
43048
  if (sdtPr.subtype !== void 0) {
43038
- inner += serializeSdtSubtypeXml(sdtPr.subtype);
43049
+ inner += serializeSdtSubtypeXml(
43050
+ sdtPr.subtype,
43051
+ sdtPr.repeatingSectionProperties
43052
+ );
43039
43053
  }
43040
43054
  if (sdtPr.appearance !== void 0) {
43041
43055
  inner += `<w:appearance w:val="${escapeXml(sdtPr.appearance)}"/>`;
@@ -43046,32 +43060,38 @@ function serializeSdtPrXml(sdtPr) {
43046
43060
  if (sdtPr.color !== void 0) {
43047
43061
  inner += `<w:color w:val="${escapeXml(sdtPr.color)}"/>`;
43048
43062
  }
43049
- if (sdtPr.unknownXml) {
43050
- inner += sdtPr.unknownXml;
43051
- }
43063
+ if (sdtPr.unknownXml) inner += sdtPr.unknownXml;
43052
43064
  return `<w:sdtPr>${inner}</w:sdtPr>`;
43053
43065
  }
43054
43066
  function serializeSdtDataBindingXml(dataBinding) {
43055
- let inner = "";
43067
+ const attrs = [];
43056
43068
  if (dataBinding.prefixMappings !== void 0) {
43057
- inner += `<w:prefixMappings w:val="${escapeXml(
43058
- dataBinding.prefixMappings
43059
- )}"/>`;
43069
+ attrs.push(`w:prefixMappings="${escapeXml(dataBinding.prefixMappings)}"`);
43060
43070
  }
43061
43071
  if (dataBinding.xpath !== void 0) {
43062
- inner += `<w:xpath w:val="${escapeXml(dataBinding.xpath)}"/>`;
43072
+ attrs.push(`w:xpath="${escapeXml(dataBinding.xpath)}"`);
43063
43073
  }
43064
43074
  if (dataBinding.storeItemID !== void 0) {
43065
- inner += `<w:storeItemID w:val="${escapeXml(dataBinding.storeItemID)}"/>`;
43075
+ attrs.push(`w:storeItemID="${escapeXml(dataBinding.storeItemID)}"`);
43066
43076
  }
43067
- return inner ? `<w:dataBinding>${inner}</w:dataBinding>` : "";
43077
+ return attrs.length > 0 ? `<w:dataBinding ${attrs.join(" ")}/>` : "";
43068
43078
  }
43069
43079
  function serializeSdtListItemXml(item) {
43070
43080
  const displayTextAttr = item.displayText !== void 0 ? ` w:displayText="${escapeXml(item.displayText)}"` : "";
43071
43081
  const valueAttr = item.value !== void 0 ? ` w:value="${escapeXml(item.value)}"` : "";
43072
43082
  return `<w:listItem${displayTextAttr}${valueAttr}/>`;
43073
43083
  }
43074
- function serializeSdtSubtypeXml(subtype) {
43084
+ function serializeRepeatingSectionXml(properties) {
43085
+ let children2 = "";
43086
+ if ((properties == null ? void 0 : properties.sectionTitle) !== void 0) {
43087
+ children2 += `<w15:sectionTitle w15:val="${escapeXml(properties.sectionTitle)}"/>`;
43088
+ }
43089
+ if ((properties == null ? void 0 : properties.doNotAllowInsertDeleteSection) !== void 0) {
43090
+ children2 += `<w15:doNotAllowInsertDeleteSection w15:val="${properties.doNotAllowInsertDeleteSection ? "1" : "0"}"/>`;
43091
+ }
43092
+ return children2 ? `<w15:repeatingSection ${WORD15_XMLNS}>${children2}</w15:repeatingSection>` : `<w15:repeatingSection ${WORD15_XMLNS}/>`;
43093
+ }
43094
+ function serializeSdtSubtypeXml(subtype, repeatingSectionProperties) {
43075
43095
  switch (subtype.kind) {
43076
43096
  case "text":
43077
43097
  return "<w:text/>";
@@ -43088,9 +43108,9 @@ function serializeSdtSubtypeXml(subtype) {
43088
43108
  case "bibliography":
43089
43109
  return "<w:bibliography/>";
43090
43110
  case "repeatingSection":
43091
- return "<w:repeatingSection/>";
43111
+ return serializeRepeatingSectionXml(repeatingSectionProperties);
43092
43112
  case "repeatingSectionItem":
43093
- return "<w:repeatingSectionItem/>";
43113
+ return `<w15:repeatingSectionItem ${WORD15_XMLNS}/>`;
43094
43114
  case "comboBox":
43095
43115
  case "dropDownList": {
43096
43116
  const items = (subtype.listItems ?? []).map(serializeSdtListItemXml).join("");
@@ -45528,29 +45548,26 @@ function overlayEditorParagraphOnOoxmlSource(paragraph, generatedParagraphProper
45528
45548
  function isSplittableTextRun(run) {
45529
45549
  return run.kind === "text" || run.kind === "sym";
45530
45550
  }
45531
- function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, styles) {
45551
+ function serializeRunsWithInlineSdtsAndBoundaries(runs, tokens, context2, paragraphStyleId, styles) {
45532
45552
  const sorted = [...tokens].sort(
45533
45553
  (a, b) => a.offset - b.offset || a.seq - b.seq
45534
45554
  );
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;
45555
+ let eventIndex = 0;
45556
+ let position2 = 0;
45557
+ const serializeLeafRun = (run) => {
45558
+ let out2 = "";
45559
+ const runStart = position2;
45546
45560
  const runEnd = runStart + run.text.length;
45547
- flushUpTo(runStart);
45561
+ while (eventIndex < sorted.length && sorted[eventIndex].offset <= runStart) {
45562
+ out2 += sorted[eventIndex].xml;
45563
+ eventIndex += 1;
45564
+ }
45548
45565
  if (isSplittableTextRun(run) && run.text.length > 0) {
45549
45566
  let cursor = runStart;
45550
- while (ei < sorted.length && sorted[ei].offset < runEnd) {
45551
- const token = sorted[ei];
45567
+ while (eventIndex < sorted.length && sorted[eventIndex].offset < runEnd) {
45568
+ const token = sorted[eventIndex];
45552
45569
  if (token.offset > cursor) {
45553
- out += serializeRunWithRelationships(
45570
+ out2 += serializeRunWithRelationships(
45554
45571
  {
45555
45572
  ...run,
45556
45573
  text: run.text.slice(cursor - runStart, token.offset - runStart)
@@ -45561,12 +45578,12 @@ function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, s
45561
45578
  serializeBlocksXml
45562
45579
  );
45563
45580
  }
45564
- out += token.xml;
45565
- ei += 1;
45581
+ out2 += token.xml;
45582
+ eventIndex += 1;
45566
45583
  cursor = token.offset;
45567
45584
  }
45568
45585
  if (cursor < runEnd) {
45569
- out += serializeRunWithRelationships(
45586
+ out2 += serializeRunWithRelationships(
45570
45587
  { ...run, text: run.text.slice(cursor - runStart) },
45571
45588
  context2,
45572
45589
  paragraphStyleId,
@@ -45575,7 +45592,7 @@ function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, s
45575
45592
  );
45576
45593
  }
45577
45594
  } else {
45578
- out += serializeRunWithRelationships(
45595
+ out2 += serializeRunWithRelationships(
45579
45596
  run,
45580
45597
  context2,
45581
45598
  paragraphStyleId,
@@ -45583,9 +45600,14 @@ function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, s
45583
45600
  serializeBlocksXml
45584
45601
  );
45585
45602
  }
45586
- pos = runEnd;
45603
+ position2 = runEnd;
45604
+ return out2;
45605
+ };
45606
+ let out = serializeRunsWithInlineSdts(runs, serializeLeafRun);
45607
+ while (eventIndex < sorted.length) {
45608
+ out += sorted[eventIndex].xml;
45609
+ eventIndex += 1;
45587
45610
  }
45588
- flushUpTo(Number.POSITIVE_INFINITY);
45589
45611
  return out;
45590
45612
  }
45591
45613
  function blockHasGeneratedBoundaryTokens(block, context2) {
@@ -45701,9 +45723,7 @@ function serializeParagraphXml(paragraph, context2, styles, overrides) {
45701
45723
  hasOverrides: Boolean(overrides),
45702
45724
  hasBoundaryTokens: boundaryTokens.length > 0
45703
45725
  });
45704
- if (reusableParagraphXml) {
45705
- return reusableParagraphXml;
45706
- }
45726
+ if (reusableParagraphXml) return reusableParagraphXml;
45707
45727
  const serializeCanonicalRun = (run) => {
45708
45728
  var _a3;
45709
45729
  return serializeRunWithRelationships(
@@ -45718,7 +45738,7 @@ function serializeParagraphXml(paragraph, context2, styles, overrides) {
45718
45738
  const runsXml = boundaryTokens.length === 0 ? serializeRunsWithInlineSdts(
45719
45739
  runs,
45720
45740
  serializeCanonicalRun
45721
- ) : serializeRunsWithBoundaries(
45741
+ ) : serializeRunsWithInlineSdtsAndBoundaries(
45722
45742
  runs,
45723
45743
  boundaryTokens,
45724
45744
  context2,
@@ -45748,9 +45768,7 @@ function serializeParagraphXml(paragraph, context2, styles, overrides) {
45748
45768
  hasBoundaryTokens: false
45749
45769
  }
45750
45770
  );
45751
- if (overlaidParagraphXml) {
45752
- return overlaidParagraphXml;
45753
- }
45771
+ if (overlaidParagraphXml) return overlaidParagraphXml;
45754
45772
  }
45755
45773
  return `${dropCapFrame}<w:p${paragraphAttributes}>${paragraphProperties}${runsXml}</w:p>`;
45756
45774
  }
@@ -47553,7 +47571,7 @@ async function importDocxInWorker(buffer, options = {}) {
47553
47571
  const worker = new Worker(
47554
47572
  new URL(
47555
47573
  /* @vite-ignore */
47556
- "" + new URL("assets/importDocxWorker-DIzjAlvN.js", import.meta.url).href,
47574
+ "" + new URL("assets/importDocxWorker-BnENWXFH.js", import.meta.url).href,
47557
47575
  import.meta.url
47558
47576
  ),
47559
47577
  {
@@ -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-BY8DRmWC.js";
2
2
  export {
3
3
  dK as ActionRow,
4
4
  ah as BalloonShell,