oasis-editor 0.0.157 → 0.0.158

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.
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
2863
2863
  onCleanup(() => {
2864
2864
  cancelled = true;
2865
2865
  });
2866
- import("./OasisEditorApp-BfdBu3ui.js").then((m) => {
2866
+ import("./OasisEditorApp-D8XC2a93.js").then((m) => {
2867
2867
  cancelled = true;
2868
2868
  setProgress(1);
2869
2869
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -38883,6 +38883,283 @@ function parseMathExpression(element) {
38883
38883
  sourceXml: serializer.serializeToString(element)
38884
38884
  };
38885
38885
  }
38886
+ const RECOGNIZED_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38887
+ "alias",
38888
+ "tag",
38889
+ "id",
38890
+ "lock",
38891
+ "placeholder",
38892
+ "dataBinding",
38893
+ "temporary",
38894
+ "appearance",
38895
+ "showingPlcHdr",
38896
+ "color",
38897
+ "text",
38898
+ "richText",
38899
+ "picture",
38900
+ "comboBox",
38901
+ "dropDownList",
38902
+ "date",
38903
+ "repeatingSection",
38904
+ "repeatingSectionItem",
38905
+ "group",
38906
+ "equation",
38907
+ "citation",
38908
+ "bibliography"
38909
+ ]);
38910
+ function parseSdtPr(sdtPr) {
38911
+ if (!sdtPr) {
38912
+ return {};
38913
+ }
38914
+ const result = {};
38915
+ const aliasEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "alias");
38916
+ if (aliasEl) {
38917
+ const alias = getAttributeValue(aliasEl, "val");
38918
+ if (alias !== null) {
38919
+ result.alias = alias;
38920
+ }
38921
+ }
38922
+ const tagEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "tag");
38923
+ if (tagEl) {
38924
+ const tag = getAttributeValue(tagEl, "val");
38925
+ if (tag !== null) {
38926
+ result.tag = tag;
38927
+ }
38928
+ }
38929
+ const idEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "id");
38930
+ if (idEl) {
38931
+ const id = getAttributeValue(idEl, "val");
38932
+ if (id !== null) {
38933
+ result.id = id;
38934
+ }
38935
+ }
38936
+ const lockEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "lock");
38937
+ if (lockEl) {
38938
+ const lock = getAttributeValue(lockEl, "val");
38939
+ if (lock !== null) {
38940
+ result.lock = lock;
38941
+ }
38942
+ }
38943
+ const appearanceEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "appearance");
38944
+ if (appearanceEl) {
38945
+ const appearance = getAttributeValue(appearanceEl, "val");
38946
+ if (appearance !== null) {
38947
+ result.appearance = appearance;
38948
+ }
38949
+ }
38950
+ const showingPlcHdrEl = getFirstChildByTagNameNS(
38951
+ sdtPr,
38952
+ WORD_NS$3,
38953
+ "showingPlcHdr"
38954
+ );
38955
+ if (showingPlcHdrEl) {
38956
+ result.showingPlcHdr = isWordTrue(
38957
+ getAttributeValue(showingPlcHdrEl, "val")
38958
+ );
38959
+ }
38960
+ const temporaryEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "temporary");
38961
+ if (temporaryEl) {
38962
+ result.temporary = isWordTrue(getAttributeValue(temporaryEl, "val"));
38963
+ }
38964
+ const colorEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "color");
38965
+ if (colorEl) {
38966
+ const color = getAttributeValue(colorEl, "val");
38967
+ if (color !== null) {
38968
+ result.color = color;
38969
+ }
38970
+ }
38971
+ const placeholderEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "placeholder");
38972
+ if (placeholderEl) {
38973
+ const docPart = getFirstChildByTagNameNS(placeholderEl, WORD_NS$3, "docPart");
38974
+ if (docPart) {
38975
+ const docPartVal = getAttributeValue(docPart, "val");
38976
+ if (docPartVal !== null) {
38977
+ result.placeholderDocPart = docPartVal;
38978
+ }
38979
+ }
38980
+ }
38981
+ const dataBindingEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "dataBinding");
38982
+ if (dataBindingEl) {
38983
+ const dataBinding = parseSdtDataBinding(dataBindingEl);
38984
+ if (dataBinding) {
38985
+ result.dataBinding = dataBinding;
38986
+ }
38987
+ }
38988
+ const subtype = parseSdtSubtype(sdtPr);
38989
+ if (subtype) {
38990
+ result.subtype = subtype;
38991
+ }
38992
+ const unknownXml = serializeUnknownSdtPrChildren(sdtPr);
38993
+ if (unknownXml.length > 0) {
38994
+ result.unknownXml = unknownXml;
38995
+ }
38996
+ return result;
38997
+ }
38998
+ function parseSdtDataBinding(el) {
38999
+ const prefixMappingsEl = getFirstChildByTagNameNS(
39000
+ el,
39001
+ WORD_NS$3,
39002
+ "prefixMappings"
39003
+ );
39004
+ const xpathEl = getFirstChildByTagNameNS(el, WORD_NS$3, "xpath");
39005
+ const storeItemIDEl = getFirstChildByTagNameNS(el, WORD_NS$3, "storeItemID");
39006
+ const dataBinding = {};
39007
+ if (prefixMappingsEl) {
39008
+ const val = getAttributeValue(prefixMappingsEl, "val");
39009
+ if (val !== null) {
39010
+ dataBinding.prefixMappings = val;
39011
+ }
39012
+ }
39013
+ if (xpathEl) {
39014
+ const val = getAttributeValue(xpathEl, "val");
39015
+ if (val !== null) {
39016
+ dataBinding.xpath = val;
39017
+ }
39018
+ }
39019
+ if (storeItemIDEl) {
39020
+ const val = getAttributeValue(storeItemIDEl, "val");
39021
+ if (val !== null) {
39022
+ dataBinding.storeItemID = val;
39023
+ }
39024
+ }
39025
+ if (dataBinding.prefixMappings === void 0 && dataBinding.xpath === void 0 && dataBinding.storeItemID === void 0) {
39026
+ return null;
39027
+ }
39028
+ return dataBinding;
39029
+ }
39030
+ function parseSdtListItems(parent) {
39031
+ const items = getChildrenByTagNameNS(parent, WORD_NS$3, "listItem");
39032
+ if (items.length === 0) {
39033
+ return void 0;
39034
+ }
39035
+ return items.map(
39036
+ (item) => ({
39037
+ displayText: getAttributeValue(item, "displayText") ?? void 0,
39038
+ value: getAttributeValue(item, "value") ?? void 0
39039
+ })
39040
+ );
39041
+ }
39042
+ function parseSdtSubtype(parent) {
39043
+ const comboBoxEl = getFirstChildByTagNameNS(parent, WORD_NS$3, "comboBox");
39044
+ if (comboBoxEl) {
39045
+ const lastSelectedEl = getFirstChildByTagNameNS(
39046
+ comboBoxEl,
39047
+ WORD_NS$3,
39048
+ "lastSelectedValue"
39049
+ );
39050
+ return {
39051
+ kind: "comboBox",
39052
+ listItems: parseSdtListItems(comboBoxEl),
39053
+ ...lastSelectedEl ? {
39054
+ lastSelectedValue: getAttributeValue(lastSelectedEl, "val") ?? void 0
39055
+ } : {}
39056
+ };
39057
+ }
39058
+ const dropDownEl = getFirstChildByTagNameNS(parent, WORD_NS$3, "dropDownList");
39059
+ if (dropDownEl) {
39060
+ const lastSelectedEl = getFirstChildByTagNameNS(
39061
+ dropDownEl,
39062
+ WORD_NS$3,
39063
+ "lastSelectedValue"
39064
+ );
39065
+ return {
39066
+ kind: "dropDownList",
39067
+ listItems: parseSdtListItems(dropDownEl),
39068
+ ...lastSelectedEl ? {
39069
+ lastSelectedValue: getAttributeValue(lastSelectedEl, "val") ?? void 0
39070
+ } : {}
39071
+ };
39072
+ }
39073
+ const dateEl = getFirstChildByTagNameNS(parent, WORD_NS$3, "date");
39074
+ if (dateEl) {
39075
+ const fullDate = getAttributeValue(dateEl, "fullDate") ?? void 0;
39076
+ const dateFormatEl = getFirstChildByTagNameNS(
39077
+ dateEl,
39078
+ WORD_NS$3,
39079
+ "dateFormat"
39080
+ );
39081
+ const lidEl = getFirstChildByTagNameNS(dateEl, WORD_NS$3, "lid");
39082
+ const calendarEl = getFirstChildByTagNameNS(dateEl, WORD_NS$3, "calendar");
39083
+ const storeMappedDataAsEl = getFirstChildByTagNameNS(
39084
+ dateEl,
39085
+ WORD_NS$3,
39086
+ "storeMappedDataAs"
39087
+ );
39088
+ return {
39089
+ kind: "date",
39090
+ fullDate,
39091
+ dateFormat: dateFormatEl ? getAttributeValue(dateFormatEl, "val") ?? void 0 : void 0,
39092
+ lid: lidEl ? getAttributeValue(lidEl, "val") ?? void 0 : void 0,
39093
+ calendar: calendarEl ? getAttributeValue(calendarEl, "val") ?? void 0 : void 0,
39094
+ storeMappedDataAs: storeMappedDataAsEl ? getAttributeValue(storeMappedDataAsEl, "val") ?? void 0 : void 0
39095
+ };
39096
+ }
39097
+ const textEl = getFirstChildByTagNameNS(parent, WORD_NS$3, "text");
39098
+ if (textEl) {
39099
+ return { kind: "text" };
39100
+ }
39101
+ for (const kind of [
39102
+ "richText",
39103
+ "picture",
39104
+ "group",
39105
+ "equation",
39106
+ "citation",
39107
+ "bibliography",
39108
+ "repeatingSection",
39109
+ "repeatingSectionItem"
39110
+ ]) {
39111
+ if (getFirstChildByTagNameNS(parent, WORD_NS$3, kind)) {
39112
+ return { kind };
39113
+ }
39114
+ }
39115
+ const w14CheckboxEl = getFirstW14Child(parent, "checkbox");
39116
+ if (w14CheckboxEl) {
39117
+ const checkedEl = getFirstChildByTagNameNS(
39118
+ w14CheckboxEl,
39119
+ WORD14_NS$1,
39120
+ "checked"
39121
+ );
39122
+ const checkedStateEl = getFirstChildByTagNameNS(
39123
+ w14CheckboxEl,
39124
+ WORD14_NS$1,
39125
+ "checkedState"
39126
+ );
39127
+ const uncheckedStateEl = getFirstChildByTagNameNS(
39128
+ w14CheckboxEl,
39129
+ WORD14_NS$1,
39130
+ "uncheckedState"
39131
+ );
39132
+ const checked = checkedEl ? isWordTrue(getAttributeValue(checkedEl, "val")) : void 0;
39133
+ return {
39134
+ kind: "checkbox",
39135
+ ...checked !== void 0 ? { checked } : {},
39136
+ ...checkedStateEl ? {
39137
+ checkedStateFont: getAttributeValue(checkedStateEl, "font") ?? void 0,
39138
+ checkedStateChar: getAttributeValue(checkedStateEl, "char") ?? void 0
39139
+ } : {},
39140
+ ...uncheckedStateEl ? {
39141
+ uncheckedStateFont: getAttributeValue(uncheckedStateEl, "font") ?? void 0,
39142
+ uncheckedStateChar: getAttributeValue(uncheckedStateEl, "char") ?? void 0
39143
+ } : {}
39144
+ };
39145
+ }
39146
+ return void 0;
39147
+ }
39148
+ function serializeUnknownSdtPrChildren(sdtPr) {
39149
+ let out = "";
39150
+ for (let i = 0; i < sdtPr.childNodes.length; i += 1) {
39151
+ const node = sdtPr.childNodes[i];
39152
+ if ((node == null ? void 0 : node.nodeType) !== node.ELEMENT_NODE) {
39153
+ continue;
39154
+ }
39155
+ const el = node;
39156
+ if (el.localName && el.namespaceURI === WORD_NS$3 && RECOGNIZED_SDT_PR_CHILDREN.has(el.localName)) {
39157
+ continue;
39158
+ }
39159
+ out += new XMLSerializer().serializeToString(el);
39160
+ }
39161
+ return out;
39162
+ }
38886
39163
  const VML_FRACTION_DENOMINATOR = 65536;
38887
39164
  function emuToPx(value2) {
38888
39165
  const emu = parseOptionalInt(value2);
@@ -39669,6 +39946,36 @@ async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets
39669
39946
  runs.push({ text: "", comment: marker });
39670
39947
  continue;
39671
39948
  }
39949
+ if (element.localName === "sdt") {
39950
+ const sdtContent = getFirstChildByTagNameNS(element, WORD_NS$3, "sdtContent");
39951
+ if (!sdtContent) {
39952
+ continue;
39953
+ }
39954
+ const sdtPr = getFirstChildByTagNameNS(element, WORD_NS$3, "sdtPr");
39955
+ const sdtEndPr = getFirstChildByTagNameNS(element, WORD_NS$3, "sdtEndPr");
39956
+ const wrapper = {
39957
+ groupId: createEditorNodeId("sdt"),
39958
+ sdtPr: parseSdtPr(sdtPr),
39959
+ ...sdtEndPr ? { sdtEndPrXml: new XMLSerializer().serializeToString(sdtEndPr) } : {}
39960
+ };
39961
+ const nestedRuns = await parseRunsContainer(
39962
+ sdtContent,
39963
+ numberingMaps,
39964
+ zip,
39965
+ relsMap,
39966
+ assets,
39967
+ theme,
39968
+ inheritedLink,
39969
+ parseNestedBlocks
39970
+ );
39971
+ for (const nestedRun of nestedRuns) {
39972
+ runs.push({
39973
+ ...nestedRun,
39974
+ sdtWrappers: [wrapper, ...nestedRun.sdtWrappers ?? []]
39975
+ });
39976
+ }
39977
+ continue;
39978
+ }
39672
39979
  if (element.localName === "r") {
39673
39980
  const runStyles = parseRunStyle(
39674
39981
  getFirstChildByTagNameNS(element, WORD_NS$3, "rPr"),
@@ -40209,6 +40516,7 @@ function captureImportedParagraphSource(paragraphNode, paragraphProperties, impo
40209
40516
  };
40210
40517
  }
40211
40518
  function importedRunToEditorRun(run) {
40519
+ var _a2;
40212
40520
  const base = {
40213
40521
  id: createEditorNodeId("run"),
40214
40522
  text: run.text
@@ -40216,6 +40524,9 @@ function importedRunToEditorRun(run) {
40216
40524
  if (run.styles) {
40217
40525
  base.styles = { ...run.styles };
40218
40526
  }
40527
+ if ((_a2 = run.sdtWrappers) == null ? void 0 : _a2.length) {
40528
+ base.sdtWrappers = [...run.sdtWrappers];
40529
+ }
40219
40530
  let editorRun;
40220
40531
  if (run.fieldChar) {
40221
40532
  editorRun = { ...base, kind: "fieldChar", fieldChar: { ...run.fieldChar } };
@@ -40260,19 +40571,14 @@ function importedRunToEditorRun(run) {
40260
40571
  }
40261
40572
  function createImportedParagraph(runs, paragraphStyle, list, markRunStyle, source) {
40262
40573
  var _a2, _b2;
40263
- const editorRuns = runs.length > 0 ? runs.map(importedRunToEditorRun) : (
40264
- // An empty paragraph still carries the formatting of its paragraph mark
40265
- // (`w:pPr/w:rPr`), which Word uses to render the blank line's font/size.
40266
- // Apply it so empty lines match Word instead of falling back to defaults.
40267
- [
40268
- {
40269
- id: createEditorNodeId("run"),
40270
- text: "",
40271
- kind: "text",
40272
- ...markRunStyle ? { styles: { ...markRunStyle } } : {}
40273
- }
40274
- ]
40275
- );
40574
+ const editorRuns = runs.length > 0 ? runs.map(importedRunToEditorRun) : [
40575
+ {
40576
+ id: createEditorNodeId("run"),
40577
+ text: "",
40578
+ kind: "text",
40579
+ ...markRunStyle ? { styles: { ...markRunStyle } } : {}
40580
+ }
40581
+ ];
40276
40582
  const paragraph = {
40277
40583
  id: createEditorNodeId("paragraph"),
40278
40584
  type: "paragraph",
@@ -40639,283 +40945,6 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
40639
40945
  );
40640
40946
  return table;
40641
40947
  }
40642
- const RECOGNIZED_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
40643
- "alias",
40644
- "tag",
40645
- "id",
40646
- "lock",
40647
- "placeholder",
40648
- "dataBinding",
40649
- "temporary",
40650
- "appearance",
40651
- "showingPlcHdr",
40652
- "color",
40653
- "text",
40654
- "richText",
40655
- "picture",
40656
- "comboBox",
40657
- "dropDownList",
40658
- "date",
40659
- "repeatingSection",
40660
- "repeatingSectionItem",
40661
- "group",
40662
- "equation",
40663
- "citation",
40664
- "bibliography"
40665
- ]);
40666
- function parseSdtPr(sdtPr) {
40667
- if (!sdtPr) {
40668
- return {};
40669
- }
40670
- const result = {};
40671
- const aliasEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "alias");
40672
- if (aliasEl) {
40673
- const alias = getAttributeValue(aliasEl, "val");
40674
- if (alias !== null) {
40675
- result.alias = alias;
40676
- }
40677
- }
40678
- const tagEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "tag");
40679
- if (tagEl) {
40680
- const tag = getAttributeValue(tagEl, "val");
40681
- if (tag !== null) {
40682
- result.tag = tag;
40683
- }
40684
- }
40685
- const idEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "id");
40686
- if (idEl) {
40687
- const id = getAttributeValue(idEl, "val");
40688
- if (id !== null) {
40689
- result.id = id;
40690
- }
40691
- }
40692
- const lockEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "lock");
40693
- if (lockEl) {
40694
- const lock = getAttributeValue(lockEl, "val");
40695
- if (lock !== null) {
40696
- result.lock = lock;
40697
- }
40698
- }
40699
- const appearanceEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "appearance");
40700
- if (appearanceEl) {
40701
- const appearance = getAttributeValue(appearanceEl, "val");
40702
- if (appearance !== null) {
40703
- result.appearance = appearance;
40704
- }
40705
- }
40706
- const showingPlcHdrEl = getFirstChildByTagNameNS(
40707
- sdtPr,
40708
- WORD_NS$3,
40709
- "showingPlcHdr"
40710
- );
40711
- if (showingPlcHdrEl) {
40712
- result.showingPlcHdr = isWordTrue(
40713
- getAttributeValue(showingPlcHdrEl, "val")
40714
- );
40715
- }
40716
- const temporaryEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "temporary");
40717
- if (temporaryEl) {
40718
- result.temporary = isWordTrue(getAttributeValue(temporaryEl, "val"));
40719
- }
40720
- const colorEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "color");
40721
- if (colorEl) {
40722
- const color = getAttributeValue(colorEl, "val");
40723
- if (color !== null) {
40724
- result.color = color;
40725
- }
40726
- }
40727
- const placeholderEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "placeholder");
40728
- if (placeholderEl) {
40729
- const docPart = getFirstChildByTagNameNS(placeholderEl, WORD_NS$3, "docPart");
40730
- if (docPart) {
40731
- const docPartVal = getAttributeValue(docPart, "val");
40732
- if (docPartVal !== null) {
40733
- result.placeholderDocPart = docPartVal;
40734
- }
40735
- }
40736
- }
40737
- const dataBindingEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "dataBinding");
40738
- if (dataBindingEl) {
40739
- const dataBinding = parseSdtDataBinding(dataBindingEl);
40740
- if (dataBinding) {
40741
- result.dataBinding = dataBinding;
40742
- }
40743
- }
40744
- const subtype = parseSdtSubtype(sdtPr);
40745
- if (subtype) {
40746
- result.subtype = subtype;
40747
- }
40748
- const unknownXml = serializeUnknownSdtPrChildren(sdtPr);
40749
- if (unknownXml.length > 0) {
40750
- result.unknownXml = unknownXml;
40751
- }
40752
- return result;
40753
- }
40754
- function parseSdtDataBinding(el) {
40755
- const prefixMappingsEl = getFirstChildByTagNameNS(
40756
- el,
40757
- WORD_NS$3,
40758
- "prefixMappings"
40759
- );
40760
- const xpathEl = getFirstChildByTagNameNS(el, WORD_NS$3, "xpath");
40761
- const storeItemIDEl = getFirstChildByTagNameNS(el, WORD_NS$3, "storeItemID");
40762
- const dataBinding = {};
40763
- if (prefixMappingsEl) {
40764
- const val = getAttributeValue(prefixMappingsEl, "val");
40765
- if (val !== null) {
40766
- dataBinding.prefixMappings = val;
40767
- }
40768
- }
40769
- if (xpathEl) {
40770
- const val = getAttributeValue(xpathEl, "val");
40771
- if (val !== null) {
40772
- dataBinding.xpath = val;
40773
- }
40774
- }
40775
- if (storeItemIDEl) {
40776
- const val = getAttributeValue(storeItemIDEl, "val");
40777
- if (val !== null) {
40778
- dataBinding.storeItemID = val;
40779
- }
40780
- }
40781
- if (dataBinding.prefixMappings === void 0 && dataBinding.xpath === void 0 && dataBinding.storeItemID === void 0) {
40782
- return null;
40783
- }
40784
- return dataBinding;
40785
- }
40786
- function parseSdtListItems(parent) {
40787
- const items = getChildrenByTagNameNS(parent, WORD_NS$3, "listItem");
40788
- if (items.length === 0) {
40789
- return void 0;
40790
- }
40791
- return items.map(
40792
- (item) => ({
40793
- displayText: getAttributeValue(item, "displayText") ?? void 0,
40794
- value: getAttributeValue(item, "value") ?? void 0
40795
- })
40796
- );
40797
- }
40798
- function parseSdtSubtype(parent) {
40799
- const comboBoxEl = getFirstChildByTagNameNS(parent, WORD_NS$3, "comboBox");
40800
- if (comboBoxEl) {
40801
- const lastSelectedEl = getFirstChildByTagNameNS(
40802
- comboBoxEl,
40803
- WORD_NS$3,
40804
- "lastSelectedValue"
40805
- );
40806
- return {
40807
- kind: "comboBox",
40808
- listItems: parseSdtListItems(comboBoxEl),
40809
- ...lastSelectedEl ? {
40810
- lastSelectedValue: getAttributeValue(lastSelectedEl, "val") ?? void 0
40811
- } : {}
40812
- };
40813
- }
40814
- const dropDownEl = getFirstChildByTagNameNS(parent, WORD_NS$3, "dropDownList");
40815
- if (dropDownEl) {
40816
- const lastSelectedEl = getFirstChildByTagNameNS(
40817
- dropDownEl,
40818
- WORD_NS$3,
40819
- "lastSelectedValue"
40820
- );
40821
- return {
40822
- kind: "dropDownList",
40823
- listItems: parseSdtListItems(dropDownEl),
40824
- ...lastSelectedEl ? {
40825
- lastSelectedValue: getAttributeValue(lastSelectedEl, "val") ?? void 0
40826
- } : {}
40827
- };
40828
- }
40829
- const dateEl = getFirstChildByTagNameNS(parent, WORD_NS$3, "date");
40830
- if (dateEl) {
40831
- const fullDate = getAttributeValue(dateEl, "fullDate") ?? void 0;
40832
- const dateFormatEl = getFirstChildByTagNameNS(
40833
- dateEl,
40834
- WORD_NS$3,
40835
- "dateFormat"
40836
- );
40837
- const lidEl = getFirstChildByTagNameNS(dateEl, WORD_NS$3, "lid");
40838
- const calendarEl = getFirstChildByTagNameNS(dateEl, WORD_NS$3, "calendar");
40839
- const storeMappedDataAsEl = getFirstChildByTagNameNS(
40840
- dateEl,
40841
- WORD_NS$3,
40842
- "storeMappedDataAs"
40843
- );
40844
- return {
40845
- kind: "date",
40846
- fullDate,
40847
- dateFormat: dateFormatEl ? getAttributeValue(dateFormatEl, "val") ?? void 0 : void 0,
40848
- lid: lidEl ? getAttributeValue(lidEl, "val") ?? void 0 : void 0,
40849
- calendar: calendarEl ? getAttributeValue(calendarEl, "val") ?? void 0 : void 0,
40850
- storeMappedDataAs: storeMappedDataAsEl ? getAttributeValue(storeMappedDataAsEl, "val") ?? void 0 : void 0
40851
- };
40852
- }
40853
- const textEl = getFirstChildByTagNameNS(parent, WORD_NS$3, "text");
40854
- if (textEl) {
40855
- return { kind: "text" };
40856
- }
40857
- for (const kind of [
40858
- "richText",
40859
- "picture",
40860
- "group",
40861
- "equation",
40862
- "citation",
40863
- "bibliography",
40864
- "repeatingSection",
40865
- "repeatingSectionItem"
40866
- ]) {
40867
- if (getFirstChildByTagNameNS(parent, WORD_NS$3, kind)) {
40868
- return { kind };
40869
- }
40870
- }
40871
- const w14CheckboxEl = getFirstW14Child(parent, "checkbox");
40872
- if (w14CheckboxEl) {
40873
- const checkedEl = getFirstChildByTagNameNS(
40874
- w14CheckboxEl,
40875
- WORD14_NS$1,
40876
- "checked"
40877
- );
40878
- const checkedStateEl = getFirstChildByTagNameNS(
40879
- w14CheckboxEl,
40880
- WORD14_NS$1,
40881
- "checkedState"
40882
- );
40883
- const uncheckedStateEl = getFirstChildByTagNameNS(
40884
- w14CheckboxEl,
40885
- WORD14_NS$1,
40886
- "uncheckedState"
40887
- );
40888
- const checked = checkedEl ? isWordTrue(getAttributeValue(checkedEl, "val")) : void 0;
40889
- return {
40890
- kind: "checkbox",
40891
- ...checked !== void 0 ? { checked } : {},
40892
- ...checkedStateEl ? {
40893
- checkedStateFont: getAttributeValue(checkedStateEl, "font") ?? void 0,
40894
- checkedStateChar: getAttributeValue(checkedStateEl, "char") ?? void 0
40895
- } : {},
40896
- ...uncheckedStateEl ? {
40897
- uncheckedStateFont: getAttributeValue(uncheckedStateEl, "font") ?? void 0,
40898
- uncheckedStateChar: getAttributeValue(uncheckedStateEl, "char") ?? void 0
40899
- } : {}
40900
- };
40901
- }
40902
- return void 0;
40903
- }
40904
- function serializeUnknownSdtPrChildren(sdtPr) {
40905
- let out = "";
40906
- for (let i = 0; i < sdtPr.childNodes.length; i += 1) {
40907
- const node = sdtPr.childNodes[i];
40908
- if ((node == null ? void 0 : node.nodeType) !== node.ELEMENT_NODE) {
40909
- continue;
40910
- }
40911
- const el = node;
40912
- if (el.localName && el.namespaceURI === WORD_NS$3 && RECOGNIZED_SDT_PR_CHILDREN.has(el.localName)) {
40913
- continue;
40914
- }
40915
- out += new XMLSerializer().serializeToString(el);
40916
- }
40917
- return out;
40918
- }
40919
40948
  async function parseBlockLevelChild(element, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks) {
40920
40949
  if (element.namespaceURI !== WORD_NS$3) {
40921
40950
  return [];
@@ -45004,6 +45033,35 @@ function serializeSdtSubtypeXml(subtype) {
45004
45033
  }
45005
45034
  }
45006
45035
  }
45036
+ function serializeRunsWithInlineSdts(runs, serializeRun2) {
45037
+ var _a2, _b2, _c;
45038
+ let out = "";
45039
+ let index = 0;
45040
+ while (index < runs.length) {
45041
+ const run = runs[index];
45042
+ const wrapper = (_a2 = run.sdtWrappers) == null ? void 0 : _a2[0];
45043
+ if (!wrapper) {
45044
+ out += serializeRun2(run);
45045
+ index += 1;
45046
+ continue;
45047
+ }
45048
+ const group = [];
45049
+ let cursor = index;
45050
+ while (cursor < runs.length && ((_c = (_b2 = runs[cursor].sdtWrappers) == null ? void 0 : _b2[0]) == null ? void 0 : _c.groupId) === wrapper.groupId) {
45051
+ const current = runs[cursor];
45052
+ const rest = current.sdtWrappers.slice(1);
45053
+ group.push({
45054
+ ...current,
45055
+ sdtWrappers: rest.length > 0 ? rest : void 0
45056
+ });
45057
+ cursor += 1;
45058
+ }
45059
+ const inner = serializeRunsWithInlineSdts(group, serializeRun2);
45060
+ out += `<w:sdt>${serializeSdtPrXml(wrapper.sdtPr)}${wrapper.sdtEndPrXml ?? ""}<w:sdtContent>${inner}</w:sdtContent></w:sdt>`;
45061
+ index = cursor;
45062
+ }
45063
+ return out;
45064
+ }
45007
45065
  function serializeDropCapFrameParagraph(dropCap) {
45008
45066
  const runProps = serializeRunProperties(dropCap.style);
45009
45067
  const framePr = `<w:framePr w:dropCap="${dropCap.type}" w:lines="${dropCap.lines}" w:wrap="around" w:vAnchor="text" w:hAnchor="text"/>`;
@@ -45491,19 +45549,21 @@ function serializeParagraphXml(paragraph, context2, styles, overrides) {
45491
45549
  if (reusableParagraphXml) {
45492
45550
  return reusableParagraphXml;
45493
45551
  }
45494
- const serializedRunXml = boundaryTokens.length === 0 ? runs.map(
45495
- (run) => {
45496
- var _a3;
45497
- return serializeRunWithRelationships(
45498
- run,
45499
- context2,
45500
- (_a3 = paragraph.style) == null ? void 0 : _a3.styleId,
45501
- styles,
45502
- serializeBlocksXml
45503
- );
45504
- }
45505
- ) : void 0;
45506
- const runsXml = serializedRunXml ? serializedRunXml.join("") : serializeRunsWithBoundaries(
45552
+ const serializeCanonicalRun = (run) => {
45553
+ var _a3;
45554
+ return serializeRunWithRelationships(
45555
+ run,
45556
+ context2,
45557
+ (_a3 = paragraph.style) == null ? void 0 : _a3.styleId,
45558
+ styles,
45559
+ serializeBlocksXml
45560
+ );
45561
+ };
45562
+ const serializedRunXml = boundaryTokens.length === 0 ? runs.map(serializeCanonicalRun) : void 0;
45563
+ const runsXml = boundaryTokens.length === 0 ? serializeRunsWithInlineSdts(
45564
+ runs,
45565
+ serializeCanonicalRun
45566
+ ) : serializeRunsWithBoundaries(
45507
45567
  runs,
45508
45568
  boundaryTokens,
45509
45569
  context2,
@@ -46356,7 +46416,8 @@ function cloneRun(run) {
46356
46416
  id: run.id,
46357
46417
  text: run.text,
46358
46418
  styles: cloneStyle(run.styles),
46359
- revision: run.revision ? { ...run.revision } : void 0
46419
+ revision: run.revision ? { ...run.revision } : void 0,
46420
+ sdtWrappers: run.sdtWrappers ? [...run.sdtWrappers] : void 0
46360
46421
  };
46361
46422
  const cloned = visitRun(run, {
46362
46423
  text: () => ({ ...base, kind: "text" }),
@@ -47337,7 +47398,7 @@ async function importDocxInWorker(buffer, options = {}) {
47337
47398
  const worker = new Worker(
47338
47399
  new URL(
47339
47400
  /* @vite-ignore */
47340
- "" + new URL("assets/importDocxWorker-DpJa1l2G.js", import.meta.url).href,
47401
+ "" + new URL("assets/importDocxWorker-CEVODY5C.js", import.meta.url).href,
47341
47402
  import.meta.url
47342
47403
  ),
47343
47404
  {
@@ -55549,7 +55610,7 @@ export {
55549
55610
  createEffect as ay,
55550
55611
  TextField as az,
55551
55612
  getPageBodyTop as b,
55552
- resolveRenderedTextChar as b$,
55613
+ resolveTextAlignmentBaselineOffset as b$,
55553
55614
  serializeLinearMath as b0,
55554
55615
  parseLinearMath as b1,
55555
55616
  Text$1 as b2,
@@ -55560,33 +55621,33 @@ export {
55560
55621
  use as b7,
55561
55622
  PluginUiHost as b8,
55562
55623
  OasisEditorEditor as b9,
55563
- exportEditorDocumentToDocxBlob as bA,
55564
- exportEditorDocumentToDocx as bB,
55565
- pxToPt as bC,
55566
- resolveFloatingObjectRect as bD,
55567
- getTextBoxFloatingGeometry as bE,
55568
- getPresetPathSegments as bF,
55569
- buildListLabels as bG,
55570
- lineDashPatternPt as bH,
55571
- DEFAULT_FONT_SIZE_PX as bI,
55572
- resolveGradientAxis as bJ,
55573
- isDoubleUnderlineStyle as bK,
55574
- isWavyUnderlineStyle as bL,
55575
- underlineStyleLineWidthPx as bM,
55576
- WAVY_UNDERLINE_WAVELENGTH_PX as bN,
55577
- WAVY_UNDERLINE_AMPLITUDE_PX as bO,
55578
- DOUBLE_UNDERLINE_OFFSET_PX as bP,
55579
- underlineStyleDashArray as bQ,
55580
- resolveEffectiveParagraphStyle as bR,
55581
- EMPHASIS_GLYPH as bS,
55582
- parseHexColorToRgb255 as bT,
55583
- rgb255ToHex as bU,
55584
- getImageFloatingGeometry as bV,
55585
- resolveEffectiveTextStyleForParagraph as bW,
55586
- textStyleToFontSizePt as bX,
55587
- mathDisplayText as bY,
55588
- TEXT_BASELINE_RATIO as bZ,
55589
- resolveTextAlignmentBaselineOffset as b_,
55624
+ getDocumentSectionsCanonical as bA,
55625
+ exportEditorDocumentToDocxBlob as bB,
55626
+ exportEditorDocumentToDocx as bC,
55627
+ pxToPt as bD,
55628
+ resolveFloatingObjectRect as bE,
55629
+ getTextBoxFloatingGeometry as bF,
55630
+ getPresetPathSegments as bG,
55631
+ buildListLabels as bH,
55632
+ lineDashPatternPt as bI,
55633
+ DEFAULT_FONT_SIZE_PX as bJ,
55634
+ resolveGradientAxis as bK,
55635
+ isDoubleUnderlineStyle as bL,
55636
+ isWavyUnderlineStyle as bM,
55637
+ underlineStyleLineWidthPx as bN,
55638
+ WAVY_UNDERLINE_WAVELENGTH_PX as bO,
55639
+ WAVY_UNDERLINE_AMPLITUDE_PX as bP,
55640
+ DOUBLE_UNDERLINE_OFFSET_PX as bQ,
55641
+ underlineStyleDashArray as bR,
55642
+ resolveEffectiveParagraphStyle as bS,
55643
+ EMPHASIS_GLYPH as bT,
55644
+ parseHexColorToRgb255 as bU,
55645
+ rgb255ToHex as bV,
55646
+ getImageFloatingGeometry as bW,
55647
+ resolveEffectiveTextStyleForParagraph as bX,
55648
+ textStyleToFontSizePt as bY,
55649
+ mathDisplayText as bZ,
55650
+ TEXT_BASELINE_RATIO as b_,
55590
55651
  OasisBrandMark as ba,
55591
55652
  setPreciseFontPreference as bb,
55592
55653
  setWelcomeSeen as bc,
@@ -55615,16 +55676,16 @@ export {
55615
55676
  mergeTablePropertiesXmlSource as bz,
55616
55677
  getPageContentWidth as c,
55617
55678
  createSectionBoundaryParagraph as c$,
55618
- resolveOpenTypeFeatureTags as c0,
55619
- isLowercaseSmallCapsChar as c1,
55620
- resolveDecorationLineY as c2,
55621
- DOUBLE_STRIKE_OFFSET_PX as c3,
55622
- resolveListLabel as c4,
55623
- getListLabelInset as c5,
55624
- getAlignedListLabelInset as c6,
55625
- getParagraphBorderInsets as c7,
55626
- buildSegmentTable as c8,
55627
- buildCanvasTableLayout as c9,
55679
+ resolveRenderedTextChar as c0,
55680
+ resolveOpenTypeFeatureTags as c1,
55681
+ isLowercaseSmallCapsChar as c2,
55682
+ resolveDecorationLineY as c3,
55683
+ DOUBLE_STRIKE_OFFSET_PX as c4,
55684
+ resolveListLabel as c5,
55685
+ getListLabelInset as c6,
55686
+ getAlignedListLabelInset as c7,
55687
+ getParagraphBorderInsets as c8,
55688
+ buildSegmentTable as c9,
55628
55689
  updateImageCaptionParagraph as cA,
55629
55690
  createImageCaptionParagraph as cB,
55630
55691
  renumberImageCaptionParagraphs as cC,
@@ -55652,28 +55713,28 @@ export {
55652
55713
  VERTICAL_HIT_WEIGHT as cY,
55653
55714
  getCachedCanvasImage as cZ,
55654
55715
  measureParagraphMinContentWidthPx as c_,
55655
- resolveCanvasTableWidth as ca,
55656
- resolveFloatingTableRect as cb,
55657
- paragraphBetweenBorderMatches as cc,
55658
- normalizeFamily as cd,
55659
- ROBOTO_FONT_FILES as ce,
55660
- loadFontAsset as cf,
55661
- getRemotePdfFontFaces as cg,
55662
- OFFICE_COMPAT_FONT_FAMILIES as ch,
55663
- BinaryReader as ci,
55664
- buildSfnt as cj,
55665
- defaultFontDecoderRegistry as ck,
55666
- SfntFontProgram as cl,
55667
- zlibSync as cm,
55668
- renumberImageCaptionsInDocument as cn,
55669
- collectPdfFontFamilies as co,
55670
- outlineFrom as cp,
55671
- getPageHeaderZoneTop as cq,
55672
- getPageColumnRects as cr,
55673
- findFootnoteReference as cs,
55674
- resolveImporterForFile as ct,
55675
- roundTo as cu,
55676
- getDocumentSectionsCanonical as cv,
55716
+ buildCanvasTableLayout as ca,
55717
+ resolveCanvasTableWidth as cb,
55718
+ resolveFloatingTableRect as cc,
55719
+ paragraphBetweenBorderMatches as cd,
55720
+ normalizeFamily as ce,
55721
+ ROBOTO_FONT_FILES as cf,
55722
+ loadFontAsset as cg,
55723
+ getRemotePdfFontFaces as ch,
55724
+ OFFICE_COMPAT_FONT_FAMILIES as ci,
55725
+ BinaryReader as cj,
55726
+ buildSfnt as ck,
55727
+ defaultFontDecoderRegistry as cl,
55728
+ SfntFontProgram as cm,
55729
+ zlibSync as cn,
55730
+ renumberImageCaptionsInDocument as co,
55731
+ collectPdfFontFamilies as cp,
55732
+ outlineFrom as cq,
55733
+ getPageHeaderZoneTop as cr,
55734
+ getPageColumnRects as cs,
55735
+ findFootnoteReference as ct,
55736
+ resolveImporterForFile as cu,
55737
+ roundTo as cv,
55677
55738
  getDocumentParagraphsCanonical as cw,
55678
55739
  getDocumentParagraphs as cx,
55679
55740
  getImageCaptionText as cy,