docx 9.7.1 → 9.7.2

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.
@@ -24,7 +24,7 @@ var docx = (function(exports) {
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
  //#endregion
27
- //#region \0@oxc-project+runtime@0.132.0/helpers/typeof.js
27
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
28
28
  function _typeof(o) {
29
29
  "@babel/helpers - typeof";
30
30
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -34,7 +34,7 @@ var docx = (function(exports) {
34
34
  }, _typeof(o);
35
35
  }
36
36
  //#endregion
37
- //#region \0@oxc-project+runtime@0.132.0/helpers/toPrimitive.js
37
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
38
38
  function toPrimitive(t, r) {
39
39
  if ("object" != _typeof(t) || !t) return t;
40
40
  var e = t[Symbol.toPrimitive];
@@ -46,13 +46,13 @@ var docx = (function(exports) {
46
46
  return ("string" === r ? String : Number)(t);
47
47
  }
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.132.0/helpers/toPropertyKey.js
49
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
50
50
  function toPropertyKey(t) {
51
51
  var i = toPrimitive(t, "string");
52
52
  return "symbol" == _typeof(i) ? i : i + "";
53
53
  }
54
54
  //#endregion
55
- //#region \0@oxc-project+runtime@0.132.0/helpers/defineProperty.js
55
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
56
56
  function _defineProperty(e, r, t) {
57
57
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
58
58
  value: t,
@@ -252,7 +252,7 @@ var docx = (function(exports) {
252
252
  }
253
253
  };
254
254
  //#endregion
255
- //#region \0@oxc-project+runtime@0.132.0/helpers/objectSpread2.js
255
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/objectSpread2.js
256
256
  function ownKeys(e, r) {
257
257
  var t = Object.keys(e);
258
258
  if (Object.getOwnPropertySymbols) {
@@ -886,7 +886,7 @@ var docx = (function(exports) {
886
886
  return 0;
887
887
  };
888
888
  browserExports = browser.exports;
889
- process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
889
+ process$1 = /*@__PURE__*/ getDefaultExportFromCjs(browserExports);
890
890
  }));
891
891
  //#endregion
892
892
  //#region node_modules/stream-browserify/node_modules/readable-stream/lib/internal/streams/stream-browser.js
@@ -3940,7 +3940,7 @@ var docx = (function(exports) {
3940
3940
  function copyBuffer(src, target, offset) {
3941
3941
  Buffer.prototype.copy.call(src, target, offset);
3942
3942
  }
3943
- module.exports = /* @__PURE__ */ function() {
3943
+ module.exports = /*#__PURE__*/ function() {
3944
3944
  function BufferList() {
3945
3945
  _classCallCheck(this, BufferList);
3946
3946
  this.head = null;
@@ -4197,7 +4197,7 @@ var docx = (function(exports) {
4197
4197
  if (typeof message === "string") return message;
4198
4198
  else return message(arg1, arg2, arg3);
4199
4199
  }
4200
- var NodeError = /* @__PURE__ */ function(_Base) {
4200
+ var NodeError = /*#__PURE__*/ function(_Base) {
4201
4201
  _inheritsLoose(NodeError, _Base);
4202
4202
  function NodeError(arg1, arg2, arg3) {
4203
4203
  return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
@@ -12274,7 +12274,7 @@ DOT: "dot" };
12274
12274
  };
12275
12275
  }));
12276
12276
  //#endregion
12277
- //#region node_modules/nanoid/non-secure/index.js
12277
+ //#region node_modules/nanoid/url-alphabet/index.js
12278
12278
  var import_hash = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
12279
12279
  var hash = exports;
12280
12280
  hash.utils = require_utils();
@@ -12290,18 +12290,20 @@ DOT: "dot" };
12290
12290
  hash.ripemd160 = hash.ripemd.ripemd160;
12291
12291
  })))(), 1);
12292
12292
  var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
12293
+ //#endregion
12294
+ //#region node_modules/nanoid/non-secure/index.js
12293
12295
  var customAlphabet = (alphabet, defaultSize = 21) => {
12294
12296
  return (size = defaultSize) => {
12295
12297
  let id = "";
12296
12298
  let i = size | 0;
12297
- while (i--) id += alphabet[Math.random() * alphabet.length | 0];
12299
+ while (i-- > 0) id += alphabet[Math.random() * alphabet.length | 0];
12298
12300
  return id;
12299
12301
  };
12300
12302
  };
12301
12303
  var nanoid = (size = 21) => {
12302
12304
  let id = "";
12303
12305
  let i = size | 0;
12304
- while (i--) id += urlAlphabet[Math.random() * 64 | 0];
12306
+ while (i-- > 0) id += urlAlphabet[Math.random() * 64 | 0];
12305
12307
  return id;
12306
12308
  };
12307
12309
  //#endregion
@@ -15736,6 +15738,7 @@ EXTERNAL: "External" };
15736
15738
  super("w:comments");
15737
15739
  _defineProperty(this, "relationships", void 0);
15738
15740
  _defineProperty(this, "threadData", void 0);
15741
+ _defineProperty(this, "commentIdsData", void 0);
15739
15742
  this.root.push(new RootCommentsAttributes({
15740
15743
  "xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
15741
15744
  "xmlns:cx1": "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",
@@ -15769,14 +15772,23 @@ EXTERNAL: "External" };
15769
15772
  "xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml",
15770
15773
  "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
15771
15774
  }));
15772
- if (children.some((child) => child.parentId !== void 0)) {
15775
+ const hasThreading = children.some((child) => child.parentId !== void 0);
15776
+ const hasDurableIds = children.some((child) => child.durableId !== void 0);
15777
+ if (hasThreading || hasDurableIds) {
15773
15778
  const idToParaId = new Map(children.map((child) => [child.id, commentIdToParaId(child.id)]));
15774
15779
  for (const child of children) this.root.push(new Comment(child, idToParaId.get(child.id)));
15775
- this.threadData = children.map((child) => ({
15780
+ if (hasThreading) this.threadData = children.map((child) => ({
15776
15781
  paraId: idToParaId.get(child.id),
15777
15782
  parentParaId: child.parentId !== void 0 ? idToParaId.get(child.parentId) : void 0,
15778
15783
  done: child.resolved
15779
15784
  }));
15785
+ if (hasDurableIds) this.commentIdsData = children.map((child) => {
15786
+ var _child$durableId;
15787
+ return {
15788
+ paraId: idToParaId.get(child.id),
15789
+ durableId: (_child$durableId = child.durableId) !== null && _child$durableId !== void 0 ? _child$durableId : idToParaId.get(child.id)
15790
+ };
15791
+ });
15780
15792
  } else for (const child of children) this.root.push(new Comment(child));
15781
15793
  this.relationships = new Relationships();
15782
15794
  }
@@ -15787,6 +15799,10 @@ EXTERNAL: "External" };
15787
15799
  get ThreadData() {
15788
15800
  return this.threadData;
15789
15801
  }
15802
+ /** Comment id data for commentsIds.xml, or undefined when no comments carry a durableId. */
15803
+ get CommentIdsData() {
15804
+ return this.commentIdsData;
15805
+ }
15790
15806
  };
15791
15807
  //#endregion
15792
15808
  //#region src/file/paragraph/run/comments-extended.ts
@@ -15867,6 +15883,69 @@ EXTERNAL: "External" };
15867
15883
  for (const data of threadData) this.root.push(new CommentEx(data));
15868
15884
  }
15869
15885
  };
15886
+ /**
15887
+ * @internal
15888
+ */
15889
+ var CommentIdAttributes = class extends XmlAttributeComponent {
15890
+ constructor(..._args3) {
15891
+ super(..._args3);
15892
+ _defineProperty(this, "xmlKeys", {
15893
+ paraId: "w16cid:paraId",
15894
+ durableId: "w16cid:durableId"
15895
+ });
15896
+ }
15897
+ };
15898
+ /**
15899
+ * @internal
15900
+ */
15901
+ var CommentId = class extends XmlComponent {
15902
+ constructor(options) {
15903
+ super("w16cid:commentId");
15904
+ this.root.push(new CommentIdAttributes({
15905
+ paraId: options.paraId,
15906
+ durableId: options.durableId
15907
+ }));
15908
+ }
15909
+ };
15910
+ /**
15911
+ * @internal
15912
+ */
15913
+ var CommentsIdsAttributes = class extends XmlAttributeComponent {
15914
+ constructor(..._args4) {
15915
+ super(..._args4);
15916
+ _defineProperty(this, "xmlKeys", {
15917
+ "xmlns:w16cid": "xmlns:w16cid",
15918
+ "xmlns:mc": "xmlns:mc",
15919
+ "mc:Ignorable": "mc:Ignorable"
15920
+ });
15921
+ }
15922
+ };
15923
+ /**
15924
+ * Represents the commentsIds part (word/commentsIds.xml).
15925
+ *
15926
+ * Contains w16cid:commentId elements that map each comment's volatile paraId
15927
+ * to a stable w16cid:durableId preserved by Word across edits.
15928
+ *
15929
+ * ## XSD Schema (wml-cid.xsd)
15930
+ * ```xml
15931
+ * <xsd:complexType name="CT_CommentsIds">
15932
+ * <xsd:sequence>
15933
+ * <xsd:element name="commentId" type="CT_CommentId" minOccurs="0" maxOccurs="unbounded"/>
15934
+ * </xsd:sequence>
15935
+ * </xsd:complexType>
15936
+ * ```
15937
+ */
15938
+ var CommentsIds = class extends XmlComponent {
15939
+ constructor(commentIdsData) {
15940
+ super("w16cid:commentsIds");
15941
+ this.root.push(new CommentsIdsAttributes({
15942
+ "xmlns:w16cid": "http://schemas.microsoft.com/office/word/2016/wordml/cid",
15943
+ "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
15944
+ "mc:Ignorable": "w16cid"
15945
+ }));
15946
+ for (const data of commentIdsData) this.root.push(new CommentId(data));
15947
+ }
15948
+ };
15870
15949
  //#endregion
15871
15950
  //#region src/file/paragraph/run/empty-children.ts
15872
15951
  /**
@@ -21877,6 +21956,12 @@ MAX: 9026 };
21877
21956
  this.root.push(createOverride("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", "/word/commentsExtended.xml"));
21878
21957
  }
21879
21958
  /**
21959
+ * Registers the commentsIds part in the content types.
21960
+ */
21961
+ addCommentsIds() {
21962
+ this.root.push(createOverride("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml", "/word/commentsIds.xml"));
21963
+ }
21964
+ /**
21880
21965
  * Registers a footer part in the content types.
21881
21966
  *
21882
21967
  * @param index - Footer index number (e.g., 1 for footer1.xml)
@@ -26800,6 +26885,12 @@ MAX: 9026 };
26800
26885
  "commentsExtended",
26801
26886
  void 0
26802
26887
  );
26888
+ _defineProperty(
26889
+ this,
26890
+ /** Durable comment id mapping (word/commentsIds.xml). */
26891
+ "commentsIds",
26892
+ void 0
26893
+ );
26803
26894
  _defineProperty(this, "fontWrapper", void 0);
26804
26895
  this.coreProperties = new CoreProperties(_objectSpread2(_objectSpread2({}, options), {}, {
26805
26896
  creator: (_options$creator = options.creator) !== null && _options$creator !== void 0 ? _options$creator : "Un-named",
@@ -26809,6 +26900,7 @@ MAX: 9026 };
26809
26900
  this.numbering = new Numbering(options.numbering ? options.numbering : { config: [] });
26810
26901
  this.comments = new Comments((_options$comments = options.comments) !== null && _options$comments !== void 0 ? _options$comments : { children: [] });
26811
26902
  if (this.comments.ThreadData) this.commentsExtended = new CommentsExtended(this.comments.ThreadData);
26903
+ if (this.comments.CommentIdsData) this.commentsIds = new CommentsIds(this.comments.CommentIdsData);
26812
26904
  this.fileRelationships = new Relationships();
26813
26905
  this.customProperties = new CustomProperties((_options$customProper = options.customProperties) !== null && _options$customProper !== void 0 ? _options$customProper : []);
26814
26906
  this.appProperties = new AppProperties();
@@ -26907,6 +26999,10 @@ MAX: 9026 };
26907
26999
  this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++, "http://schemas.microsoft.com/office/2011/relationships/commentsExtended", "commentsExtended.xml");
26908
27000
  this.contentTypes.addCommentsExtended();
26909
27001
  }
27002
+ if (this.commentsIds) {
27003
+ this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++, "http://schemas.microsoft.com/office/2016/09/relationships/commentsIds", "commentsIds.xml");
27004
+ this.contentTypes.addCommentsIds();
27005
+ }
26910
27006
  }
26911
27007
  get Document() {
26912
27008
  return this.documentWrapper;
@@ -26957,6 +27053,10 @@ MAX: 9026 };
26957
27053
  get CommentsExtended() {
26958
27054
  return this.commentsExtended;
26959
27055
  }
27056
+ /** Durable comment id part. Undefined when no comment carries a durableId. */
27057
+ get CommentsIds() {
27058
+ return this.commentsIds;
27059
+ }
26960
27060
  get FontTable() {
26961
27061
  return this.fontWrapper;
26962
27062
  }
@@ -27126,7 +27226,7 @@ MAX: 9026 };
27126
27226
  }
27127
27227
  };
27128
27228
  //#endregion
27129
- //#region \0@oxc-project+runtime@0.132.0/helpers/objectWithoutPropertiesLoose.js
27229
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/objectWithoutPropertiesLoose.js
27130
27230
  function _objectWithoutPropertiesLoose(r, e) {
27131
27231
  if (null == r) return {};
27132
27232
  var t = {};
@@ -27137,7 +27237,7 @@ MAX: 9026 };
27137
27237
  return t;
27138
27238
  }
27139
27239
  //#endregion
27140
- //#region \0@oxc-project+runtime@0.132.0/helpers/objectWithoutProperties.js
27240
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/objectWithoutProperties.js
27141
27241
  function _objectWithoutProperties(e, t) {
27142
27242
  if (null == e) return {};
27143
27243
  var o, r, i = _objectWithoutPropertiesLoose(e, t);
@@ -31533,7 +31633,7 @@ while (n === a[++i] && n === a[++i] && n === a[++i] && n === a[++i] && n === a[+
31533
31633
  const documentMediaDatas = this.imageReplacer.getMediaData(documentXmlData, file.Media);
31534
31634
  const commentMediaDatas = this.imageReplacer.getMediaData(commentXmlData, file.Media);
31535
31635
  const footnoteMediaDatas = this.imageReplacer.getMediaData(footnoteXmlData, file.Media);
31536
- return _objectSpread2(_objectSpread2({
31636
+ return _objectSpread2(_objectSpread2(_objectSpread2({
31537
31637
  Relationships: {
31538
31638
  data: (() => {
31539
31639
  documentMediaDatas.forEach((mediaData, i) => {
@@ -31834,6 +31934,22 @@ while (n === a[++i] && n === a[++i] && n === a[++i] && n === a[++i] && n === a[+
31834
31934
  }
31835
31935
  }),
31836
31936
  path: "word/commentsExtended.xml"
31937
+ } } : {}), file.CommentsIds ? { CommentsIds: {
31938
+ data: (0, import_xml.default)(this.formatter.format(file.CommentsIds, {
31939
+ viewWrapper: {
31940
+ View: file.CommentsIds,
31941
+ Relationships: file.Comments.Relationships
31942
+ },
31943
+ file,
31944
+ stack: []
31945
+ }), {
31946
+ indent: prettify,
31947
+ declaration: {
31948
+ standalone: "yes",
31949
+ encoding: "UTF-8"
31950
+ }
31951
+ }),
31952
+ path: "word/commentsIds.xml"
31837
31953
  } } : {}), {}, {
31838
31954
  FontTable: {
31839
31955
  data: (0, import_xml.default)(this.formatter.format(file.FontTable.View, {
@@ -31850,21 +31966,21 @@ while (n === a[++i] && n === a[++i] && n === a[++i] && n === a[++i] && n === a[+
31850
31966
  path: "word/fontTable.xml"
31851
31967
  },
31852
31968
  FontTableRelationships: {
31853
- data: (0, import_xml.default)(this.formatter.format(file.FontTable.Relationships, {
31969
+ data: (() => (0, import_xml.default)(this.formatter.format(file.FontTable.Relationships, {
31854
31970
  viewWrapper: file.Document,
31855
31971
  file,
31856
31972
  stack: []
31857
31973
  }), {
31858
31974
  indent: prettify,
31859
31975
  declaration: { encoding: "UTF-8" }
31860
- }),
31976
+ }))(),
31861
31977
  path: "word/_rels/fontTable.xml.rels"
31862
31978
  }
31863
31979
  });
31864
31980
  }
31865
31981
  };
31866
31982
  //#endregion
31867
- //#region \0@oxc-project+runtime@0.132.0/helpers/asyncToGenerator.js
31983
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/asyncToGenerator.js
31868
31984
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
31869
31985
  try {
31870
31986
  var i = n[a](c), u = i.value;
@@ -32890,6 +33006,7 @@ while (n === a[++i] && n === a[++i] && n === a[++i] && n === a[++i] && n === a[+
32890
33006
  exports.CommentReference = CommentReference;
32891
33007
  exports.Comments = Comments;
32892
33008
  exports.CommentsExtended = CommentsExtended;
33009
+ exports.CommentsIds = CommentsIds;
32893
33010
  exports.ConcreteHyperlink = ConcreteHyperlink;
32894
33011
  exports.ConcreteNumbering = ConcreteNumbering;
32895
33012
  exports.ContinuationSeparator = ContinuationSeparator;