docx-plus 0.0.2 → 0.0.4

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.
package/dist/index.mjs CHANGED
@@ -1,11 +1,10 @@
1
1
  import { js2xml, xml2js } from "xml-js";
2
2
  import hash from "hash.js";
3
3
  import { customAlphabet, nanoid } from "nanoid/non-secure";
4
- import { Readable } from "stream";
5
- import { Zip, ZipDeflate, ZipPassThrough, strFromU8, unzipSync, zipSync } from "fflate";
6
4
  import { textToUint8Array, toUint8Array } from "undio";
5
+ import { Zip, ZipDeflate, ZipPassThrough, strFromU8, unzipSync, zipSync } from "fflate";
7
6
  import xml from "xml";
8
- //#region \0@oxc-project+runtime@0.123.0/helpers/typeof.js
7
+ //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
9
8
  function _typeof(o) {
10
9
  "@babel/helpers - typeof";
11
10
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -15,7 +14,7 @@ function _typeof(o) {
15
14
  }, _typeof(o);
16
15
  }
17
16
  //#endregion
18
- //#region \0@oxc-project+runtime@0.123.0/helpers/toPrimitive.js
17
+ //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
19
18
  function toPrimitive(t, r) {
20
19
  if ("object" != _typeof(t) || !t) return t;
21
20
  var e = t[Symbol.toPrimitive];
@@ -27,13 +26,13 @@ function toPrimitive(t, r) {
27
26
  return ("string" === r ? String : Number)(t);
28
27
  }
29
28
  //#endregion
30
- //#region \0@oxc-project+runtime@0.123.0/helpers/toPropertyKey.js
29
+ //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
31
30
  function toPropertyKey(t) {
32
31
  var i = toPrimitive(t, "string");
33
32
  return "symbol" == _typeof(i) ? i : i + "";
34
33
  }
35
34
  //#endregion
36
- //#region \0@oxc-project+runtime@0.123.0/helpers/defineProperty.js
35
+ //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
37
36
  function _defineProperty(e, r, t) {
38
37
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
39
38
  value: t,
@@ -218,29 +217,6 @@ var IgnoreIfEmptyXmlComponent = class extends XmlComponent {
218
217
  }
219
218
  };
220
219
  //#endregion
221
- //#region \0@oxc-project+runtime@0.123.0/helpers/objectSpread2.js
222
- function ownKeys(e, r) {
223
- var t = Object.keys(e);
224
- if (Object.getOwnPropertySymbols) {
225
- var o = Object.getOwnPropertySymbols(e);
226
- r && (o = o.filter(function(r) {
227
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
228
- })), t.push.apply(t, o);
229
- }
230
- return t;
231
- }
232
- function _objectSpread2(e) {
233
- for (var r = 1; r < arguments.length; r++) {
234
- var t = null != arguments[r] ? arguments[r] : {};
235
- r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
236
- _defineProperty(e, r, t[r]);
237
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
238
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
239
- });
240
- }
241
- return e;
242
- }
243
- //#endregion
244
220
  //#region src/file/xml-components/default-attributes.ts
245
221
  /**
246
222
  * XML attribute components for the docx library.
@@ -334,7 +310,10 @@ var NextAttributeComponent = class extends BaseXmlComponent {
334
310
  * @returns Object with _attr key containing the attributes
335
311
  */
336
312
  prepForXml(_) {
337
- return { _attr: Object.values(this.root).filter(({ value }) => value !== void 0).reduce((acc, { key, value }) => _objectSpread2(_objectSpread2({}, acc), {}, { [key]: value }), {}) };
313
+ return { _attr: Object.values(this.root).filter(({ value }) => value !== void 0).reduce((acc, { key, value }) => ({
314
+ ...acc,
315
+ [key]: value
316
+ }), {}) };
338
317
  }
339
318
  };
340
319
  //#endregion
@@ -4708,13 +4687,16 @@ var ChildNonVisualProperties = class extends XmlComponent {
4708
4687
  * @returns An XML component representing the click hyperlink
4709
4688
  */
4710
4689
  const createHyperlinkClick = (linkId, hasXmlNs) => new BuilderElement({
4711
- attributes: _objectSpread2(_objectSpread2({}, hasXmlNs ? { xmlns: {
4712
- key: "xmlns:a",
4713
- value: "http://schemas.openxmlformats.org/drawingml/2006/main"
4714
- } } : {}), {}, { id: {
4715
- key: "r:id",
4716
- value: `rId${linkId}`
4717
- } }),
4690
+ attributes: {
4691
+ ...hasXmlNs ? { xmlns: {
4692
+ key: "xmlns:a",
4693
+ value: "http://schemas.openxmlformats.org/drawingml/2006/main"
4694
+ } } : {},
4695
+ id: {
4696
+ key: "r:id",
4697
+ value: `rId${linkId}`
4698
+ }
4699
+ },
4718
4700
  name: "a:hlinkClick"
4719
4701
  });
4720
4702
  //#endregion
@@ -4962,21 +4944,23 @@ var GraphicData = class extends XmlComponent {
4962
4944
  super("a:graphicData");
4963
4945
  if (mediaData.type === "wps") {
4964
4946
  this.root.push(new GraphicDataAttributes({ uri: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" }));
4965
- const wps = createWpsShape(_objectSpread2(_objectSpread2({}, mediaData.data), {}, {
4947
+ const wps = createWpsShape({
4948
+ ...mediaData.data,
4966
4949
  outline,
4967
4950
  solidFill,
4968
4951
  transformation: transform
4969
- }));
4952
+ });
4970
4953
  this.root.push(wps);
4971
4954
  } else if (mediaData.type === "wpg") {
4972
4955
  this.root.push(new GraphicDataAttributes({ uri: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" }));
4973
4956
  const wpg = createWpgGroup({
4974
4957
  children: mediaData.children.map((child) => {
4975
- if (child.type === "wps") return createWpsShape(_objectSpread2(_objectSpread2({}, child.data), {}, {
4958
+ if (child.type === "wps") return createWpsShape({
4959
+ ...child.data,
4976
4960
  outline: child.outline,
4977
4961
  solidFill: child.solidFill,
4978
4962
  transformation: child.transformation
4979
- }));
4963
+ });
4980
4964
  else return new Pic({
4981
4965
  mediaData: child,
4982
4966
  outline: child.outline,
@@ -5605,14 +5589,15 @@ var AnchorAttributes = class extends XmlAttributeComponent {
5605
5589
  var Anchor = class extends XmlComponent {
5606
5590
  constructor({ mediaData, transform, drawingOptions }) {
5607
5591
  super("wp:anchor");
5608
- const floating = _objectSpread2({
5592
+ const floating = {
5609
5593
  allowOverlap: true,
5610
5594
  behindDocument: false,
5611
5595
  horizontalPosition: {},
5612
5596
  layoutInCell: true,
5613
5597
  lockAnchor: false,
5614
- verticalPosition: {}
5615
- }, drawingOptions.floating);
5598
+ verticalPosition: {},
5599
+ ...drawingOptions.floating
5600
+ };
5616
5601
  this.root.push(new AnchorAttributes({
5617
5602
  distT: floating.margins ? floating.margins.top || 0 : 0,
5618
5603
  distB: floating.margins ? floating.margins.bottom || 0 : 0,
@@ -5752,29 +5737,20 @@ var Drawing = class extends XmlComponent {
5752
5737
  };
5753
5738
  //#endregion
5754
5739
  //#region src/file/paragraph/run/image-run.ts
5755
- const convertDataURIToBinary = (dataURI) => {
5756
- const base64Index = dataURI.indexOf(";base64,");
5757
- const base64IndexWithOffset = base64Index === -1 ? 0 : base64Index + 8;
5758
- const binaryString = atob(dataURI.substring(base64IndexWithOffset));
5759
- const bytes = new Uint8Array(binaryString.length);
5760
- for (let i = 0; i < binaryString.length; i++) bytes[i] = binaryString.charCodeAt(i);
5761
- return bytes;
5762
- };
5763
- const standardizeData = (data) => typeof data === "string" ? convertDataURIToBinary(data) : data;
5764
- const createImageData = (options, key) => ({
5765
- data: standardizeData(options.data),
5740
+ const createImageData = (data, transformation, key) => ({
5741
+ data,
5766
5742
  fileName: key,
5767
5743
  transformation: {
5768
5744
  emus: {
5769
- x: Math.round(options.transformation.width * 9525),
5770
- y: Math.round(options.transformation.height * 9525)
5745
+ x: Math.round(transformation.width * 9525),
5746
+ y: Math.round(transformation.height * 9525)
5771
5747
  },
5772
- flip: options.transformation.flip,
5748
+ flip: transformation.flip,
5773
5749
  pixels: {
5774
- x: Math.round(options.transformation.width),
5775
- y: Math.round(options.transformation.height)
5750
+ x: Math.round(transformation.width),
5751
+ y: Math.round(transformation.height)
5776
5752
  },
5777
- rotation: options.transformation.rotation ? options.transformation.rotation * 6e4 : void 0
5753
+ rotation: transformation.rotation ? transformation.rotation * 6e4 : void 0
5778
5754
  }
5779
5755
  });
5780
5756
  /**
@@ -5803,8 +5779,22 @@ var ImageRun = class extends Run {
5803
5779
  constructor(options) {
5804
5780
  super({});
5805
5781
  _defineProperty(this, "imageData", void 0);
5806
- const key = `${hashedId(options.data)}.${options.type}`;
5807
- this.imageData = options.type === "svg" ? _objectSpread2(_objectSpread2({ type: options.type }, createImageData(options, key)), {}, { fallback: _objectSpread2({ type: options.fallback.type }, createImageData(_objectSpread2(_objectSpread2({}, options.fallback), {}, { transformation: options.transformation }), `${hashedId(options.fallback.data)}.${options.fallback.type}`)) }) : _objectSpread2({ type: options.type }, createImageData(options, key));
5782
+ const rawData = toUint8Array(options.data);
5783
+ const key = `${hashedId(rawData)}.${options.type}`;
5784
+ if (options.type === "svg") {
5785
+ const fallbackData = toUint8Array(options.fallback.data);
5786
+ this.imageData = {
5787
+ type: options.type,
5788
+ ...createImageData(rawData, options.transformation, key),
5789
+ fallback: {
5790
+ type: options.fallback.type,
5791
+ ...createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)
5792
+ }
5793
+ };
5794
+ } else this.imageData = {
5795
+ type: options.type,
5796
+ ...createImageData(rawData, options.transformation, key)
5797
+ };
5808
5798
  const drawing = new Drawing(this.imageData, {
5809
5799
  docProperties: options.altText,
5810
5800
  floating: options.floating,
@@ -5853,7 +5843,7 @@ var WpsShapeRun = class extends Run {
5853
5843
  super({});
5854
5844
  _defineProperty(this, "wpsShapeData", void 0);
5855
5845
  this.wpsShapeData = {
5856
- data: _objectSpread2({}, options),
5846
+ data: { ...options },
5857
5847
  transformation: createTransformation(options.transformation),
5858
5848
  type: options.type
5859
5849
  };
@@ -7880,13 +7870,16 @@ const CharacterSet = {
7880
7870
  * Creates a font relationship element for embedding fonts.
7881
7871
  */
7882
7872
  const createFontRelationship = ({ id, fontKey, subsetted }, name) => new BuilderElement({
7883
- attributes: _objectSpread2({ id: {
7884
- key: "r:id",
7885
- value: id
7886
- } }, fontKey ? { fontKey: {
7887
- key: "w:fontKey",
7888
- value: `{${fontKey}}`
7889
- } } : {}),
7873
+ attributes: {
7874
+ id: {
7875
+ key: "r:id",
7876
+ value: id
7877
+ },
7878
+ ...fontKey ? { fontKey: {
7879
+ key: "w:fontKey",
7880
+ value: `{${fontKey}}`
7881
+ } } : {}
7882
+ },
7890
7883
  children: subsetted ? [new OnOffElement("w:subsetted", subsetted)] : [],
7891
7884
  name
7892
7885
  });
@@ -8124,7 +8117,10 @@ var FontWrapper = class {
8124
8117
  _defineProperty(this, "fontTable", void 0);
8125
8118
  _defineProperty(this, "relationships", void 0);
8126
8119
  _defineProperty(this, "fontOptionsWithKey", []);
8127
- this.fontOptionsWithKey = options.map((o) => _objectSpread2(_objectSpread2({}, o), {}, { fontKey: uniqueUuid() }));
8120
+ this.fontOptionsWithKey = options.map((o) => ({
8121
+ ...o,
8122
+ fontKey: uniqueUuid()
8123
+ }));
8128
8124
  this.fontTable = createFontTable(this.fontOptionsWithKey);
8129
8125
  this.relationships = new Relationships();
8130
8126
  for (let i = 0; i < options.length; i++) this.relationships.addRelationship(i + 1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font", `fonts/${options[i].name}.odttf`);
@@ -8542,7 +8538,10 @@ var ParagraphPropertiesChange = class extends XmlComponent {
8542
8538
  date: options.date,
8543
8539
  id: options.id
8544
8540
  }));
8545
- this.root.push(new ParagraphProperties(_objectSpread2(_objectSpread2({}, options), {}, { includeIfEmpty: true })));
8541
+ this.root.push(new ParagraphProperties({
8542
+ ...options,
8543
+ includeIfEmpty: true
8544
+ }));
8546
8545
  }
8547
8546
  };
8548
8547
  //#endregion
@@ -10757,7 +10756,10 @@ const VerticalAlignTable = {
10757
10756
  *
10758
10757
  * @publicApi
10759
10758
  */
10760
- const VerticalAlignSection = _objectSpread2(_objectSpread2({}, VerticalAlignTable), {}, { BOTH: "both" });
10759
+ const VerticalAlignSection = {
10760
+ ...VerticalAlignTable,
10761
+ BOTH: "both"
10762
+ };
10761
10763
  /**
10762
10764
  * @deprecated Use {@link VerticalAlignTable} for table cells or
10763
10765
  * {@link VerticalAlignSection} for section properties. This alias remains for
@@ -11274,7 +11276,10 @@ var TableCellPropertiesChange = class extends XmlComponent {
11274
11276
  date: options.date,
11275
11277
  id: options.id
11276
11278
  }));
11277
- this.root.push(new TableCellProperties(_objectSpread2(_objectSpread2({}, options), {}, { includeIfEmpty: true })));
11279
+ this.root.push(new TableCellProperties({
11280
+ ...options,
11281
+ includeIfEmpty: true
11282
+ }));
11278
11283
  }
11279
11284
  };
11280
11285
  //#endregion
@@ -11818,7 +11823,10 @@ var TablePropertiesChange = class extends XmlComponent {
11818
11823
  date: options.date,
11819
11824
  id: options.id
11820
11825
  }));
11821
- this.root.push(new TableProperties(_objectSpread2(_objectSpread2({}, options), {}, { includeIfEmpty: true })));
11826
+ this.root.push(new TableProperties({
11827
+ ...options,
11828
+ includeIfEmpty: true
11829
+ }));
11822
11830
  }
11823
11831
  };
11824
11832
  //#endregion
@@ -12063,7 +12071,10 @@ var TableRowPropertiesChange = class extends XmlComponent {
12063
12071
  date: options.date,
12064
12072
  id: options.id
12065
12073
  }));
12066
- this.root.push(new TableRowProperties(_objectSpread2(_objectSpread2({}, options), {}, { includeIfEmpty: true })));
12074
+ this.root.push(new TableRowProperties({
12075
+ ...options,
12076
+ includeIfEmpty: true
12077
+ }));
12067
12078
  }
12068
12079
  };
12069
12080
  //#endregion
@@ -12462,8 +12473,14 @@ const DocumentAttributeNamespaces = {
12462
12473
  */
12463
12474
  var DocumentAttributes = class extends XmlAttributeComponent {
12464
12475
  constructor(ns, Ignorable) {
12465
- super(_objectSpread2({ Ignorable }, Object.fromEntries(ns.map((n) => [n, DocumentAttributeNamespaces[n]]))));
12466
- _defineProperty(this, "xmlKeys", _objectSpread2({ Ignorable: "mc:Ignorable" }, Object.fromEntries(Object.keys(DocumentAttributeNamespaces).map((key) => [key, `xmlns:${key}`]))));
12476
+ super({
12477
+ Ignorable,
12478
+ ...Object.fromEntries(ns.map((n) => [n, DocumentAttributeNamespaces[n]]))
12479
+ });
12480
+ _defineProperty(this, "xmlKeys", {
12481
+ Ignorable: "mc:Ignorable",
12482
+ ...Object.fromEntries(Object.keys(DocumentAttributeNamespaces).map((key) => [key, `xmlns:${key}`]))
12483
+ });
12467
12484
  }
12468
12485
  };
12469
12486
  //#endregion
@@ -16143,7 +16160,10 @@ var Settings = class extends XmlComponent {
16143
16160
  if (((_options$hyphenation2 = options.hyphenation) === null || _options$hyphenation2 === void 0 ? void 0 : _options$hyphenation2.hyphenationZone) !== void 0) this.root.push(new NumberValueElement("w:hyphenationZone", options.hyphenation.hyphenationZone));
16144
16161
  if (((_options$hyphenation3 = options.hyphenation) === null || _options$hyphenation3 === void 0 ? void 0 : _options$hyphenation3.consecutiveHyphenLimit) !== void 0) this.root.push(new NumberValueElement("w:consecutiveHyphenLimit", options.hyphenation.consecutiveHyphenLimit));
16145
16162
  if (((_options$hyphenation4 = options.hyphenation) === null || _options$hyphenation4 === void 0 ? void 0 : _options$hyphenation4.doNotHyphenateCaps) !== void 0) this.root.push(new OnOffElement("w:doNotHyphenateCaps", options.hyphenation.doNotHyphenateCaps));
16146
- this.root.push(new Compatibility(_objectSpread2(_objectSpread2({}, options.compatibility), {}, { version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15 })));
16163
+ this.root.push(new Compatibility({
16164
+ ...options.compatibility,
16165
+ version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15
16166
+ }));
16147
16167
  }
16148
16168
  };
16149
16169
  //#endregion
@@ -16412,10 +16432,11 @@ var StyleForCharacter = class extends Style {
16412
16432
  super({
16413
16433
  styleId: options.id,
16414
16434
  type: "character"
16415
- }, _objectSpread2({
16435
+ }, {
16416
16436
  uiPriority: 99,
16417
- unhideWhenUsed: true
16418
- }, options));
16437
+ unhideWhenUsed: true,
16438
+ ...options
16439
+ });
16419
16440
  _defineProperty(this, "runProperties", void 0);
16420
16441
  this.runProperties = new RunProperties(options.run);
16421
16442
  this.root.push(this.runProperties);
@@ -16451,11 +16472,12 @@ var StyleForCharacter = class extends Style {
16451
16472
  */
16452
16473
  var HeadingStyle = class extends StyleForParagraph {
16453
16474
  constructor(options) {
16454
- super(_objectSpread2({
16475
+ super({
16455
16476
  basedOn: "Normal",
16456
16477
  next: "Normal",
16457
- quickFormat: true
16458
- }, options));
16478
+ quickFormat: true,
16479
+ ...options
16480
+ });
16459
16481
  }
16460
16482
  };
16461
16483
  /**
@@ -16472,10 +16494,11 @@ var HeadingStyle = class extends StyleForParagraph {
16472
16494
  */
16473
16495
  var TitleStyle = class extends HeadingStyle {
16474
16496
  constructor(options) {
16475
- super(_objectSpread2({
16497
+ super({
16476
16498
  id: "Title",
16477
- name: "Title"
16478
- }, options));
16499
+ name: "Title",
16500
+ ...options
16501
+ });
16479
16502
  }
16480
16503
  };
16481
16504
  /**
@@ -16492,10 +16515,11 @@ var TitleStyle = class extends HeadingStyle {
16492
16515
  */
16493
16516
  var Heading1Style = class extends HeadingStyle {
16494
16517
  constructor(options) {
16495
- super(_objectSpread2({
16518
+ super({
16496
16519
  id: "Heading1",
16497
- name: "Heading 1"
16498
- }, options));
16520
+ name: "Heading 1",
16521
+ ...options
16522
+ });
16499
16523
  }
16500
16524
  };
16501
16525
  /**
@@ -16505,10 +16529,11 @@ var Heading1Style = class extends HeadingStyle {
16505
16529
  */
16506
16530
  var Heading2Style = class extends HeadingStyle {
16507
16531
  constructor(options) {
16508
- super(_objectSpread2({
16532
+ super({
16509
16533
  id: "Heading2",
16510
- name: "Heading 2"
16511
- }, options));
16534
+ name: "Heading 2",
16535
+ ...options
16536
+ });
16512
16537
  }
16513
16538
  };
16514
16539
  /**
@@ -16518,10 +16543,11 @@ var Heading2Style = class extends HeadingStyle {
16518
16543
  */
16519
16544
  var Heading3Style = class extends HeadingStyle {
16520
16545
  constructor(options) {
16521
- super(_objectSpread2({
16546
+ super({
16522
16547
  id: "Heading3",
16523
- name: "Heading 3"
16524
- }, options));
16548
+ name: "Heading 3",
16549
+ ...options
16550
+ });
16525
16551
  }
16526
16552
  };
16527
16553
  /**
@@ -16531,10 +16557,11 @@ var Heading3Style = class extends HeadingStyle {
16531
16557
  */
16532
16558
  var Heading4Style = class extends HeadingStyle {
16533
16559
  constructor(options) {
16534
- super(_objectSpread2({
16560
+ super({
16535
16561
  id: "Heading4",
16536
- name: "Heading 4"
16537
- }, options));
16562
+ name: "Heading 4",
16563
+ ...options
16564
+ });
16538
16565
  }
16539
16566
  };
16540
16567
  /**
@@ -16544,10 +16571,11 @@ var Heading4Style = class extends HeadingStyle {
16544
16571
  */
16545
16572
  var Heading5Style = class extends HeadingStyle {
16546
16573
  constructor(options) {
16547
- super(_objectSpread2({
16574
+ super({
16548
16575
  id: "Heading5",
16549
- name: "Heading 5"
16550
- }, options));
16576
+ name: "Heading 5",
16577
+ ...options
16578
+ });
16551
16579
  }
16552
16580
  };
16553
16581
  /**
@@ -16557,10 +16585,11 @@ var Heading5Style = class extends HeadingStyle {
16557
16585
  */
16558
16586
  var Heading6Style = class extends HeadingStyle {
16559
16587
  constructor(options) {
16560
- super(_objectSpread2({
16588
+ super({
16561
16589
  id: "Heading6",
16562
- name: "Heading 6"
16563
- }, options));
16590
+ name: "Heading 6",
16591
+ ...options
16592
+ });
16564
16593
  }
16565
16594
  };
16566
16595
  /**
@@ -16570,10 +16599,11 @@ var Heading6Style = class extends HeadingStyle {
16570
16599
  */
16571
16600
  var StrongStyle = class extends HeadingStyle {
16572
16601
  constructor(options) {
16573
- super(_objectSpread2({
16602
+ super({
16574
16603
  id: "Strong",
16575
- name: "Strong"
16576
- }, options));
16604
+ name: "Strong",
16605
+ ...options
16606
+ });
16577
16607
  }
16578
16608
  };
16579
16609
  /**
@@ -16583,12 +16613,13 @@ var StrongStyle = class extends HeadingStyle {
16583
16613
  */
16584
16614
  var ListParagraph = class extends StyleForParagraph {
16585
16615
  constructor(options) {
16586
- super(_objectSpread2({
16616
+ super({
16587
16617
  basedOn: "Normal",
16588
16618
  id: "ListParagraph",
16589
16619
  name: "List Paragraph",
16590
- quickFormat: true
16591
- }, options));
16620
+ quickFormat: true,
16621
+ ...options
16622
+ });
16592
16623
  }
16593
16624
  };
16594
16625
  /**
@@ -16598,7 +16629,7 @@ var ListParagraph = class extends StyleForParagraph {
16598
16629
  */
16599
16630
  var FootnoteText = class extends StyleForParagraph {
16600
16631
  constructor(options) {
16601
- super(_objectSpread2({
16632
+ super({
16602
16633
  basedOn: "Normal",
16603
16634
  id: "FootnoteText",
16604
16635
  link: "FootnoteTextChar",
@@ -16611,8 +16642,9 @@ var FootnoteText = class extends StyleForParagraph {
16611
16642
  run: { size: 20 },
16612
16643
  semiHidden: true,
16613
16644
  uiPriority: 99,
16614
- unhideWhenUsed: true
16615
- }, options));
16645
+ unhideWhenUsed: true,
16646
+ ...options
16647
+ });
16616
16648
  }
16617
16649
  };
16618
16650
  /**
@@ -16622,13 +16654,14 @@ var FootnoteText = class extends StyleForParagraph {
16622
16654
  */
16623
16655
  var FootnoteReferenceStyle = class extends StyleForCharacter {
16624
16656
  constructor(options) {
16625
- super(_objectSpread2({
16657
+ super({
16626
16658
  basedOn: "DefaultParagraphFont",
16627
16659
  id: "FootnoteReference",
16628
16660
  name: "footnote reference",
16629
16661
  run: { superScript: true },
16630
- semiHidden: true
16631
- }, options));
16662
+ semiHidden: true,
16663
+ ...options
16664
+ });
16632
16665
  }
16633
16666
  };
16634
16667
  /**
@@ -16638,14 +16671,15 @@ var FootnoteReferenceStyle = class extends StyleForCharacter {
16638
16671
  */
16639
16672
  var FootnoteTextChar = class extends StyleForCharacter {
16640
16673
  constructor(options) {
16641
- super(_objectSpread2({
16674
+ super({
16642
16675
  basedOn: "DefaultParagraphFont",
16643
16676
  id: "FootnoteTextChar",
16644
16677
  link: "FootnoteText",
16645
16678
  name: "Footnote Text Char",
16646
16679
  run: { size: 20 },
16647
- semiHidden: true
16648
- }, options));
16680
+ semiHidden: true,
16681
+ ...options
16682
+ });
16649
16683
  }
16650
16684
  };
16651
16685
  /**
@@ -16655,7 +16689,7 @@ var FootnoteTextChar = class extends StyleForCharacter {
16655
16689
  */
16656
16690
  var EndnoteText = class extends StyleForParagraph {
16657
16691
  constructor(options) {
16658
- super(_objectSpread2({
16692
+ super({
16659
16693
  basedOn: "Normal",
16660
16694
  id: "EndnoteText",
16661
16695
  link: "EndnoteTextChar",
@@ -16668,8 +16702,9 @@ var EndnoteText = class extends StyleForParagraph {
16668
16702
  run: { size: 20 },
16669
16703
  semiHidden: true,
16670
16704
  uiPriority: 99,
16671
- unhideWhenUsed: true
16672
- }, options));
16705
+ unhideWhenUsed: true,
16706
+ ...options
16707
+ });
16673
16708
  }
16674
16709
  };
16675
16710
  /**
@@ -16679,13 +16714,14 @@ var EndnoteText = class extends StyleForParagraph {
16679
16714
  */
16680
16715
  var EndnoteReferenceStyle = class extends StyleForCharacter {
16681
16716
  constructor(options) {
16682
- super(_objectSpread2({
16717
+ super({
16683
16718
  basedOn: "DefaultParagraphFont",
16684
16719
  id: "EndnoteReference",
16685
16720
  name: "endnote reference",
16686
16721
  run: { superScript: true },
16687
- semiHidden: true
16688
- }, options));
16722
+ semiHidden: true,
16723
+ ...options
16724
+ });
16689
16725
  }
16690
16726
  };
16691
16727
  /**
@@ -16695,14 +16731,15 @@ var EndnoteReferenceStyle = class extends StyleForCharacter {
16695
16731
  */
16696
16732
  var EndnoteTextChar = class extends StyleForCharacter {
16697
16733
  constructor(options) {
16698
- super(_objectSpread2({
16734
+ super({
16699
16735
  basedOn: "DefaultParagraphFont",
16700
16736
  id: "EndnoteTextChar",
16701
16737
  link: "EndnoteText",
16702
16738
  name: "Endnote Text Char",
16703
16739
  run: { size: 20 },
16704
- semiHidden: true
16705
- }, options));
16740
+ semiHidden: true,
16741
+ ...options
16742
+ });
16706
16743
  }
16707
16744
  };
16708
16745
  /**
@@ -16712,15 +16749,16 @@ var EndnoteTextChar = class extends StyleForCharacter {
16712
16749
  */
16713
16750
  var HyperlinkStyle = class extends StyleForCharacter {
16714
16751
  constructor(options) {
16715
- super(_objectSpread2({
16752
+ super({
16716
16753
  basedOn: "DefaultParagraphFont",
16717
16754
  id: "Hyperlink",
16718
16755
  name: "Hyperlink",
16719
16756
  run: {
16720
16757
  color: "0563C1",
16721
16758
  underline: { type: UnderlineType.SINGLE }
16722
- }
16723
- }, options));
16759
+ },
16760
+ ...options
16761
+ });
16724
16762
  }
16725
16763
  };
16726
16764
  //#endregion
@@ -16990,26 +17028,50 @@ var DefaultStylesFactory = class {
16990
17028
  return {
16991
17029
  importedStyles: [
16992
17030
  new DocumentDefaults((_options$document = options.document) !== null && _options$document !== void 0 ? _options$document : {}),
16993
- new TitleStyle(_objectSpread2({ run: { size: 56 } }, options.title)),
16994
- new Heading1Style(_objectSpread2({ run: {
16995
- color: "2E74B5",
16996
- size: 32
16997
- } }, options.heading1)),
16998
- new Heading2Style(_objectSpread2({ run: {
16999
- color: "2E74B5",
17000
- size: 26
17001
- } }, options.heading2)),
17002
- new Heading3Style(_objectSpread2({ run: {
17003
- color: "1F4D78",
17004
- size: 24
17005
- } }, options.heading3)),
17006
- new Heading4Style(_objectSpread2({ run: {
17007
- color: "2E74B5",
17008
- italics: true
17009
- } }, options.heading4)),
17010
- new Heading5Style(_objectSpread2({ run: { color: "2E74B5" } }, options.heading5)),
17011
- new Heading6Style(_objectSpread2({ run: { color: "1F4D78" } }, options.heading6)),
17012
- new StrongStyle(_objectSpread2({ run: { bold: true } }, options.strong)),
17031
+ new TitleStyle({
17032
+ run: { size: 56 },
17033
+ ...options.title
17034
+ }),
17035
+ new Heading1Style({
17036
+ run: {
17037
+ color: "2E74B5",
17038
+ size: 32
17039
+ },
17040
+ ...options.heading1
17041
+ }),
17042
+ new Heading2Style({
17043
+ run: {
17044
+ color: "2E74B5",
17045
+ size: 26
17046
+ },
17047
+ ...options.heading2
17048
+ }),
17049
+ new Heading3Style({
17050
+ run: {
17051
+ color: "1F4D78",
17052
+ size: 24
17053
+ },
17054
+ ...options.heading3
17055
+ }),
17056
+ new Heading4Style({
17057
+ run: {
17058
+ color: "2E74B5",
17059
+ italics: true
17060
+ },
17061
+ ...options.heading4
17062
+ }),
17063
+ new Heading5Style({
17064
+ run: { color: "2E74B5" },
17065
+ ...options.heading5
17066
+ }),
17067
+ new Heading6Style({
17068
+ run: { color: "1F4D78" },
17069
+ ...options.heading6
17070
+ }),
17071
+ new StrongStyle({
17072
+ run: { bold: true },
17073
+ ...options.strong
17074
+ }),
17013
17075
  new ListParagraph(options.listParagraph || {}),
17014
17076
  new HyperlinkStyle(options.hyperlink || {}),
17015
17077
  new FootnoteReferenceStyle(options.footnoteReference || {}),
@@ -17127,11 +17189,12 @@ var File = class {
17127
17189
  _defineProperty(this, "styles", void 0);
17128
17190
  _defineProperty(this, "comments", void 0);
17129
17191
  _defineProperty(this, "fontWrapper", void 0);
17130
- this.coreProperties = new CoreProperties(_objectSpread2(_objectSpread2({}, options), {}, {
17192
+ this.coreProperties = new CoreProperties({
17193
+ ...options,
17131
17194
  creator: (_options$creator = options.creator) !== null && _options$creator !== void 0 ? _options$creator : "Un-named",
17132
17195
  lastModifiedBy: (_options$lastModified = options.lastModifiedBy) !== null && _options$lastModified !== void 0 ? _options$lastModified : "Un-named",
17133
17196
  revision: (_options$revision = options.revision) !== null && _options$revision !== void 0 ? _options$revision : 1
17134
- }));
17197
+ });
17135
17198
  this.numbering = new Numbering(options.numbering ? options.numbering : { config: [] });
17136
17199
  this.comments = new Comments((_options$comments = options.comments) !== null && _options$comments !== void 0 ? _options$comments : { children: [] });
17137
17200
  this.fileRelationships = new Relationships();
@@ -17160,8 +17223,14 @@ var File = class {
17160
17223
  var _options$styles;
17161
17224
  const defaultStyles = new DefaultStylesFactory().newInstance((_options$styles = options.styles) === null || _options$styles === void 0 ? void 0 : _options$styles.default);
17162
17225
  const externalStyles = new ExternalStylesFactory().newInstance(options.externalStyles);
17163
- this.styles = new Styles(_objectSpread2(_objectSpread2({}, externalStyles), {}, { importedStyles: [...defaultStyles.importedStyles, ...externalStyles.importedStyles] }));
17164
- } else if (options.styles) this.styles = new Styles(_objectSpread2(_objectSpread2({}, new DefaultStylesFactory().newInstance(options.styles.default)), options.styles));
17226
+ this.styles = new Styles({
17227
+ ...externalStyles,
17228
+ importedStyles: [...defaultStyles.importedStyles, ...externalStyles.importedStyles]
17229
+ });
17230
+ } else if (options.styles) this.styles = new Styles({
17231
+ ...new DefaultStylesFactory().newInstance(options.styles.default),
17232
+ ...options.styles
17233
+ });
17165
17234
  else this.styles = new Styles(new DefaultStylesFactory().newInstance());
17166
17235
  this.addDefaultRelationships();
17167
17236
  for (const section of options.sections) this.addSection(section);
@@ -17170,7 +17239,8 @@ var File = class {
17170
17239
  this.fontWrapper = new FontWrapper((_options$fonts = options.fonts) !== null && _options$fonts !== void 0 ? _options$fonts : []);
17171
17240
  }
17172
17241
  addSection({ headers = {}, footers = {}, children, properties }) {
17173
- this.documentWrapper.View.Body.addSection(_objectSpread2(_objectSpread2({}, properties), {}, {
17242
+ this.documentWrapper.View.Body.addSection({
17243
+ ...properties,
17174
17244
  footerWrapperGroup: {
17175
17245
  default: footers.default ? this.createFooter(footers.default) : void 0,
17176
17246
  even: footers.even ? this.createFooter(footers.even) : void 0,
@@ -17181,7 +17251,7 @@ var File = class {
17181
17251
  even: headers.even ? this.createHeader(headers.even) : void 0,
17182
17252
  first: headers.first ? this.createHeader(headers.first) : void 0
17183
17253
  }
17184
- }));
17254
+ });
17185
17255
  for (const child of children) this.documentWrapper.View.add(child);
17186
17256
  }
17187
17257
  createHeader(header) {
@@ -17438,28 +17508,6 @@ var StructuredDocumentTagProperties = class extends XmlComponent {
17438
17508
  }
17439
17509
  };
17440
17510
  //#endregion
17441
- //#region \0@oxc-project+runtime@0.123.0/helpers/objectWithoutPropertiesLoose.js
17442
- function _objectWithoutPropertiesLoose(r, e) {
17443
- if (null == r) return {};
17444
- var t = {};
17445
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
17446
- if (e.includes(n)) continue;
17447
- t[n] = r[n];
17448
- }
17449
- return t;
17450
- }
17451
- //#endregion
17452
- //#region \0@oxc-project+runtime@0.123.0/helpers/objectWithoutProperties.js
17453
- function _objectWithoutProperties(e, t) {
17454
- if (null == e) return {};
17455
- var o, r, i = _objectWithoutPropertiesLoose(e, t);
17456
- if (Object.getOwnPropertySymbols) {
17457
- var s = Object.getOwnPropertySymbols(e);
17458
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
17459
- }
17460
- return i;
17461
- }
17462
- //#endregion
17463
17511
  //#region src/file/table-of-contents/table-of-contents.ts
17464
17512
  /**
17465
17513
  * Table of Contents module for WordprocessingML documents.
@@ -17471,11 +17519,6 @@ function _objectWithoutProperties(e, t) {
17471
17519
  *
17472
17520
  * @module
17473
17521
  */
17474
- const _excluded$1 = [
17475
- "contentChildren",
17476
- "cachedEntries",
17477
- "beginDirty"
17478
- ];
17479
17522
  /**
17480
17523
  * Represents a Table of Contents in a WordprocessingML document.
17481
17524
  *
@@ -17506,8 +17549,7 @@ const _excluded$1 = [
17506
17549
  * ```
17507
17550
  */
17508
17551
  var TableOfContents = class extends FileChild {
17509
- constructor(alias = "Table of Contents", _ref = {}) {
17510
- let { contentChildren = [], cachedEntries = [], beginDirty = true } = _ref, properties = _objectWithoutProperties(_ref, _excluded$1);
17552
+ constructor(alias = "Table of Contents", { contentChildren = [], cachedEntries = [], beginDirty = true, ...properties } = {}) {
17511
17553
  super("w:sdt");
17512
17554
  this.root.push(new StructuredDocumentTagProperties(alias));
17513
17555
  const content = new StructuredDocumentTagContent();
@@ -18203,7 +18245,6 @@ const createShape = ({ id, children, type = SHAPE_TYPE, style }) => new BuilderE
18203
18245
  *
18204
18246
  * @module
18205
18247
  */
18206
- const _excluded = ["style", "children"];
18207
18248
  /**
18208
18249
  * Represents a textbox in a WordprocessingML document.
18209
18250
  *
@@ -18253,8 +18294,7 @@ const _excluded = ["style", "children"];
18253
18294
  * ```
18254
18295
  */
18255
18296
  var Textbox = class extends FileChild {
18256
- constructor(_ref) {
18257
- let { style, children } = _ref, rest = _objectWithoutProperties(_ref, _excluded);
18297
+ constructor({ style, children, ...rest }) {
18258
18298
  super("w:p");
18259
18299
  this.root.push(new ParagraphProperties(rest));
18260
18300
  this.root.push(createPictElement({ shape: createShape({
@@ -18265,115 +18305,3259 @@ var Textbox = class extends FileChild {
18265
18305
  }
18266
18306
  };
18267
18307
  //#endregion
18268
- //#region src/util/output-type.ts
18269
- /**
18270
- * Converts a Uint8Array to the specified output type.
18271
- *
18272
- * This is used by both the Packer and patchDocument to convert fflate's
18273
- * raw Uint8Array output into the user's requested format.
18274
- */
18275
- const convertOutput = (data, type) => {
18276
- switch (type) {
18277
- case "nodebuffer": return Buffer.from(data);
18278
- case "blob": return new Blob([data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
18279
- case "arraybuffer": return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
18280
- case "uint8array": return data;
18281
- case "base64": return Buffer.from(data).toString("base64");
18282
- case "string":
18283
- case "text": return Buffer.from(data).toString("binary");
18284
- case "binarystring": return Buffer.from(data).toString("binary");
18285
- case "array": return [...data];
18286
- default: return data;
18308
+ //#region \0polyfill-node.events.js
18309
+ var domain;
18310
+ function EventHandlers() {}
18311
+ EventHandlers.prototype = Object.create(null);
18312
+ function EventEmitter() {
18313
+ EventEmitter.init.call(this);
18314
+ }
18315
+ EventEmitter.EventEmitter = EventEmitter;
18316
+ EventEmitter.usingDomains = false;
18317
+ EventEmitter.prototype.domain = void 0;
18318
+ EventEmitter.prototype._events = void 0;
18319
+ EventEmitter.prototype._maxListeners = void 0;
18320
+ EventEmitter.defaultMaxListeners = 10;
18321
+ EventEmitter.init = function() {
18322
+ this.domain = null;
18323
+ if (EventEmitter.usingDomains) {
18324
+ if (domain.active && !(this instanceof domain.Domain)) this.domain = domain.active;
18325
+ }
18326
+ if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
18327
+ this._events = new EventHandlers();
18328
+ this._eventsCount = 0;
18329
+ }
18330
+ this._maxListeners = this._maxListeners || void 0;
18331
+ };
18332
+ EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
18333
+ if (typeof n !== "number" || n < 0 || isNaN(n)) throw new TypeError("\"n\" argument must be a positive number");
18334
+ this._maxListeners = n;
18335
+ return this;
18336
+ };
18337
+ function $getMaxListeners(that) {
18338
+ if (that._maxListeners === void 0) return EventEmitter.defaultMaxListeners;
18339
+ return that._maxListeners;
18340
+ }
18341
+ EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
18342
+ return $getMaxListeners(this);
18343
+ };
18344
+ function emitNone(handler, isFn, self) {
18345
+ if (isFn) handler.call(self);
18346
+ else {
18347
+ var len = handler.length;
18348
+ var listeners = arrayClone(handler, len);
18349
+ for (var i = 0; i < len; ++i) listeners[i].call(self);
18350
+ }
18351
+ }
18352
+ function emitOne(handler, isFn, self, arg1) {
18353
+ if (isFn) handler.call(self, arg1);
18354
+ else {
18355
+ var len = handler.length;
18356
+ var listeners = arrayClone(handler, len);
18357
+ for (var i = 0; i < len; ++i) listeners[i].call(self, arg1);
18287
18358
  }
18359
+ }
18360
+ function emitTwo(handler, isFn, self, arg1, arg2) {
18361
+ if (isFn) handler.call(self, arg1, arg2);
18362
+ else {
18363
+ var len = handler.length;
18364
+ var listeners = arrayClone(handler, len);
18365
+ for (var i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2);
18366
+ }
18367
+ }
18368
+ function emitThree(handler, isFn, self, arg1, arg2, arg3) {
18369
+ if (isFn) handler.call(self, arg1, arg2, arg3);
18370
+ else {
18371
+ var len = handler.length;
18372
+ var listeners = arrayClone(handler, len);
18373
+ for (var i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2, arg3);
18374
+ }
18375
+ }
18376
+ function emitMany(handler, isFn, self, args) {
18377
+ if (isFn) handler.apply(self, args);
18378
+ else {
18379
+ var len = handler.length;
18380
+ var listeners = arrayClone(handler, len);
18381
+ for (var i = 0; i < len; ++i) listeners[i].apply(self, args);
18382
+ }
18383
+ }
18384
+ EventEmitter.prototype.emit = function emit(type) {
18385
+ var er, handler, len, args, i, events, domain;
18386
+ var needDomainExit = false;
18387
+ var doError = type === "error";
18388
+ events = this._events;
18389
+ if (events) doError = doError && events.error == null;
18390
+ else if (!doError) return false;
18391
+ domain = this.domain;
18392
+ if (doError) {
18393
+ er = arguments[1];
18394
+ if (domain) {
18395
+ if (!er) er = /* @__PURE__ */ new Error("Uncaught, unspecified \"error\" event");
18396
+ er.domainEmitter = this;
18397
+ er.domain = domain;
18398
+ er.domainThrown = false;
18399
+ domain.emit("error", er);
18400
+ } else if (er instanceof Error) throw er;
18401
+ else {
18402
+ var err = /* @__PURE__ */ new Error("Uncaught, unspecified \"error\" event. (" + er + ")");
18403
+ err.context = er;
18404
+ throw err;
18405
+ }
18406
+ return false;
18407
+ }
18408
+ handler = events[type];
18409
+ if (!handler) return false;
18410
+ var isFn = typeof handler === "function";
18411
+ len = arguments.length;
18412
+ switch (len) {
18413
+ case 1:
18414
+ emitNone(handler, isFn, this);
18415
+ break;
18416
+ case 2:
18417
+ emitOne(handler, isFn, this, arguments[1]);
18418
+ break;
18419
+ case 3:
18420
+ emitTwo(handler, isFn, this, arguments[1], arguments[2]);
18421
+ break;
18422
+ case 4:
18423
+ emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
18424
+ break;
18425
+ default:
18426
+ args = new Array(len - 1);
18427
+ for (i = 1; i < len; i++) args[i - 1] = arguments[i];
18428
+ emitMany(handler, isFn, this, args);
18429
+ }
18430
+ if (needDomainExit) domain.exit();
18431
+ return true;
18432
+ };
18433
+ function _addListener(target, type, listener, prepend) {
18434
+ var m;
18435
+ var events;
18436
+ var existing;
18437
+ if (typeof listener !== "function") throw new TypeError("\"listener\" argument must be a function");
18438
+ events = target._events;
18439
+ if (!events) {
18440
+ events = target._events = new EventHandlers();
18441
+ target._eventsCount = 0;
18442
+ } else {
18443
+ if (events.newListener) {
18444
+ target.emit("newListener", type, listener.listener ? listener.listener : listener);
18445
+ events = target._events;
18446
+ }
18447
+ existing = events[type];
18448
+ }
18449
+ if (!existing) {
18450
+ existing = events[type] = listener;
18451
+ ++target._eventsCount;
18452
+ } else {
18453
+ if (typeof existing === "function") existing = events[type] = prepend ? [listener, existing] : [existing, listener];
18454
+ else if (prepend) existing.unshift(listener);
18455
+ else existing.push(listener);
18456
+ if (!existing.warned) {
18457
+ m = $getMaxListeners(target);
18458
+ if (m && m > 0 && existing.length > m) {
18459
+ existing.warned = true;
18460
+ var w = /* @__PURE__ */ new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + type + " listeners added. Use emitter.setMaxListeners() to increase limit");
18461
+ w.name = "MaxListenersExceededWarning";
18462
+ w.emitter = target;
18463
+ w.type = type;
18464
+ w.count = existing.length;
18465
+ emitWarning(w);
18466
+ }
18467
+ }
18468
+ }
18469
+ return target;
18470
+ }
18471
+ function emitWarning(e) {
18472
+ typeof console.warn === "function" ? console.warn(e) : console.log(e);
18473
+ }
18474
+ EventEmitter.prototype.addListener = function addListener(type, listener) {
18475
+ return _addListener(this, type, listener, false);
18476
+ };
18477
+ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
18478
+ EventEmitter.prototype.prependListener = function prependListener(type, listener) {
18479
+ return _addListener(this, type, listener, true);
18480
+ };
18481
+ function _onceWrap(target, type, listener) {
18482
+ var fired = false;
18483
+ function g() {
18484
+ target.removeListener(type, g);
18485
+ if (!fired) {
18486
+ fired = true;
18487
+ listener.apply(target, arguments);
18488
+ }
18489
+ }
18490
+ g.listener = listener;
18491
+ return g;
18492
+ }
18493
+ EventEmitter.prototype.once = function once(type, listener) {
18494
+ if (typeof listener !== "function") throw new TypeError("\"listener\" argument must be a function");
18495
+ this.on(type, _onceWrap(this, type, listener));
18496
+ return this;
18497
+ };
18498
+ EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {
18499
+ if (typeof listener !== "function") throw new TypeError("\"listener\" argument must be a function");
18500
+ this.prependListener(type, _onceWrap(this, type, listener));
18501
+ return this;
18502
+ };
18503
+ EventEmitter.prototype.removeListener = function removeListener(type, listener) {
18504
+ var list, events, position, i, originalListener;
18505
+ if (typeof listener !== "function") throw new TypeError("\"listener\" argument must be a function");
18506
+ events = this._events;
18507
+ if (!events) return this;
18508
+ list = events[type];
18509
+ if (!list) return this;
18510
+ if (list === listener || list.listener && list.listener === listener) if (--this._eventsCount === 0) this._events = new EventHandlers();
18511
+ else {
18512
+ delete events[type];
18513
+ if (events.removeListener) this.emit("removeListener", type, list.listener || listener);
18514
+ }
18515
+ else if (typeof list !== "function") {
18516
+ position = -1;
18517
+ for (i = list.length; i-- > 0;) if (list[i] === listener || list[i].listener && list[i].listener === listener) {
18518
+ originalListener = list[i].listener;
18519
+ position = i;
18520
+ break;
18521
+ }
18522
+ if (position < 0) return this;
18523
+ if (list.length === 1) {
18524
+ list[0] = void 0;
18525
+ if (--this._eventsCount === 0) {
18526
+ this._events = new EventHandlers();
18527
+ return this;
18528
+ } else delete events[type];
18529
+ } else spliceOne(list, position);
18530
+ if (events.removeListener) this.emit("removeListener", type, originalListener || listener);
18531
+ }
18532
+ return this;
18533
+ };
18534
+ EventEmitter.prototype.off = function(type, listener) {
18535
+ return this.removeListener(type, listener);
18536
+ };
18537
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
18538
+ var listeners, events = this._events;
18539
+ if (!events) return this;
18540
+ if (!events.removeListener) {
18541
+ if (arguments.length === 0) {
18542
+ this._events = new EventHandlers();
18543
+ this._eventsCount = 0;
18544
+ } else if (events[type]) if (--this._eventsCount === 0) this._events = new EventHandlers();
18545
+ else delete events[type];
18546
+ return this;
18547
+ }
18548
+ if (arguments.length === 0) {
18549
+ var keys = Object.keys(events);
18550
+ for (var i = 0, key; i < keys.length; ++i) {
18551
+ key = keys[i];
18552
+ if (key === "removeListener") continue;
18553
+ this.removeAllListeners(key);
18554
+ }
18555
+ this.removeAllListeners("removeListener");
18556
+ this._events = new EventHandlers();
18557
+ this._eventsCount = 0;
18558
+ return this;
18559
+ }
18560
+ listeners = events[type];
18561
+ if (typeof listeners === "function") this.removeListener(type, listeners);
18562
+ else if (listeners) do
18563
+ this.removeListener(type, listeners[listeners.length - 1]);
18564
+ while (listeners[0]);
18565
+ return this;
18566
+ };
18567
+ EventEmitter.prototype.listeners = function listeners(type) {
18568
+ var evlistener;
18569
+ var ret;
18570
+ var events = this._events;
18571
+ if (!events) ret = [];
18572
+ else {
18573
+ evlistener = events[type];
18574
+ if (!evlistener) ret = [];
18575
+ else if (typeof evlistener === "function") ret = [evlistener.listener || evlistener];
18576
+ else ret = unwrapListeners(evlistener);
18577
+ }
18578
+ return ret;
18579
+ };
18580
+ EventEmitter.listenerCount = function(emitter, type) {
18581
+ if (typeof emitter.listenerCount === "function") return emitter.listenerCount(type);
18582
+ else return listenerCount$1.call(emitter, type);
18583
+ };
18584
+ EventEmitter.prototype.listenerCount = listenerCount$1;
18585
+ function listenerCount$1(type) {
18586
+ var events = this._events;
18587
+ if (events) {
18588
+ var evlistener = events[type];
18589
+ if (typeof evlistener === "function") return 1;
18590
+ else if (evlistener) return evlistener.length;
18591
+ }
18592
+ return 0;
18593
+ }
18594
+ EventEmitter.prototype.eventNames = function eventNames() {
18595
+ return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
18288
18596
  };
18597
+ function spliceOne(list, index) {
18598
+ for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) list[i] = list[k];
18599
+ list.pop();
18600
+ }
18601
+ function arrayClone(arr, i) {
18602
+ var copy = new Array(i);
18603
+ while (i--) copy[i] = arr[i];
18604
+ return copy;
18605
+ }
18606
+ function unwrapListeners(arr) {
18607
+ var ret = new Array(arr.length);
18608
+ for (var i = 0; i < ret.length; ++i) ret[i] = arr[i].listener || arr[i];
18609
+ return ret;
18610
+ }
18289
18611
  //#endregion
18290
- //#region src/file/fonts/obfuscate-ttf-to-odttf.ts
18612
+ //#region \0polyfill-node.global.js
18613
+ var _polyfill_node_global_default = typeof _polyfill_node_global_default !== "undefined" ? _polyfill_node_global_default : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
18614
+ //#endregion
18615
+ //#region \0polyfill-node.buffer.js
18616
+ var lookup = [];
18617
+ var revLookup = [];
18618
+ var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
18619
+ var inited = false;
18620
+ function init() {
18621
+ inited = true;
18622
+ var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
18623
+ for (var i = 0, len = code.length; i < len; ++i) {
18624
+ lookup[i] = code[i];
18625
+ revLookup[code.charCodeAt(i)] = i;
18626
+ }
18627
+ revLookup["-".charCodeAt(0)] = 62;
18628
+ revLookup["_".charCodeAt(0)] = 63;
18629
+ }
18630
+ function toByteArray(b64) {
18631
+ if (!inited) init();
18632
+ var i, j, l, tmp, placeHolders, arr;
18633
+ var len = b64.length;
18634
+ if (len % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
18635
+ placeHolders = b64[len - 2] === "=" ? 2 : b64[len - 1] === "=" ? 1 : 0;
18636
+ arr = new Arr(len * 3 / 4 - placeHolders);
18637
+ l = placeHolders > 0 ? len - 4 : len;
18638
+ var L = 0;
18639
+ for (i = 0, j = 0; i < l; i += 4, j += 3) {
18640
+ tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
18641
+ arr[L++] = tmp >> 16 & 255;
18642
+ arr[L++] = tmp >> 8 & 255;
18643
+ arr[L++] = tmp & 255;
18644
+ }
18645
+ if (placeHolders === 2) {
18646
+ tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
18647
+ arr[L++] = tmp & 255;
18648
+ } else if (placeHolders === 1) {
18649
+ tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
18650
+ arr[L++] = tmp >> 8 & 255;
18651
+ arr[L++] = tmp & 255;
18652
+ }
18653
+ return arr;
18654
+ }
18655
+ function tripletToBase64(num) {
18656
+ return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
18657
+ }
18658
+ function encodeChunk(uint8, start, end) {
18659
+ var tmp;
18660
+ var output = [];
18661
+ for (var i = start; i < end; i += 3) {
18662
+ tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
18663
+ output.push(tripletToBase64(tmp));
18664
+ }
18665
+ return output.join("");
18666
+ }
18667
+ function fromByteArray(uint8) {
18668
+ if (!inited) init();
18669
+ var tmp;
18670
+ var len = uint8.length;
18671
+ var extraBytes = len % 3;
18672
+ var output = "";
18673
+ var parts = [];
18674
+ var maxChunkLength = 16383;
18675
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
18676
+ if (extraBytes === 1) {
18677
+ tmp = uint8[len - 1];
18678
+ output += lookup[tmp >> 2];
18679
+ output += lookup[tmp << 4 & 63];
18680
+ output += "==";
18681
+ } else if (extraBytes === 2) {
18682
+ tmp = (uint8[len - 2] << 8) + uint8[len - 1];
18683
+ output += lookup[tmp >> 10];
18684
+ output += lookup[tmp >> 4 & 63];
18685
+ output += lookup[tmp << 2 & 63];
18686
+ output += "=";
18687
+ }
18688
+ parts.push(output);
18689
+ return parts.join("");
18690
+ }
18691
+ function read(buffer, offset, isLE, mLen, nBytes) {
18692
+ var e, m;
18693
+ var eLen = nBytes * 8 - mLen - 1;
18694
+ var eMax = (1 << eLen) - 1;
18695
+ var eBias = eMax >> 1;
18696
+ var nBits = -7;
18697
+ var i = isLE ? nBytes - 1 : 0;
18698
+ var d = isLE ? -1 : 1;
18699
+ var s = buffer[offset + i];
18700
+ i += d;
18701
+ e = s & (1 << -nBits) - 1;
18702
+ s >>= -nBits;
18703
+ nBits += eLen;
18704
+ for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);
18705
+ m = e & (1 << -nBits) - 1;
18706
+ e >>= -nBits;
18707
+ nBits += mLen;
18708
+ for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);
18709
+ if (e === 0) e = 1 - eBias;
18710
+ else if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity;
18711
+ else {
18712
+ m = m + Math.pow(2, mLen);
18713
+ e = e - eBias;
18714
+ }
18715
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
18716
+ }
18717
+ function write(buffer, value, offset, isLE, mLen, nBytes) {
18718
+ var e, m, c;
18719
+ var eLen = nBytes * 8 - mLen - 1;
18720
+ var eMax = (1 << eLen) - 1;
18721
+ var eBias = eMax >> 1;
18722
+ var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
18723
+ var i = isLE ? 0 : nBytes - 1;
18724
+ var d = isLE ? 1 : -1;
18725
+ var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
18726
+ value = Math.abs(value);
18727
+ if (isNaN(value) || value === Infinity) {
18728
+ m = isNaN(value) ? 1 : 0;
18729
+ e = eMax;
18730
+ } else {
18731
+ e = Math.floor(Math.log(value) / Math.LN2);
18732
+ if (value * (c = Math.pow(2, -e)) < 1) {
18733
+ e--;
18734
+ c *= 2;
18735
+ }
18736
+ if (e + eBias >= 1) value += rt / c;
18737
+ else value += rt * Math.pow(2, 1 - eBias);
18738
+ if (value * c >= 2) {
18739
+ e++;
18740
+ c /= 2;
18741
+ }
18742
+ if (e + eBias >= eMax) {
18743
+ m = 0;
18744
+ e = eMax;
18745
+ } else if (e + eBias >= 1) {
18746
+ m = (value * c - 1) * Math.pow(2, mLen);
18747
+ e = e + eBias;
18748
+ } else {
18749
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
18750
+ e = 0;
18751
+ }
18752
+ }
18753
+ for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8);
18754
+ e = e << mLen | m;
18755
+ eLen += mLen;
18756
+ for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8);
18757
+ buffer[offset + i - d] |= s * 128;
18758
+ }
18759
+ var toString = {}.toString;
18760
+ var isArray$1 = Array.isArray || function(arr) {
18761
+ return toString.call(arr) == "[object Array]";
18762
+ };
18291
18763
  /**
18292
- * Font obfuscation module for embedding fonts in WordprocessingML documents.
18293
- *
18294
- * This module implements the OOXML font obfuscation algorithm used to embed
18295
- * fonts in DOCX documents. Obfuscation is required by the OOXML specification
18296
- * to prevent simple extraction of embedded font files.
18764
+ * If `Buffer.TYPED_ARRAY_SUPPORT`:
18765
+ * === true Use Uint8Array implementation (fastest)
18766
+ * === false Use Object implementation (most compatible, even IE6)
18297
18767
  *
18298
- * Reference: ECMA-376 Part 2, Section 11.1 (Font Embedding)
18768
+ * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
18769
+ * Opera 11.6+, iOS 4.2+.
18299
18770
  *
18300
- * @module
18301
- */
18302
- /** Start offset for obfuscation in the font file */
18303
- const obfuscatedStartOffset = 0;
18304
- /** End offset for obfuscation (first 32 bytes are obfuscated) */
18305
- const obfuscatedEndOffset = 32;
18306
- /** Expected GUID size (32 hex characters without dashes) */
18307
- const guidSize = 32;
18308
- /**
18309
- * Obfuscates a TrueType font file for embedding in OOXML documents.
18771
+ * Due to various browser bugs, sometimes the Object implementation will be used even
18772
+ * when the browser supports typed arrays.
18310
18773
  *
18311
- * The obfuscation algorithm XORs the first 32 bytes of the font file
18312
- * with a reversed byte sequence derived from the font's GUID key.
18313
- * This prevents simple extraction while maintaining font functionality.
18774
+ * Note:
18314
18775
  *
18315
- * @param buf - The original font file as a byte array
18316
- * @param fontKey - The GUID key for the font (with or without dashes)
18317
- * @returns The obfuscated font data
18318
- * @throws Error if the fontKey is not a valid 32-character GUID
18776
+ * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
18777
+ * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
18319
18778
  *
18320
- * @example
18321
- * ```typescript
18322
- * const fontData = readFileSync("font.ttf");
18323
- * const fontKey = "00000000-0000-0000-0000-000000000000";
18324
- * const obfuscatedData = obfuscate(fontData, fontKey);
18325
- * ```
18779
+ * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
18326
18780
  *
18327
- * @internal
18781
+ * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
18782
+ * incorrect length in some situations.
18783
+
18784
+ * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
18785
+ * get the Object implementation, which is slower but behaves correctly.
18328
18786
  */
18329
- const obfuscate = (buf, fontKey) => {
18330
- const guid = fontKey.replace(/-/g, "");
18331
- if (guid.length !== guidSize) throw new Error(`Error: Cannot extract GUID from font filename: ${fontKey}`);
18332
- const hexNumbers = guid.replace(/(..)/g, "$1 ").trim().split(" ").map((hexString) => parseInt(hexString, 16));
18333
- hexNumbers.reverse();
18334
- const obfuscatedBytes = buf.slice(obfuscatedStartOffset, obfuscatedEndOffset).map((byte, i) => byte ^ hexNumbers[i % hexNumbers.length]);
18335
- const out = new Uint8Array(obfuscatedStartOffset + obfuscatedBytes.length + Math.max(0, buf.length - obfuscatedEndOffset));
18336
- out.set(buf.slice(0, obfuscatedStartOffset));
18337
- out.set(obfuscatedBytes, obfuscatedStartOffset);
18338
- out.set(buf.slice(obfuscatedEndOffset), obfuscatedStartOffset + obfuscatedBytes.length);
18339
- return out;
18340
- };
18341
- //#endregion
18342
- //#region src/export/formatter.ts
18787
+ Buffer.TYPED_ARRAY_SUPPORT = _polyfill_node_global_default.TYPED_ARRAY_SUPPORT !== void 0 ? _polyfill_node_global_default.TYPED_ARRAY_SUPPORT : true;
18788
+ kMaxLength();
18789
+ function kMaxLength() {
18790
+ return Buffer.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
18791
+ }
18792
+ function createBuffer(that, length) {
18793
+ if (kMaxLength() < length) throw new RangeError("Invalid typed array length");
18794
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
18795
+ that = new Uint8Array(length);
18796
+ that.__proto__ = Buffer.prototype;
18797
+ } else {
18798
+ if (that === null) that = new Buffer(length);
18799
+ that.length = length;
18800
+ }
18801
+ return that;
18802
+ }
18343
18803
  /**
18344
- * Converts XML components into serializable objects ready for XML generation.
18345
- *
18346
- * The Formatter is responsible for preparing XML components for serialization by calling
18347
- * their prepForXml method with the appropriate context. This is a critical step in the
18348
- * export pipeline that transforms the declarative API objects into XML-compatible structures.
18804
+ * The Buffer constructor returns instances of `Uint8Array` that have their
18805
+ * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
18806
+ * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
18807
+ * and the `Uint8Array` methods. Square bracket notation works as expected -- it
18808
+ * returns a single octet.
18349
18809
  *
18350
- * @example
18351
- * ```typescript
18352
- * const formatter = new Formatter();
18353
- * const paragraph = new Paragraph("Hello World");
18354
- * const xmlObject = formatter.format(paragraph, context);
18355
- * ```
18810
+ * The `Uint8Array` prototype remains unmodified.
18356
18811
  */
18357
- var Formatter = class {
18358
- /**
18359
- * Formats an XML component into a serializable object.
18360
- *
18361
- * @param input - The XML component to format
18362
- * @param context - The context containing file state and relationships
18363
- * @returns A serializable XML object structure
18364
- * @throws Error if the component cannot be formatted correctly
18365
- */
18366
- format(input, context = { stack: [] }) {
18367
- const output = input.prepForXml(context);
18368
- if (output) return output;
18369
- else throw new Error("XMLComponent did not format correctly");
18812
+ function Buffer(arg, encodingOrOffset, length) {
18813
+ if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) return new Buffer(arg, encodingOrOffset, length);
18814
+ if (typeof arg === "number") {
18815
+ if (typeof encodingOrOffset === "string") throw new Error("If encoding is specified then the first argument must be a string");
18816
+ return allocUnsafe(this, arg);
18370
18817
  }
18371
- };
18372
- //#endregion
18373
- //#region src/export/packer/image-replacer.ts
18818
+ return from(this, arg, encodingOrOffset, length);
18819
+ }
18820
+ Buffer.poolSize = 8192;
18821
+ Buffer._augment = function(arr) {
18822
+ arr.__proto__ = Buffer.prototype;
18823
+ return arr;
18824
+ };
18825
+ function from(that, value, encodingOrOffset, length) {
18826
+ if (typeof value === "number") throw new TypeError("\"value\" argument must not be a number");
18827
+ if (typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer) return fromArrayBuffer(that, value, encodingOrOffset, length);
18828
+ if (typeof value === "string") return fromString(that, value, encodingOrOffset);
18829
+ return fromObject(that, value);
18830
+ }
18374
18831
  /**
18375
- * Replaces image placeholders with relationship IDs in XML content.
18376
- *
18832
+ * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
18833
+ * if value is a number.
18834
+ * Buffer.from(str[, encoding])
18835
+ * Buffer.from(array)
18836
+ * Buffer.from(buffer)
18837
+ * Buffer.from(arrayBuffer[, byteOffset[, length]])
18838
+ **/
18839
+ Buffer.from = function(value, encodingOrOffset, length) {
18840
+ return from(null, value, encodingOrOffset, length);
18841
+ };
18842
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
18843
+ Buffer.prototype.__proto__ = Uint8Array.prototype;
18844
+ Buffer.__proto__ = Uint8Array;
18845
+ if (typeof Symbol !== "undefined" && Symbol.species && Buffer[Symbol.species] === Buffer);
18846
+ }
18847
+ function assertSize(size) {
18848
+ if (typeof size !== "number") throw new TypeError("\"size\" argument must be a number");
18849
+ else if (size < 0) throw new RangeError("\"size\" argument must not be negative");
18850
+ }
18851
+ function alloc(that, size, fill, encoding) {
18852
+ assertSize(size);
18853
+ if (size <= 0) return createBuffer(that, size);
18854
+ if (fill !== void 0) return typeof encoding === "string" ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
18855
+ return createBuffer(that, size);
18856
+ }
18857
+ /**
18858
+ * Creates a new filled Buffer instance.
18859
+ * alloc(size[, fill[, encoding]])
18860
+ **/
18861
+ Buffer.alloc = function(size, fill, encoding) {
18862
+ return alloc(null, size, fill, encoding);
18863
+ };
18864
+ function allocUnsafe(that, size) {
18865
+ assertSize(size);
18866
+ that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
18867
+ if (!Buffer.TYPED_ARRAY_SUPPORT) for (var i = 0; i < size; ++i) that[i] = 0;
18868
+ return that;
18869
+ }
18870
+ /**
18871
+ * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
18872
+ * */
18873
+ Buffer.allocUnsafe = function(size) {
18874
+ return allocUnsafe(null, size);
18875
+ };
18876
+ /**
18877
+ * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
18878
+ */
18879
+ Buffer.allocUnsafeSlow = function(size) {
18880
+ return allocUnsafe(null, size);
18881
+ };
18882
+ function fromString(that, string, encoding) {
18883
+ if (typeof encoding !== "string" || encoding === "") encoding = "utf8";
18884
+ if (!Buffer.isEncoding(encoding)) throw new TypeError("\"encoding\" must be a valid string encoding");
18885
+ var length = byteLength(string, encoding) | 0;
18886
+ that = createBuffer(that, length);
18887
+ var actual = that.write(string, encoding);
18888
+ if (actual !== length) that = that.slice(0, actual);
18889
+ return that;
18890
+ }
18891
+ function fromArrayLike(that, array) {
18892
+ var length = array.length < 0 ? 0 : checked(array.length) | 0;
18893
+ that = createBuffer(that, length);
18894
+ for (var i = 0; i < length; i += 1) that[i] = array[i] & 255;
18895
+ return that;
18896
+ }
18897
+ function fromArrayBuffer(that, array, byteOffset, length) {
18898
+ array.byteLength;
18899
+ if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError("'offset' is out of bounds");
18900
+ if (array.byteLength < byteOffset + (length || 0)) throw new RangeError("'length' is out of bounds");
18901
+ if (byteOffset === void 0 && length === void 0) array = new Uint8Array(array);
18902
+ else if (length === void 0) array = new Uint8Array(array, byteOffset);
18903
+ else array = new Uint8Array(array, byteOffset, length);
18904
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
18905
+ that = array;
18906
+ that.__proto__ = Buffer.prototype;
18907
+ } else that = fromArrayLike(that, array);
18908
+ return that;
18909
+ }
18910
+ function fromObject(that, obj) {
18911
+ if (internalIsBuffer(obj)) {
18912
+ var len = checked(obj.length) | 0;
18913
+ that = createBuffer(that, len);
18914
+ if (that.length === 0) return that;
18915
+ obj.copy(that, 0, 0, len);
18916
+ return that;
18917
+ }
18918
+ if (obj) {
18919
+ if (typeof ArrayBuffer !== "undefined" && obj.buffer instanceof ArrayBuffer || "length" in obj) {
18920
+ if (typeof obj.length !== "number" || isnan(obj.length)) return createBuffer(that, 0);
18921
+ return fromArrayLike(that, obj);
18922
+ }
18923
+ if (obj.type === "Buffer" && isArray$1(obj.data)) return fromArrayLike(that, obj.data);
18924
+ }
18925
+ throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
18926
+ }
18927
+ function checked(length) {
18928
+ if (length >= kMaxLength()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength().toString(16) + " bytes");
18929
+ return length | 0;
18930
+ }
18931
+ Buffer.isBuffer = isBuffer;
18932
+ function internalIsBuffer(b) {
18933
+ return !!(b != null && b._isBuffer);
18934
+ }
18935
+ Buffer.compare = function compare(a, b) {
18936
+ if (!internalIsBuffer(a) || !internalIsBuffer(b)) throw new TypeError("Arguments must be Buffers");
18937
+ if (a === b) return 0;
18938
+ var x = a.length;
18939
+ var y = b.length;
18940
+ for (var i = 0, len = Math.min(x, y); i < len; ++i) if (a[i] !== b[i]) {
18941
+ x = a[i];
18942
+ y = b[i];
18943
+ break;
18944
+ }
18945
+ if (x < y) return -1;
18946
+ if (y < x) return 1;
18947
+ return 0;
18948
+ };
18949
+ Buffer.isEncoding = function isEncoding(encoding) {
18950
+ switch (String(encoding).toLowerCase()) {
18951
+ case "hex":
18952
+ case "utf8":
18953
+ case "utf-8":
18954
+ case "ascii":
18955
+ case "latin1":
18956
+ case "binary":
18957
+ case "base64":
18958
+ case "ucs2":
18959
+ case "ucs-2":
18960
+ case "utf16le":
18961
+ case "utf-16le": return true;
18962
+ default: return false;
18963
+ }
18964
+ };
18965
+ Buffer.concat = function concat(list, length) {
18966
+ if (!isArray$1(list)) throw new TypeError("\"list\" argument must be an Array of Buffers");
18967
+ if (list.length === 0) return Buffer.alloc(0);
18968
+ var i;
18969
+ if (length === void 0) {
18970
+ length = 0;
18971
+ for (i = 0; i < list.length; ++i) length += list[i].length;
18972
+ }
18973
+ var buffer = Buffer.allocUnsafe(length);
18974
+ var pos = 0;
18975
+ for (i = 0; i < list.length; ++i) {
18976
+ var buf = list[i];
18977
+ if (!internalIsBuffer(buf)) throw new TypeError("\"list\" argument must be an Array of Buffers");
18978
+ buf.copy(buffer, pos);
18979
+ pos += buf.length;
18980
+ }
18981
+ return buffer;
18982
+ };
18983
+ function byteLength(string, encoding) {
18984
+ if (internalIsBuffer(string)) return string.length;
18985
+ if (typeof ArrayBuffer !== "undefined" && typeof ArrayBuffer.isView === "function" && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) return string.byteLength;
18986
+ if (typeof string !== "string") string = "" + string;
18987
+ var len = string.length;
18988
+ if (len === 0) return 0;
18989
+ var loweredCase = false;
18990
+ for (;;) switch (encoding) {
18991
+ case "ascii":
18992
+ case "latin1":
18993
+ case "binary": return len;
18994
+ case "utf8":
18995
+ case "utf-8":
18996
+ case void 0: return utf8ToBytes(string).length;
18997
+ case "ucs2":
18998
+ case "ucs-2":
18999
+ case "utf16le":
19000
+ case "utf-16le": return len * 2;
19001
+ case "hex": return len >>> 1;
19002
+ case "base64": return base64ToBytes(string).length;
19003
+ default:
19004
+ if (loweredCase) return utf8ToBytes(string).length;
19005
+ encoding = ("" + encoding).toLowerCase();
19006
+ loweredCase = true;
19007
+ }
19008
+ }
19009
+ Buffer.byteLength = byteLength;
19010
+ function slowToString(encoding, start, end) {
19011
+ var loweredCase = false;
19012
+ if (start === void 0 || start < 0) start = 0;
19013
+ if (start > this.length) return "";
19014
+ if (end === void 0 || end > this.length) end = this.length;
19015
+ if (end <= 0) return "";
19016
+ end >>>= 0;
19017
+ start >>>= 0;
19018
+ if (end <= start) return "";
19019
+ if (!encoding) encoding = "utf8";
19020
+ while (true) switch (encoding) {
19021
+ case "hex": return hexSlice(this, start, end);
19022
+ case "utf8":
19023
+ case "utf-8": return utf8Slice(this, start, end);
19024
+ case "ascii": return asciiSlice(this, start, end);
19025
+ case "latin1":
19026
+ case "binary": return latin1Slice(this, start, end);
19027
+ case "base64": return base64Slice(this, start, end);
19028
+ case "ucs2":
19029
+ case "ucs-2":
19030
+ case "utf16le":
19031
+ case "utf-16le": return utf16leSlice(this, start, end);
19032
+ default:
19033
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
19034
+ encoding = (encoding + "").toLowerCase();
19035
+ loweredCase = true;
19036
+ }
19037
+ }
19038
+ Buffer.prototype._isBuffer = true;
19039
+ function swap(b, n, m) {
19040
+ var i = b[n];
19041
+ b[n] = b[m];
19042
+ b[m] = i;
19043
+ }
19044
+ Buffer.prototype.swap16 = function swap16() {
19045
+ var len = this.length;
19046
+ if (len % 2 !== 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
19047
+ for (var i = 0; i < len; i += 2) swap(this, i, i + 1);
19048
+ return this;
19049
+ };
19050
+ Buffer.prototype.swap32 = function swap32() {
19051
+ var len = this.length;
19052
+ if (len % 4 !== 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
19053
+ for (var i = 0; i < len; i += 4) {
19054
+ swap(this, i, i + 3);
19055
+ swap(this, i + 1, i + 2);
19056
+ }
19057
+ return this;
19058
+ };
19059
+ Buffer.prototype.swap64 = function swap64() {
19060
+ var len = this.length;
19061
+ if (len % 8 !== 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
19062
+ for (var i = 0; i < len; i += 8) {
19063
+ swap(this, i, i + 7);
19064
+ swap(this, i + 1, i + 6);
19065
+ swap(this, i + 2, i + 5);
19066
+ swap(this, i + 3, i + 4);
19067
+ }
19068
+ return this;
19069
+ };
19070
+ Buffer.prototype.toString = function toString() {
19071
+ var length = this.length | 0;
19072
+ if (length === 0) return "";
19073
+ if (arguments.length === 0) return utf8Slice(this, 0, length);
19074
+ return slowToString.apply(this, arguments);
19075
+ };
19076
+ Buffer.prototype.equals = function equals(b) {
19077
+ if (!internalIsBuffer(b)) throw new TypeError("Argument must be a Buffer");
19078
+ if (this === b) return true;
19079
+ return Buffer.compare(this, b) === 0;
19080
+ };
19081
+ Buffer.prototype.inspect = function inspect() {
19082
+ var str = "";
19083
+ var max = 50;
19084
+ if (this.length > 0) {
19085
+ str = this.toString("hex", 0, max).match(/.{2}/g).join(" ");
19086
+ if (this.length > max) str += " ... ";
19087
+ }
19088
+ return "<Buffer " + str + ">";
19089
+ };
19090
+ Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
19091
+ if (!internalIsBuffer(target)) throw new TypeError("Argument must be a Buffer");
19092
+ if (start === void 0) start = 0;
19093
+ if (end === void 0) end = target ? target.length : 0;
19094
+ if (thisStart === void 0) thisStart = 0;
19095
+ if (thisEnd === void 0) thisEnd = this.length;
19096
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError("out of range index");
19097
+ if (thisStart >= thisEnd && start >= end) return 0;
19098
+ if (thisStart >= thisEnd) return -1;
19099
+ if (start >= end) return 1;
19100
+ start >>>= 0;
19101
+ end >>>= 0;
19102
+ thisStart >>>= 0;
19103
+ thisEnd >>>= 0;
19104
+ if (this === target) return 0;
19105
+ var x = thisEnd - thisStart;
19106
+ var y = end - start;
19107
+ var len = Math.min(x, y);
19108
+ var thisCopy = this.slice(thisStart, thisEnd);
19109
+ var targetCopy = target.slice(start, end);
19110
+ for (var i = 0; i < len; ++i) if (thisCopy[i] !== targetCopy[i]) {
19111
+ x = thisCopy[i];
19112
+ y = targetCopy[i];
19113
+ break;
19114
+ }
19115
+ if (x < y) return -1;
19116
+ if (y < x) return 1;
19117
+ return 0;
19118
+ };
19119
+ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
19120
+ if (buffer.length === 0) return -1;
19121
+ if (typeof byteOffset === "string") {
19122
+ encoding = byteOffset;
19123
+ byteOffset = 0;
19124
+ } else if (byteOffset > 2147483647) byteOffset = 2147483647;
19125
+ else if (byteOffset < -2147483648) byteOffset = -2147483648;
19126
+ byteOffset = +byteOffset;
19127
+ if (isNaN(byteOffset)) byteOffset = dir ? 0 : buffer.length - 1;
19128
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
19129
+ if (byteOffset >= buffer.length) if (dir) return -1;
19130
+ else byteOffset = buffer.length - 1;
19131
+ else if (byteOffset < 0) if (dir) byteOffset = 0;
19132
+ else return -1;
19133
+ if (typeof val === "string") val = Buffer.from(val, encoding);
19134
+ if (internalIsBuffer(val)) {
19135
+ if (val.length === 0) return -1;
19136
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
19137
+ } else if (typeof val === "number") {
19138
+ val = val & 255;
19139
+ if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === "function") if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
19140
+ else return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
19141
+ return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
19142
+ }
19143
+ throw new TypeError("val must be string, number or Buffer");
19144
+ }
19145
+ function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
19146
+ var indexSize = 1;
19147
+ var arrLength = arr.length;
19148
+ var valLength = val.length;
19149
+ if (encoding !== void 0) {
19150
+ encoding = String(encoding).toLowerCase();
19151
+ if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
19152
+ if (arr.length < 2 || val.length < 2) return -1;
19153
+ indexSize = 2;
19154
+ arrLength /= 2;
19155
+ valLength /= 2;
19156
+ byteOffset /= 2;
19157
+ }
19158
+ }
19159
+ function read(buf, i) {
19160
+ if (indexSize === 1) return buf[i];
19161
+ else return buf.readUInt16BE(i * indexSize);
19162
+ }
19163
+ var i;
19164
+ if (dir) {
19165
+ var foundIndex = -1;
19166
+ for (i = byteOffset; i < arrLength; i++) if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
19167
+ if (foundIndex === -1) foundIndex = i;
19168
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
19169
+ } else {
19170
+ if (foundIndex !== -1) i -= i - foundIndex;
19171
+ foundIndex = -1;
19172
+ }
19173
+ } else {
19174
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
19175
+ for (i = byteOffset; i >= 0; i--) {
19176
+ var found = true;
19177
+ for (var j = 0; j < valLength; j++) if (read(arr, i + j) !== read(val, j)) {
19178
+ found = false;
19179
+ break;
19180
+ }
19181
+ if (found) return i;
19182
+ }
19183
+ }
19184
+ return -1;
19185
+ }
19186
+ Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
19187
+ return this.indexOf(val, byteOffset, encoding) !== -1;
19188
+ };
19189
+ Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
19190
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
19191
+ };
19192
+ Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
19193
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
19194
+ };
19195
+ function hexWrite(buf, string, offset, length) {
19196
+ offset = Number(offset) || 0;
19197
+ var remaining = buf.length - offset;
19198
+ if (!length) length = remaining;
19199
+ else {
19200
+ length = Number(length);
19201
+ if (length > remaining) length = remaining;
19202
+ }
19203
+ var strLen = string.length;
19204
+ if (strLen % 2 !== 0) throw new TypeError("Invalid hex string");
19205
+ if (length > strLen / 2) length = strLen / 2;
19206
+ for (var i = 0; i < length; ++i) {
19207
+ var parsed = parseInt(string.substr(i * 2, 2), 16);
19208
+ if (isNaN(parsed)) return i;
19209
+ buf[offset + i] = parsed;
19210
+ }
19211
+ return i;
19212
+ }
19213
+ function utf8Write(buf, string, offset, length) {
19214
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
19215
+ }
19216
+ function asciiWrite(buf, string, offset, length) {
19217
+ return blitBuffer(asciiToBytes(string), buf, offset, length);
19218
+ }
19219
+ function latin1Write(buf, string, offset, length) {
19220
+ return asciiWrite(buf, string, offset, length);
19221
+ }
19222
+ function base64Write(buf, string, offset, length) {
19223
+ return blitBuffer(base64ToBytes(string), buf, offset, length);
19224
+ }
19225
+ function ucs2Write(buf, string, offset, length) {
19226
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
19227
+ }
19228
+ Buffer.prototype.write = function write(string, offset, length, encoding) {
19229
+ if (offset === void 0) {
19230
+ encoding = "utf8";
19231
+ length = this.length;
19232
+ offset = 0;
19233
+ } else if (length === void 0 && typeof offset === "string") {
19234
+ encoding = offset;
19235
+ length = this.length;
19236
+ offset = 0;
19237
+ } else if (isFinite(offset)) {
19238
+ offset = offset | 0;
19239
+ if (isFinite(length)) {
19240
+ length = length | 0;
19241
+ if (encoding === void 0) encoding = "utf8";
19242
+ } else {
19243
+ encoding = length;
19244
+ length = void 0;
19245
+ }
19246
+ } else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
19247
+ var remaining = this.length - offset;
19248
+ if (length === void 0 || length > remaining) length = remaining;
19249
+ if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError("Attempt to write outside buffer bounds");
19250
+ if (!encoding) encoding = "utf8";
19251
+ var loweredCase = false;
19252
+ for (;;) switch (encoding) {
19253
+ case "hex": return hexWrite(this, string, offset, length);
19254
+ case "utf8":
19255
+ case "utf-8": return utf8Write(this, string, offset, length);
19256
+ case "ascii": return asciiWrite(this, string, offset, length);
19257
+ case "latin1":
19258
+ case "binary": return latin1Write(this, string, offset, length);
19259
+ case "base64": return base64Write(this, string, offset, length);
19260
+ case "ucs2":
19261
+ case "ucs-2":
19262
+ case "utf16le":
19263
+ case "utf-16le": return ucs2Write(this, string, offset, length);
19264
+ default:
19265
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
19266
+ encoding = ("" + encoding).toLowerCase();
19267
+ loweredCase = true;
19268
+ }
19269
+ };
19270
+ Buffer.prototype.toJSON = function toJSON() {
19271
+ return {
19272
+ type: "Buffer",
19273
+ data: Array.prototype.slice.call(this._arr || this, 0)
19274
+ };
19275
+ };
19276
+ function base64Slice(buf, start, end) {
19277
+ if (start === 0 && end === buf.length) return fromByteArray(buf);
19278
+ else return fromByteArray(buf.slice(start, end));
19279
+ }
19280
+ function utf8Slice(buf, start, end) {
19281
+ end = Math.min(buf.length, end);
19282
+ var res = [];
19283
+ var i = start;
19284
+ while (i < end) {
19285
+ var firstByte = buf[i];
19286
+ var codePoint = null;
19287
+ var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
19288
+ if (i + bytesPerSequence <= end) {
19289
+ var secondByte, thirdByte, fourthByte, tempCodePoint;
19290
+ switch (bytesPerSequence) {
19291
+ case 1:
19292
+ if (firstByte < 128) codePoint = firstByte;
19293
+ break;
19294
+ case 2:
19295
+ secondByte = buf[i + 1];
19296
+ if ((secondByte & 192) === 128) {
19297
+ tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
19298
+ if (tempCodePoint > 127) codePoint = tempCodePoint;
19299
+ }
19300
+ break;
19301
+ case 3:
19302
+ secondByte = buf[i + 1];
19303
+ thirdByte = buf[i + 2];
19304
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
19305
+ tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
19306
+ if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) codePoint = tempCodePoint;
19307
+ }
19308
+ break;
19309
+ case 4:
19310
+ secondByte = buf[i + 1];
19311
+ thirdByte = buf[i + 2];
19312
+ fourthByte = buf[i + 3];
19313
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
19314
+ tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
19315
+ if (tempCodePoint > 65535 && tempCodePoint < 1114112) codePoint = tempCodePoint;
19316
+ }
19317
+ }
19318
+ }
19319
+ if (codePoint === null) {
19320
+ codePoint = 65533;
19321
+ bytesPerSequence = 1;
19322
+ } else if (codePoint > 65535) {
19323
+ codePoint -= 65536;
19324
+ res.push(codePoint >>> 10 & 1023 | 55296);
19325
+ codePoint = 56320 | codePoint & 1023;
19326
+ }
19327
+ res.push(codePoint);
19328
+ i += bytesPerSequence;
19329
+ }
19330
+ return decodeCodePointsArray(res);
19331
+ }
19332
+ var MAX_ARGUMENTS_LENGTH = 4096;
19333
+ function decodeCodePointsArray(codePoints) {
19334
+ var len = codePoints.length;
19335
+ if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints);
19336
+ var res = "";
19337
+ var i = 0;
19338
+ while (i < len) res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
19339
+ return res;
19340
+ }
19341
+ function asciiSlice(buf, start, end) {
19342
+ var ret = "";
19343
+ end = Math.min(buf.length, end);
19344
+ for (var i = start; i < end; ++i) ret += String.fromCharCode(buf[i] & 127);
19345
+ return ret;
19346
+ }
19347
+ function latin1Slice(buf, start, end) {
19348
+ var ret = "";
19349
+ end = Math.min(buf.length, end);
19350
+ for (var i = start; i < end; ++i) ret += String.fromCharCode(buf[i]);
19351
+ return ret;
19352
+ }
19353
+ function hexSlice(buf, start, end) {
19354
+ var len = buf.length;
19355
+ if (!start || start < 0) start = 0;
19356
+ if (!end || end < 0 || end > len) end = len;
19357
+ var out = "";
19358
+ for (var i = start; i < end; ++i) out += toHex(buf[i]);
19359
+ return out;
19360
+ }
19361
+ function utf16leSlice(buf, start, end) {
19362
+ var bytes = buf.slice(start, end);
19363
+ var res = "";
19364
+ for (var i = 0; i < bytes.length; i += 2) res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
19365
+ return res;
19366
+ }
19367
+ Buffer.prototype.slice = function slice(start, end) {
19368
+ var len = this.length;
19369
+ start = ~~start;
19370
+ end = end === void 0 ? len : ~~end;
19371
+ if (start < 0) {
19372
+ start += len;
19373
+ if (start < 0) start = 0;
19374
+ } else if (start > len) start = len;
19375
+ if (end < 0) {
19376
+ end += len;
19377
+ if (end < 0) end = 0;
19378
+ } else if (end > len) end = len;
19379
+ if (end < start) end = start;
19380
+ var newBuf;
19381
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
19382
+ newBuf = this.subarray(start, end);
19383
+ newBuf.__proto__ = Buffer.prototype;
19384
+ } else {
19385
+ var sliceLen = end - start;
19386
+ newBuf = new Buffer(sliceLen, void 0);
19387
+ for (var i = 0; i < sliceLen; ++i) newBuf[i] = this[i + start];
19388
+ }
19389
+ return newBuf;
19390
+ };
19391
+ function checkOffset(offset, ext, length) {
19392
+ if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
19393
+ if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
19394
+ }
19395
+ Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
19396
+ offset = offset | 0;
19397
+ byteLength = byteLength | 0;
19398
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
19399
+ var val = this[offset];
19400
+ var mul = 1;
19401
+ var i = 0;
19402
+ while (++i < byteLength && (mul *= 256)) val += this[offset + i] * mul;
19403
+ return val;
19404
+ };
19405
+ Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
19406
+ offset = offset | 0;
19407
+ byteLength = byteLength | 0;
19408
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
19409
+ var val = this[offset + --byteLength];
19410
+ var mul = 1;
19411
+ while (byteLength > 0 && (mul *= 256)) val += this[offset + --byteLength] * mul;
19412
+ return val;
19413
+ };
19414
+ Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
19415
+ if (!noAssert) checkOffset(offset, 1, this.length);
19416
+ return this[offset];
19417
+ };
19418
+ Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
19419
+ if (!noAssert) checkOffset(offset, 2, this.length);
19420
+ return this[offset] | this[offset + 1] << 8;
19421
+ };
19422
+ Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
19423
+ if (!noAssert) checkOffset(offset, 2, this.length);
19424
+ return this[offset] << 8 | this[offset + 1];
19425
+ };
19426
+ Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
19427
+ if (!noAssert) checkOffset(offset, 4, this.length);
19428
+ return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
19429
+ };
19430
+ Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
19431
+ if (!noAssert) checkOffset(offset, 4, this.length);
19432
+ return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
19433
+ };
19434
+ Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
19435
+ offset = offset | 0;
19436
+ byteLength = byteLength | 0;
19437
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
19438
+ var val = this[offset];
19439
+ var mul = 1;
19440
+ var i = 0;
19441
+ while (++i < byteLength && (mul *= 256)) val += this[offset + i] * mul;
19442
+ mul *= 128;
19443
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
19444
+ return val;
19445
+ };
19446
+ Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
19447
+ offset = offset | 0;
19448
+ byteLength = byteLength | 0;
19449
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
19450
+ var i = byteLength;
19451
+ var mul = 1;
19452
+ var val = this[offset + --i];
19453
+ while (i > 0 && (mul *= 256)) val += this[offset + --i] * mul;
19454
+ mul *= 128;
19455
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
19456
+ return val;
19457
+ };
19458
+ Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
19459
+ if (!noAssert) checkOffset(offset, 1, this.length);
19460
+ if (!(this[offset] & 128)) return this[offset];
19461
+ return (255 - this[offset] + 1) * -1;
19462
+ };
19463
+ Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
19464
+ if (!noAssert) checkOffset(offset, 2, this.length);
19465
+ var val = this[offset] | this[offset + 1] << 8;
19466
+ return val & 32768 ? val | 4294901760 : val;
19467
+ };
19468
+ Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
19469
+ if (!noAssert) checkOffset(offset, 2, this.length);
19470
+ var val = this[offset + 1] | this[offset] << 8;
19471
+ return val & 32768 ? val | 4294901760 : val;
19472
+ };
19473
+ Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
19474
+ if (!noAssert) checkOffset(offset, 4, this.length);
19475
+ return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
19476
+ };
19477
+ Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
19478
+ if (!noAssert) checkOffset(offset, 4, this.length);
19479
+ return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
19480
+ };
19481
+ Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
19482
+ if (!noAssert) checkOffset(offset, 4, this.length);
19483
+ return read(this, offset, true, 23, 4);
19484
+ };
19485
+ Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
19486
+ if (!noAssert) checkOffset(offset, 4, this.length);
19487
+ return read(this, offset, false, 23, 4);
19488
+ };
19489
+ Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
19490
+ if (!noAssert) checkOffset(offset, 8, this.length);
19491
+ return read(this, offset, true, 52, 8);
19492
+ };
19493
+ Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
19494
+ if (!noAssert) checkOffset(offset, 8, this.length);
19495
+ return read(this, offset, false, 52, 8);
19496
+ };
19497
+ function checkInt(buf, value, offset, ext, max, min) {
19498
+ if (!internalIsBuffer(buf)) throw new TypeError("\"buffer\" argument must be a Buffer instance");
19499
+ if (value > max || value < min) throw new RangeError("\"value\" argument is out of bounds");
19500
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
19501
+ }
19502
+ Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
19503
+ value = +value;
19504
+ offset = offset | 0;
19505
+ byteLength = byteLength | 0;
19506
+ if (!noAssert) {
19507
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1;
19508
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
19509
+ }
19510
+ var mul = 1;
19511
+ var i = 0;
19512
+ this[offset] = value & 255;
19513
+ while (++i < byteLength && (mul *= 256)) this[offset + i] = value / mul & 255;
19514
+ return offset + byteLength;
19515
+ };
19516
+ Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
19517
+ value = +value;
19518
+ offset = offset | 0;
19519
+ byteLength = byteLength | 0;
19520
+ if (!noAssert) {
19521
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1;
19522
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
19523
+ }
19524
+ var i = byteLength - 1;
19525
+ var mul = 1;
19526
+ this[offset + i] = value & 255;
19527
+ while (--i >= 0 && (mul *= 256)) this[offset + i] = value / mul & 255;
19528
+ return offset + byteLength;
19529
+ };
19530
+ Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
19531
+ value = +value;
19532
+ offset = offset | 0;
19533
+ if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
19534
+ if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
19535
+ this[offset] = value & 255;
19536
+ return offset + 1;
19537
+ };
19538
+ function objectWriteUInt16(buf, value, offset, littleEndian) {
19539
+ if (value < 0) value = 65535 + value + 1;
19540
+ for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) buf[offset + i] = (value & 255 << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
19541
+ }
19542
+ Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
19543
+ value = +value;
19544
+ offset = offset | 0;
19545
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
19546
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
19547
+ this[offset] = value & 255;
19548
+ this[offset + 1] = value >>> 8;
19549
+ } else objectWriteUInt16(this, value, offset, true);
19550
+ return offset + 2;
19551
+ };
19552
+ Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
19553
+ value = +value;
19554
+ offset = offset | 0;
19555
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
19556
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
19557
+ this[offset] = value >>> 8;
19558
+ this[offset + 1] = value & 255;
19559
+ } else objectWriteUInt16(this, value, offset, false);
19560
+ return offset + 2;
19561
+ };
19562
+ function objectWriteUInt32(buf, value, offset, littleEndian) {
19563
+ if (value < 0) value = 4294967295 + value + 1;
19564
+ for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 255;
19565
+ }
19566
+ Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
19567
+ value = +value;
19568
+ offset = offset | 0;
19569
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
19570
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
19571
+ this[offset + 3] = value >>> 24;
19572
+ this[offset + 2] = value >>> 16;
19573
+ this[offset + 1] = value >>> 8;
19574
+ this[offset] = value & 255;
19575
+ } else objectWriteUInt32(this, value, offset, true);
19576
+ return offset + 4;
19577
+ };
19578
+ Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
19579
+ value = +value;
19580
+ offset = offset | 0;
19581
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
19582
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
19583
+ this[offset] = value >>> 24;
19584
+ this[offset + 1] = value >>> 16;
19585
+ this[offset + 2] = value >>> 8;
19586
+ this[offset + 3] = value & 255;
19587
+ } else objectWriteUInt32(this, value, offset, false);
19588
+ return offset + 4;
19589
+ };
19590
+ Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
19591
+ value = +value;
19592
+ offset = offset | 0;
19593
+ if (!noAssert) {
19594
+ var limit = Math.pow(2, 8 * byteLength - 1);
19595
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
19596
+ }
19597
+ var i = 0;
19598
+ var mul = 1;
19599
+ var sub = 0;
19600
+ this[offset] = value & 255;
19601
+ while (++i < byteLength && (mul *= 256)) {
19602
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) sub = 1;
19603
+ this[offset + i] = (value / mul >> 0) - sub & 255;
19604
+ }
19605
+ return offset + byteLength;
19606
+ };
19607
+ Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
19608
+ value = +value;
19609
+ offset = offset | 0;
19610
+ if (!noAssert) {
19611
+ var limit = Math.pow(2, 8 * byteLength - 1);
19612
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
19613
+ }
19614
+ var i = byteLength - 1;
19615
+ var mul = 1;
19616
+ var sub = 0;
19617
+ this[offset + i] = value & 255;
19618
+ while (--i >= 0 && (mul *= 256)) {
19619
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) sub = 1;
19620
+ this[offset + i] = (value / mul >> 0) - sub & 255;
19621
+ }
19622
+ return offset + byteLength;
19623
+ };
19624
+ Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
19625
+ value = +value;
19626
+ offset = offset | 0;
19627
+ if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
19628
+ if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
19629
+ if (value < 0) value = 255 + value + 1;
19630
+ this[offset] = value & 255;
19631
+ return offset + 1;
19632
+ };
19633
+ Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
19634
+ value = +value;
19635
+ offset = offset | 0;
19636
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
19637
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
19638
+ this[offset] = value & 255;
19639
+ this[offset + 1] = value >>> 8;
19640
+ } else objectWriteUInt16(this, value, offset, true);
19641
+ return offset + 2;
19642
+ };
19643
+ Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
19644
+ value = +value;
19645
+ offset = offset | 0;
19646
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
19647
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
19648
+ this[offset] = value >>> 8;
19649
+ this[offset + 1] = value & 255;
19650
+ } else objectWriteUInt16(this, value, offset, false);
19651
+ return offset + 2;
19652
+ };
19653
+ Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
19654
+ value = +value;
19655
+ offset = offset | 0;
19656
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
19657
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
19658
+ this[offset] = value & 255;
19659
+ this[offset + 1] = value >>> 8;
19660
+ this[offset + 2] = value >>> 16;
19661
+ this[offset + 3] = value >>> 24;
19662
+ } else objectWriteUInt32(this, value, offset, true);
19663
+ return offset + 4;
19664
+ };
19665
+ Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
19666
+ value = +value;
19667
+ offset = offset | 0;
19668
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
19669
+ if (value < 0) value = 4294967295 + value + 1;
19670
+ if (Buffer.TYPED_ARRAY_SUPPORT) {
19671
+ this[offset] = value >>> 24;
19672
+ this[offset + 1] = value >>> 16;
19673
+ this[offset + 2] = value >>> 8;
19674
+ this[offset + 3] = value & 255;
19675
+ } else objectWriteUInt32(this, value, offset, false);
19676
+ return offset + 4;
19677
+ };
19678
+ function checkIEEE754(buf, value, offset, ext, max, min) {
19679
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
19680
+ if (offset < 0) throw new RangeError("Index out of range");
19681
+ }
19682
+ function writeFloat(buf, value, offset, littleEndian, noAssert) {
19683
+ if (!noAssert) checkIEEE754(buf, value, offset, 4);
19684
+ write(buf, value, offset, littleEndian, 23, 4);
19685
+ return offset + 4;
19686
+ }
19687
+ Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
19688
+ return writeFloat(this, value, offset, true, noAssert);
19689
+ };
19690
+ Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
19691
+ return writeFloat(this, value, offset, false, noAssert);
19692
+ };
19693
+ function writeDouble(buf, value, offset, littleEndian, noAssert) {
19694
+ if (!noAssert) checkIEEE754(buf, value, offset, 8);
19695
+ write(buf, value, offset, littleEndian, 52, 8);
19696
+ return offset + 8;
19697
+ }
19698
+ Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
19699
+ return writeDouble(this, value, offset, true, noAssert);
19700
+ };
19701
+ Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
19702
+ return writeDouble(this, value, offset, false, noAssert);
19703
+ };
19704
+ Buffer.prototype.copy = function copy(target, targetStart, start, end) {
19705
+ if (!start) start = 0;
19706
+ if (!end && end !== 0) end = this.length;
19707
+ if (targetStart >= target.length) targetStart = target.length;
19708
+ if (!targetStart) targetStart = 0;
19709
+ if (end > 0 && end < start) end = start;
19710
+ if (end === start) return 0;
19711
+ if (target.length === 0 || this.length === 0) return 0;
19712
+ if (targetStart < 0) throw new RangeError("targetStart out of bounds");
19713
+ if (start < 0 || start >= this.length) throw new RangeError("sourceStart out of bounds");
19714
+ if (end < 0) throw new RangeError("sourceEnd out of bounds");
19715
+ if (end > this.length) end = this.length;
19716
+ if (target.length - targetStart < end - start) end = target.length - targetStart + start;
19717
+ var len = end - start;
19718
+ var i;
19719
+ if (this === target && start < targetStart && targetStart < end) for (i = len - 1; i >= 0; --i) target[i + targetStart] = this[i + start];
19720
+ else if (len < 1e3 || !Buffer.TYPED_ARRAY_SUPPORT) for (i = 0; i < len; ++i) target[i + targetStart] = this[i + start];
19721
+ else Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
19722
+ return len;
19723
+ };
19724
+ Buffer.prototype.fill = function fill(val, start, end, encoding) {
19725
+ if (typeof val === "string") {
19726
+ if (typeof start === "string") {
19727
+ encoding = start;
19728
+ start = 0;
19729
+ end = this.length;
19730
+ } else if (typeof end === "string") {
19731
+ encoding = end;
19732
+ end = this.length;
19733
+ }
19734
+ if (val.length === 1) {
19735
+ var code = val.charCodeAt(0);
19736
+ if (code < 256) val = code;
19737
+ }
19738
+ if (encoding !== void 0 && typeof encoding !== "string") throw new TypeError("encoding must be a string");
19739
+ if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) throw new TypeError("Unknown encoding: " + encoding);
19740
+ } else if (typeof val === "number") val = val & 255;
19741
+ if (start < 0 || this.length < start || this.length < end) throw new RangeError("Out of range index");
19742
+ if (end <= start) return this;
19743
+ start = start >>> 0;
19744
+ end = end === void 0 ? this.length : end >>> 0;
19745
+ if (!val) val = 0;
19746
+ var i;
19747
+ if (typeof val === "number") for (i = start; i < end; ++i) this[i] = val;
19748
+ else {
19749
+ var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString());
19750
+ var len = bytes.length;
19751
+ for (i = 0; i < end - start; ++i) this[i + start] = bytes[i % len];
19752
+ }
19753
+ return this;
19754
+ };
19755
+ var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
19756
+ function base64clean(str) {
19757
+ str = stringtrim(str).replace(INVALID_BASE64_RE, "");
19758
+ if (str.length < 2) return "";
19759
+ while (str.length % 4 !== 0) str = str + "=";
19760
+ return str;
19761
+ }
19762
+ function stringtrim(str) {
19763
+ if (str.trim) return str.trim();
19764
+ return str.replace(/^\s+|\s+$/g, "");
19765
+ }
19766
+ function toHex(n) {
19767
+ if (n < 16) return "0" + n.toString(16);
19768
+ return n.toString(16);
19769
+ }
19770
+ function utf8ToBytes(string, units) {
19771
+ units = units || Infinity;
19772
+ var codePoint;
19773
+ var length = string.length;
19774
+ var leadSurrogate = null;
19775
+ var bytes = [];
19776
+ for (var i = 0; i < length; ++i) {
19777
+ codePoint = string.charCodeAt(i);
19778
+ if (codePoint > 55295 && codePoint < 57344) {
19779
+ if (!leadSurrogate) {
19780
+ if (codePoint > 56319) {
19781
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
19782
+ continue;
19783
+ } else if (i + 1 === length) {
19784
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
19785
+ continue;
19786
+ }
19787
+ leadSurrogate = codePoint;
19788
+ continue;
19789
+ }
19790
+ if (codePoint < 56320) {
19791
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
19792
+ leadSurrogate = codePoint;
19793
+ continue;
19794
+ }
19795
+ codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
19796
+ } else if (leadSurrogate) {
19797
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
19798
+ }
19799
+ leadSurrogate = null;
19800
+ if (codePoint < 128) {
19801
+ if ((units -= 1) < 0) break;
19802
+ bytes.push(codePoint);
19803
+ } else if (codePoint < 2048) {
19804
+ if ((units -= 2) < 0) break;
19805
+ bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
19806
+ } else if (codePoint < 65536) {
19807
+ if ((units -= 3) < 0) break;
19808
+ bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
19809
+ } else if (codePoint < 1114112) {
19810
+ if ((units -= 4) < 0) break;
19811
+ bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
19812
+ } else throw new Error("Invalid code point");
19813
+ }
19814
+ return bytes;
19815
+ }
19816
+ function asciiToBytes(str) {
19817
+ var byteArray = [];
19818
+ for (var i = 0; i < str.length; ++i) byteArray.push(str.charCodeAt(i) & 255);
19819
+ return byteArray;
19820
+ }
19821
+ function utf16leToBytes(str, units) {
19822
+ var c, hi, lo;
19823
+ var byteArray = [];
19824
+ for (var i = 0; i < str.length; ++i) {
19825
+ if ((units -= 2) < 0) break;
19826
+ c = str.charCodeAt(i);
19827
+ hi = c >> 8;
19828
+ lo = c % 256;
19829
+ byteArray.push(lo);
19830
+ byteArray.push(hi);
19831
+ }
19832
+ return byteArray;
19833
+ }
19834
+ function base64ToBytes(str) {
19835
+ return toByteArray(base64clean(str));
19836
+ }
19837
+ function blitBuffer(src, dst, offset, length) {
19838
+ for (var i = 0; i < length; ++i) {
19839
+ if (i + offset >= dst.length || i >= src.length) break;
19840
+ dst[i + offset] = src[i];
19841
+ }
19842
+ return i;
19843
+ }
19844
+ function isnan(val) {
19845
+ return val !== val;
19846
+ }
19847
+ function isBuffer(obj) {
19848
+ return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
19849
+ }
19850
+ function isFastBuffer(obj) {
19851
+ return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
19852
+ }
19853
+ function isSlowBuffer(obj) {
19854
+ return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isFastBuffer(obj.slice(0, 0));
19855
+ }
19856
+ //#endregion
19857
+ //#region \0polyfill-node.process.js
19858
+ function defaultSetTimout() {
19859
+ throw new Error("setTimeout has not been defined");
19860
+ }
19861
+ function defaultClearTimeout() {
19862
+ throw new Error("clearTimeout has not been defined");
19863
+ }
19864
+ var cachedSetTimeout = defaultSetTimout;
19865
+ var cachedClearTimeout = defaultClearTimeout;
19866
+ if (typeof _polyfill_node_global_default.setTimeout === "function") cachedSetTimeout = setTimeout;
19867
+ if (typeof _polyfill_node_global_default.clearTimeout === "function") cachedClearTimeout = clearTimeout;
19868
+ function runTimeout(fun) {
19869
+ if (cachedSetTimeout === setTimeout) return setTimeout(fun, 0);
19870
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
19871
+ cachedSetTimeout = setTimeout;
19872
+ return setTimeout(fun, 0);
19873
+ }
19874
+ try {
19875
+ return cachedSetTimeout(fun, 0);
19876
+ } catch (e) {
19877
+ try {
19878
+ return cachedSetTimeout.call(null, fun, 0);
19879
+ } catch (e) {
19880
+ return cachedSetTimeout.call(this, fun, 0);
19881
+ }
19882
+ }
19883
+ }
19884
+ function runClearTimeout(marker) {
19885
+ if (cachedClearTimeout === clearTimeout) return clearTimeout(marker);
19886
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
19887
+ cachedClearTimeout = clearTimeout;
19888
+ return clearTimeout(marker);
19889
+ }
19890
+ try {
19891
+ return cachedClearTimeout(marker);
19892
+ } catch (e) {
19893
+ try {
19894
+ return cachedClearTimeout.call(null, marker);
19895
+ } catch (e) {
19896
+ return cachedClearTimeout.call(this, marker);
19897
+ }
19898
+ }
19899
+ }
19900
+ var queue = [];
19901
+ var draining = false;
19902
+ var currentQueue;
19903
+ var queueIndex = -1;
19904
+ function cleanUpNextTick() {
19905
+ if (!draining || !currentQueue) return;
19906
+ draining = false;
19907
+ if (currentQueue.length) queue = currentQueue.concat(queue);
19908
+ else queueIndex = -1;
19909
+ if (queue.length) drainQueue();
19910
+ }
19911
+ function drainQueue() {
19912
+ if (draining) return;
19913
+ var timeout = runTimeout(cleanUpNextTick);
19914
+ draining = true;
19915
+ var len = queue.length;
19916
+ while (len) {
19917
+ currentQueue = queue;
19918
+ queue = [];
19919
+ while (++queueIndex < len) if (currentQueue) currentQueue[queueIndex].run();
19920
+ queueIndex = -1;
19921
+ len = queue.length;
19922
+ }
19923
+ currentQueue = null;
19924
+ draining = false;
19925
+ runClearTimeout(timeout);
19926
+ }
19927
+ function nextTick(fun) {
19928
+ var args = new Array(arguments.length - 1);
19929
+ if (arguments.length > 1) for (var i = 1; i < arguments.length; i++) args[i - 1] = arguments[i];
19930
+ queue.push(new Item(fun, args));
19931
+ if (queue.length === 1 && !draining) runTimeout(drainQueue);
19932
+ }
19933
+ function Item(fun, array) {
19934
+ this.fun = fun;
19935
+ this.array = array;
19936
+ }
19937
+ Item.prototype.run = function() {
19938
+ this.fun.apply(null, this.array);
19939
+ };
19940
+ var title = "browser";
19941
+ var platform = "browser";
19942
+ var env = {};
19943
+ var argv = [];
19944
+ var versions = {};
19945
+ var release = {};
19946
+ var config = {};
19947
+ function noop() {}
19948
+ var on = noop;
19949
+ var addListener = noop;
19950
+ var once = noop;
19951
+ var off = noop;
19952
+ var removeListener = noop;
19953
+ var removeAllListeners = noop;
19954
+ var emit = noop;
19955
+ function binding(name) {
19956
+ throw new Error("process.binding is not supported");
19957
+ }
19958
+ function cwd() {
19959
+ return "/";
19960
+ }
19961
+ function chdir(dir) {
19962
+ throw new Error("process.chdir is not supported");
19963
+ }
19964
+ function umask() {
19965
+ return 0;
19966
+ }
19967
+ var performance = _polyfill_node_global_default.performance || {};
19968
+ var performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function() {
19969
+ return (/* @__PURE__ */ new Date()).getTime();
19970
+ };
19971
+ function hrtime(previousTimestamp) {
19972
+ var clocktime = performanceNow.call(performance) * .001;
19973
+ var seconds = Math.floor(clocktime);
19974
+ var nanoseconds = Math.floor(clocktime % 1 * 1e9);
19975
+ if (previousTimestamp) {
19976
+ seconds = seconds - previousTimestamp[0];
19977
+ nanoseconds = nanoseconds - previousTimestamp[1];
19978
+ if (nanoseconds < 0) {
19979
+ seconds--;
19980
+ nanoseconds += 1e9;
19981
+ }
19982
+ }
19983
+ return [seconds, nanoseconds];
19984
+ }
19985
+ var startTime = /* @__PURE__ */ new Date();
19986
+ function uptime() {
19987
+ return (/* @__PURE__ */ new Date() - startTime) / 1e3;
19988
+ }
19989
+ var browser$1 = {
19990
+ nextTick,
19991
+ title,
19992
+ browser: true,
19993
+ env,
19994
+ argv,
19995
+ version: "",
19996
+ versions,
19997
+ on,
19998
+ addListener,
19999
+ once,
20000
+ off,
20001
+ removeListener,
20002
+ removeAllListeners,
20003
+ emit,
20004
+ binding,
20005
+ cwd,
20006
+ chdir,
20007
+ umask,
20008
+ hrtime,
20009
+ platform,
20010
+ release,
20011
+ config,
20012
+ uptime
20013
+ };
20014
+ //#endregion
20015
+ //#region \0polyfill-node._inherits.js
20016
+ var inherits;
20017
+ if (typeof Object.create === "function") inherits = function inherits(ctor, superCtor) {
20018
+ ctor.super_ = superCtor;
20019
+ ctor.prototype = Object.create(superCtor.prototype, { constructor: {
20020
+ value: ctor,
20021
+ enumerable: false,
20022
+ writable: true,
20023
+ configurable: true
20024
+ } });
20025
+ };
20026
+ else inherits = function inherits(ctor, superCtor) {
20027
+ ctor.super_ = superCtor;
20028
+ var TempCtor = function() {};
20029
+ TempCtor.prototype = superCtor.prototype;
20030
+ ctor.prototype = new TempCtor();
20031
+ ctor.prototype.constructor = ctor;
20032
+ };
20033
+ var _polyfill_node__inherits_default = inherits;
20034
+ //#endregion
20035
+ //#region \0polyfill-node.util.js
20036
+ /**
20037
+ * Inherit the prototype methods from one constructor into another.
20038
+ *
20039
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
20040
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
20041
+ * during bootstrapping this function needs to be rewritten using some native
20042
+ * functions as prototype setup using normal JavaScript does not work as
20043
+ * expected during bootstrapping (see mirror.js in r114903).
20044
+ *
20045
+ * @param {function} ctor Constructor function which needs to inherit the
20046
+ * prototype.
20047
+ * @param {function} superCtor Constructor function to inherit prototype from.
20048
+ */
20049
+ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(obj) {
20050
+ var keys = Object.keys(obj);
20051
+ var descriptors = {};
20052
+ for (var i = 0; i < keys.length; i++) descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
20053
+ return descriptors;
20054
+ };
20055
+ var formatRegExp = /%[sdj%]/g;
20056
+ function format(f) {
20057
+ if (!isString(f)) {
20058
+ var objects = [];
20059
+ for (var i = 0; i < arguments.length; i++) objects.push(inspect(arguments[i]));
20060
+ return objects.join(" ");
20061
+ }
20062
+ var i = 1;
20063
+ var args = arguments;
20064
+ var len = args.length;
20065
+ var str = String(f).replace(formatRegExp, function(x) {
20066
+ if (x === "%%") return "%";
20067
+ if (i >= len) return x;
20068
+ switch (x) {
20069
+ case "%s": return String(args[i++]);
20070
+ case "%d": return Number(args[i++]);
20071
+ case "%j": try {
20072
+ return JSON.stringify(args[i++]);
20073
+ } catch (_) {
20074
+ return "[Circular]";
20075
+ }
20076
+ default: return x;
20077
+ }
20078
+ });
20079
+ for (var x = args[i]; i < len; x = args[++i]) if (isNull(x) || !isObject(x)) str += " " + x;
20080
+ else str += " " + inspect(x);
20081
+ return str;
20082
+ }
20083
+ function deprecate(fn, msg) {
20084
+ if (isUndefined(_polyfill_node_global_default.process)) return function() {
20085
+ return deprecate(fn, msg).apply(this, arguments);
20086
+ };
20087
+ if (browser$1.noDeprecation === true) return fn;
20088
+ var warned = false;
20089
+ function deprecated() {
20090
+ if (!warned) {
20091
+ if (browser$1.throwDeprecation) throw new Error(msg);
20092
+ else if (browser$1.traceDeprecation) console.trace(msg);
20093
+ else console.error(msg);
20094
+ warned = true;
20095
+ }
20096
+ return fn.apply(this, arguments);
20097
+ }
20098
+ return deprecated;
20099
+ }
20100
+ var debugs = {};
20101
+ var debugEnviron;
20102
+ function debuglog(set) {
20103
+ if (isUndefined(debugEnviron)) debugEnviron = browser$1.env.NODE_DEBUG || "";
20104
+ set = set.toUpperCase();
20105
+ if (!debugs[set]) if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) {
20106
+ var pid = 0;
20107
+ debugs[set] = function() {
20108
+ var msg = format.apply(null, arguments);
20109
+ console.error("%s %d: %s", set, pid, msg);
20110
+ };
20111
+ } else debugs[set] = function() {};
20112
+ return debugs[set];
20113
+ }
20114
+ /**
20115
+ * Echos the value of a value. Trys to print the value out
20116
+ * in the best way possible given the different types.
20117
+ *
20118
+ * @param {Object} obj The object to print out.
20119
+ * @param {Object} opts Optional options object that alters the output.
20120
+ */
20121
+ function inspect(obj, opts) {
20122
+ var ctx = {
20123
+ seen: [],
20124
+ stylize: stylizeNoColor
20125
+ };
20126
+ if (arguments.length >= 3) ctx.depth = arguments[2];
20127
+ if (arguments.length >= 4) ctx.colors = arguments[3];
20128
+ if (isBoolean(opts)) ctx.showHidden = opts;
20129
+ else if (opts) _extend(ctx, opts);
20130
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
20131
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
20132
+ if (isUndefined(ctx.colors)) ctx.colors = false;
20133
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
20134
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
20135
+ return formatValue(ctx, obj, ctx.depth);
20136
+ }
20137
+ inspect.colors = {
20138
+ "bold": [1, 22],
20139
+ "italic": [3, 23],
20140
+ "underline": [4, 24],
20141
+ "inverse": [7, 27],
20142
+ "white": [37, 39],
20143
+ "grey": [90, 39],
20144
+ "black": [30, 39],
20145
+ "blue": [34, 39],
20146
+ "cyan": [36, 39],
20147
+ "green": [32, 39],
20148
+ "magenta": [35, 39],
20149
+ "red": [31, 39],
20150
+ "yellow": [33, 39]
20151
+ };
20152
+ inspect.styles = {
20153
+ "special": "cyan",
20154
+ "number": "yellow",
20155
+ "boolean": "yellow",
20156
+ "undefined": "grey",
20157
+ "null": "bold",
20158
+ "string": "green",
20159
+ "date": "magenta",
20160
+ "regexp": "red"
20161
+ };
20162
+ function stylizeWithColor(str, styleType) {
20163
+ var style = inspect.styles[styleType];
20164
+ if (style) return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m";
20165
+ else return str;
20166
+ }
20167
+ function stylizeNoColor(str, styleType) {
20168
+ return str;
20169
+ }
20170
+ function arrayToHash(array) {
20171
+ var hash = {};
20172
+ array.forEach(function(val, idx) {
20173
+ hash[val] = true;
20174
+ });
20175
+ return hash;
20176
+ }
20177
+ function formatValue(ctx, value, recurseTimes) {
20178
+ if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== inspect && !(value.constructor && value.constructor.prototype === value)) {
20179
+ var ret = value.inspect(recurseTimes, ctx);
20180
+ if (!isString(ret)) ret = formatValue(ctx, ret, recurseTimes);
20181
+ return ret;
20182
+ }
20183
+ var primitive = formatPrimitive(ctx, value);
20184
+ if (primitive) return primitive;
20185
+ var keys = Object.keys(value);
20186
+ var visibleKeys = arrayToHash(keys);
20187
+ if (ctx.showHidden) keys = Object.getOwnPropertyNames(value);
20188
+ if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) return formatError(value);
20189
+ if (keys.length === 0) {
20190
+ if (isFunction(value)) {
20191
+ var name = value.name ? ": " + value.name : "";
20192
+ return ctx.stylize("[Function" + name + "]", "special");
20193
+ }
20194
+ if (isRegExp(value)) return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
20195
+ if (isDate(value)) return ctx.stylize(Date.prototype.toString.call(value), "date");
20196
+ if (isError(value)) return formatError(value);
20197
+ }
20198
+ var base = "", array = false, braces = ["{", "}"];
20199
+ if (isArray(value)) {
20200
+ array = true;
20201
+ braces = ["[", "]"];
20202
+ }
20203
+ if (isFunction(value)) base = " [Function" + (value.name ? ": " + value.name : "") + "]";
20204
+ if (isRegExp(value)) base = " " + RegExp.prototype.toString.call(value);
20205
+ if (isDate(value)) base = " " + Date.prototype.toUTCString.call(value);
20206
+ if (isError(value)) base = " " + formatError(value);
20207
+ if (keys.length === 0 && (!array || value.length == 0)) return braces[0] + base + braces[1];
20208
+ if (recurseTimes < 0) if (isRegExp(value)) return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
20209
+ else return ctx.stylize("[Object]", "special");
20210
+ ctx.seen.push(value);
20211
+ var output;
20212
+ if (array) output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
20213
+ else output = keys.map(function(key) {
20214
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
20215
+ });
20216
+ ctx.seen.pop();
20217
+ return reduceToSingleString(output, base, braces);
20218
+ }
20219
+ function formatPrimitive(ctx, value) {
20220
+ if (isUndefined(value)) return ctx.stylize("undefined", "undefined");
20221
+ if (isString(value)) {
20222
+ var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, "\"") + "'";
20223
+ return ctx.stylize(simple, "string");
20224
+ }
20225
+ if (isNumber(value)) return ctx.stylize("" + value, "number");
20226
+ if (isBoolean(value)) return ctx.stylize("" + value, "boolean");
20227
+ if (isNull(value)) return ctx.stylize("null", "null");
20228
+ }
20229
+ function formatError(value) {
20230
+ return "[" + Error.prototype.toString.call(value) + "]";
20231
+ }
20232
+ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
20233
+ var output = [];
20234
+ for (var i = 0, l = value.length; i < l; ++i) if (hasOwnProperty(value, String(i))) output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
20235
+ else output.push("");
20236
+ keys.forEach(function(key) {
20237
+ if (!key.match(/^\d+$/)) output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
20238
+ });
20239
+ return output;
20240
+ }
20241
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
20242
+ var name, str, desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
20243
+ if (desc.get) if (desc.set) str = ctx.stylize("[Getter/Setter]", "special");
20244
+ else str = ctx.stylize("[Getter]", "special");
20245
+ else if (desc.set) str = ctx.stylize("[Setter]", "special");
20246
+ if (!hasOwnProperty(visibleKeys, key)) name = "[" + key + "]";
20247
+ if (!str) if (ctx.seen.indexOf(desc.value) < 0) {
20248
+ if (isNull(recurseTimes)) str = formatValue(ctx, desc.value, null);
20249
+ else str = formatValue(ctx, desc.value, recurseTimes - 1);
20250
+ if (str.indexOf("\n") > -1) if (array) str = str.split("\n").map(function(line) {
20251
+ return " " + line;
20252
+ }).join("\n").substr(2);
20253
+ else str = "\n" + str.split("\n").map(function(line) {
20254
+ return " " + line;
20255
+ }).join("\n");
20256
+ } else str = ctx.stylize("[Circular]", "special");
20257
+ if (isUndefined(name)) {
20258
+ if (array && key.match(/^\d+$/)) return str;
20259
+ name = JSON.stringify("" + key);
20260
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
20261
+ name = name.substr(1, name.length - 2);
20262
+ name = ctx.stylize(name, "name");
20263
+ } else {
20264
+ name = name.replace(/'/g, "\\'").replace(/\\"/g, "\"").replace(/(^"|"$)/g, "'");
20265
+ name = ctx.stylize(name, "string");
20266
+ }
20267
+ }
20268
+ return name + ": " + str;
20269
+ }
20270
+ function reduceToSingleString(output, base, braces) {
20271
+ var numLinesEst = 0;
20272
+ if (output.reduce(function(prev, cur) {
20273
+ numLinesEst++;
20274
+ if (cur.indexOf("\n") >= 0) numLinesEst++;
20275
+ return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
20276
+ }, 0) > 60) return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1];
20277
+ return braces[0] + base + " " + output.join(", ") + " " + braces[1];
20278
+ }
20279
+ function isArray(ar) {
20280
+ return Array.isArray(ar);
20281
+ }
20282
+ function isBoolean(arg) {
20283
+ return typeof arg === "boolean";
20284
+ }
20285
+ function isNull(arg) {
20286
+ return arg === null;
20287
+ }
20288
+ function isNumber(arg) {
20289
+ return typeof arg === "number";
20290
+ }
20291
+ function isString(arg) {
20292
+ return typeof arg === "string";
20293
+ }
20294
+ function isUndefined(arg) {
20295
+ return arg === void 0;
20296
+ }
20297
+ function isRegExp(re) {
20298
+ return isObject(re) && objectToString(re) === "[object RegExp]";
20299
+ }
20300
+ function isObject(arg) {
20301
+ return typeof arg === "object" && arg !== null;
20302
+ }
20303
+ function isDate(d) {
20304
+ return isObject(d) && objectToString(d) === "[object Date]";
20305
+ }
20306
+ function isError(e) {
20307
+ return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
20308
+ }
20309
+ function isFunction(arg) {
20310
+ return typeof arg === "function";
20311
+ }
20312
+ function objectToString(o) {
20313
+ return Object.prototype.toString.call(o);
20314
+ }
20315
+ function _extend(origin, add) {
20316
+ if (!add || !isObject(add)) return origin;
20317
+ var keys = Object.keys(add);
20318
+ var i = keys.length;
20319
+ while (i--) origin[keys[i]] = add[keys[i]];
20320
+ return origin;
20321
+ }
20322
+ function hasOwnProperty(obj, prop) {
20323
+ return Object.prototype.hasOwnProperty.call(obj, prop);
20324
+ }
20325
+ var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0;
20326
+ function promisify(original) {
20327
+ if (typeof original !== "function") throw new TypeError("The \"original\" argument must be of type Function");
20328
+ if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
20329
+ var fn = original[kCustomPromisifiedSymbol];
20330
+ if (typeof fn !== "function") throw new TypeError("The \"util.promisify.custom\" argument must be of type Function");
20331
+ Object.defineProperty(fn, kCustomPromisifiedSymbol, {
20332
+ value: fn,
20333
+ enumerable: false,
20334
+ writable: false,
20335
+ configurable: true
20336
+ });
20337
+ return fn;
20338
+ }
20339
+ function fn() {
20340
+ var promiseResolve, promiseReject;
20341
+ var promise = new Promise(function(resolve, reject) {
20342
+ promiseResolve = resolve;
20343
+ promiseReject = reject;
20344
+ });
20345
+ var args = [];
20346
+ for (var i = 0; i < arguments.length; i++) args.push(arguments[i]);
20347
+ args.push(function(err, value) {
20348
+ if (err) promiseReject(err);
20349
+ else promiseResolve(value);
20350
+ });
20351
+ try {
20352
+ original.apply(this, args);
20353
+ } catch (err) {
20354
+ promiseReject(err);
20355
+ }
20356
+ return promise;
20357
+ }
20358
+ Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
20359
+ if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
20360
+ value: fn,
20361
+ enumerable: false,
20362
+ writable: false,
20363
+ configurable: true
20364
+ });
20365
+ return Object.defineProperties(fn, getOwnPropertyDescriptors(original));
20366
+ }
20367
+ promisify.custom = kCustomPromisifiedSymbol;
20368
+ //#endregion
20369
+ //#region \0polyfill-node._buffer_list.js
20370
+ var _polyfill_node__buffer_list_default = BufferList;
20371
+ function BufferList() {
20372
+ this.head = null;
20373
+ this.tail = null;
20374
+ this.length = 0;
20375
+ }
20376
+ BufferList.prototype.push = function(v) {
20377
+ var entry = {
20378
+ data: v,
20379
+ next: null
20380
+ };
20381
+ if (this.length > 0) this.tail.next = entry;
20382
+ else this.head = entry;
20383
+ this.tail = entry;
20384
+ ++this.length;
20385
+ };
20386
+ BufferList.prototype.unshift = function(v) {
20387
+ var entry = {
20388
+ data: v,
20389
+ next: this.head
20390
+ };
20391
+ if (this.length === 0) this.tail = entry;
20392
+ this.head = entry;
20393
+ ++this.length;
20394
+ };
20395
+ BufferList.prototype.shift = function() {
20396
+ if (this.length === 0) return;
20397
+ var ret = this.head.data;
20398
+ if (this.length === 1) this.head = this.tail = null;
20399
+ else this.head = this.head.next;
20400
+ --this.length;
20401
+ return ret;
20402
+ };
20403
+ BufferList.prototype.clear = function() {
20404
+ this.head = this.tail = null;
20405
+ this.length = 0;
20406
+ };
20407
+ BufferList.prototype.join = function(s) {
20408
+ if (this.length === 0) return "";
20409
+ var p = this.head;
20410
+ var ret = "" + p.data;
20411
+ while (p = p.next) ret += s + p.data;
20412
+ return ret;
20413
+ };
20414
+ BufferList.prototype.concat = function(n) {
20415
+ if (this.length === 0) return Buffer.alloc(0);
20416
+ if (this.length === 1) return this.head.data;
20417
+ var ret = Buffer.allocUnsafe(n >>> 0);
20418
+ var p = this.head;
20419
+ var i = 0;
20420
+ while (p) {
20421
+ p.data.copy(ret, i);
20422
+ i += p.data.length;
20423
+ p = p.next;
20424
+ }
20425
+ return ret;
20426
+ };
20427
+ //#endregion
20428
+ //#region \0polyfill-node.string_decoder.js
20429
+ var isBufferEncoding = Buffer.isEncoding || function(encoding) {
20430
+ switch (encoding && encoding.toLowerCase()) {
20431
+ case "hex":
20432
+ case "utf8":
20433
+ case "utf-8":
20434
+ case "ascii":
20435
+ case "binary":
20436
+ case "base64":
20437
+ case "ucs2":
20438
+ case "ucs-2":
20439
+ case "utf16le":
20440
+ case "utf-16le":
20441
+ case "raw": return true;
20442
+ default: return false;
20443
+ }
20444
+ };
20445
+ function assertEncoding(encoding) {
20446
+ if (encoding && !isBufferEncoding(encoding)) throw new Error("Unknown encoding: " + encoding);
20447
+ }
20448
+ function StringDecoder(encoding) {
20449
+ this.encoding = (encoding || "utf8").toLowerCase().replace(/[-_]/, "");
20450
+ assertEncoding(encoding);
20451
+ switch (this.encoding) {
20452
+ case "utf8":
20453
+ this.surrogateSize = 3;
20454
+ break;
20455
+ case "ucs2":
20456
+ case "utf16le":
20457
+ this.surrogateSize = 2;
20458
+ this.detectIncompleteChar = utf16DetectIncompleteChar;
20459
+ break;
20460
+ case "base64":
20461
+ this.surrogateSize = 3;
20462
+ this.detectIncompleteChar = base64DetectIncompleteChar;
20463
+ break;
20464
+ default:
20465
+ this.write = passThroughWrite;
20466
+ return;
20467
+ }
20468
+ this.charBuffer = new Buffer(6);
20469
+ this.charReceived = 0;
20470
+ this.charLength = 0;
20471
+ }
20472
+ StringDecoder.prototype.write = function(buffer) {
20473
+ var charStr = "";
20474
+ while (this.charLength) {
20475
+ var available = buffer.length >= this.charLength - this.charReceived ? this.charLength - this.charReceived : buffer.length;
20476
+ buffer.copy(this.charBuffer, this.charReceived, 0, available);
20477
+ this.charReceived += available;
20478
+ if (this.charReceived < this.charLength) return "";
20479
+ buffer = buffer.slice(available, buffer.length);
20480
+ charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
20481
+ var charCode = charStr.charCodeAt(charStr.length - 1);
20482
+ if (charCode >= 55296 && charCode <= 56319) {
20483
+ this.charLength += this.surrogateSize;
20484
+ charStr = "";
20485
+ continue;
20486
+ }
20487
+ this.charReceived = this.charLength = 0;
20488
+ if (buffer.length === 0) return charStr;
20489
+ break;
20490
+ }
20491
+ this.detectIncompleteChar(buffer);
20492
+ var end = buffer.length;
20493
+ if (this.charLength) {
20494
+ buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
20495
+ end -= this.charReceived;
20496
+ }
20497
+ charStr += buffer.toString(this.encoding, 0, end);
20498
+ var end = charStr.length - 1;
20499
+ var charCode = charStr.charCodeAt(end);
20500
+ if (charCode >= 55296 && charCode <= 56319) {
20501
+ var size = this.surrogateSize;
20502
+ this.charLength += size;
20503
+ this.charReceived += size;
20504
+ this.charBuffer.copy(this.charBuffer, size, 0, size);
20505
+ buffer.copy(this.charBuffer, 0, 0, size);
20506
+ return charStr.substring(0, end);
20507
+ }
20508
+ return charStr;
20509
+ };
20510
+ StringDecoder.prototype.detectIncompleteChar = function(buffer) {
20511
+ var i = buffer.length >= 3 ? 3 : buffer.length;
20512
+ for (; i > 0; i--) {
20513
+ var c = buffer[buffer.length - i];
20514
+ if (i == 1 && c >> 5 == 6) {
20515
+ this.charLength = 2;
20516
+ break;
20517
+ }
20518
+ if (i <= 2 && c >> 4 == 14) {
20519
+ this.charLength = 3;
20520
+ break;
20521
+ }
20522
+ if (i <= 3 && c >> 3 == 30) {
20523
+ this.charLength = 4;
20524
+ break;
20525
+ }
20526
+ }
20527
+ this.charReceived = i;
20528
+ };
20529
+ StringDecoder.prototype.end = function(buffer) {
20530
+ var res = "";
20531
+ if (buffer && buffer.length) res = this.write(buffer);
20532
+ if (this.charReceived) {
20533
+ var cr = this.charReceived;
20534
+ var buf = this.charBuffer;
20535
+ var enc = this.encoding;
20536
+ res += buf.slice(0, cr).toString(enc);
20537
+ }
20538
+ return res;
20539
+ };
20540
+ function passThroughWrite(buffer) {
20541
+ return buffer.toString(this.encoding);
20542
+ }
20543
+ function utf16DetectIncompleteChar(buffer) {
20544
+ this.charReceived = buffer.length % 2;
20545
+ this.charLength = this.charReceived ? 2 : 0;
20546
+ }
20547
+ function base64DetectIncompleteChar(buffer) {
20548
+ this.charReceived = buffer.length % 3;
20549
+ this.charLength = this.charReceived ? 3 : 0;
20550
+ }
20551
+ //#endregion
20552
+ //#region \0polyfill-node._stream_readable.js
20553
+ Readable.ReadableState = ReadableState;
20554
+ var debug = debuglog("stream");
20555
+ _polyfill_node__inherits_default(Readable, EventEmitter);
20556
+ function prependListener(emitter, event, fn) {
20557
+ if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
20558
+ else if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
20559
+ else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);
20560
+ else emitter._events[event] = [fn, emitter._events[event]];
20561
+ }
20562
+ function listenerCount(emitter, type) {
20563
+ return emitter.listeners(type).length;
20564
+ }
20565
+ function ReadableState(options, stream) {
20566
+ options = options || {};
20567
+ this.objectMode = !!options.objectMode;
20568
+ if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
20569
+ var hwm = options.highWaterMark;
20570
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
20571
+ this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
20572
+ this.highWaterMark = ~~this.highWaterMark;
20573
+ this.buffer = new _polyfill_node__buffer_list_default();
20574
+ this.length = 0;
20575
+ this.pipes = null;
20576
+ this.pipesCount = 0;
20577
+ this.flowing = null;
20578
+ this.ended = false;
20579
+ this.endEmitted = false;
20580
+ this.reading = false;
20581
+ this.sync = true;
20582
+ this.needReadable = false;
20583
+ this.emittedReadable = false;
20584
+ this.readableListening = false;
20585
+ this.resumeScheduled = false;
20586
+ this.defaultEncoding = options.defaultEncoding || "utf8";
20587
+ this.ranOut = false;
20588
+ this.awaitDrain = 0;
20589
+ this.readingMore = false;
20590
+ this.decoder = null;
20591
+ this.encoding = null;
20592
+ if (options.encoding) {
20593
+ this.decoder = new StringDecoder(options.encoding);
20594
+ this.encoding = options.encoding;
20595
+ }
20596
+ }
20597
+ function Readable(options) {
20598
+ if (!(this instanceof Readable)) return new Readable(options);
20599
+ this._readableState = new ReadableState(options, this);
20600
+ this.readable = true;
20601
+ if (options && typeof options.read === "function") this._read = options.read;
20602
+ EventEmitter.call(this);
20603
+ }
20604
+ Readable.prototype.push = function(chunk, encoding) {
20605
+ var state = this._readableState;
20606
+ if (!state.objectMode && typeof chunk === "string") {
20607
+ encoding = encoding || state.defaultEncoding;
20608
+ if (encoding !== state.encoding) {
20609
+ chunk = Buffer.from(chunk, encoding);
20610
+ encoding = "";
20611
+ }
20612
+ }
20613
+ return readableAddChunk(this, state, chunk, encoding, false);
20614
+ };
20615
+ Readable.prototype.unshift = function(chunk) {
20616
+ var state = this._readableState;
20617
+ return readableAddChunk(this, state, chunk, "", true);
20618
+ };
20619
+ Readable.prototype.isPaused = function() {
20620
+ return this._readableState.flowing === false;
20621
+ };
20622
+ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
20623
+ var er = chunkInvalid(state, chunk);
20624
+ if (er) stream.emit("error", er);
20625
+ else if (chunk === null) {
20626
+ state.reading = false;
20627
+ onEofChunk(stream, state);
20628
+ } else if (state.objectMode || chunk && chunk.length > 0) if (state.ended && !addToFront) {
20629
+ var e = /* @__PURE__ */ new Error("stream.push() after EOF");
20630
+ stream.emit("error", e);
20631
+ } else if (state.endEmitted && addToFront) {
20632
+ var _e = /* @__PURE__ */ new Error("stream.unshift() after end event");
20633
+ stream.emit("error", _e);
20634
+ } else {
20635
+ var skipAdd;
20636
+ if (state.decoder && !addToFront && !encoding) {
20637
+ chunk = state.decoder.write(chunk);
20638
+ skipAdd = !state.objectMode && chunk.length === 0;
20639
+ }
20640
+ if (!addToFront) state.reading = false;
20641
+ if (!skipAdd) if (state.flowing && state.length === 0 && !state.sync) {
20642
+ stream.emit("data", chunk);
20643
+ stream.read(0);
20644
+ } else {
20645
+ state.length += state.objectMode ? 1 : chunk.length;
20646
+ if (addToFront) state.buffer.unshift(chunk);
20647
+ else state.buffer.push(chunk);
20648
+ if (state.needReadable) emitReadable(stream);
20649
+ }
20650
+ maybeReadMore(stream, state);
20651
+ }
20652
+ else if (!addToFront) state.reading = false;
20653
+ return needMoreData(state);
20654
+ }
20655
+ function needMoreData(state) {
20656
+ return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
20657
+ }
20658
+ Readable.prototype.setEncoding = function(enc) {
20659
+ this._readableState.decoder = new StringDecoder(enc);
20660
+ this._readableState.encoding = enc;
20661
+ return this;
20662
+ };
20663
+ var MAX_HWM = 8388608;
20664
+ function computeNewHighWaterMark(n) {
20665
+ if (n >= MAX_HWM) n = MAX_HWM;
20666
+ else {
20667
+ n--;
20668
+ n |= n >>> 1;
20669
+ n |= n >>> 2;
20670
+ n |= n >>> 4;
20671
+ n |= n >>> 8;
20672
+ n |= n >>> 16;
20673
+ n++;
20674
+ }
20675
+ return n;
20676
+ }
20677
+ function howMuchToRead(n, state) {
20678
+ if (n <= 0 || state.length === 0 && state.ended) return 0;
20679
+ if (state.objectMode) return 1;
20680
+ if (n !== n) if (state.flowing && state.length) return state.buffer.head.data.length;
20681
+ else return state.length;
20682
+ if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
20683
+ if (n <= state.length) return n;
20684
+ if (!state.ended) {
20685
+ state.needReadable = true;
20686
+ return 0;
20687
+ }
20688
+ return state.length;
20689
+ }
20690
+ Readable.prototype.read = function(n) {
20691
+ debug("read", n);
20692
+ n = parseInt(n, 10);
20693
+ var state = this._readableState;
20694
+ var nOrig = n;
20695
+ if (n !== 0) state.emittedReadable = false;
20696
+ if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
20697
+ debug("read: emitReadable", state.length, state.ended);
20698
+ if (state.length === 0 && state.ended) endReadable(this);
20699
+ else emitReadable(this);
20700
+ return null;
20701
+ }
20702
+ n = howMuchToRead(n, state);
20703
+ if (n === 0 && state.ended) {
20704
+ if (state.length === 0) endReadable(this);
20705
+ return null;
20706
+ }
20707
+ var doRead = state.needReadable;
20708
+ debug("need readable", doRead);
20709
+ if (state.length === 0 || state.length - n < state.highWaterMark) {
20710
+ doRead = true;
20711
+ debug("length less than watermark", doRead);
20712
+ }
20713
+ if (state.ended || state.reading) {
20714
+ doRead = false;
20715
+ debug("reading or ended", doRead);
20716
+ } else if (doRead) {
20717
+ debug("do read");
20718
+ state.reading = true;
20719
+ state.sync = true;
20720
+ if (state.length === 0) state.needReadable = true;
20721
+ this._read(state.highWaterMark);
20722
+ state.sync = false;
20723
+ if (!state.reading) n = howMuchToRead(nOrig, state);
20724
+ }
20725
+ var ret;
20726
+ if (n > 0) ret = fromList(n, state);
20727
+ else ret = null;
20728
+ if (ret === null) {
20729
+ state.needReadable = true;
20730
+ n = 0;
20731
+ } else state.length -= n;
20732
+ if (state.length === 0) {
20733
+ if (!state.ended) state.needReadable = true;
20734
+ if (nOrig !== n && state.ended) endReadable(this);
20735
+ }
20736
+ if (ret !== null) this.emit("data", ret);
20737
+ return ret;
20738
+ };
20739
+ function chunkInvalid(state, chunk) {
20740
+ var er = null;
20741
+ if (!Buffer.isBuffer(chunk) && typeof chunk !== "string" && chunk !== null && chunk !== void 0 && !state.objectMode) er = /* @__PURE__ */ new TypeError("Invalid non-string/buffer chunk");
20742
+ return er;
20743
+ }
20744
+ function onEofChunk(stream, state) {
20745
+ if (state.ended) return;
20746
+ if (state.decoder) {
20747
+ var chunk = state.decoder.end();
20748
+ if (chunk && chunk.length) {
20749
+ state.buffer.push(chunk);
20750
+ state.length += state.objectMode ? 1 : chunk.length;
20751
+ }
20752
+ }
20753
+ state.ended = true;
20754
+ emitReadable(stream);
20755
+ }
20756
+ function emitReadable(stream) {
20757
+ var state = stream._readableState;
20758
+ state.needReadable = false;
20759
+ if (!state.emittedReadable) {
20760
+ debug("emitReadable", state.flowing);
20761
+ state.emittedReadable = true;
20762
+ if (state.sync) nextTick(emitReadable_, stream);
20763
+ else emitReadable_(stream);
20764
+ }
20765
+ }
20766
+ function emitReadable_(stream) {
20767
+ debug("emit readable");
20768
+ stream.emit("readable");
20769
+ flow(stream);
20770
+ }
20771
+ function maybeReadMore(stream, state) {
20772
+ if (!state.readingMore) {
20773
+ state.readingMore = true;
20774
+ nextTick(maybeReadMore_, stream, state);
20775
+ }
20776
+ }
20777
+ function maybeReadMore_(stream, state) {
20778
+ var len = state.length;
20779
+ while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
20780
+ debug("maybeReadMore read 0");
20781
+ stream.read(0);
20782
+ if (len === state.length) break;
20783
+ else len = state.length;
20784
+ }
20785
+ state.readingMore = false;
20786
+ }
20787
+ Readable.prototype._read = function(n) {
20788
+ this.emit("error", /* @__PURE__ */ new Error("not implemented"));
20789
+ };
20790
+ Readable.prototype.pipe = function(dest, pipeOpts) {
20791
+ var src = this;
20792
+ var state = this._readableState;
20793
+ switch (state.pipesCount) {
20794
+ case 0:
20795
+ state.pipes = dest;
20796
+ break;
20797
+ case 1:
20798
+ state.pipes = [state.pipes, dest];
20799
+ break;
20800
+ default:
20801
+ state.pipes.push(dest);
20802
+ break;
20803
+ }
20804
+ state.pipesCount += 1;
20805
+ debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
20806
+ var endFn = !pipeOpts || pipeOpts.end !== false ? onend : cleanup;
20807
+ if (state.endEmitted) nextTick(endFn);
20808
+ else src.once("end", endFn);
20809
+ dest.on("unpipe", onunpipe);
20810
+ function onunpipe(readable) {
20811
+ debug("onunpipe");
20812
+ if (readable === src) cleanup();
20813
+ }
20814
+ function onend() {
20815
+ debug("onend");
20816
+ dest.end();
20817
+ }
20818
+ var ondrain = pipeOnDrain(src);
20819
+ dest.on("drain", ondrain);
20820
+ var cleanedUp = false;
20821
+ function cleanup() {
20822
+ debug("cleanup");
20823
+ dest.removeListener("close", onclose);
20824
+ dest.removeListener("finish", onfinish);
20825
+ dest.removeListener("drain", ondrain);
20826
+ dest.removeListener("error", onerror);
20827
+ dest.removeListener("unpipe", onunpipe);
20828
+ src.removeListener("end", onend);
20829
+ src.removeListener("end", cleanup);
20830
+ src.removeListener("data", ondata);
20831
+ cleanedUp = true;
20832
+ if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
20833
+ }
20834
+ var increasedAwaitDrain = false;
20835
+ src.on("data", ondata);
20836
+ function ondata(chunk) {
20837
+ debug("ondata");
20838
+ increasedAwaitDrain = false;
20839
+ if (false === dest.write(chunk) && !increasedAwaitDrain) {
20840
+ if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
20841
+ debug("false write response, pause", src._readableState.awaitDrain);
20842
+ src._readableState.awaitDrain++;
20843
+ increasedAwaitDrain = true;
20844
+ }
20845
+ src.pause();
20846
+ }
20847
+ }
20848
+ function onerror(er) {
20849
+ debug("onerror", er);
20850
+ unpipe();
20851
+ dest.removeListener("error", onerror);
20852
+ if (listenerCount(dest, "error") === 0) dest.emit("error", er);
20853
+ }
20854
+ prependListener(dest, "error", onerror);
20855
+ function onclose() {
20856
+ dest.removeListener("finish", onfinish);
20857
+ unpipe();
20858
+ }
20859
+ dest.once("close", onclose);
20860
+ function onfinish() {
20861
+ debug("onfinish");
20862
+ dest.removeListener("close", onclose);
20863
+ unpipe();
20864
+ }
20865
+ dest.once("finish", onfinish);
20866
+ function unpipe() {
20867
+ debug("unpipe");
20868
+ src.unpipe(dest);
20869
+ }
20870
+ dest.emit("pipe", src);
20871
+ if (!state.flowing) {
20872
+ debug("pipe resume");
20873
+ src.resume();
20874
+ }
20875
+ return dest;
20876
+ };
20877
+ function pipeOnDrain(src) {
20878
+ return function() {
20879
+ var state = src._readableState;
20880
+ debug("pipeOnDrain", state.awaitDrain);
20881
+ if (state.awaitDrain) state.awaitDrain--;
20882
+ if (state.awaitDrain === 0 && src.listeners("data").length) {
20883
+ state.flowing = true;
20884
+ flow(src);
20885
+ }
20886
+ };
20887
+ }
20888
+ Readable.prototype.unpipe = function(dest) {
20889
+ var state = this._readableState;
20890
+ if (state.pipesCount === 0) return this;
20891
+ if (state.pipesCount === 1) {
20892
+ if (dest && dest !== state.pipes) return this;
20893
+ if (!dest) dest = state.pipes;
20894
+ state.pipes = null;
20895
+ state.pipesCount = 0;
20896
+ state.flowing = false;
20897
+ if (dest) dest.emit("unpipe", this);
20898
+ return this;
20899
+ }
20900
+ if (!dest) {
20901
+ var dests = state.pipes;
20902
+ var len = state.pipesCount;
20903
+ state.pipes = null;
20904
+ state.pipesCount = 0;
20905
+ state.flowing = false;
20906
+ for (var _i = 0; _i < len; _i++) dests[_i].emit("unpipe", this);
20907
+ return this;
20908
+ }
20909
+ var i = indexOf(state.pipes, dest);
20910
+ if (i === -1) return this;
20911
+ state.pipes.splice(i, 1);
20912
+ state.pipesCount -= 1;
20913
+ if (state.pipesCount === 1) state.pipes = state.pipes[0];
20914
+ dest.emit("unpipe", this);
20915
+ return this;
20916
+ };
20917
+ Readable.prototype.on = function(ev, fn) {
20918
+ var res = EventEmitter.prototype.on.call(this, ev, fn);
20919
+ if (ev === "data") {
20920
+ if (this._readableState.flowing !== false) this.resume();
20921
+ } else if (ev === "readable") {
20922
+ var state = this._readableState;
20923
+ if (!state.endEmitted && !state.readableListening) {
20924
+ state.readableListening = state.needReadable = true;
20925
+ state.emittedReadable = false;
20926
+ if (!state.reading) nextTick(nReadingNextTick, this);
20927
+ else if (state.length) emitReadable(this, state);
20928
+ }
20929
+ }
20930
+ return res;
20931
+ };
20932
+ Readable.prototype.addListener = Readable.prototype.on;
20933
+ function nReadingNextTick(self) {
20934
+ debug("readable nexttick read 0");
20935
+ self.read(0);
20936
+ }
20937
+ Readable.prototype.resume = function() {
20938
+ var state = this._readableState;
20939
+ if (!state.flowing) {
20940
+ debug("resume");
20941
+ state.flowing = true;
20942
+ resume(this, state);
20943
+ }
20944
+ return this;
20945
+ };
20946
+ function resume(stream, state) {
20947
+ if (!state.resumeScheduled) {
20948
+ state.resumeScheduled = true;
20949
+ nextTick(resume_, stream, state);
20950
+ }
20951
+ }
20952
+ function resume_(stream, state) {
20953
+ if (!state.reading) {
20954
+ debug("resume read 0");
20955
+ stream.read(0);
20956
+ }
20957
+ state.resumeScheduled = false;
20958
+ state.awaitDrain = 0;
20959
+ stream.emit("resume");
20960
+ flow(stream);
20961
+ if (state.flowing && !state.reading) stream.read(0);
20962
+ }
20963
+ Readable.prototype.pause = function() {
20964
+ debug("call pause flowing=%j", this._readableState.flowing);
20965
+ if (false !== this._readableState.flowing) {
20966
+ debug("pause");
20967
+ this._readableState.flowing = false;
20968
+ this.emit("pause");
20969
+ }
20970
+ return this;
20971
+ };
20972
+ function flow(stream) {
20973
+ var state = stream._readableState;
20974
+ debug("flow", state.flowing);
20975
+ while (state.flowing && stream.read() !== null);
20976
+ }
20977
+ Readable.prototype.wrap = function(stream) {
20978
+ var state = this._readableState;
20979
+ var paused = false;
20980
+ var self = this;
20981
+ stream.on("end", function() {
20982
+ debug("wrapped end");
20983
+ if (state.decoder && !state.ended) {
20984
+ var chunk = state.decoder.end();
20985
+ if (chunk && chunk.length) self.push(chunk);
20986
+ }
20987
+ self.push(null);
20988
+ });
20989
+ stream.on("data", function(chunk) {
20990
+ debug("wrapped data");
20991
+ if (state.decoder) chunk = state.decoder.write(chunk);
20992
+ if (state.objectMode && (chunk === null || chunk === void 0)) return;
20993
+ else if (!state.objectMode && (!chunk || !chunk.length)) return;
20994
+ if (!self.push(chunk)) {
20995
+ paused = true;
20996
+ stream.pause();
20997
+ }
20998
+ });
20999
+ for (var i in stream) if (this[i] === void 0 && typeof stream[i] === "function") this[i] = function(method) {
21000
+ return function() {
21001
+ return stream[method].apply(stream, arguments);
21002
+ };
21003
+ }(i);
21004
+ forEach([
21005
+ "error",
21006
+ "close",
21007
+ "destroy",
21008
+ "pause",
21009
+ "resume"
21010
+ ], function(ev) {
21011
+ stream.on(ev, self.emit.bind(self, ev));
21012
+ });
21013
+ self._read = function(n) {
21014
+ debug("wrapped _read", n);
21015
+ if (paused) {
21016
+ paused = false;
21017
+ stream.resume();
21018
+ }
21019
+ };
21020
+ return self;
21021
+ };
21022
+ Readable._fromList = fromList;
21023
+ function fromList(n, state) {
21024
+ if (state.length === 0) return null;
21025
+ var ret;
21026
+ if (state.objectMode) ret = state.buffer.shift();
21027
+ else if (!n || n >= state.length) {
21028
+ if (state.decoder) ret = state.buffer.join("");
21029
+ else if (state.buffer.length === 1) ret = state.buffer.head.data;
21030
+ else ret = state.buffer.concat(state.length);
21031
+ state.buffer.clear();
21032
+ } else ret = fromListPartial(n, state.buffer, state.decoder);
21033
+ return ret;
21034
+ }
21035
+ function fromListPartial(n, list, hasStrings) {
21036
+ var ret;
21037
+ if (n < list.head.data.length) {
21038
+ ret = list.head.data.slice(0, n);
21039
+ list.head.data = list.head.data.slice(n);
21040
+ } else if (n === list.head.data.length) ret = list.shift();
21041
+ else ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
21042
+ return ret;
21043
+ }
21044
+ function copyFromBufferString(n, list) {
21045
+ var p = list.head;
21046
+ var c = 1;
21047
+ var ret = p.data;
21048
+ n -= ret.length;
21049
+ while (p = p.next) {
21050
+ var str = p.data;
21051
+ var nb = n > str.length ? str.length : n;
21052
+ if (nb === str.length) ret += str;
21053
+ else ret += str.slice(0, n);
21054
+ n -= nb;
21055
+ if (n === 0) {
21056
+ if (nb === str.length) {
21057
+ ++c;
21058
+ if (p.next) list.head = p.next;
21059
+ else list.head = list.tail = null;
21060
+ } else {
21061
+ list.head = p;
21062
+ p.data = str.slice(nb);
21063
+ }
21064
+ break;
21065
+ }
21066
+ ++c;
21067
+ }
21068
+ list.length -= c;
21069
+ return ret;
21070
+ }
21071
+ function copyFromBuffer(n, list) {
21072
+ var ret = Buffer.allocUnsafe(n);
21073
+ var p = list.head;
21074
+ var c = 1;
21075
+ p.data.copy(ret);
21076
+ n -= p.data.length;
21077
+ while (p = p.next) {
21078
+ var buf = p.data;
21079
+ var nb = n > buf.length ? buf.length : n;
21080
+ buf.copy(ret, ret.length - n, 0, nb);
21081
+ n -= nb;
21082
+ if (n === 0) {
21083
+ if (nb === buf.length) {
21084
+ ++c;
21085
+ if (p.next) list.head = p.next;
21086
+ else list.head = list.tail = null;
21087
+ } else {
21088
+ list.head = p;
21089
+ p.data = buf.slice(nb);
21090
+ }
21091
+ break;
21092
+ }
21093
+ ++c;
21094
+ }
21095
+ list.length -= c;
21096
+ return ret;
21097
+ }
21098
+ function endReadable(stream) {
21099
+ var state = stream._readableState;
21100
+ if (state.length > 0) throw new Error("\"endReadable()\" called on non-empty stream");
21101
+ if (!state.endEmitted) {
21102
+ state.ended = true;
21103
+ nextTick(endReadableNT, state, stream);
21104
+ }
21105
+ }
21106
+ function endReadableNT(state, stream) {
21107
+ if (!state.endEmitted && state.length === 0) {
21108
+ state.endEmitted = true;
21109
+ stream.readable = false;
21110
+ stream.emit("end");
21111
+ }
21112
+ }
21113
+ function forEach(xs, f) {
21114
+ for (var i = 0, l = xs.length; i < l; i++) f(xs[i], i);
21115
+ }
21116
+ function indexOf(xs, x) {
21117
+ for (var i = 0, l = xs.length; i < l; i++) if (xs[i] === x) return i;
21118
+ return -1;
21119
+ }
21120
+ //#endregion
21121
+ //#region \0polyfill-node._stream_writable.js
21122
+ Writable.WritableState = WritableState;
21123
+ _polyfill_node__inherits_default(Writable, EventEmitter);
21124
+ function nop() {}
21125
+ function WriteReq(chunk, encoding, cb) {
21126
+ this.chunk = chunk;
21127
+ this.encoding = encoding;
21128
+ this.callback = cb;
21129
+ this.next = null;
21130
+ }
21131
+ function WritableState(options, stream) {
21132
+ Object.defineProperty(this, "buffer", { get: deprecate(function() {
21133
+ return this.getBuffer();
21134
+ }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.") });
21135
+ options = options || {};
21136
+ this.objectMode = !!options.objectMode;
21137
+ if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
21138
+ var hwm = options.highWaterMark;
21139
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
21140
+ this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
21141
+ this.highWaterMark = ~~this.highWaterMark;
21142
+ this.needDrain = false;
21143
+ this.ending = false;
21144
+ this.ended = false;
21145
+ this.finished = false;
21146
+ this.decodeStrings = !(options.decodeStrings === false);
21147
+ this.defaultEncoding = options.defaultEncoding || "utf8";
21148
+ this.length = 0;
21149
+ this.writing = false;
21150
+ this.corked = 0;
21151
+ this.sync = true;
21152
+ this.bufferProcessing = false;
21153
+ this.onwrite = function(er) {
21154
+ onwrite(stream, er);
21155
+ };
21156
+ this.writecb = null;
21157
+ this.writelen = 0;
21158
+ this.bufferedRequest = null;
21159
+ this.lastBufferedRequest = null;
21160
+ this.pendingcb = 0;
21161
+ this.prefinished = false;
21162
+ this.errorEmitted = false;
21163
+ this.bufferedRequestCount = 0;
21164
+ this.corkedRequestsFree = new CorkedRequest(this);
21165
+ }
21166
+ WritableState.prototype.getBuffer = function writableStateGetBuffer() {
21167
+ var current = this.bufferedRequest;
21168
+ var out = [];
21169
+ while (current) {
21170
+ out.push(current);
21171
+ current = current.next;
21172
+ }
21173
+ return out;
21174
+ };
21175
+ function Writable(options) {
21176
+ if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);
21177
+ this._writableState = new WritableState(options, this);
21178
+ this.writable = true;
21179
+ if (options) {
21180
+ if (typeof options.write === "function") this._write = options.write;
21181
+ if (typeof options.writev === "function") this._writev = options.writev;
21182
+ }
21183
+ EventEmitter.call(this);
21184
+ }
21185
+ Writable.prototype.pipe = function() {
21186
+ this.emit("error", /* @__PURE__ */ new Error("Cannot pipe, not readable"));
21187
+ };
21188
+ function writeAfterEnd(stream, cb) {
21189
+ var er = /* @__PURE__ */ new Error("write after end");
21190
+ stream.emit("error", er);
21191
+ nextTick(cb, er);
21192
+ }
21193
+ function validChunk(stream, state, chunk, cb) {
21194
+ var valid = true;
21195
+ var er = false;
21196
+ if (chunk === null) er = /* @__PURE__ */ new TypeError("May not write null values to stream");
21197
+ else if (!Buffer.isBuffer(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) er = /* @__PURE__ */ new TypeError("Invalid non-string/buffer chunk");
21198
+ if (er) {
21199
+ stream.emit("error", er);
21200
+ nextTick(cb, er);
21201
+ valid = false;
21202
+ }
21203
+ return valid;
21204
+ }
21205
+ Writable.prototype.write = function(chunk, encoding, cb) {
21206
+ var state = this._writableState;
21207
+ var ret = false;
21208
+ if (typeof encoding === "function") {
21209
+ cb = encoding;
21210
+ encoding = null;
21211
+ }
21212
+ if (Buffer.isBuffer(chunk)) encoding = "buffer";
21213
+ else if (!encoding) encoding = state.defaultEncoding;
21214
+ if (typeof cb !== "function") cb = nop;
21215
+ if (state.ended) writeAfterEnd(this, cb);
21216
+ else if (validChunk(this, state, chunk, cb)) {
21217
+ state.pendingcb++;
21218
+ ret = writeOrBuffer(this, state, chunk, encoding, cb);
21219
+ }
21220
+ return ret;
21221
+ };
21222
+ Writable.prototype.cork = function() {
21223
+ var state = this._writableState;
21224
+ state.corked++;
21225
+ };
21226
+ Writable.prototype.uncork = function() {
21227
+ var state = this._writableState;
21228
+ if (state.corked) {
21229
+ state.corked--;
21230
+ if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
21231
+ }
21232
+ };
21233
+ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
21234
+ if (typeof encoding === "string") encoding = encoding.toLowerCase();
21235
+ if (!([
21236
+ "hex",
21237
+ "utf8",
21238
+ "utf-8",
21239
+ "ascii",
21240
+ "binary",
21241
+ "base64",
21242
+ "ucs2",
21243
+ "ucs-2",
21244
+ "utf16le",
21245
+ "utf-16le",
21246
+ "raw"
21247
+ ].indexOf((encoding + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + encoding);
21248
+ this._writableState.defaultEncoding = encoding;
21249
+ return this;
21250
+ };
21251
+ function decodeChunk(state, chunk, encoding) {
21252
+ if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") chunk = Buffer.from(chunk, encoding);
21253
+ return chunk;
21254
+ }
21255
+ function writeOrBuffer(stream, state, chunk, encoding, cb) {
21256
+ chunk = decodeChunk(state, chunk, encoding);
21257
+ if (Buffer.isBuffer(chunk)) encoding = "buffer";
21258
+ var len = state.objectMode ? 1 : chunk.length;
21259
+ state.length += len;
21260
+ var ret = state.length < state.highWaterMark;
21261
+ if (!ret) state.needDrain = true;
21262
+ if (state.writing || state.corked) {
21263
+ var last = state.lastBufferedRequest;
21264
+ state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
21265
+ if (last) last.next = state.lastBufferedRequest;
21266
+ else state.bufferedRequest = state.lastBufferedRequest;
21267
+ state.bufferedRequestCount += 1;
21268
+ } else doWrite(stream, state, false, len, chunk, encoding, cb);
21269
+ return ret;
21270
+ }
21271
+ function doWrite(stream, state, writev, len, chunk, encoding, cb) {
21272
+ state.writelen = len;
21273
+ state.writecb = cb;
21274
+ state.writing = true;
21275
+ state.sync = true;
21276
+ if (writev) stream._writev(chunk, state.onwrite);
21277
+ else stream._write(chunk, encoding, state.onwrite);
21278
+ state.sync = false;
21279
+ }
21280
+ function onwriteError(stream, state, sync, er, cb) {
21281
+ --state.pendingcb;
21282
+ if (sync) nextTick(cb, er);
21283
+ else cb(er);
21284
+ stream._writableState.errorEmitted = true;
21285
+ stream.emit("error", er);
21286
+ }
21287
+ function onwriteStateUpdate(state) {
21288
+ state.writing = false;
21289
+ state.writecb = null;
21290
+ state.length -= state.writelen;
21291
+ state.writelen = 0;
21292
+ }
21293
+ function onwrite(stream, er) {
21294
+ var state = stream._writableState;
21295
+ var sync = state.sync;
21296
+ var cb = state.writecb;
21297
+ onwriteStateUpdate(state);
21298
+ if (er) onwriteError(stream, state, sync, er, cb);
21299
+ else {
21300
+ var finished = needFinish(state);
21301
+ if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(stream, state);
21302
+ if (sync) nextTick(afterWrite, stream, state, finished, cb);
21303
+ else afterWrite(stream, state, finished, cb);
21304
+ }
21305
+ }
21306
+ function afterWrite(stream, state, finished, cb) {
21307
+ if (!finished) onwriteDrain(stream, state);
21308
+ state.pendingcb--;
21309
+ cb();
21310
+ finishMaybe(stream, state);
21311
+ }
21312
+ function onwriteDrain(stream, state) {
21313
+ if (state.length === 0 && state.needDrain) {
21314
+ state.needDrain = false;
21315
+ stream.emit("drain");
21316
+ }
21317
+ }
21318
+ function clearBuffer(stream, state) {
21319
+ state.bufferProcessing = true;
21320
+ var entry = state.bufferedRequest;
21321
+ if (stream._writev && entry && entry.next) {
21322
+ var l = state.bufferedRequestCount;
21323
+ var buffer = new Array(l);
21324
+ var holder = state.corkedRequestsFree;
21325
+ holder.entry = entry;
21326
+ var count = 0;
21327
+ while (entry) {
21328
+ buffer[count] = entry;
21329
+ entry = entry.next;
21330
+ count += 1;
21331
+ }
21332
+ doWrite(stream, state, true, state.length, buffer, "", holder.finish);
21333
+ state.pendingcb++;
21334
+ state.lastBufferedRequest = null;
21335
+ if (holder.next) {
21336
+ state.corkedRequestsFree = holder.next;
21337
+ holder.next = null;
21338
+ } else state.corkedRequestsFree = new CorkedRequest(state);
21339
+ } else {
21340
+ while (entry) {
21341
+ var chunk = entry.chunk;
21342
+ var encoding = entry.encoding;
21343
+ var cb = entry.callback;
21344
+ doWrite(stream, state, false, state.objectMode ? 1 : chunk.length, chunk, encoding, cb);
21345
+ entry = entry.next;
21346
+ if (state.writing) break;
21347
+ }
21348
+ if (entry === null) state.lastBufferedRequest = null;
21349
+ }
21350
+ state.bufferedRequestCount = 0;
21351
+ state.bufferedRequest = entry;
21352
+ state.bufferProcessing = false;
21353
+ }
21354
+ Writable.prototype._write = function(chunk, encoding, cb) {
21355
+ cb(/* @__PURE__ */ new Error("not implemented"));
21356
+ };
21357
+ Writable.prototype._writev = null;
21358
+ Writable.prototype.end = function(chunk, encoding, cb) {
21359
+ var state = this._writableState;
21360
+ if (typeof chunk === "function") {
21361
+ cb = chunk;
21362
+ chunk = null;
21363
+ encoding = null;
21364
+ } else if (typeof encoding === "function") {
21365
+ cb = encoding;
21366
+ encoding = null;
21367
+ }
21368
+ if (chunk !== null && chunk !== void 0) this.write(chunk, encoding);
21369
+ if (state.corked) {
21370
+ state.corked = 1;
21371
+ this.uncork();
21372
+ }
21373
+ if (!state.ending && !state.finished) endWritable(this, state, cb);
21374
+ };
21375
+ function needFinish(state) {
21376
+ return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
21377
+ }
21378
+ function prefinish(stream, state) {
21379
+ if (!state.prefinished) {
21380
+ state.prefinished = true;
21381
+ stream.emit("prefinish");
21382
+ }
21383
+ }
21384
+ function finishMaybe(stream, state) {
21385
+ var need = needFinish(state);
21386
+ if (need) if (state.pendingcb === 0) {
21387
+ prefinish(stream, state);
21388
+ state.finished = true;
21389
+ stream.emit("finish");
21390
+ } else prefinish(stream, state);
21391
+ return need;
21392
+ }
21393
+ function endWritable(stream, state, cb) {
21394
+ state.ending = true;
21395
+ finishMaybe(stream, state);
21396
+ if (cb) if (state.finished) nextTick(cb);
21397
+ else stream.once("finish", cb);
21398
+ state.ended = true;
21399
+ stream.writable = false;
21400
+ }
21401
+ function CorkedRequest(state) {
21402
+ var _this = this;
21403
+ this.next = null;
21404
+ this.entry = null;
21405
+ this.finish = function(err) {
21406
+ var entry = _this.entry;
21407
+ _this.entry = null;
21408
+ while (entry) {
21409
+ var cb = entry.callback;
21410
+ state.pendingcb--;
21411
+ cb(err);
21412
+ entry = entry.next;
21413
+ }
21414
+ if (state.corkedRequestsFree) state.corkedRequestsFree.next = _this;
21415
+ else state.corkedRequestsFree = _this;
21416
+ };
21417
+ }
21418
+ //#endregion
21419
+ //#region \0polyfill-node._stream_duplex.js
21420
+ _polyfill_node__inherits_default(Duplex, Readable);
21421
+ var keys = Object.keys(Writable.prototype);
21422
+ for (var v = 0; v < keys.length; v++) {
21423
+ var method = keys[v];
21424
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
21425
+ }
21426
+ function Duplex(options) {
21427
+ if (!(this instanceof Duplex)) return new Duplex(options);
21428
+ Readable.call(this, options);
21429
+ Writable.call(this, options);
21430
+ if (options && options.readable === false) this.readable = false;
21431
+ if (options && options.writable === false) this.writable = false;
21432
+ this.allowHalfOpen = true;
21433
+ if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
21434
+ this.once("end", onend);
21435
+ }
21436
+ function onend() {
21437
+ if (this.allowHalfOpen || this._writableState.ended) return;
21438
+ nextTick(onEndNT, this);
21439
+ }
21440
+ function onEndNT(self) {
21441
+ self.end();
21442
+ }
21443
+ //#endregion
21444
+ //#region src/util/output-type.ts
21445
+ /**
21446
+ * Output type definitions for document generation.
21447
+ *
21448
+ * This module defines the various output formats supported when generating
21449
+ * .docx files. These types correspond to fflate's output formats.
21450
+ *
21451
+ * @module
21452
+ */
21453
+ /**
21454
+ * Converts a Uint8Array to the specified output type.
21455
+ *
21456
+ * This is used by both the Packer and patchDocument to convert fflate's
21457
+ * raw Uint8Array output into the user's requested format.
21458
+ */
21459
+ const convertOutput = (data, type) => {
21460
+ switch (type) {
21461
+ case "nodebuffer": return Buffer.from(data);
21462
+ case "blob": return new Blob([data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
21463
+ case "arraybuffer": return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
21464
+ case "uint8array": return data;
21465
+ case "base64": return btoa(strFromU8(data, true));
21466
+ case "string":
21467
+ case "text":
21468
+ case "binarystring": return strFromU8(data, true);
21469
+ case "array": return [...data];
21470
+ default: return data;
21471
+ }
21472
+ };
21473
+ //#endregion
21474
+ //#region src/file/fonts/obfuscate-ttf-to-odttf.ts
21475
+ /**
21476
+ * Font obfuscation module for embedding fonts in WordprocessingML documents.
21477
+ *
21478
+ * This module implements the OOXML font obfuscation algorithm used to embed
21479
+ * fonts in DOCX documents. Obfuscation is required by the OOXML specification
21480
+ * to prevent simple extraction of embedded font files.
21481
+ *
21482
+ * Reference: ECMA-376 Part 2, Section 11.1 (Font Embedding)
21483
+ *
21484
+ * @module
21485
+ */
21486
+ /** Start offset for obfuscation in the font file */
21487
+ const obfuscatedStartOffset = 0;
21488
+ /** End offset for obfuscation (first 32 bytes are obfuscated) */
21489
+ const obfuscatedEndOffset = 32;
21490
+ /** Expected GUID size (32 hex characters without dashes) */
21491
+ const guidSize = 32;
21492
+ /**
21493
+ * Obfuscates a TrueType font file for embedding in OOXML documents.
21494
+ *
21495
+ * The obfuscation algorithm XORs the first 32 bytes of the font file
21496
+ * with a reversed byte sequence derived from the font's GUID key.
21497
+ * This prevents simple extraction while maintaining font functionality.
21498
+ *
21499
+ * @param buf - The original font file as a byte array
21500
+ * @param fontKey - The GUID key for the font (with or without dashes)
21501
+ * @returns The obfuscated font data
21502
+ * @throws Error if the fontKey is not a valid 32-character GUID
21503
+ *
21504
+ * @example
21505
+ * ```typescript
21506
+ * const fontData = readFileSync("font.ttf");
21507
+ * const fontKey = "00000000-0000-0000-0000-000000000000";
21508
+ * const obfuscatedData = obfuscate(fontData, fontKey);
21509
+ * ```
21510
+ *
21511
+ * @internal
21512
+ */
21513
+ const obfuscate = (buf, fontKey) => {
21514
+ const guid = fontKey.replace(/-/g, "");
21515
+ if (guid.length !== guidSize) throw new Error(`Error: Cannot extract GUID from font filename: ${fontKey}`);
21516
+ const hexNumbers = guid.replace(/(..)/g, "$1 ").trim().split(" ").map((hexString) => parseInt(hexString, 16));
21517
+ hexNumbers.reverse();
21518
+ const obfuscatedBytes = buf.slice(obfuscatedStartOffset, obfuscatedEndOffset).map((byte, i) => byte ^ hexNumbers[i % hexNumbers.length]);
21519
+ const out = new Uint8Array(obfuscatedStartOffset + obfuscatedBytes.length + Math.max(0, buf.length - obfuscatedEndOffset));
21520
+ out.set(buf.slice(0, obfuscatedStartOffset));
21521
+ out.set(obfuscatedBytes, obfuscatedStartOffset);
21522
+ out.set(buf.slice(obfuscatedEndOffset), obfuscatedStartOffset + obfuscatedBytes.length);
21523
+ return out;
21524
+ };
21525
+ //#endregion
21526
+ //#region src/export/formatter.ts
21527
+ /**
21528
+ * Converts XML components into serializable objects ready for XML generation.
21529
+ *
21530
+ * The Formatter is responsible for preparing XML components for serialization by calling
21531
+ * their prepForXml method with the appropriate context. This is a critical step in the
21532
+ * export pipeline that transforms the declarative API objects into XML-compatible structures.
21533
+ *
21534
+ * @example
21535
+ * ```typescript
21536
+ * const formatter = new Formatter();
21537
+ * const paragraph = new Paragraph("Hello World");
21538
+ * const xmlObject = formatter.format(paragraph, context);
21539
+ * ```
21540
+ */
21541
+ var Formatter = class {
21542
+ /**
21543
+ * Formats an XML component into a serializable object.
21544
+ *
21545
+ * @param input - The XML component to format
21546
+ * @param context - The context containing file state and relationships
21547
+ * @returns A serializable XML object structure
21548
+ * @throws Error if the component cannot be formatted correctly
21549
+ */
21550
+ format(input, context = { stack: [] }) {
21551
+ const output = input.prepForXml(context);
21552
+ if (output) return output;
21553
+ else throw new Error("XMLComponent did not format correctly");
21554
+ }
21555
+ };
21556
+ //#endregion
21557
+ //#region src/export/packer/image-replacer.ts
21558
+ /**
21559
+ * Replaces image placeholders with relationship IDs in XML content.
21560
+ *
18377
21561
  * During document compilation, images are referenced using placeholder tokens
18378
21562
  * like {image1.png}. This class replaces those placeholders with the actual
18379
21563
  * relationship IDs used in the OOXML structure.
@@ -18856,32 +22040,6 @@ var Compiler = class {
18856
22040
  }
18857
22041
  };
18858
22042
  //#endregion
18859
- //#region \0@oxc-project+runtime@0.123.0/helpers/asyncToGenerator.js
18860
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
18861
- try {
18862
- var i = n[a](c), u = i.value;
18863
- } catch (n) {
18864
- e(n);
18865
- return;
18866
- }
18867
- i.done ? t(u) : Promise.resolve(u).then(r, o);
18868
- }
18869
- function _asyncToGenerator(n) {
18870
- return function() {
18871
- var t = this, e = arguments;
18872
- return new Promise(function(r, o) {
18873
- var a = n.apply(t, e);
18874
- function _next(n) {
18875
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
18876
- }
18877
- function _throw(n) {
18878
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
18879
- }
18880
- _next(void 0);
18881
- });
18882
- };
18883
- }
18884
- //#endregion
18885
22043
  //#region src/export/packer/packer.ts
18886
22044
  /**
18887
22045
  * Packer module for exporting documents to various output formats.
@@ -18934,11 +22092,8 @@ var Packer = class Packer {
18934
22092
  * @param overrides - Optional array of file overrides for custom XML content
18935
22093
  * @returns A promise resolving to the exported document in the specified format
18936
22094
  */
18937
- static pack(_x, _x2, _x3) {
18938
- var _this = this;
18939
- return _asyncToGenerator(function* (file, type, prettify, overrides = []) {
18940
- return convertOutput(zipSync(_this.compiler.compile(file, convertPrettifyType(prettify), overrides), { level: 6 }), type);
18941
- }).apply(this, arguments);
22095
+ static async pack(file, type, prettify, overrides = []) {
22096
+ return convertOutput(zipSync(this.compiler.compile(file, convertPrettifyType(prettify), overrides), { level: 6 }), type);
18942
22097
  }
18943
22098
  /**
18944
22099
  * Exports a document to a string representation.
@@ -19014,14 +22169,18 @@ var Packer = class Packer {
19014
22169
  * ```
19015
22170
  */
19016
22171
  static toStream(file, prettify, overrides = []) {
22172
+ /* v8 ignore start */
19017
22173
  const stream = new Readable({ read() {} });
22174
+ /* v8 ignore stop */
19018
22175
  try {
19019
22176
  const files = this.compiler.compile(file, convertPrettifyType(prettify), overrides);
19020
22177
  const zip = new Zip((err, chunk, final) => {
22178
+ /* v8 ignore start */
19021
22179
  if (err) {
19022
22180
  stream.destroy(err);
19023
22181
  return;
19024
22182
  }
22183
+ /* v8 ignore stop */
19025
22184
  if (!stream.destroyed) stream.push(chunk);
19026
22185
  if (final) stream.push(null);
19027
22186
  });
@@ -19106,7 +22265,10 @@ const createTextElementContents = (text) => {
19106
22265
  * // Adds xml:space="preserve" to maintain whitespace
19107
22266
  * ```
19108
22267
  */
19109
- const patchSpaceAttribute = (element) => _objectSpread2(_objectSpread2({}, element), {}, { attributes: { "xml:space": "preserve" } });
22268
+ const patchSpaceAttribute = (element) => ({
22269
+ ...element,
22270
+ attributes: { "xml:space": "preserve" }
22271
+ });
19110
22272
  /**
19111
22273
  * Retrieves first-level child elements by parent element name.
19112
22274
  *
@@ -19298,14 +22460,24 @@ const splitRunElement = (runElement, token) => {
19298
22460
  if (e.type === "element" && e.name === "w:t") {
19299
22461
  var _ref, _e$elements;
19300
22462
  const splitText = ((_ref = (_e$elements = e.elements) === null || _e$elements === void 0 || (_e$elements = _e$elements[0]) === null || _e$elements === void 0 ? void 0 : _e$elements.text) !== null && _ref !== void 0 ? _ref : "").split(token);
19301
- const newElements = splitText.map((t) => _objectSpread2(_objectSpread2(_objectSpread2({}, e), patchSpaceAttribute(e)), {}, { elements: createTextElementContents(t) }));
22463
+ const newElements = splitText.map((t) => ({
22464
+ ...e,
22465
+ ...patchSpaceAttribute(e),
22466
+ elements: createTextElementContents(t)
22467
+ }));
19302
22468
  if (splitText.length > 1) splitIndex = i;
19303
22469
  return newElements;
19304
22470
  } else return e;
19305
22471
  }).flat()) !== null && _runElement$elements$ !== void 0 ? _runElement$elements$ : [];
19306
22472
  return {
19307
- left: _objectSpread2(_objectSpread2({}, JSON.parse(JSON.stringify(runElement))), {}, { elements: splitElements.slice(0, splitIndex + 1) }),
19308
- right: _objectSpread2(_objectSpread2({}, JSON.parse(JSON.stringify(runElement))), {}, { elements: splitElements.slice(splitIndex + 1) })
22473
+ left: {
22474
+ ...JSON.parse(JSON.stringify(runElement)),
22475
+ elements: splitElements.slice(0, splitIndex + 1)
22476
+ },
22477
+ right: {
22478
+ ...JSON.parse(JSON.stringify(runElement)),
22479
+ elements: splitElements.slice(splitIndex + 1)
22480
+ }
19309
22481
  };
19310
22482
  };
19311
22483
  //#endregion
@@ -19565,9 +22737,15 @@ const replacer = ({ json, patch, patchText, context, keepOriginalStyles = true }
19565
22737
  const runElementNonTextualElements = runElementToBeReplaced.elements.filter((e) => e.type === "element" && e.name === "w:rPr");
19566
22738
  newRunElements = textJson.map((e) => {
19567
22739
  var _e$elements;
19568
- return _objectSpread2(_objectSpread2({}, e), {}, { elements: [...runElementNonTextualElements, ...(_e$elements = e.elements) !== null && _e$elements !== void 0 ? _e$elements : []] });
22740
+ return {
22741
+ ...e,
22742
+ elements: [...runElementNonTextualElements, ...(_e$elements = e.elements) !== null && _e$elements !== void 0 ? _e$elements : []]
22743
+ };
19569
22744
  });
19570
- patchedRightElement = _objectSpread2(_objectSpread2({}, right), {}, { elements: [...runElementNonTextualElements, ...right.elements] });
22745
+ patchedRightElement = {
22746
+ ...right,
22747
+ elements: [...runElementNonTextualElements, ...right.elements]
22748
+ };
19571
22749
  }
19572
22750
  paragraphElement.elements.splice(index, 1, left, ...newRunElements, patchedRightElement);
19573
22751
  break;
@@ -19653,69 +22831,70 @@ const compareByteArrays = (a, b) => {
19653
22831
  *
19654
22832
  * @publicApi
19655
22833
  */
19656
- const patchDocument = function() {
19657
- var _ref = _asyncToGenerator(function* ({ outputType, data, patches, keepOriginalStyles, placeholderDelimiters = {
19658
- end: "}}",
19659
- start: "{{"
19660
- }, recursive = true }) {
19661
- const zipContent = unzipSync(toUint8Array(data));
19662
- const contexts = /* @__PURE__ */ new Map();
19663
- const file = { Media: new Media() };
19664
- const map = /* @__PURE__ */ new Map();
19665
- const imageRelationshipAdditions = [];
19666
- const hyperlinkRelationshipAdditions = [];
19667
- let hasMedia = false;
19668
- const binaryContentMap = /* @__PURE__ */ new Map();
19669
- for (const [key, value] of Object.entries(zipContent)) {
19670
- const startBytes = value.slice(0, 2);
19671
- if (compareByteArrays(startBytes, UTF16LE) || compareByteArrays(startBytes, UTF16BE)) {
19672
- binaryContentMap.set(key, value);
19673
- continue;
19674
- }
19675
- if (!key.endsWith(".xml") && !key.endsWith(".rels")) {
19676
- binaryContentMap.set(key, value);
19677
- continue;
19678
- }
19679
- const json = toJson(strFromU8(value));
19680
- if (key === "word/document.xml") {
19681
- var _json$elements;
19682
- const document = (_json$elements = json.elements) === null || _json$elements === void 0 ? void 0 : _json$elements.find((i) => i.name === "w:document");
19683
- if (document && document.attributes) {
19684
- for (const ns of [
19685
- "mc",
19686
- "wp",
19687
- "r",
19688
- "w15",
19689
- "m"
19690
- ]) document.attributes[`xmlns:${ns}`] = DocumentAttributeNamespaces[ns];
19691
- document.attributes["mc:Ignorable"] = `${document.attributes["mc:Ignorable"] || ""} w15`.trim();
19692
- }
22834
+ const patchDocument = async ({ outputType, data, patches, keepOriginalStyles, placeholderDelimiters = {
22835
+ end: "}}",
22836
+ start: "{{"
22837
+ }, recursive = true }) => {
22838
+ const zipContent = unzipSync(toUint8Array(data));
22839
+ const contexts = /* @__PURE__ */ new Map();
22840
+ const file = { Media: new Media() };
22841
+ const map = /* @__PURE__ */ new Map();
22842
+ const imageRelationshipAdditions = [];
22843
+ const hyperlinkRelationshipAdditions = [];
22844
+ let hasMedia = false;
22845
+ const binaryContentMap = /* @__PURE__ */ new Map();
22846
+ for (const [key, value] of Object.entries(zipContent)) {
22847
+ const startBytes = value.slice(0, 2);
22848
+ if (compareByteArrays(startBytes, UTF16LE) || compareByteArrays(startBytes, UTF16BE)) {
22849
+ binaryContentMap.set(key, value);
22850
+ continue;
22851
+ }
22852
+ if (!key.endsWith(".xml") && !key.endsWith(".rels")) {
22853
+ binaryContentMap.set(key, value);
22854
+ continue;
22855
+ }
22856
+ const json = toJson(strFromU8(value));
22857
+ if (key === "word/document.xml") {
22858
+ var _json$elements;
22859
+ const document = (_json$elements = json.elements) === null || _json$elements === void 0 ? void 0 : _json$elements.find((i) => i.name === "w:document");
22860
+ if (document && document.attributes) {
22861
+ for (const ns of [
22862
+ "mc",
22863
+ "wp",
22864
+ "r",
22865
+ "w15",
22866
+ "m"
22867
+ ]) document.attributes[`xmlns:${ns}`] = DocumentAttributeNamespaces[ns];
22868
+ document.attributes["mc:Ignorable"] = `${document.attributes["mc:Ignorable"] || ""} w15`.trim();
19693
22869
  }
19694
- if (key.startsWith("word/") && !key.endsWith(".xml.rels")) {
19695
- const context = {
19696
- file,
19697
- stack: [],
19698
- viewWrapper: { Relationships: { addRelationship: (linkId, _, target, __) => {
19699
- hyperlinkRelationshipAdditions.push({
19700
- hyperlink: {
19701
- id: linkId,
19702
- link: target
19703
- },
19704
- key
19705
- });
19706
- } } }
19707
- };
19708
- contexts.set(key, context);
19709
- if (!(placeholderDelimiters === null || placeholderDelimiters === void 0 ? void 0 : placeholderDelimiters.start.trim()) || !(placeholderDelimiters === null || placeholderDelimiters === void 0 ? void 0 : placeholderDelimiters.end.trim())) throw new Error("Both start and end delimiters must be non-empty strings.");
19710
- const { start, end } = placeholderDelimiters;
19711
- for (const [patchKey, patchValue] of Object.entries(patches)) {
19712
- const patchText = `${start}${patchKey}${end}`;
19713
- while (true) {
19714
- const { didFindOccurrence } = replacer({
19715
- context,
19716
- json,
19717
- keepOriginalStyles,
19718
- patch: _objectSpread2(_objectSpread2({}, patchValue), {}, { children: patchValue.children.map((element) => {
22870
+ }
22871
+ if (key.startsWith("word/") && !key.endsWith(".xml.rels")) {
22872
+ const context = {
22873
+ file,
22874
+ stack: [],
22875
+ viewWrapper: { Relationships: { addRelationship: (linkId, _, target, __) => {
22876
+ hyperlinkRelationshipAdditions.push({
22877
+ hyperlink: {
22878
+ id: linkId,
22879
+ link: target
22880
+ },
22881
+ key
22882
+ });
22883
+ } } }
22884
+ };
22885
+ contexts.set(key, context);
22886
+ if (!(placeholderDelimiters === null || placeholderDelimiters === void 0 ? void 0 : placeholderDelimiters.start.trim()) || !(placeholderDelimiters === null || placeholderDelimiters === void 0 ? void 0 : placeholderDelimiters.end.trim())) throw new Error("Both start and end delimiters must be non-empty strings.");
22887
+ const { start, end } = placeholderDelimiters;
22888
+ for (const [patchKey, patchValue] of Object.entries(patches)) {
22889
+ const patchText = `${start}${patchKey}${end}`;
22890
+ while (true) {
22891
+ const { didFindOccurrence } = replacer({
22892
+ context,
22893
+ json,
22894
+ keepOriginalStyles,
22895
+ patch: {
22896
+ ...patchValue,
22897
+ children: patchValue.children.map((element) => {
19719
22898
  if (element instanceof ExternalHyperlink) {
19720
22899
  const concreteHyperlink = new ConcreteHyperlink(element.options.children, uniqueId());
19721
22900
  hyperlinkRelationshipAdditions.push({
@@ -19727,63 +22906,60 @@ const patchDocument = function() {
19727
22906
  });
19728
22907
  return concreteHyperlink;
19729
22908
  } else return element;
19730
- }) }),
19731
- patchText
19732
- });
19733
- if (!recursive || !didFindOccurrence) break;
19734
- }
19735
- }
19736
- const mediaDatas = imageReplacer.getMediaData(JSON.stringify(json), context.file.Media);
19737
- if (mediaDatas.length > 0) {
19738
- hasMedia = true;
19739
- imageRelationshipAdditions.push({
19740
- key,
19741
- mediaDatas
22909
+ })
22910
+ },
22911
+ patchText
19742
22912
  });
22913
+ if (!recursive || !didFindOccurrence) break;
19743
22914
  }
19744
22915
  }
19745
- map.set(key, json);
19746
- }
19747
- for (const { key, mediaDatas } of imageRelationshipAdditions) {
19748
- var _map$get;
19749
- const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
19750
- const relationshipsJson = (_map$get = map.get(relationshipKey)) !== null && _map$get !== void 0 ? _map$get : createRelationshipFile();
19751
- map.set(relationshipKey, relationshipsJson);
19752
- const index = getNextRelationshipIndex(relationshipsJson);
19753
- const newJson = imageReplacer.replace(JSON.stringify(map.get(key)), mediaDatas, index);
19754
- map.set(key, JSON.parse(newJson));
19755
- for (let i = 0; i < mediaDatas.length; i++) {
19756
- const { fileName } = mediaDatas[i];
19757
- appendRelationship(relationshipsJson, index + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${fileName}`);
22916
+ const mediaDatas = imageReplacer.getMediaData(JSON.stringify(json), context.file.Media);
22917
+ if (mediaDatas.length > 0) {
22918
+ hasMedia = true;
22919
+ imageRelationshipAdditions.push({
22920
+ key,
22921
+ mediaDatas
22922
+ });
19758
22923
  }
19759
22924
  }
19760
- for (const { key, hyperlink } of hyperlinkRelationshipAdditions) {
19761
- var _map$get2;
19762
- const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
19763
- const relationshipsJson = (_map$get2 = map.get(relationshipKey)) !== null && _map$get2 !== void 0 ? _map$get2 : createRelationshipFile();
19764
- map.set(relationshipKey, relationshipsJson);
19765
- appendRelationship(relationshipsJson, hyperlink.id, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hyperlink.link, TargetModeType.EXTERNAL);
22925
+ map.set(key, json);
22926
+ }
22927
+ for (const { key, mediaDatas } of imageRelationshipAdditions) {
22928
+ var _map$get;
22929
+ const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
22930
+ const relationshipsJson = (_map$get = map.get(relationshipKey)) !== null && _map$get !== void 0 ? _map$get : createRelationshipFile();
22931
+ map.set(relationshipKey, relationshipsJson);
22932
+ const index = getNextRelationshipIndex(relationshipsJson);
22933
+ const newJson = imageReplacer.replace(JSON.stringify(map.get(key)), mediaDatas, index);
22934
+ map.set(key, JSON.parse(newJson));
22935
+ for (let i = 0; i < mediaDatas.length; i++) {
22936
+ const { fileName } = mediaDatas[i];
22937
+ appendRelationship(relationshipsJson, index + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${fileName}`);
19766
22938
  }
19767
- if (hasMedia) {
19768
- const contentTypesJson = map.get("[Content_Types].xml");
19769
- if (!contentTypesJson) throw new Error("Could not find content types file");
19770
- appendContentType(contentTypesJson, "image/png", "png");
19771
- appendContentType(contentTypesJson, "image/jpeg", "jpeg");
19772
- appendContentType(contentTypesJson, "image/jpeg", "jpg");
19773
- appendContentType(contentTypesJson, "image/bmp", "bmp");
19774
- appendContentType(contentTypesJson, "image/gif", "gif");
19775
- appendContentType(contentTypesJson, "image/svg+xml", "svg");
19776
- }
19777
- const files = {};
19778
- for (const [key, value] of map) files[key] = textToUint8Array(toXml(value));
19779
- for (const [key, value] of binaryContentMap) files[key] = value;
19780
- for (const { data: mediaData, fileName } of file.Media.Array) files[`word/media/${fileName}`] = mediaData instanceof Uint8Array ? mediaData : new Uint8Array(mediaData);
19781
- return convertOutput(zipSync(files, { level: 6 }), outputType);
19782
- });
19783
- return function patchDocument(_x) {
19784
- return _ref.apply(this, arguments);
19785
- };
19786
- }();
22939
+ }
22940
+ for (const { key, hyperlink } of hyperlinkRelationshipAdditions) {
22941
+ var _map$get2;
22942
+ const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
22943
+ const relationshipsJson = (_map$get2 = map.get(relationshipKey)) !== null && _map$get2 !== void 0 ? _map$get2 : createRelationshipFile();
22944
+ map.set(relationshipKey, relationshipsJson);
22945
+ appendRelationship(relationshipsJson, hyperlink.id, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hyperlink.link, TargetModeType.EXTERNAL);
22946
+ }
22947
+ if (hasMedia) {
22948
+ const contentTypesJson = map.get("[Content_Types].xml");
22949
+ if (!contentTypesJson) throw new Error("Could not find content types file");
22950
+ appendContentType(contentTypesJson, "image/png", "png");
22951
+ appendContentType(contentTypesJson, "image/jpeg", "jpeg");
22952
+ appendContentType(contentTypesJson, "image/jpeg", "jpg");
22953
+ appendContentType(contentTypesJson, "image/bmp", "bmp");
22954
+ appendContentType(contentTypesJson, "image/gif", "gif");
22955
+ appendContentType(contentTypesJson, "image/svg+xml", "svg");
22956
+ }
22957
+ const files = {};
22958
+ for (const [key, value] of map) files[key] = textToUint8Array(toXml(value));
22959
+ for (const [key, value] of binaryContentMap) files[key] = value;
22960
+ for (const { data: mediaData, fileName } of file.Media.Array) files[`word/media/${fileName}`] = mediaData instanceof Uint8Array ? mediaData : new Uint8Array(mediaData);
22961
+ return convertOutput(zipSync(files, { level: 6 }), outputType);
22962
+ };
19787
22963
  const toXml = (jsonObj) => {
19788
22964
  return js2xml(jsonObj, { attributeValueFn: (str) => String(str).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;") });
19789
22965
  };
@@ -19832,20 +23008,15 @@ const createRelationshipFile = () => ({
19832
23008
  * });
19833
23009
  * ```
19834
23010
  */
19835
- const patchDetector = function() {
19836
- var _ref = _asyncToGenerator(function* ({ data }) {
19837
- const zipContent = unzipSync(toUint8Array(data));
19838
- const patches = /* @__PURE__ */ new Set();
19839
- for (const [key, value] of Object.entries(zipContent)) {
19840
- if (!key.endsWith(".xml") && !key.endsWith(".rels")) continue;
19841
- if (key.startsWith("word/") && !key.endsWith(".xml.rels")) traverse(toJson(strFromU8(value))).forEach((p) => findPatchKeys(p.text).forEach((patch) => patches.add(patch)));
19842
- }
19843
- return [...patches];
19844
- });
19845
- return function patchDetector(_x) {
19846
- return _ref.apply(this, arguments);
19847
- };
19848
- }();
23011
+ const patchDetector = async ({ data }) => {
23012
+ const zipContent = unzipSync(toUint8Array(data));
23013
+ const patches = /* @__PURE__ */ new Set();
23014
+ for (const [key, value] of Object.entries(zipContent)) {
23015
+ if (!key.endsWith(".xml") && !key.endsWith(".rels")) continue;
23016
+ if (key.startsWith("word/") && !key.endsWith(".xml.rels")) traverse(toJson(strFromU8(value))).forEach((p) => findPatchKeys(p.text).forEach((patch) => patches.add(patch)));
23017
+ }
23018
+ return [...patches];
23019
+ };
19849
23020
  /**
19850
23021
  * Extracts placeholder keys from text using regex pattern.
19851
23022
  *
@@ -19854,8 +23025,7 @@ const patchDetector = function() {
19854
23025
  */
19855
23026
  const findPatchKeys = (text) => {
19856
23027
  var _text$match;
19857
- const pattern = /* @__PURE__ */ new RegExp("(?<=\\{\\{).+?(?=\\}\\})", "gs");
19858
- return (_text$match = text.match(pattern)) !== null && _text$match !== void 0 ? _text$match : [];
23028
+ return (_text$match = text.match(/(?<=\{\{).+?(?=\}\})/gs)) !== null && _text$match !== void 0 ? _text$match : [];
19859
23029
  };
19860
23030
  //#endregion
19861
- export { AbstractNumbering, AlignmentType, AnnotationReference, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, ThematicBreak, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, encodeUtf8, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, standardizeData, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber };
23031
+ export { AbstractNumbering, AlignmentType, AnnotationReference, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, ThematicBreak, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, encodeUtf8, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber };