pdfmake 0.3.7 → 0.3.9

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/build/pdfmake.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! pdfmake v0.3.7, @license MIT, @link http://pdfmake.org */
1
+ /*! pdfmake v0.3.9, @license MIT, @link http://pdfmake.org */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory();
@@ -25,10 +25,62 @@ __webpack_require__.d(__webpack_exports__, {
25
25
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.includes.js
26
26
  var es_array_includes = __webpack_require__(187);
27
27
  // EXTERNAL MODULE: ./node_modules/pdfkit/js/pdfkit.es.js
28
- var pdfkit_es = __webpack_require__(5167);
28
+ var pdfkit_es = __webpack_require__(8259);
29
+ ;// ./src/helpers/variableType.js
30
+ /**
31
+ * @param {any} variable
32
+ * @returns {boolean}
33
+ */
34
+ function isString(variable) {
35
+ return typeof variable === 'string' || variable instanceof String;
36
+ }
37
+
38
+ /**
39
+ * @param {any} variable
40
+ * @returns {boolean}
41
+ */
42
+ function isNumber(variable) {
43
+ return (typeof variable === 'number' || variable instanceof Number) && !Number.isNaN(variable);
44
+ }
45
+
46
+ /**
47
+ * @param {any} variable
48
+ * @returns {boolean}
49
+ */
50
+ function isPositiveInteger(variable) {
51
+ if (!isNumber(variable) || !Number.isInteger(variable) || variable <= 0) {
52
+ return false;
53
+ }
54
+ return true;
55
+ }
56
+
57
+ /**
58
+ * @param {any} variable
59
+ * @returns {boolean}
60
+ */
61
+ function isObject(variable) {
62
+ return variable !== null && !Array.isArray(variable) && !isString(variable) && !isNumber(variable) && typeof variable === 'object';
63
+ }
64
+
65
+ /**
66
+ * @param {any} variable
67
+ * @returns {boolean}
68
+ */
69
+ function isEmptyObject(variable) {
70
+ return isObject(variable) && Object.keys(variable).length === 0;
71
+ }
72
+
73
+ /**
74
+ * @param {any} variable
75
+ * @returns {boolean}
76
+ */
77
+ function isValue(variable) {
78
+ return variable !== undefined && variable !== null;
79
+ }
29
80
  ;// ./src/PDFDocument.js
30
81
  /* provided dependency */ var Buffer = __webpack_require__(783)["Buffer"];
31
82
 
83
+
32
84
  const typeName = (bold, italics) => {
33
85
  let type = 'normal';
34
86
  if (bold && italics) {
@@ -41,7 +93,7 @@ const typeName = (bold, italics) => {
41
93
  return type;
42
94
  };
43
95
  class PDFDocument extends pdfkit_es/* default */.A {
44
- constructor(fonts, images, patterns, attachments, options, virtualfs) {
96
+ constructor(fonts, images, patterns, attachments, options, virtualfs, localAccessPolicy) {
45
97
  if (fonts === void 0) {
46
98
  fonts = {};
47
99
  }
@@ -60,6 +112,9 @@ class PDFDocument extends pdfkit_es/* default */.A {
60
112
  if (virtualfs === void 0) {
61
113
  virtualfs = null;
62
114
  }
115
+ if (localAccessPolicy === void 0) {
116
+ localAccessPolicy = undefined;
117
+ }
63
118
  super(options);
64
119
  this.fonts = {};
65
120
  this.fontCache = {};
@@ -84,6 +139,7 @@ class PDFDocument extends pdfkit_es/* default */.A {
84
139
  this.images = images;
85
140
  this.attachments = attachments;
86
141
  this.virtualfs = virtualfs;
142
+ this.localAccessPolicy = localAccessPolicy;
87
143
  }
88
144
  getFontType(bold, italics) {
89
145
  return typeName(bold, italics);
@@ -108,6 +164,8 @@ class PDFDocument extends pdfkit_es/* default */.A {
108
164
  }
109
165
  if (this.virtualfs && this.virtualfs.existsSync(def[0])) {
110
166
  def[0] = this.virtualfs.readFileSync(def[0]);
167
+ } else {
168
+ this.validateLocalFile(def[0]);
111
169
  }
112
170
  this.fontCache[familyName][type] = this.font(...def)._font;
113
171
  }
@@ -132,8 +190,10 @@ class PDFDocument extends pdfkit_es/* default */.A {
132
190
  return this._imageRegistry[src];
133
191
  }
134
192
  let image;
193
+ let imageSrc = realImageSrc(src);
194
+ this.validateLocalFile(imageSrc);
135
195
  try {
136
- image = this.openImage(realImageSrc(src));
196
+ image = this.openImage(imageSrc);
137
197
  if (!image) {
138
198
  throw new Error('No image');
139
199
  }
@@ -174,8 +234,19 @@ class PDFDocument extends pdfkit_es/* default */.A {
174
234
  if (this.virtualfs && this.virtualfs.existsSync(attachment.src)) {
175
235
  return this.virtualfs.readFileSync(attachment.src);
176
236
  }
237
+ this.validateLocalFile(attachment.src);
177
238
  return attachment;
178
239
  }
240
+ resolveColor(color, defaultColor) {
241
+ color = color || defaultColor;
242
+ if (typeof this._normalizeColor === 'function') {
243
+ if (isString(color) && this._normalizeColor(color) === null) {
244
+ // color is not valid
245
+ return defaultColor;
246
+ }
247
+ }
248
+ return color;
249
+ }
179
250
  setOpenActionAsPrint() {
180
251
  let printActionRef = this.ref({
181
252
  Type: 'Action',
@@ -185,59 +256,29 @@ class PDFDocument extends pdfkit_es/* default */.A {
185
256
  this._root.data.OpenAction = printActionRef;
186
257
  printActionRef.end();
187
258
  }
188
- }
189
- /* harmony default export */ const src_PDFDocument = (PDFDocument);
190
- ;// ./src/helpers/variableType.js
191
- /**
192
- * @param {any} variable
193
- * @returns {boolean}
194
- */
195
- function isString(variable) {
196
- return typeof variable === 'string' || variable instanceof String;
197
- }
198
-
199
- /**
200
- * @param {any} variable
201
- * @returns {boolean}
202
- */
203
- function isNumber(variable) {
204
- return (typeof variable === 'number' || variable instanceof Number) && !Number.isNaN(variable);
205
- }
206
-
207
- /**
208
- * @param {any} variable
209
- * @returns {boolean}
210
- */
211
- function isPositiveInteger(variable) {
212
- if (!isNumber(variable) || !Number.isInteger(variable) || variable <= 0) {
213
- return false;
259
+ file(src, options) {
260
+ if (options === void 0) {
261
+ options = {};
262
+ }
263
+ this.validateLocalFile(src);
264
+ return super.file(src, options);
265
+ }
266
+ validateLocalFile(path) {
267
+ if (typeof this.localAccessPolicy === 'undefined') {
268
+ return;
269
+ }
270
+ if (!isString(path)) {
271
+ return;
272
+ }
273
+ if (/^data:/.test(path)) {
274
+ return;
275
+ }
276
+ if (this.localAccessPolicy(path) !== true) {
277
+ throw new Error(`Access to local file denied by resource access policy: ${path}`);
278
+ }
214
279
  }
215
- return true;
216
- }
217
-
218
- /**
219
- * @param {any} variable
220
- * @returns {boolean}
221
- */
222
- function isObject(variable) {
223
- return variable !== null && !Array.isArray(variable) && !isString(variable) && !isNumber(variable) && typeof variable === 'object';
224
- }
225
-
226
- /**
227
- * @param {any} variable
228
- * @returns {boolean}
229
- */
230
- function isEmptyObject(variable) {
231
- return isObject(variable) && Object.keys(variable).length === 0;
232
- }
233
-
234
- /**
235
- * @param {any} variable
236
- * @returns {boolean}
237
- */
238
- function isValue(variable) {
239
- return variable !== undefined && variable !== null;
240
280
  }
281
+ /* harmony default export */ const src_PDFDocument = (PDFDocument);
241
282
  ;// ./src/helpers/node.js
242
283
 
243
284
  function fontStringify(key, val) {
@@ -4394,6 +4435,7 @@ class DocumentContext extends events.EventEmitter {
4394
4435
  let maxBottomY = this.y;
4395
4436
  let maxBottomPage = this.page;
4396
4437
  let maxBottomAvailableHeight = this.availableHeight;
4438
+ let overflowed = saved.overflowed;
4397
4439
 
4398
4440
  // Pop overflowed snapshots created by moveToNextColumn (snaking columns).
4399
4441
  // Merge their bottomMost values to find the true maximum.
@@ -4411,16 +4453,17 @@ class DocumentContext extends events.EventEmitter {
4411
4453
  if (!saved) {
4412
4454
  return {};
4413
4455
  }
4414
-
4415
- // Apply the max bottom from all overflowed columns to this base snapshot
4416
- if (maxBottomPage > saved.bottomMost.page || maxBottomPage === saved.bottomMost.page && maxBottomY > saved.bottomMost.y) {
4417
- saved.bottomMost = {
4418
- x: saved.x,
4419
- y: maxBottomY,
4420
- page: maxBottomPage,
4421
- availableHeight: maxBottomAvailableHeight,
4422
- availableWidth: saved.availableWidth
4423
- };
4456
+ if (overflowed) {
4457
+ // Apply the max bottom from all overflowed columns to this base snapshot
4458
+ if (maxBottomPage > saved.bottomMost.page || maxBottomPage === saved.bottomMost.page && maxBottomY > saved.bottomMost.y) {
4459
+ saved.bottomMost = {
4460
+ x: saved.x,
4461
+ y: maxBottomY,
4462
+ page: maxBottomPage,
4463
+ availableHeight: maxBottomAvailableHeight,
4464
+ availableWidth: saved.availableWidth
4465
+ };
4466
+ }
4424
4467
  }
4425
4468
  this.calculateBottomMost(saved, endingCell);
4426
4469
  this.x = saved.x;
@@ -4595,10 +4638,9 @@ class DocumentContext extends events.EventEmitter {
4595
4638
  initializePage() {
4596
4639
  this.y = this.pageMargins.top;
4597
4640
  this.availableHeight = this.getCurrentPage().pageSize.height - this.pageMargins.top - this.pageMargins.bottom;
4598
- const {
4599
- pageCtx,
4600
- isSnapshot
4601
- } = this.pageSnapshot();
4641
+ const _this$pageSnapshot = this.pageSnapshot(),
4642
+ pageCtx = _this$pageSnapshot.pageCtx,
4643
+ isSnapshot = _this$pageSnapshot.isSnapshot;
4602
4644
  pageCtx.availableWidth = this.getCurrentPage().pageSize.width - this.pageMargins.left - this.pageMargins.right;
4603
4645
  if (isSnapshot && this.marginXTopParent) {
4604
4646
  pageCtx.availableWidth -= this.marginXTopParent[0];
@@ -5549,9 +5591,17 @@ class PageElementWriter extends src_ElementWriter {
5549
5591
  ;// ./src/TableProcessor.js
5550
5592
 
5551
5593
 
5594
+ const PAGE_BREAK_VALUES = new Set(['before', 'beforeOdd', 'beforeEven', 'after', 'afterOdd', 'afterEven']);
5595
+ const hasExplicitPageBreak = cell => {
5596
+ if (!cell || typeof cell !== 'object') {
5597
+ return false;
5598
+ }
5599
+ return PAGE_BREAK_VALUES.has(cell.pageBreak);
5600
+ };
5552
5601
  class TableProcessor {
5553
5602
  constructor(tableNode) {
5554
5603
  this.tableNode = tableNode;
5604
+ this._isCurrentRowUnbreakable = false;
5555
5605
  }
5556
5606
  beginTable(writer) {
5557
5607
  const getTableInnerContentWidth = () => {
@@ -5690,7 +5740,10 @@ class TableProcessor {
5690
5740
  writer.context().moveDown(this.topLineWidth);
5691
5741
  }
5692
5742
  this.rowTopPageY = writer.context().y + this.rowPaddingTop;
5693
- if (this.dontBreakRows && rowIndex > 0) {
5743
+ const rowCells = this.tableNode.table.body[rowIndex] || [];
5744
+ const rowHasPageBreak = rowCells.some(hasExplicitPageBreak);
5745
+ this._isCurrentRowUnbreakable = this.dontBreakRows && rowIndex > 0 && !rowHasPageBreak;
5746
+ if (this._isCurrentRowUnbreakable) {
5694
5747
  writer.beginUnbreakableBlock();
5695
5748
  }
5696
5749
  this.rowTopY = writer.context().y;
@@ -6083,7 +6136,8 @@ class TableProcessor {
6083
6136
  if (this.headerRows && rowIndex === this.headerRows - 1) {
6084
6137
  this.headerRepeatable = writer.currentBlockToRepeatable();
6085
6138
  }
6086
- if (this.dontBreakRows) {
6139
+ const shouldCommitCurrentRowUnbreakable = this.dontBreakRows && (rowIndex === 0 || this._isCurrentRowUnbreakable);
6140
+ if (shouldCommitCurrentRowUnbreakable) {
6087
6141
  const pageChangedCallback = () => {
6088
6142
  if (rowIndex > 0 && !this.headerRows && this.layout.hLineWhenBroken !== false) {
6089
6143
  // Draw the top border of the row after a page break
@@ -6094,6 +6148,7 @@ class TableProcessor {
6094
6148
  writer.commitUnbreakableBlock();
6095
6149
  writer.removeListener('pageChanged', pageChangedCallback);
6096
6150
  }
6151
+ this._isCurrentRowUnbreakable = false;
6097
6152
  if (this.headerRepeatable && (rowIndex === this.rowsWithoutPageBreak - 1 || rowIndex === this.tableNode.table.body.length - 1)) {
6098
6153
  writer.commitUnbreakableBlock();
6099
6154
  writer.pushToRepeatables(this.headerRepeatable);
@@ -6983,19 +7038,21 @@ class LayoutBuilder {
6983
7038
  return null;
6984
7039
  }
6985
7040
  processRow(_ref) {
6986
- let {
6987
- marginX = [0, 0],
6988
- dontBreakRows = false,
6989
- rowsWithoutPageBreak = 0,
6990
- cells,
6991
- widths,
6992
- gaps,
6993
- tableNode,
6994
- tableBody,
6995
- rowIndex,
6996
- height,
6997
- snakingColumns = false
6998
- } = _ref;
7041
+ let _ref$marginX = _ref.marginX,
7042
+ marginX = _ref$marginX === void 0 ? [0, 0] : _ref$marginX,
7043
+ _ref$dontBreakRows = _ref.dontBreakRows,
7044
+ dontBreakRows = _ref$dontBreakRows === void 0 ? false : _ref$dontBreakRows,
7045
+ _ref$rowsWithoutPageB = _ref.rowsWithoutPageBreak,
7046
+ rowsWithoutPageBreak = _ref$rowsWithoutPageB === void 0 ? 0 : _ref$rowsWithoutPageB,
7047
+ cells = _ref.cells,
7048
+ widths = _ref.widths,
7049
+ gaps = _ref.gaps,
7050
+ tableNode = _ref.tableNode,
7051
+ tableBody = _ref.tableBody,
7052
+ rowIndex = _ref.rowIndex,
7053
+ height = _ref.height,
7054
+ _ref$snakingColumns = _ref.snakingColumns,
7055
+ snakingColumns = _ref$snakingColumns === void 0 ? false : _ref$snakingColumns;
6999
7056
  const isUnbreakableRow = dontBreakRows || rowIndex <= rowsWithoutPageBreak - 1;
7000
7057
  let pageBreaks = [];
7001
7058
  let pageBreaksByRowSpan = [];
@@ -7055,11 +7112,13 @@ class LayoutBuilder {
7055
7112
  // We store a reference of the ending cell in the first cell of the rowspan
7056
7113
  cell._endingCell = rowSpanRightEndingCell;
7057
7114
  cell._endingCell._startingRowSpanY = cell._startingRowSpanY;
7115
+ cell._endingCell._startingRowSpanPage = cell._startingRowSpanPage;
7058
7116
  }
7059
7117
  if (rowSpanLeftEndingCell) {
7060
7118
  // We store a reference of the left ending cell in the first cell of the rowspan
7061
7119
  cell._leftEndingCell = rowSpanLeftEndingCell;
7062
7120
  cell._leftEndingCell._startingRowSpanY = cell._startingRowSpanY;
7121
+ cell._leftEndingCell._startingRowSpanPage = cell._startingRowSpanPage;
7063
7122
  }
7064
7123
 
7065
7124
  // If we are after a cell that started a rowspan
@@ -7094,7 +7153,13 @@ class LayoutBuilder {
7094
7153
  if (dontBreakRows) {
7095
7154
  // Calculate how many points we have to discount to Y when dontBreakRows and rowSpan are combined
7096
7155
  const ctxBeforeRowSpanLastRow = this.writer.contextStack[this.writer.contextStack.length - 1];
7097
- discountY = ctxBeforeRowSpanLastRow.y - cell._startingRowSpanY;
7156
+ const startsOnCurrentPage = typeof cell._startingRowSpanPage === 'number' && cell._startingRowSpanPage === ctxBeforeRowSpanLastRow.page;
7157
+ if (startsOnCurrentPage && typeof cell._startingRowSpanY === 'number') {
7158
+ discountY = ctxBeforeRowSpanLastRow.y - cell._startingRowSpanY;
7159
+ }
7160
+
7161
+ // Do not increase Y by applying a negative discount.
7162
+ discountY = Math.max(0, discountY);
7098
7163
  }
7099
7164
  let originalXOffset = 0;
7100
7165
  // If context was saved from an unbreakable block and we are not in an unbreakable block anymore
@@ -7256,6 +7321,7 @@ class LayoutBuilder {
7256
7321
  tableNode.table.body[i].forEach(cell => {
7257
7322
  if (cell.rowSpan && cell.rowSpan > 1) {
7258
7323
  cell._startingRowSpanY = this.writer.context().y;
7324
+ cell._startingRowSpanPage = this.writer.context().page;
7259
7325
  }
7260
7326
  });
7261
7327
  }
@@ -7603,7 +7669,7 @@ class SVGMeasure {
7603
7669
  /* harmony default export */ const src_SVGMeasure = (SVGMeasure);
7604
7670
  ;// ./src/TextDecorator.js
7605
7671
 
7606
- const groupDecorations = line => {
7672
+ const groupDecorations = (line, pdfDocument) => {
7607
7673
  let groups = [];
7608
7674
  let currentGroup = null;
7609
7675
  for (let i = 0, l = line.inlines.length; i < l; i++) {
@@ -7616,7 +7682,7 @@ const groupDecorations = line => {
7616
7682
  if (!Array.isArray(decoration)) {
7617
7683
  decoration = [decoration];
7618
7684
  }
7619
- let color = inline.decorationColor || inline.color || 'black';
7685
+ let color = pdfDocument.resolveColor(pdfDocument.resolveColor(inline.decorationColor, inline.color), 'black');
7620
7686
  let style = inline.decorationStyle || 'solid';
7621
7687
  let thickness = isNumber(inline.decorationThickness) ? inline.decorationThickness : null;
7622
7688
  for (let ii = 0, ll = decoration.length; ii < ll; ii++) {
@@ -7646,10 +7712,10 @@ class TextDecorator {
7646
7712
  let height = line.getHeight();
7647
7713
  for (let i = 0, l = line.inlines.length; i < l; i++) {
7648
7714
  let inline = line.inlines[i];
7649
- if (!inline.background) {
7715
+ let color = this.pdfDocument.resolveColor(inline.background, undefined);
7716
+ if (!color) {
7650
7717
  continue;
7651
7718
  }
7652
- let color = inline.background;
7653
7719
  let patternColor = this.pdfDocument.providePattern(inline.background);
7654
7720
  if (patternColor !== null) {
7655
7721
  color = patternColor;
@@ -7659,7 +7725,7 @@ class TextDecorator {
7659
7725
  }
7660
7726
  }
7661
7727
  drawDecorations(line, x, y) {
7662
- let groups = groupDecorations(line);
7728
+ let groups = groupDecorations(line, this.pdfDocument);
7663
7729
  for (let i = 0, l = groups.length; i < l; i++) {
7664
7730
  this._drawDecoration(groups[i], x, y);
7665
7731
  }
@@ -7921,7 +7987,7 @@ class Renderer {
7921
7987
  }
7922
7988
  let opacity = isNumber(inline.opacity) ? inline.opacity : 1;
7923
7989
  this.pdfDocument.opacity(opacity);
7924
- this.pdfDocument.fill(inline.color || 'black');
7990
+ this.pdfDocument.fill(this.pdfDocument.resolveColor(inline.color, 'black'));
7925
7991
  this.pdfDocument._font = inline.font;
7926
7992
  this.pdfDocument.fontSize(inline.fontSize);
7927
7993
  let shiftedY = offsetText(y + shiftToBaseline, inline);
@@ -8014,14 +8080,14 @@ class Renderer {
8014
8080
  let fillOpacity = isNumber(vector.fillOpacity) ? vector.fillOpacity : 1;
8015
8081
  let strokeOpacity = isNumber(vector.strokeOpacity) ? vector.strokeOpacity : 1;
8016
8082
  if (vector.color && vector.lineColor) {
8017
- this.pdfDocument.fillColor(vector.color, fillOpacity);
8018
- this.pdfDocument.strokeColor(vector.lineColor, strokeOpacity);
8083
+ this.pdfDocument.fillColor(this.pdfDocument.resolveColor(vector.color, 'black'), fillOpacity);
8084
+ this.pdfDocument.strokeColor(this.pdfDocument.resolveColor(vector.lineColor, 'black'), strokeOpacity);
8019
8085
  this.pdfDocument.fillAndStroke();
8020
8086
  } else if (vector.color) {
8021
- this.pdfDocument.fillColor(vector.color, fillOpacity);
8087
+ this.pdfDocument.fillColor(this.pdfDocument.resolveColor(vector.color, 'black'), fillOpacity);
8022
8088
  this.pdfDocument.fill();
8023
8089
  } else {
8024
- this.pdfDocument.strokeColor(vector.lineColor || 'black', strokeOpacity);
8090
+ this.pdfDocument.strokeColor(this.pdfDocument.resolveColor(vector.lineColor, 'black'), strokeOpacity);
8025
8091
  this.pdfDocument.stroke();
8026
8092
  }
8027
8093
  }
@@ -8161,7 +8227,7 @@ class Renderer {
8161
8227
  }
8162
8228
  renderWatermark(page) {
8163
8229
  let watermark = page.watermark;
8164
- this.pdfDocument.fill(watermark.color);
8230
+ this.pdfDocument.fill(this.pdfDocument.resolveColor(watermark.color, 'black'));
8165
8231
  this.pdfDocument.opacity(watermark.opacity);
8166
8232
  this.pdfDocument.save();
8167
8233
  this.pdfDocument.rotate(watermark.angle, {
@@ -8193,11 +8259,13 @@ class PdfPrinter {
8193
8259
  * @param {object} fontDescriptors font definition dictionary
8194
8260
  * @param {object} virtualfs
8195
8261
  * @param {object} urlResolver
8262
+ * @param {(path: string) => boolean} localAccessPolicy
8196
8263
  */
8197
- constructor(fontDescriptors, virtualfs, urlResolver) {
8264
+ constructor(fontDescriptors, virtualfs, urlResolver, localAccessPolicy) {
8198
8265
  this.fontDescriptors = fontDescriptors;
8199
8266
  this.virtualfs = virtualfs;
8200
8267
  this.urlResolver = urlResolver;
8268
+ this.localAccessPolicy = localAccessPolicy;
8201
8269
  }
8202
8270
 
8203
8271
  /**
@@ -8246,7 +8314,7 @@ class PdfPrinter {
8246
8314
  info: createMetadata(docDefinition),
8247
8315
  font: null
8248
8316
  };
8249
- this.pdfKitDoc = new src_PDFDocument(this.fontDescriptors, docDefinition.images, docDefinition.patterns, docDefinition.attachments, pdfOptions, this.virtualfs);
8317
+ this.pdfKitDoc = new src_PDFDocument(this.fontDescriptors, docDefinition.images, docDefinition.patterns, docDefinition.attachments, pdfOptions, this.virtualfs, this.localAccessPolicy);
8250
8318
  embedFiles(docDefinition, this.pdfKitDoc);
8251
8319
  const builder = new src_LayoutBuilder(pageSize, normalizePageMargin(docDefinition.pageMargins), new src_SVGMeasure());
8252
8320
  builder.registerTableLayouts(tableLayouts);
@@ -8451,23 +8519,55 @@ function calculatePageHeight(page, margins) {
8451
8519
  // EXTERNAL MODULE: ./src/virtual-fs.js
8452
8520
  var virtual_fs = __webpack_require__(6811);
8453
8521
  ;// ./src/URLResolver.js
8454
- async function fetchUrl(url, headers) {
8522
+ const MAX_REDIRECTS = 30;
8523
+
8524
+ /**
8525
+ * @param {string} url
8526
+ * @param {object} headers
8527
+ * @param {(url: string) => boolean} urlAccessPolicy
8528
+ * @returns {Promise<Response>}
8529
+ */
8530
+ async function fetchUrl(url, headers, urlAccessPolicy) {
8455
8531
  if (headers === void 0) {
8456
8532
  headers = {};
8457
8533
  }
8458
- try {
8459
- const response = await fetch(url, {
8460
- headers
8461
- });
8462
- if (!response.ok) {
8463
- throw new Error(`Failed to fetch (status code: ${response.status}, url: "${url}")`);
8534
+ for (let i = 0; i <= MAX_REDIRECTS; i++) {
8535
+ if (typeof urlAccessPolicy !== 'undefined' && urlAccessPolicy(url) !== true) {
8536
+ throw new Error(`Access to URL denied by resource access policy: ${url}`);
8537
+ }
8538
+ try {
8539
+ let response = await fetch(url, {
8540
+ headers,
8541
+ redirect: 'manual'
8542
+ });
8543
+
8544
+ // redirect url
8545
+ if (response.status >= 300 && response.status < 400) {
8546
+ let location = response.headers.get('location');
8547
+ if (!location) {
8548
+ throw new Error('Redirect response missing Location header');
8549
+ }
8550
+ url = new URL(location, url).href;
8551
+ continue;
8552
+ }
8553
+
8554
+ // browsers do not support redirect: 'manual'
8555
+ if (response.type === 'opaqueredirect') {
8556
+ response = await fetch(url, {
8557
+ headers
8558
+ });
8559
+ }
8560
+ if (!response.ok) {
8561
+ throw new Error(`Failed to fetch (status code: ${response.status})`);
8562
+ }
8563
+ return response;
8564
+ } catch (error) {
8565
+ throw new Error(`Network request failed (url: "${url}", error: ${error.message})`, {
8566
+ cause: error
8567
+ });
8464
8568
  }
8465
- return await response.arrayBuffer();
8466
- } catch (error) {
8467
- throw new Error(`Network request failed (url: "${url}", error: ${error.message})`, {
8468
- cause: error
8469
- });
8470
8569
  }
8570
+ throw new Error(`Network request failed (url: "${url}", error: Too many redirects)`);
8471
8571
  }
8472
8572
  class URLResolver {
8473
8573
  constructor(fs) {
@@ -8491,10 +8591,15 @@ class URLResolver {
8491
8591
  if (this.fs.existsSync(url)) {
8492
8592
  return; // url was downloaded earlier
8493
8593
  }
8494
- if (typeof this.urlAccessPolicy !== 'undefined' && this.urlAccessPolicy(url) !== true) {
8495
- throw new Error(`Access to URL denied by resource access policy: ${url}`);
8594
+ const response = await fetchUrl(url, headers, this.urlAccessPolicy);
8595
+
8596
+ // validate access policy on redirected url (in browsers, only the final URL is validated)
8597
+ if (response.redirected) {
8598
+ if (typeof this.urlAccessPolicy !== 'undefined' && this.urlAccessPolicy(response.url) !== true) {
8599
+ throw new Error(`Access to URL denied by resource access policy: ${response.url}`);
8600
+ }
8496
8601
  }
8497
- const buffer = await fetchUrl(url, headers);
8602
+ const buffer = await response.arrayBuffer();
8498
8603
  this.fs.writeFileSync(url, buffer);
8499
8604
  }
8500
8605
  // else cannot be resolved
@@ -8520,6 +8625,7 @@ class pdfmake {
8520
8625
  constructor() {
8521
8626
  this.virtualfs = virtual_fs["default"];
8522
8627
  this.urlAccessPolicy = undefined;
8628
+ this.localAccessPolicy = undefined;
8523
8629
  }
8524
8630
 
8525
8631
  /**
@@ -8543,9 +8649,12 @@ class pdfmake {
8543
8649
  if (typeof this.urlAccessPolicy === 'undefined' && isServer) {
8544
8650
  console.warn('No URL access policy defined. Consider using setUrlAccessPolicy() to restrict external resource downloads.');
8545
8651
  }
8652
+ if (typeof this.localAccessPolicy === 'undefined' && isServer) {
8653
+ console.warn('No local access policy defined. Consider using setLocalAccessPolicy() to restrict local file system access.');
8654
+ }
8546
8655
  let urlResolver = new src_URLResolver(this.virtualfs);
8547
8656
  urlResolver.setUrlAccessPolicy(this.urlAccessPolicy);
8548
- let printer = new Printer(this.fonts, this.virtualfs, urlResolver);
8657
+ let printer = new Printer(this.fonts, this.virtualfs, urlResolver, this.localAccessPolicy);
8549
8658
  const pdfDocumentPromise = printer.createPdfKitDocument(docDefinition, options);
8550
8659
  return this._transformToDocument(pdfDocumentPromise);
8551
8660
  }
@@ -8648,7 +8757,7 @@ class OutputDocument {
8648
8757
  }
8649
8758
  /* harmony default export */ const src_OutputDocument = (OutputDocument);
8650
8759
  // EXTERNAL MODULE: ./node_modules/file-saver/dist/FileSaver.min.js
8651
- var FileSaver_min = __webpack_require__(6457);
8760
+ var FileSaver_min = __webpack_require__(7286);
8652
8761
  ;// ./src/browser-extensions/OutputDocumentBrowser.js
8653
8762
 
8654
8763
 
@@ -14553,7 +14662,10 @@ class StateMachine {
14553
14662
  */
14554
14663
 
14555
14664
  apply(str, actions) {
14556
- for (var [start, end, tags] of this.match(str)) {
14665
+ for (var _ref of this.match(str)) {
14666
+ var start = _ref[0];
14667
+ var end = _ref[1];
14668
+ var tags = _ref[2];
14557
14669
  for (var tag of tags) {
14558
14670
  if (typeof actions[tag] === 'function') {
14559
14671
  actions[tag](start, end, str.slice(start, end + 1));
@@ -14680,370 +14792,6 @@ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
14680
14792
 
14681
14793
  /***/ },
14682
14794
 
14683
- /***/ 336
14684
- (module, __unused_webpack_exports, __webpack_require__) {
14685
-
14686
- "use strict";
14687
- /* provided dependency */ var Buffer = __webpack_require__(783)["Buffer"];
14688
-
14689
-
14690
- __webpack_require__(187);
14691
- /*
14692
- * MIT LICENSE
14693
- * Copyright (c) 2011 Devon Govett
14694
- *
14695
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this
14696
- * software and associated documentation files (the "Software"), to deal in the Software
14697
- * without restriction, including without limitation the rights to use, copy, modify, merge,
14698
- * publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
14699
- * to whom the Software is furnished to do so, subject to the following conditions:
14700
- *
14701
- * The above copyright notice and this permission notice shall be included in all copies or
14702
- * substantial portions of the Software.
14703
- *
14704
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
14705
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14706
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14707
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
14708
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14709
- */
14710
-
14711
- const fs = __webpack_require__(2416);
14712
- const zlib = __webpack_require__(6729);
14713
- module.exports = class PNG {
14714
- static decode(path, fn) {
14715
- return fs.readFile(path, function (err, file) {
14716
- const png = new PNG(file);
14717
- return png.decode(pixels => fn(pixels));
14718
- });
14719
- }
14720
- static load(path) {
14721
- const file = fs.readFileSync(path);
14722
- return new PNG(file);
14723
- }
14724
- constructor(data) {
14725
- let i;
14726
- this.data = data;
14727
- this.pos = 8; // Skip the default header
14728
-
14729
- this.palette = [];
14730
- this.imgData = [];
14731
- this.transparency = {};
14732
- this.text = {};
14733
- while (true) {
14734
- const chunkSize = this.readUInt32();
14735
- let section = '';
14736
- for (i = 0; i < 4; i++) {
14737
- section += String.fromCharCode(this.data[this.pos++]);
14738
- }
14739
- switch (section) {
14740
- case 'IHDR':
14741
- // we can grab interesting values from here (like width, height, etc)
14742
- this.width = this.readUInt32();
14743
- this.height = this.readUInt32();
14744
- this.bits = this.data[this.pos++];
14745
- this.colorType = this.data[this.pos++];
14746
- this.compressionMethod = this.data[this.pos++];
14747
- this.filterMethod = this.data[this.pos++];
14748
- this.interlaceMethod = this.data[this.pos++];
14749
- break;
14750
- case 'PLTE':
14751
- this.palette = this.read(chunkSize);
14752
- break;
14753
- case 'IDAT':
14754
- for (i = 0; i < chunkSize; i++) {
14755
- this.imgData.push(this.data[this.pos++]);
14756
- }
14757
- break;
14758
- case 'tRNS':
14759
- // This chunk can only occur once and it must occur after the
14760
- // PLTE chunk and before the IDAT chunk.
14761
- this.transparency = {};
14762
- switch (this.colorType) {
14763
- case 3:
14764
- // Indexed color, RGB. Each byte in this chunk is an alpha for
14765
- // the palette index in the PLTE ("palette") chunk up until the
14766
- // last non-opaque entry. Set up an array, stretching over all
14767
- // palette entries which will be 0 (opaque) or 1 (transparent).
14768
- this.transparency.indexed = this.read(chunkSize);
14769
- var short = 255 - this.transparency.indexed.length;
14770
- if (short > 0) {
14771
- for (i = 0; i < short; i++) {
14772
- this.transparency.indexed.push(255);
14773
- }
14774
- }
14775
- break;
14776
- case 0:
14777
- // Greyscale. Corresponding to entries in the PLTE chunk.
14778
- // Grey is two bytes, range 0 .. (2 ^ bit-depth) - 1
14779
- this.transparency.grayscale = this.read(chunkSize)[0];
14780
- break;
14781
- case 2:
14782
- // True color with proper alpha channel.
14783
- this.transparency.rgb = this.read(chunkSize);
14784
- break;
14785
- }
14786
- break;
14787
- case 'tEXt':
14788
- var text = this.read(chunkSize);
14789
- var index = text.indexOf(0);
14790
- var key = String.fromCharCode.apply(String, text.slice(0, index));
14791
- this.text[key] = String.fromCharCode.apply(String, text.slice(index + 1));
14792
- break;
14793
- case 'IEND':
14794
- // we've got everything we need!
14795
- switch (this.colorType) {
14796
- case 0:
14797
- case 3:
14798
- case 4:
14799
- this.colors = 1;
14800
- break;
14801
- case 2:
14802
- case 6:
14803
- this.colors = 3;
14804
- break;
14805
- }
14806
- this.hasAlphaChannel = [4, 6].includes(this.colorType);
14807
- var colors = this.colors + (this.hasAlphaChannel ? 1 : 0);
14808
- this.pixelBitlength = this.bits * colors;
14809
- switch (this.colors) {
14810
- case 1:
14811
- this.colorSpace = 'DeviceGray';
14812
- break;
14813
- case 3:
14814
- this.colorSpace = 'DeviceRGB';
14815
- break;
14816
- }
14817
- this.imgData = new Buffer(this.imgData);
14818
- return;
14819
- // removed by dead control flow
14820
-
14821
- default:
14822
- // unknown (or unimportant) section, skip it
14823
- this.pos += chunkSize;
14824
- }
14825
- this.pos += 4; // Skip the CRC
14826
-
14827
- if (this.pos > this.data.length) {
14828
- throw new Error('Incomplete or corrupt PNG file');
14829
- }
14830
- }
14831
- }
14832
- read(bytes) {
14833
- const result = new Array(bytes);
14834
- for (let i = 0; i < bytes; i++) {
14835
- result[i] = this.data[this.pos++];
14836
- }
14837
- return result;
14838
- }
14839
- readUInt32() {
14840
- const b1 = this.data[this.pos++] << 24;
14841
- const b2 = this.data[this.pos++] << 16;
14842
- const b3 = this.data[this.pos++] << 8;
14843
- const b4 = this.data[this.pos++];
14844
- return b1 | b2 | b3 | b4;
14845
- }
14846
- readUInt16() {
14847
- const b1 = this.data[this.pos++] << 8;
14848
- const b2 = this.data[this.pos++];
14849
- return b1 | b2;
14850
- }
14851
- decodePixels(fn) {
14852
- return zlib.inflate(this.imgData, (err, data) => {
14853
- if (err) {
14854
- throw err;
14855
- }
14856
- const {
14857
- width,
14858
- height
14859
- } = this;
14860
- const pixelBytes = this.pixelBitlength / 8;
14861
- const pixels = new Buffer(width * height * pixelBytes);
14862
- const {
14863
- length
14864
- } = data;
14865
- let pos = 0;
14866
- function pass(x0, y0, dx, dy, singlePass) {
14867
- if (singlePass === void 0) {
14868
- singlePass = false;
14869
- }
14870
- const w = Math.ceil((width - x0) / dx);
14871
- const h = Math.ceil((height - y0) / dy);
14872
- const scanlineLength = pixelBytes * w;
14873
- const buffer = singlePass ? pixels : new Buffer(scanlineLength * h);
14874
- let row = 0;
14875
- let c = 0;
14876
- while (row < h && pos < length) {
14877
- var byte, col, i, left, upper;
14878
- switch (data[pos++]) {
14879
- case 0:
14880
- // None
14881
- for (i = 0; i < scanlineLength; i++) {
14882
- buffer[c++] = data[pos++];
14883
- }
14884
- break;
14885
- case 1:
14886
- // Sub
14887
- for (i = 0; i < scanlineLength; i++) {
14888
- byte = data[pos++];
14889
- left = i < pixelBytes ? 0 : buffer[c - pixelBytes];
14890
- buffer[c++] = (byte + left) % 256;
14891
- }
14892
- break;
14893
- case 2:
14894
- // Up
14895
- for (i = 0; i < scanlineLength; i++) {
14896
- byte = data[pos++];
14897
- col = (i - i % pixelBytes) / pixelBytes;
14898
- upper = row && buffer[(row - 1) * scanlineLength + col * pixelBytes + i % pixelBytes];
14899
- buffer[c++] = (upper + byte) % 256;
14900
- }
14901
- break;
14902
- case 3:
14903
- // Average
14904
- for (i = 0; i < scanlineLength; i++) {
14905
- byte = data[pos++];
14906
- col = (i - i % pixelBytes) / pixelBytes;
14907
- left = i < pixelBytes ? 0 : buffer[c - pixelBytes];
14908
- upper = row && buffer[(row - 1) * scanlineLength + col * pixelBytes + i % pixelBytes];
14909
- buffer[c++] = (byte + Math.floor((left + upper) / 2)) % 256;
14910
- }
14911
- break;
14912
- case 4:
14913
- // Paeth
14914
- for (i = 0; i < scanlineLength; i++) {
14915
- var paeth, upperLeft;
14916
- byte = data[pos++];
14917
- col = (i - i % pixelBytes) / pixelBytes;
14918
- left = i < pixelBytes ? 0 : buffer[c - pixelBytes];
14919
- if (row === 0) {
14920
- upper = upperLeft = 0;
14921
- } else {
14922
- upper = buffer[(row - 1) * scanlineLength + col * pixelBytes + i % pixelBytes];
14923
- upperLeft = col && buffer[(row - 1) * scanlineLength + (col - 1) * pixelBytes + i % pixelBytes];
14924
- }
14925
- const p = left + upper - upperLeft;
14926
- const pa = Math.abs(p - left);
14927
- const pb = Math.abs(p - upper);
14928
- const pc = Math.abs(p - upperLeft);
14929
- if (pa <= pb && pa <= pc) {
14930
- paeth = left;
14931
- } else if (pb <= pc) {
14932
- paeth = upper;
14933
- } else {
14934
- paeth = upperLeft;
14935
- }
14936
- buffer[c++] = (byte + paeth) % 256;
14937
- }
14938
- break;
14939
- default:
14940
- throw new Error(`Invalid filter algorithm: ${data[pos - 1]}`);
14941
- }
14942
- if (!singlePass) {
14943
- let pixelsPos = ((y0 + row * dy) * width + x0) * pixelBytes;
14944
- let bufferPos = row * scanlineLength;
14945
- for (i = 0; i < w; i++) {
14946
- for (let j = 0; j < pixelBytes; j++) pixels[pixelsPos++] = buffer[bufferPos++];
14947
- pixelsPos += (dx - 1) * pixelBytes;
14948
- }
14949
- }
14950
- row++;
14951
- }
14952
- }
14953
- if (this.interlaceMethod === 1) {
14954
- /*
14955
- 1 6 4 6 2 6 4 6
14956
- 7 7 7 7 7 7 7 7
14957
- 5 6 5 6 5 6 5 6
14958
- 7 7 7 7 7 7 7 7
14959
- 3 6 4 6 3 6 4 6
14960
- 7 7 7 7 7 7 7 7
14961
- 5 6 5 6 5 6 5 6
14962
- 7 7 7 7 7 7 7 7
14963
- */
14964
- pass(0, 0, 8, 8); // 1
14965
- pass(4, 0, 8, 8); // 2
14966
- pass(0, 4, 4, 8); // 3
14967
- pass(2, 0, 4, 4); // 4
14968
- pass(0, 2, 2, 4); // 5
14969
- pass(1, 0, 2, 2); // 6
14970
- pass(0, 1, 1, 2); // 7
14971
- } else {
14972
- pass(0, 0, 1, 1, true);
14973
- }
14974
- return fn(pixels);
14975
- });
14976
- }
14977
- decodePalette() {
14978
- const {
14979
- palette
14980
- } = this;
14981
- const {
14982
- length
14983
- } = palette;
14984
- const transparency = this.transparency.indexed || [];
14985
- const ret = new Buffer(transparency.length + length);
14986
- let pos = 0;
14987
- let c = 0;
14988
- for (let i = 0; i < length; i += 3) {
14989
- var left;
14990
- ret[pos++] = palette[i];
14991
- ret[pos++] = palette[i + 1];
14992
- ret[pos++] = palette[i + 2];
14993
- ret[pos++] = (left = transparency[c++]) != null ? left : 255;
14994
- }
14995
- return ret;
14996
- }
14997
- copyToImageData(imageData, pixels) {
14998
- let j, k;
14999
- let {
15000
- colors
15001
- } = this;
15002
- let palette = null;
15003
- let alpha = this.hasAlphaChannel;
15004
- if (this.palette.length) {
15005
- palette = this._decodedPalette || (this._decodedPalette = this.decodePalette());
15006
- colors = 4;
15007
- alpha = true;
15008
- }
15009
- const data = imageData.data || imageData;
15010
- const {
15011
- length
15012
- } = data;
15013
- const input = palette || pixels;
15014
- let i = j = 0;
15015
- if (colors === 1) {
15016
- while (i < length) {
15017
- k = palette ? pixels[i / 4] * 4 : j;
15018
- const v = input[k++];
15019
- data[i++] = v;
15020
- data[i++] = v;
15021
- data[i++] = v;
15022
- data[i++] = alpha ? input[k++] : 255;
15023
- j = k;
15024
- }
15025
- } else {
15026
- while (i < length) {
15027
- k = palette ? pixels[i / 4] * 4 : j;
15028
- data[i++] = input[k++];
15029
- data[i++] = input[k++];
15030
- data[i++] = input[k++];
15031
- data[i++] = alpha ? input[k++] : 255;
15032
- j = k;
15033
- }
15034
- }
15035
- }
15036
- decode(fn) {
15037
- const ret = new Buffer(this.width * this.height * 4);
15038
- return this.decodePixels(pixels => {
15039
- this.copyToImageData(ret, pixels);
15040
- return fn(ret);
15041
- });
15042
- }
15043
- };
15044
-
15045
- /***/ },
15046
-
15047
14795
  /***/ 182
15048
14796
  (module, __unused_webpack_exports, __webpack_require__) {
15049
14797
 
@@ -15373,9 +15121,8 @@ __webpack_require__(8376);
15373
15121
  __webpack_require__(6401);
15374
15122
  __webpack_require__(2017);
15375
15123
  const inflate = __webpack_require__(3483);
15376
- const {
15377
- swap32LE
15378
- } = __webpack_require__(6016);
15124
+ const _require = __webpack_require__(6016),
15125
+ swap32LE = _require.swap32LE;
15379
15126
 
15380
15127
  // Shift size for getting the index-1 table offset.
15381
15128
  const SHIFT_1 = 6 + 5;
@@ -15466,11 +15213,10 @@ class UnicodeTrie {
15466
15213
  this.data = new Uint32Array(data.buffer);
15467
15214
  } else {
15468
15215
  // pre-parsed data
15469
- ({
15470
- data: this.data,
15471
- highStart: this.highStart,
15472
- errorValue: this.errorValue
15473
- } = data);
15216
+ var _data = data;
15217
+ this.data = _data.data;
15218
+ this.highStart = _data.highStart;
15219
+ this.errorValue = _data.errorValue;
15474
15220
  }
15475
15221
  }
15476
15222
  get(codePoint) {
@@ -15540,7 +15286,7 @@ module.exports = {
15540
15286
 
15541
15287
  /***/ },
15542
15288
 
15543
- /***/ 5167
15289
+ /***/ 8259
15544
15290
  (__unused_webpack_module, exports, __webpack_require__) {
15545
15291
 
15546
15292
  "use strict";
@@ -15566,7 +15312,7 @@ var _aes = __webpack_require__(2651);
15566
15312
  var fontkit = _interopRequireWildcard(__webpack_require__(1715));
15567
15313
  var _events = __webpack_require__(4785);
15568
15314
  var _linebreak = _interopRequireDefault(__webpack_require__(2532));
15569
- var _pngJs = _interopRequireDefault(__webpack_require__(336));
15315
+ var _pngJs = _interopRequireDefault(__webpack_require__(381));
15570
15316
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15571
15317
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15572
15318
  var fs = __webpack_require__(2416);
@@ -16035,13 +15781,17 @@ function rc4(data, key) {
16035
15781
  let j = 0;
16036
15782
  for (let i = 0; i < 256; i++) {
16037
15783
  j = j + s[i] + key[i % key.length] & 0xff;
16038
- [s[i], s[j]] = [s[j], s[i]];
15784
+ var _ref3 = [s[j], s[i]];
15785
+ s[i] = _ref3[0];
15786
+ s[j] = _ref3[1];
16039
15787
  }
16040
15788
  const output = new Uint8Array(data.length);
16041
15789
  for (let i = 0, j = 0, k = 0; k < data.length; k++) {
16042
15790
  i = i + 1 & 0xff;
16043
15791
  j = j + s[i] & 0xff;
16044
- [s[i], s[j]] = [s[j], s[i]];
15792
+ var _ref4 = [s[j], s[i]];
15793
+ s[i] = _ref4[0];
15794
+ s[j] = _ref4[1];
16045
15795
  output[k] = data[k] ^ s[s[i] + s[j] & 0xff];
16046
15796
  }
16047
15797
  return output;
@@ -16480,9 +16230,7 @@ function processPasswordR5() {
16480
16230
  return out;
16481
16231
  }
16482
16232
  const PASSWORD_PADDING = [0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a];
16483
- const {
16484
- number: number$2
16485
- } = PDFObject;
16233
+ const number$2 = PDFObject.number;
16486
16234
  class PDFGradient$1 {
16487
16235
  constructor(doc) {
16488
16236
  this.doc = doc;
@@ -16631,8 +16379,20 @@ class PDFGradient$1 {
16631
16379
  return pattern;
16632
16380
  }
16633
16381
  apply(stroke) {
16634
- const [m0, m1, m2, m3, m4, m5] = this.doc._ctm;
16635
- const [m11, m12, m21, m22, dx, dy] = this.transform;
16382
+ const _this$doc$_ctm = this.doc._ctm,
16383
+ m0 = _this$doc$_ctm[0],
16384
+ m1 = _this$doc$_ctm[1],
16385
+ m2 = _this$doc$_ctm[2],
16386
+ m3 = _this$doc$_ctm[3],
16387
+ m4 = _this$doc$_ctm[4],
16388
+ m5 = _this$doc$_ctm[5];
16389
+ const _this$transform = this.transform,
16390
+ m11 = _this$transform[0],
16391
+ m12 = _this$transform[1],
16392
+ m21 = _this$transform[2],
16393
+ m22 = _this$transform[3],
16394
+ dx = _this$transform[4],
16395
+ dy = _this$transform[5];
16636
16396
  const m = [m0 * m11 + m2 * m12, m1 * m11 + m3 * m12, m0 * m21 + m2 * m22, m1 * m21 + m3 * m22, m0 * dx + m2 * dy + m4, m1 * dx + m3 * dy + m5];
16637
16397
  if (!this.embedded || m.join(' ') !== this.matrix.join(' ')) {
16638
16398
  this.embed(m);
@@ -16704,8 +16464,19 @@ class PDFTilingPattern$1 {
16704
16464
  createPattern() {
16705
16465
  const resources = this.doc.ref();
16706
16466
  resources.end();
16707
- const [m0, m1, m2, m3, m4, m5] = this.doc._ctm;
16708
- const [m11, m12, m21, m22, dx, dy] = [1, 0, 0, 1, 0, 0];
16467
+ const _this$doc$_ctm2 = this.doc._ctm,
16468
+ m0 = _this$doc$_ctm2[0],
16469
+ m1 = _this$doc$_ctm2[1],
16470
+ m2 = _this$doc$_ctm2[2],
16471
+ m3 = _this$doc$_ctm2[3],
16472
+ m4 = _this$doc$_ctm2[4],
16473
+ m5 = _this$doc$_ctm2[5];
16474
+ const m11 = 1,
16475
+ m12 = 0,
16476
+ m21 = 0,
16477
+ m22 = 1,
16478
+ dx = 0,
16479
+ dy = 0;
16709
16480
  const m = [m0 * m11 + m2 * m12, m1 * m11 + m3 * m12, m0 * m21 + m2 * m22, m1 * m21 + m3 * m22, m0 * dx + m2 * dy + m4, m1 * dx + m3 * dy + m5];
16710
16481
  const pattern = this.doc.ref({
16711
16482
  Type: 'Pattern',
@@ -16757,14 +16528,10 @@ class PDFTilingPattern$1 {
16757
16528
  var pattern = {
16758
16529
  PDFTilingPattern: PDFTilingPattern$1
16759
16530
  };
16760
- const {
16761
- PDFGradient,
16762
- PDFLinearGradient,
16763
- PDFRadialGradient
16764
- } = Gradient;
16765
- const {
16766
- PDFTilingPattern
16767
- } = pattern;
16531
+ const PDFGradient = Gradient.PDFGradient,
16532
+ PDFLinearGradient = Gradient.PDFLinearGradient,
16533
+ PDFRadialGradient = Gradient.PDFRadialGradient;
16534
+ const PDFTilingPattern = pattern.PDFTilingPattern;
16768
16535
  var ColorMixin = {
16769
16536
  initColor() {
16770
16537
  this.spotColors = {};
@@ -16873,7 +16640,9 @@ var ColorMixin = {
16873
16640
  }
16874
16641
  const key = `${fillOpacity}_${strokeOpacity}`;
16875
16642
  if (this._opacityRegistry[key]) {
16876
- [dictionary, name] = this._opacityRegistry[key];
16643
+ var _this$_opacityRegistr = this._opacityRegistry[key];
16644
+ dictionary = _this$_opacityRegistr[0];
16645
+ name = _this$_opacityRegistr[1];
16877
16646
  } else {
16878
16647
  dictionary = {
16879
16648
  Type: 'ExtGState'
@@ -17205,11 +16974,15 @@ const parse = function (path) {
17205
16974
  const position = args.length;
17206
16975
  if (position === 0 || position === 1) {
17207
16976
  if (c !== '+' && c !== '-') {
17208
- [newCursor, number] = readNumber(path, i);
16977
+ var _readNumber = readNumber(path, i);
16978
+ newCursor = _readNumber[0];
16979
+ number = _readNumber[1];
17209
16980
  }
17210
16981
  }
17211
16982
  if (position === 2 || position === 5 || position === 6) {
17212
- [newCursor, number] = readNumber(path, i);
16983
+ var _readNumber2 = readNumber(path, i);
16984
+ newCursor = _readNumber2[0];
16985
+ number = _readNumber2[1];
17213
16986
  }
17214
16987
  if (position === 3 || position === 4) {
17215
16988
  if (c === '0') {
@@ -17220,7 +16993,9 @@ const parse = function (path) {
17220
16993
  }
17221
16994
  }
17222
16995
  } else {
17223
- [newCursor, number] = readNumber(path, i);
16996
+ var _readNumber3 = readNumber(path, i);
16997
+ newCursor = _readNumber3[0];
16998
+ number = _readNumber3[1];
17224
16999
  }
17225
17000
  if (number == null) {
17226
17001
  return pathData;
@@ -17403,7 +17178,13 @@ const runners = {
17403
17178
  }
17404
17179
  };
17405
17180
  const solveArc = function (doc, x, y, coords) {
17406
- const [rx, ry, rot, large, sweep, ex, ey] = coords;
17181
+ const rx = coords[0],
17182
+ ry = coords[1],
17183
+ rot = coords[2],
17184
+ large = coords[3],
17185
+ sweep = coords[4],
17186
+ ex = coords[5],
17187
+ ey = coords[6];
17407
17188
  const segs = arcToSegments(ex, ey, rx, ry, large, sweep, rot, x, y);
17408
17189
  for (let seg of segs) {
17409
17190
  const bez = segmentToBezier(...seg);
@@ -17481,9 +17262,7 @@ class SVGPath {
17481
17262
  apply(commands, doc);
17482
17263
  }
17483
17264
  }
17484
- const {
17485
- number: number$1
17486
- } = PDFObject;
17265
+ const number$1 = PDFObject.number;
17487
17266
  const KAPPA = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0);
17488
17267
  var VectorMixin = {
17489
17268
  initVector() {
@@ -17698,7 +17477,12 @@ var VectorMixin = {
17698
17477
  return this;
17699
17478
  }
17700
17479
  const m = this._ctm;
17701
- const [m0, m1, m2, m3, m4, m5] = m;
17480
+ const m0 = m[0],
17481
+ m1 = m[1],
17482
+ m2 = m[2],
17483
+ m3 = m[3],
17484
+ m4 = m[4],
17485
+ m5 = m[5];
17702
17486
  m[0] = m0 * m11 + m2 * m12;
17703
17487
  m[1] = m1 * m11 + m3 * m12;
17704
17488
  m[2] = m0 * m21 + m2 * m22;
@@ -17719,7 +17503,9 @@ var VectorMixin = {
17719
17503
  const sin = Math.sin(rad);
17720
17504
  let x = y = 0;
17721
17505
  if (options.origin != null) {
17722
- [x, y] = options.origin;
17506
+ var _options$origin = options.origin;
17507
+ x = _options$origin[0];
17508
+ y = _options$origin[1];
17723
17509
  const x1 = x * cos - y * sin;
17724
17510
  const y1 = x * sin + y * cos;
17725
17511
  x -= x1;
@@ -17739,7 +17525,9 @@ var VectorMixin = {
17739
17525
  }
17740
17526
  let x = y = 0;
17741
17527
  if (options.origin != null) {
17742
- [x, y] = options.origin;
17528
+ var _options$origin2 = options.origin;
17529
+ x = _options$origin2[0];
17530
+ y = _options$origin2[1];
17743
17531
  x -= xFactor * x;
17744
17532
  y -= yFactor * y;
17745
17533
  }
@@ -18018,14 +17806,13 @@ class StandardFont extends PDFFont {
18018
17806
  this.name = name;
18019
17807
  this.id = id;
18020
17808
  this.font = new AFMFont(STANDARD_FONTS[this.name]());
18021
- ({
18022
- ascender: this.ascender,
18023
- descender: this.descender,
18024
- bbox: this.bbox,
18025
- lineGap: this.lineGap,
18026
- xHeight: this.xHeight,
18027
- capHeight: this.capHeight
18028
- } = this.font);
17809
+ var _this$font = this.font;
17810
+ this.ascender = _this$font.ascender;
17811
+ this.descender = _this$font.descender;
17812
+ this.bbox = _this$font.bbox;
17813
+ this.lineGap = _this$font.lineGap;
17814
+ this.xHeight = _this$font.xHeight;
17815
+ this.capHeight = _this$font.capHeight;
18029
17816
  }
18030
17817
  embed() {
18031
17818
  this.dictionary.data = {
@@ -18144,10 +17931,9 @@ class EmbeddedFont extends PDFFont {
18144
17931
  };
18145
17932
  }
18146
17933
  encode(text, features) {
18147
- const {
18148
- glyphs,
18149
- positions
18150
- } = this.layout(text, features);
17934
+ const _this$layout = this.layout(text, features),
17935
+ glyphs = _this$layout.glyphs,
17936
+ positions = _this$layout.positions;
18151
17937
  const res = [];
18152
17938
  for (let i = 0; i < glyphs.length; i++) {
18153
17939
  const glyph = glyphs[i];
@@ -18191,9 +17977,7 @@ class EmbeddedFont extends PDFFont {
18191
17977
  }
18192
17978
  const tag = [1, 2, 3, 4, 5, 6].map(i => String.fromCharCode((this.id.charCodeAt(i) || 73) + 17)).join('');
18193
17979
  const name = tag + '+' + this.font.postscriptName?.replaceAll(' ', '_');
18194
- const {
18195
- bbox
18196
- } = this.font;
17980
+ const bbox = this.font.bbox;
18197
17981
  const descriptor = this.document.ref({
18198
17982
  Type: 'FontDescriptor',
18199
17983
  FontName: name,
@@ -18349,10 +18133,9 @@ var FontsMixin = {
18349
18133
  }
18350
18134
  if (typeof src === 'string' && this._registeredFonts[src]) {
18351
18135
  cacheKey = src;
18352
- ({
18353
- src,
18354
- family
18355
- } = this._registeredFonts[src]);
18136
+ var _this$_registeredFont = this._registeredFonts[src];
18137
+ src = _this$_registeredFont.src;
18138
+ family = _this$_registeredFont.family;
18356
18139
  } else {
18357
18140
  cacheKey = family || src;
18358
18141
  if (typeof cacheKey !== 'string') {
@@ -18504,9 +18287,7 @@ class LineWrapper extends _events.EventEmitter {
18504
18287
  });
18505
18288
  });
18506
18289
  this.on('lastLine', options => {
18507
- const {
18508
- align
18509
- } = options;
18290
+ const align = options.align;
18510
18291
  if (align === 'justify') {
18511
18292
  options.align = 'left';
18512
18293
  }
@@ -18604,16 +18385,12 @@ class LineWrapper extends _events.EventEmitter {
18604
18385
  let textWidth = 0;
18605
18386
  let wc = 0;
18606
18387
  let lc = 0;
18607
- let {
18608
- y
18609
- } = this.document;
18388
+ let y = this.document.y;
18610
18389
  const emitLine = () => {
18611
18390
  options.textWidth = textWidth + this.wordSpacing * (wc - 1);
18612
18391
  options.wordCount = wc;
18613
18392
  options.lineWidth = this.lineWidth;
18614
- ({
18615
- y
18616
- } = this.document);
18393
+ y = this.document.y;
18617
18394
  this.emit('line', buffer, options, this);
18618
18395
  return lc++;
18619
18396
  };
@@ -18727,9 +18504,7 @@ class LineWrapper extends _events.EventEmitter {
18727
18504
  return true;
18728
18505
  }
18729
18506
  }
18730
- const {
18731
- number
18732
- } = PDFObject;
18507
+ const number = PDFObject.number;
18733
18508
  function formatListLabel(n, listType) {
18734
18509
  if (listType === 'numbered') {
18735
18510
  return `${n}.`;
@@ -18810,10 +18585,8 @@ var TextMixin = {
18810
18585
  },
18811
18586
  boundsOfString(string, x, y, options) {
18812
18587
  options = this._initOptions(x, y, options);
18813
- ({
18814
- x,
18815
- y
18816
- } = this);
18588
+ x = this.x;
18589
+ y = this.y;
18817
18590
  const lineGap = options.lineGap ?? this._lineGap ?? 0;
18818
18591
  const lineHeight = this.currentLineHeight(true) + lineGap;
18819
18592
  let contentWidth = 0;
@@ -18901,10 +18674,8 @@ var TextMixin = {
18901
18674
  };
18902
18675
  },
18903
18676
  heightOfString(text, options) {
18904
- const {
18905
- x,
18906
- y
18907
- } = this;
18677
+ const x = this.x,
18678
+ y = this.y;
18908
18679
  options = this._initOptions(options);
18909
18680
  options.height = Infinity;
18910
18681
  const lineGap = options.lineGap || this._lineGap || 0;
@@ -18954,9 +18725,14 @@ var TextMixin = {
18954
18725
  let item, itemType, labelType, bodyType;
18955
18726
  if (options.structParent) {
18956
18727
  if (options.structTypes) {
18957
- [itemType, labelType, bodyType] = options.structTypes;
18728
+ var _options$structTypes = options.structTypes;
18729
+ itemType = _options$structTypes[0];
18730
+ labelType = _options$structTypes[1];
18731
+ bodyType = _options$structTypes[2];
18958
18732
  } else {
18959
- [itemType, labelType, bodyType] = ['LI', 'Lbl', 'LBody'];
18733
+ itemType = 'LI';
18734
+ labelType = 'Lbl';
18735
+ bodyType = 'LBody';
18960
18736
  }
18961
18737
  }
18962
18738
  if (itemType) {
@@ -19198,7 +18974,9 @@ var TextMixin = {
19198
18974
  encoded = [];
19199
18975
  positions = [];
19200
18976
  for (let word of words) {
19201
- const [encodedWord, positionsWord] = this._font.encode(word, options.features);
18977
+ const _this$_font$encode = this._font.encode(word, options.features),
18978
+ encodedWord = _this$_font$encode[0],
18979
+ positionsWord = _this$_font$encode[1];
19202
18980
  encoded = encoded.concat(encodedWord);
19203
18981
  positions = positions.concat(positionsWord);
19204
18982
  const space = {};
@@ -19211,7 +18989,9 @@ var TextMixin = {
19211
18989
  positions[positions.length - 1] = space;
19212
18990
  }
19213
18991
  } else {
19214
- [encoded, positions] = this._font.encode(text, options.features);
18992
+ var _this$_font$encode2 = this._font.encode(text, options.features);
18993
+ encoded = _this$_font$encode2[0];
18994
+ positions = _this$_font$encode2[1];
19215
18995
  }
19216
18996
  const scale = this._fontSize / 1000;
19217
18997
  const commands = [];
@@ -19401,9 +19181,7 @@ class PNGImage {
19401
19181
  const val = this.image.transparency.grayscale;
19402
19182
  this.obj.data['Mask'] = [val, val];
19403
19183
  } else if (this.image.transparency.rgb) {
19404
- const {
19405
- rgb
19406
- } = this.image.transparency;
19184
+ const rgb = this.image.transparency.rgb;
19407
19185
  const mask = [];
19408
19186
  for (let x of rgb) {
19409
19187
  mask.push(x, x);
@@ -19545,12 +19323,13 @@ var ImagesMixin = {
19545
19323
  if (this.page.xobjects[image.label] == null) {
19546
19324
  this.page.xobjects[image.label] = image.obj;
19547
19325
  }
19548
- let {
19549
- width,
19550
- height
19551
- } = image;
19326
+ let _image = image,
19327
+ width = _image.width,
19328
+ height = _image.height;
19552
19329
  if (!ignoreOrientation && image.orientation > 4) {
19553
- [width, height] = [height, width];
19330
+ var _ref5 = [height, width];
19331
+ width = _ref5[0];
19332
+ height = _ref5[1];
19554
19333
  }
19555
19334
  let w = options.width || width;
19556
19335
  let h = options.height || height;
@@ -19566,7 +19345,9 @@ var ImagesMixin = {
19566
19345
  w = width * options.scale;
19567
19346
  h = height * options.scale;
19568
19347
  } else if (options.fit) {
19569
- [bw, bh] = options.fit;
19348
+ var _options$fit = options.fit;
19349
+ bw = _options$fit[0];
19350
+ bh = _options$fit[1];
19570
19351
  bp = bw / bh;
19571
19352
  ip = width / height;
19572
19353
  if (ip > bp) {
@@ -19577,7 +19358,9 @@ var ImagesMixin = {
19577
19358
  w = bh * ip;
19578
19359
  }
19579
19360
  } else if (options.cover) {
19580
- [bw, bh] = options.cover;
19361
+ var _options$cover = options.cover;
19362
+ bw = _options$cover[0];
19363
+ bh = _options$cover[1];
19581
19364
  bp = bw / bh;
19582
19365
  ip = width / height;
19583
19366
  if (ip > bp) {
@@ -19788,7 +19571,11 @@ var AnnotationsMixin = {
19788
19571
  },
19789
19572
  _markup(x, y, w, h) {
19790
19573
  let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
19791
- const [x1, y1, x2, y2] = this._convertRect(x, y, w, h);
19574
+ const _this$_convertRect = this._convertRect(x, y, w, h),
19575
+ x1 = _this$_convertRect[0],
19576
+ y1 = _this$_convertRect[1],
19577
+ x2 = _this$_convertRect[2],
19578
+ y2 = _this$_convertRect[3];
19792
19579
  options.QuadPoints = [x1, y2, x2, y2, x1, y1, x2, y1];
19793
19580
  options.Contents = new String();
19794
19581
  return this.annotate(x, y, w, h, options);
@@ -19856,7 +19643,13 @@ var AnnotationsMixin = {
19856
19643
  let y2 = y1;
19857
19644
  y1 += h;
19858
19645
  let x2 = x1 + w;
19859
- const [m0, m1, m2, m3, m4, m5] = this._ctm;
19646
+ const _this$_ctm = this._ctm,
19647
+ m0 = _this$_ctm[0],
19648
+ m1 = _this$_ctm[1],
19649
+ m2 = _this$_ctm[2],
19650
+ m3 = _this$_ctm[3],
19651
+ m4 = _this$_ctm[4],
19652
+ m5 = _this$_ctm[5];
19860
19653
  x1 = m0 * x1 + m2 * y1 + m4;
19861
19654
  y1 = m1 * x1 + m3 * y1 + m5;
19862
19655
  x2 = m0 * x2 + m2 * y2 + m4;
@@ -20016,10 +19809,8 @@ class PDFStructureElement {
20016
19809
  }
20017
19810
  _addContentToParentTree(content) {
20018
19811
  content.refs.forEach(_ref => {
20019
- let {
20020
- pageRef,
20021
- mcid
20022
- } = _ref;
19812
+ let pageRef = _ref.pageRef,
19813
+ mcid = _ref.mcid;
20023
19814
  const pageStructParents = this.document.getStructParentTree().get(pageRef.data.StructParents);
20024
19815
  pageStructParents[mcid] = this.dictionary;
20025
19816
  });
@@ -20107,10 +19898,8 @@ class PDFStructureElement {
20107
19898
  }
20108
19899
  if (child instanceof PDFStructureContent) {
20109
19900
  child.refs.forEach(_ref2 => {
20110
- let {
20111
- pageRef,
20112
- mcid
20113
- } = _ref2;
19901
+ let pageRef = _ref2.pageRef,
19902
+ mcid = _ref2.mcid;
20114
19903
  if (!this.dictionary.data.Pg) {
20115
19904
  this.dictionary.data.Pg = pageRef;
20116
19905
  }
@@ -20673,10 +20462,9 @@ var AttachmentsMixin = {
20673
20462
  if (!data) {
20674
20463
  throw new Error(`Could not read contents of file at filepath ${src}`);
20675
20464
  }
20676
- const {
20677
- birthtime,
20678
- ctime
20679
- } = fs.statSync(src);
20465
+ const _fs$statSync = fs.statSync(src),
20466
+ birthtime = _fs$statSync.birthtime,
20467
+ ctime = _fs$statSync.ctime;
20680
20468
  refBody.Params.CreationDate = birthtime;
20681
20469
  refBody.Params.ModDate = ctime;
20682
20470
  }
@@ -20872,11 +20660,11 @@ function normalizedDefaultStyle(defaultStyleInternal) {
20872
20660
  text: defaultStyle
20873
20661
  };
20874
20662
  const defaultRowStyle = Object.fromEntries(Object.entries(defaultStyle).filter(_ref => {
20875
- let [k] = _ref;
20663
+ let k = _ref[0];
20876
20664
  return ROW_FIELDS.includes(k);
20877
20665
  }));
20878
20666
  const defaultColStyle = Object.fromEntries(Object.entries(defaultStyle).filter(_ref2 => {
20879
- let [k] = _ref2;
20667
+ let k = _ref2[0];
20880
20668
  return COLUMN_FIELDS.includes(k);
20881
20669
  }));
20882
20670
  defaultStyle.padding = normalizeSides(defaultStyle.padding);
@@ -20950,11 +20738,10 @@ function normalizeTable() {
20950
20738
  y: doc.sizeToPoint(opts.position?.y, doc.y)
20951
20739
  };
20952
20740
  this._maxWidth = doc.sizeToPoint(opts.maxWidth, doc.page.width - doc.page.margins.right - this._position.x);
20953
- const {
20954
- defaultStyle,
20955
- defaultColStyle,
20956
- defaultRowStyle
20957
- } = normalizedDefaultStyle(opts.defaultStyle);
20741
+ const _normalizedDefaultSty = normalizedDefaultStyle(opts.defaultStyle),
20742
+ defaultStyle = _normalizedDefaultSty.defaultStyle,
20743
+ defaultColStyle = _normalizedDefaultSty.defaultColStyle,
20744
+ defaultRowStyle = _normalizedDefaultSty.defaultRowStyle;
20958
20745
  this._defaultStyle = defaultStyle;
20959
20746
  let colStyle;
20960
20747
  if (opts.columnStyles) {
@@ -21151,10 +20938,9 @@ function measureCell(cell, rowHeight) {
21151
20938
  const textAllocatedWidth = cellWidth - cell.padding.left - cell.padding.right;
21152
20939
  const textAllocatedHeight = cellHeight - cell.padding.top - cell.padding.bottom;
21153
20940
  const rotation = cell.textOptions.rotation ?? 0;
21154
- const {
21155
- width: textMaxWidth,
21156
- height: textMaxHeight
21157
- } = computeBounds(rotation, textAllocatedWidth, textAllocatedHeight);
20941
+ const _computeBounds = computeBounds(rotation, textAllocatedWidth, textAllocatedHeight),
20942
+ textMaxWidth = _computeBounds.width,
20943
+ textMaxHeight = _computeBounds.height;
21158
20944
  const textOptions = {
21159
20945
  align: cell.align.x,
21160
20946
  ellipsis: true,
@@ -21392,7 +21178,8 @@ function renderCellText(cell) {
21392
21178
  }
21393
21179
  function renderBorder(border, borderColor, x, y, width, height, mask) {
21394
21180
  border = Object.fromEntries(Object.entries(border).map(_ref => {
21395
- let [k, v] = _ref;
21181
+ let k = _ref[0],
21182
+ v = _ref[1];
21396
21183
  return [k, mask && !mask[k] ? 0 : v];
21397
21184
  }));
21398
21185
  const doc = this.document;
@@ -21437,10 +21224,9 @@ class PDFTable {
21437
21224
  row = Array.from(row);
21438
21225
  row = normalizeRow.call(this, row, this._currRowIndex);
21439
21226
  if (this._currRowIndex === 0) ensure.call(this, row);
21440
- const {
21441
- newPage,
21442
- toRender
21443
- } = measure.call(this, row, this._currRowIndex);
21227
+ const _measure$call = measure.call(this, row, this._currRowIndex),
21228
+ newPage = _measure$call.newPage,
21229
+ toRender = _measure$call.toRender;
21444
21230
  if (newPage) this.document.continueOnNewPage();
21445
21231
  const yPos = renderRow.call(this, toRender, this._currRowIndex);
21446
21232
  this.document.x = this._position.x;
@@ -21659,9 +21445,7 @@ class PDFDocument extends _stream.default.Readable {
21659
21445
  }
21660
21446
  addPage(options) {
21661
21447
  if (options == null) {
21662
- ({
21663
- options
21664
- } = this);
21448
+ options = this.options;
21665
21449
  }
21666
21450
  if (!this.options.bufferPages) {
21667
21451
  this.flushPages();
@@ -21867,10 +21651,11 @@ module.exports = ___EXPOSE_LOADER_IMPORT___;
21867
21651
  (__unused_webpack_module, exports, __webpack_require__) {
21868
21652
 
21869
21653
  "use strict";
21654
+ var __webpack_unused_export__;
21870
21655
 
21871
- Object.defineProperty(exports, "__esModule", ({ value: true }));
21656
+ __webpack_unused_export__ = ({ value: true });
21872
21657
  exports.polyval = exports.ghash = void 0;
21873
- exports._toGHASHKey = _toGHASHKey;
21658
+ __webpack_unused_export__ = _toGHASHKey;
21874
21659
  /**
21875
21660
  * GHash from AES-GCM and its little-endian "mirror image" Polyval from AES-SIV.
21876
21661
  *
@@ -23020,37 +22805,38 @@ exports.unsafe = {
23020
22805
  (__unused_webpack_module, exports) {
23021
22806
 
23022
22807
  "use strict";
22808
+ var __webpack_unused_export__;
23023
22809
 
23024
22810
  /**
23025
22811
  * Utilities for hex, bytes, CSPRNG.
23026
22812
  * @module
23027
22813
  */
23028
22814
  /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
23029
- Object.defineProperty(exports, "__esModule", ({ value: true }));
23030
- exports.wrapCipher = exports.Hash = exports.nextTick = exports.isLE = void 0;
23031
- exports.isBytes = isBytes;
23032
- exports.abool = abool;
23033
- exports.anumber = anumber;
22815
+ __webpack_unused_export__ = ({ value: true });
22816
+ exports.wrapCipher = __webpack_unused_export__ = __webpack_unused_export__ = exports.qv = void 0;
22817
+ __webpack_unused_export__ = isBytes;
22818
+ __webpack_unused_export__ = abool;
22819
+ __webpack_unused_export__ = anumber;
23034
22820
  exports.abytes = abytes;
23035
- exports.ahash = ahash;
22821
+ __webpack_unused_export__ = ahash;
23036
22822
  exports.aexists = aexists;
23037
22823
  exports.aoutput = aoutput;
23038
22824
  exports.u8 = u8;
23039
22825
  exports.u32 = u32;
23040
22826
  exports.clean = clean;
23041
22827
  exports.createView = createView;
23042
- exports.bytesToHex = bytesToHex;
23043
- exports.hexToBytes = hexToBytes;
23044
- exports.hexToNumber = hexToNumber;
23045
- exports.bytesToNumberBE = bytesToNumberBE;
23046
- exports.numberToBytesBE = numberToBytesBE;
23047
- exports.utf8ToBytes = utf8ToBytes;
23048
- exports.bytesToUtf8 = bytesToUtf8;
22828
+ __webpack_unused_export__ = bytesToHex;
22829
+ __webpack_unused_export__ = hexToBytes;
22830
+ __webpack_unused_export__ = hexToNumber;
22831
+ __webpack_unused_export__ = bytesToNumberBE;
22832
+ __webpack_unused_export__ = numberToBytesBE;
22833
+ __webpack_unused_export__ = utf8ToBytes;
22834
+ __webpack_unused_export__ = bytesToUtf8;
23049
22835
  exports.toBytes = toBytes;
23050
22836
  exports.overlapBytes = overlapBytes;
23051
22837
  exports.complexOverlapBytes = complexOverlapBytes;
23052
22838
  exports.concatBytes = concatBytes;
23053
- exports.checkOpts = checkOpts;
22839
+ __webpack_unused_export__ = checkOpts;
23054
22840
  exports.equalBytes = equalBytes;
23055
22841
  exports.getOutput = getOutput;
23056
22842
  exports.setBigUint64 = setBigUint64;
@@ -23123,7 +22909,7 @@ function createView(arr) {
23123
22909
  return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
23124
22910
  }
23125
22911
  /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
23126
- exports.isLE = (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
22912
+ exports.qv = (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
23127
22913
  // Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
23128
22914
  const hasHexBuiltin = /* @__PURE__ */ (() =>
23129
22915
  // @ts-ignore
@@ -23203,7 +22989,7 @@ function numberToBytesBE(n, len) {
23203
22989
  // call of async fn will return Promise, which will be fullfiled only on
23204
22990
  // next scheduler queue processing step and this is exactly what we need.
23205
22991
  const nextTick = async () => { };
23206
- exports.nextTick = nextTick;
22992
+ __webpack_unused_export__ = nextTick;
23207
22993
  /**
23208
22994
  * Converts string to bytes using UTF8 encoding.
23209
22995
  * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
@@ -23291,7 +23077,7 @@ function equalBytes(a, b) {
23291
23077
  /** For runtime check if class implements interface. */
23292
23078
  class Hash {
23293
23079
  }
23294
- exports.Hash = Hash;
23080
+ __webpack_unused_export__ = Hash;
23295
23081
  /**
23296
23082
  * Wraps a cipher: validates args, ensures encrypt() can only be called once.
23297
23083
  * @__NO_SIDE_EFFECTS__
@@ -23301,7 +23087,7 @@ const wrapCipher = (params, constructor) => {
23301
23087
  // Validate key
23302
23088
  abytes(key);
23303
23089
  // Big-Endian hardware is rare. Just in case someone still decides to run ciphers:
23304
- if (!exports.isLE)
23090
+ if (!exports.qv)
23305
23091
  throw new Error('Non little-endian hardware is not yet supported');
23306
23092
  // Validate nonce if nonceLength is present
23307
23093
  if (params.nonceLength !== undefined) {
@@ -23401,10 +23187,11 @@ function copyBytes(bytes) {
23401
23187
  (__unused_webpack_module, exports, __webpack_require__) {
23402
23188
 
23403
23189
  "use strict";
23190
+ var __webpack_unused_export__;
23404
23191
 
23405
- Object.defineProperty(exports, "__esModule", ({ value: true }));
23192
+ __webpack_unused_export__ = ({ value: true });
23406
23193
  exports.SHA512_IV = exports.SHA384_IV = exports.SHA224_IV = exports.SHA256_IV = exports.HashMD = void 0;
23407
- exports.setBigUint64 = setBigUint64;
23194
+ __webpack_unused_export__ = setBigUint64;
23408
23195
  exports.Chi = Chi;
23409
23196
  exports.Maj = Maj;
23410
23197
  /**
@@ -23570,11 +23357,12 @@ exports.SHA512_IV = Uint32Array.from([
23570
23357
  (__unused_webpack_module, exports) {
23571
23358
 
23572
23359
  "use strict";
23360
+ var __webpack_unused_export__;
23573
23361
 
23574
- Object.defineProperty(exports, "__esModule", ({ value: true }));
23575
- exports.toBig = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = exports.rotr32L = exports.rotr32H = exports.rotlSL = exports.rotlSH = exports.rotlBL = exports.rotlBH = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = void 0;
23362
+ __webpack_unused_export__ = ({ value: true });
23363
+ __webpack_unused_export__ = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = void 0;
23576
23364
  exports.add = add;
23577
- exports.fromBig = fromBig;
23365
+ __webpack_unused_export__ = fromBig;
23578
23366
  exports.split = split;
23579
23367
  /**
23580
23368
  * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
@@ -23599,7 +23387,7 @@ function split(lst, le = false) {
23599
23387
  return [Ah, Al];
23600
23388
  }
23601
23389
  const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
23602
- exports.toBig = toBig;
23390
+ __webpack_unused_export__ = toBig;
23603
23391
  // for Shift in [0, 32)
23604
23392
  const shrSH = (h, _l, s) => h >>> s;
23605
23393
  exports.shrSH = shrSH;
@@ -23617,19 +23405,19 @@ const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
23617
23405
  exports.rotrBL = rotrBL;
23618
23406
  // Right rotate for shift===32 (just swaps l&h)
23619
23407
  const rotr32H = (_h, l) => l;
23620
- exports.rotr32H = rotr32H;
23408
+ __webpack_unused_export__ = rotr32H;
23621
23409
  const rotr32L = (h, _l) => h;
23622
- exports.rotr32L = rotr32L;
23410
+ __webpack_unused_export__ = rotr32L;
23623
23411
  // Left rotate for Shift in [1, 32)
23624
23412
  const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
23625
- exports.rotlSH = rotlSH;
23413
+ __webpack_unused_export__ = rotlSH;
23626
23414
  const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
23627
- exports.rotlSL = rotlSL;
23415
+ __webpack_unused_export__ = rotlSL;
23628
23416
  // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
23629
23417
  const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
23630
- exports.rotlBH = rotlBH;
23418
+ __webpack_unused_export__ = rotlBH;
23631
23419
  const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
23632
- exports.rotlBL = rotlBL;
23420
+ __webpack_unused_export__ = rotlBL;
23633
23421
  // JS uses 32-bit signed integers for bitwise operations which means we cannot
23634
23422
  // simple take carry out of low bit sum by shift, we need to use division.
23635
23423
  function add(Ah, Al, Bh, Bl) {
@@ -23658,7 +23446,7 @@ const u64 = {
23658
23446
  rotlSH, rotlSL, rotlBH, rotlBL,
23659
23447
  add, add3L, add3H, add4L, add4H, add5H, add5L,
23660
23448
  };
23661
- exports["default"] = u64;
23449
+ __webpack_unused_export__ = u64;
23662
23450
 
23663
23451
 
23664
23452
  /***/ },
@@ -23667,8 +23455,9 @@ exports["default"] = u64;
23667
23455
  (__unused_webpack_module, exports) {
23668
23456
 
23669
23457
  "use strict";
23458
+ var __webpack_unused_export__;
23670
23459
 
23671
- Object.defineProperty(exports, "__esModule", ({ value: true }));
23460
+ __webpack_unused_export__ = ({ value: true });
23672
23461
  exports.crypto = void 0;
23673
23462
  exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
23674
23463
 
@@ -23679,9 +23468,10 @@ exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? glob
23679
23468
  (__unused_webpack_module, exports, __webpack_require__) {
23680
23469
 
23681
23470
  "use strict";
23471
+ var __webpack_unused_export__;
23682
23472
 
23683
- Object.defineProperty(exports, "__esModule", ({ value: true }));
23684
- exports.sha512_224 = exports.sha512_256 = exports.sha384 = exports.sha512 = exports.sha224 = exports.sha256 = exports.SHA512_256 = exports.SHA512_224 = exports.SHA384 = exports.SHA512 = exports.SHA224 = exports.SHA256 = void 0;
23473
+ __webpack_unused_export__ = ({ value: true });
23474
+ __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.sha224 = exports.sha256 = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.SHA224 = exports.SHA256 = void 0;
23685
23475
  /**
23686
23476
  * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
23687
23477
  * SHA256 is the fastest hash implementable in JS, even faster than Blake3.
@@ -23955,7 +23745,7 @@ class SHA512 extends _md_ts_1.HashMD {
23955
23745
  this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
23956
23746
  }
23957
23747
  }
23958
- exports.SHA512 = SHA512;
23748
+ __webpack_unused_export__ = SHA512;
23959
23749
  class SHA384 extends SHA512 {
23960
23750
  constructor() {
23961
23751
  super(48);
@@ -23977,7 +23767,7 @@ class SHA384 extends SHA512 {
23977
23767
  this.Hl = _md_ts_1.SHA384_IV[15] | 0;
23978
23768
  }
23979
23769
  }
23980
- exports.SHA384 = SHA384;
23770
+ __webpack_unused_export__ = SHA384;
23981
23771
  /**
23982
23772
  * Truncated SHA512/256 and SHA512/224.
23983
23773
  * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as "intermediary" IV of SHA512/t.
@@ -24015,7 +23805,7 @@ class SHA512_224 extends SHA512 {
24015
23805
  this.Hl = T224_IV[15] | 0;
24016
23806
  }
24017
23807
  }
24018
- exports.SHA512_224 = SHA512_224;
23808
+ __webpack_unused_export__ = SHA512_224;
24019
23809
  class SHA512_256 extends SHA512 {
24020
23810
  constructor() {
24021
23811
  super(32);
@@ -24037,7 +23827,7 @@ class SHA512_256 extends SHA512 {
24037
23827
  this.Hl = T256_IV[15] | 0;
24038
23828
  }
24039
23829
  }
24040
- exports.SHA512_256 = SHA512_256;
23830
+ __webpack_unused_export__ = SHA512_256;
24041
23831
  /**
24042
23832
  * SHA2-256 hash function from RFC 4634.
24043
23833
  *
@@ -24049,19 +23839,19 @@ exports.sha256 = (0, utils_ts_1.createHasher)(() => new SHA256());
24049
23839
  /** SHA2-224 hash function from RFC 4634 */
24050
23840
  exports.sha224 = (0, utils_ts_1.createHasher)(() => new SHA224());
24051
23841
  /** SHA2-512 hash function from RFC 4634. */
24052
- exports.sha512 = (0, utils_ts_1.createHasher)(() => new SHA512());
23842
+ __webpack_unused_export__ = (0, utils_ts_1.createHasher)(() => new SHA512());
24053
23843
  /** SHA2-384 hash function from RFC 4634. */
24054
- exports.sha384 = (0, utils_ts_1.createHasher)(() => new SHA384());
23844
+ __webpack_unused_export__ = (0, utils_ts_1.createHasher)(() => new SHA384());
24055
23845
  /**
24056
23846
  * SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks.
24057
23847
  * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
24058
23848
  */
24059
- exports.sha512_256 = (0, utils_ts_1.createHasher)(() => new SHA512_256());
23849
+ __webpack_unused_export__ = (0, utils_ts_1.createHasher)(() => new SHA512_256());
24060
23850
  /**
24061
23851
  * SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks.
24062
23852
  * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
24063
23853
  */
24064
- exports.sha512_224 = (0, utils_ts_1.createHasher)(() => new SHA512_224());
23854
+ __webpack_unused_export__ = (0, utils_ts_1.createHasher)(() => new SHA512_224());
24065
23855
 
24066
23856
 
24067
23857
  /***/ },
@@ -29459,10 +29249,10 @@ var applyBind = __webpack_require__(8619);
29459
29249
 
29460
29250
  module.exports = function callBind(originalFunction) {
29461
29251
  var func = callBindBasic(arguments);
29462
- var adjustedLength = originalFunction.length - (arguments.length - 1);
29252
+ var adjustedLength = 1 + originalFunction.length - (arguments.length - 1);
29463
29253
  return setFunctionLength(
29464
29254
  func,
29465
- 1 + (adjustedLength > 0 ? adjustedLength : 0),
29255
+ adjustedLength > 0 ? adjustedLength : 0,
29466
29256
  true
29467
29257
  );
29468
29258
  };
@@ -31758,7 +31548,7 @@ var getProto = __webpack_require__(7106);
31758
31548
  var toStr = callBound('Object.prototype.toString');
31759
31549
  var fnToStr = callBound('Function.prototype.toString');
31760
31550
 
31761
- var getGeneratorFunction = __webpack_require__(3011);
31551
+ var getGeneratorFunction = __webpack_require__(9294).c;
31762
31552
 
31763
31553
  /** @type {import('.')} */
31764
31554
  module.exports = function isGeneratorFunction(fn) {
@@ -46110,7 +45900,7 @@ module.exports = function whichTypedArray(value) {
46110
45900
 
46111
45901
  /***/ },
46112
45902
 
46113
- /***/ 6457
45903
+ /***/ 7286
46114
45904
  (module, exports, __webpack_require__) {
46115
45905
 
46116
45906
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function(a,b){if(true)!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (b),
@@ -63467,6 +63257,403 @@ module.exports = $f898ea50f3b38ab8$var$LineBreaker;
63467
63257
 
63468
63258
 
63469
63259
 
63260
+ /***/ },
63261
+
63262
+ /***/ 381
63263
+ (module, __unused_webpack_exports, __webpack_require__) {
63264
+
63265
+ "use strict";
63266
+ /* provided dependency */ var Buffer = __webpack_require__(783)["Buffer"];
63267
+
63268
+
63269
+ var zlib = __webpack_require__(6729);
63270
+
63271
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
63272
+
63273
+ var zlib__default = /*#__PURE__*/_interopDefaultCompat(zlib);
63274
+
63275
+ class PNG {
63276
+ static decode(path, fn) {
63277
+ {
63278
+ throw new Error('PNG.decode not available in browser build');
63279
+ }
63280
+ }
63281
+
63282
+ static load(path) {
63283
+ {
63284
+ throw new Error('PNG.load not available in browser build');
63285
+ }
63286
+ }
63287
+
63288
+ constructor(data) {
63289
+ let i;
63290
+ this.data = data;
63291
+ this.pos = 8; // Skip the default header
63292
+
63293
+ this.palette = [];
63294
+ this.imgData = [];
63295
+ this.transparency = {};
63296
+ this.text = {};
63297
+
63298
+ while (true) {
63299
+ const chunkSize = this.readUInt32();
63300
+ let section = '';
63301
+ for (i = 0; i < 4; i++) {
63302
+ section += String.fromCharCode(this.data[this.pos++]);
63303
+ }
63304
+
63305
+ switch (section) {
63306
+ case 'IHDR':
63307
+ // we can grab interesting values from here (like width, height, etc)
63308
+ this.width = this.readUInt32();
63309
+ this.height = this.readUInt32();
63310
+ this.bits = this.data[this.pos++];
63311
+ this.colorType = this.data[this.pos++];
63312
+ this.compressionMethod = this.data[this.pos++];
63313
+ this.filterMethod = this.data[this.pos++];
63314
+ this.interlaceMethod = this.data[this.pos++];
63315
+ break;
63316
+
63317
+ case 'PLTE':
63318
+ this.palette = this.read(chunkSize);
63319
+ break;
63320
+
63321
+ case 'IDAT':
63322
+ for (i = 0; i < chunkSize; i++) {
63323
+ this.imgData.push(this.data[this.pos++]);
63324
+ }
63325
+ break;
63326
+
63327
+ case 'tRNS':
63328
+ // This chunk can only occur once and it must occur after the
63329
+ // PLTE chunk and before the IDAT chunk.
63330
+ this.transparency = {};
63331
+ switch (this.colorType) {
63332
+ case 3:
63333
+ // Indexed color, RGB. Each byte in this chunk is an alpha for
63334
+ // the palette index in the PLTE ("palette") chunk up until the
63335
+ // last non-opaque entry. Set up an array, stretching over all
63336
+ // palette entries which will be 0 (opaque) or 1 (transparent).
63337
+ this.transparency.indexed = this.read(chunkSize);
63338
+ var short = 255 - this.transparency.indexed.length;
63339
+ if (short > 0) {
63340
+ for (i = 0; i < short; i++) {
63341
+ this.transparency.indexed.push(255);
63342
+ }
63343
+ }
63344
+ break;
63345
+ case 0:
63346
+ // Greyscale. Corresponding to entries in the PLTE chunk.
63347
+ // Grey is two bytes, range 0 .. (2 ^ bit-depth) - 1
63348
+ this.transparency.grayscale = this.read(chunkSize)[0];
63349
+ break;
63350
+ case 2:
63351
+ // True color with proper alpha channel.
63352
+ this.transparency.rgb = this.read(chunkSize);
63353
+ break;
63354
+ }
63355
+ break;
63356
+
63357
+ case 'tEXt':
63358
+ var text = this.read(chunkSize);
63359
+ var index = text.indexOf(0);
63360
+ var key = String.fromCharCode.apply(String, text.slice(0, index));
63361
+ this.text[key] = String.fromCharCode.apply(
63362
+ String,
63363
+ text.slice(index + 1)
63364
+ );
63365
+ break;
63366
+
63367
+ case 'IEND':
63368
+ // we've got everything we need!
63369
+ switch (this.colorType) {
63370
+ case 0:
63371
+ case 3:
63372
+ case 4:
63373
+ this.colors = 1;
63374
+ break;
63375
+ case 2:
63376
+ case 6:
63377
+ this.colors = 3;
63378
+ break;
63379
+ }
63380
+
63381
+ this.hasAlphaChannel = [4, 6].includes(this.colorType);
63382
+ var colors = this.colors + (this.hasAlphaChannel ? 1 : 0);
63383
+ this.pixelBitlength = this.bits * colors;
63384
+
63385
+ switch (this.colors) {
63386
+ case 1:
63387
+ this.colorSpace = 'DeviceGray';
63388
+ break;
63389
+ case 3:
63390
+ this.colorSpace = 'DeviceRGB';
63391
+ break;
63392
+ }
63393
+
63394
+ this.imgData = Buffer.from(this.imgData);
63395
+ return;
63396
+
63397
+ default:
63398
+ // unknown (or unimportant) section, skip it
63399
+ this.pos += chunkSize;
63400
+ }
63401
+
63402
+ this.pos += 4; // Skip the CRC
63403
+
63404
+ if (this.pos > this.data.length) {
63405
+ throw new Error('Incomplete or corrupt PNG file');
63406
+ }
63407
+ }
63408
+ }
63409
+
63410
+ read(bytes) {
63411
+ const result = new Array(bytes);
63412
+ for (let i = 0; i < bytes; i++) {
63413
+ result[i] = this.data[this.pos++];
63414
+ }
63415
+ return result;
63416
+ }
63417
+
63418
+ readUInt32() {
63419
+ const b1 = this.data[this.pos++] << 24;
63420
+ const b2 = this.data[this.pos++] << 16;
63421
+ const b3 = this.data[this.pos++] << 8;
63422
+ const b4 = this.data[this.pos++];
63423
+ return b1 | b2 | b3 | b4;
63424
+ }
63425
+
63426
+ readUInt16() {
63427
+ const b1 = this.data[this.pos++] << 8;
63428
+ const b2 = this.data[this.pos++];
63429
+ return b1 | b2;
63430
+ }
63431
+
63432
+ decodePixels(fn) {
63433
+ return zlib__default.default.inflate(this.imgData, (err, data) => {
63434
+ if (err) {
63435
+ throw err;
63436
+ }
63437
+
63438
+ const { width, height } = this;
63439
+ const pixelBytes = this.pixelBitlength / 8;
63440
+
63441
+ const pixels = Buffer.alloc(width * height * pixelBytes);
63442
+ const { length } = data;
63443
+ let pos = 0;
63444
+
63445
+ function pass(x0, y0, dx, dy, singlePass = false) {
63446
+ const w = Math.ceil((width - x0) / dx);
63447
+ const h = Math.ceil((height - y0) / dy);
63448
+ const scanlineLength = pixelBytes * w;
63449
+ const buffer = singlePass ? pixels : Buffer.alloc(scanlineLength * h);
63450
+ let row = 0;
63451
+ let c = 0;
63452
+ while (row < h && pos < length) {
63453
+ var byte, col, i, left, upper;
63454
+ switch (data[pos++]) {
63455
+ case 0: // None
63456
+ for (i = 0; i < scanlineLength; i++) {
63457
+ buffer[c++] = data[pos++];
63458
+ }
63459
+ break;
63460
+
63461
+ case 1: // Sub
63462
+ for (i = 0; i < scanlineLength; i++) {
63463
+ byte = data[pos++];
63464
+ left = i < pixelBytes ? 0 : buffer[c - pixelBytes];
63465
+ buffer[c++] = (byte + left) % 256;
63466
+ }
63467
+ break;
63468
+
63469
+ case 2: // Up
63470
+ for (i = 0; i < scanlineLength; i++) {
63471
+ byte = data[pos++];
63472
+ col = (i - (i % pixelBytes)) / pixelBytes;
63473
+ upper =
63474
+ row &&
63475
+ buffer[
63476
+ (row - 1) * scanlineLength +
63477
+ col * pixelBytes +
63478
+ (i % pixelBytes)
63479
+ ];
63480
+ buffer[c++] = (upper + byte) % 256;
63481
+ }
63482
+ break;
63483
+
63484
+ case 3: // Average
63485
+ for (i = 0; i < scanlineLength; i++) {
63486
+ byte = data[pos++];
63487
+ col = (i - (i % pixelBytes)) / pixelBytes;
63488
+ left = i < pixelBytes ? 0 : buffer[c - pixelBytes];
63489
+ upper =
63490
+ row &&
63491
+ buffer[
63492
+ (row - 1) * scanlineLength +
63493
+ col * pixelBytes +
63494
+ (i % pixelBytes)
63495
+ ];
63496
+ buffer[c++] = (byte + Math.floor((left + upper) / 2)) % 256;
63497
+ }
63498
+ break;
63499
+
63500
+ case 4: // Paeth
63501
+ for (i = 0; i < scanlineLength; i++) {
63502
+ var paeth, upperLeft;
63503
+ byte = data[pos++];
63504
+ col = (i - (i % pixelBytes)) / pixelBytes;
63505
+ left = i < pixelBytes ? 0 : buffer[c - pixelBytes];
63506
+
63507
+ if (row === 0) {
63508
+ upper = upperLeft = 0;
63509
+ } else {
63510
+ upper =
63511
+ buffer[
63512
+ (row - 1) * scanlineLength +
63513
+ col * pixelBytes +
63514
+ (i % pixelBytes)
63515
+ ];
63516
+ upperLeft =
63517
+ col &&
63518
+ buffer[
63519
+ (row - 1) * scanlineLength +
63520
+ (col - 1) * pixelBytes +
63521
+ (i % pixelBytes)
63522
+ ];
63523
+ }
63524
+
63525
+ const p = left + upper - upperLeft;
63526
+ const pa = Math.abs(p - left);
63527
+ const pb = Math.abs(p - upper);
63528
+ const pc = Math.abs(p - upperLeft);
63529
+
63530
+ if (pa <= pb && pa <= pc) {
63531
+ paeth = left;
63532
+ } else if (pb <= pc) {
63533
+ paeth = upper;
63534
+ } else {
63535
+ paeth = upperLeft;
63536
+ }
63537
+
63538
+ buffer[c++] = (byte + paeth) % 256;
63539
+ }
63540
+ break;
63541
+
63542
+ default:
63543
+ throw new Error(`Invalid filter algorithm: ${data[pos - 1]}`);
63544
+ }
63545
+
63546
+ if (!singlePass) {
63547
+ let pixelsPos = ((y0 + row * dy) * width + x0) * pixelBytes;
63548
+ let bufferPos = row * scanlineLength;
63549
+ for (i = 0; i < w; i++) {
63550
+ for (let j = 0; j < pixelBytes; j++)
63551
+ pixels[pixelsPos++] = buffer[bufferPos++];
63552
+ pixelsPos += (dx - 1) * pixelBytes;
63553
+ }
63554
+ }
63555
+
63556
+ row++;
63557
+ }
63558
+ }
63559
+
63560
+ if (this.interlaceMethod === 1) {
63561
+ /*
63562
+ 1 6 4 6 2 6 4 6
63563
+ 7 7 7 7 7 7 7 7
63564
+ 5 6 5 6 5 6 5 6
63565
+ 7 7 7 7 7 7 7 7
63566
+ 3 6 4 6 3 6 4 6
63567
+ 7 7 7 7 7 7 7 7
63568
+ 5 6 5 6 5 6 5 6
63569
+ 7 7 7 7 7 7 7 7
63570
+ */
63571
+ pass(0, 0, 8, 8); // 1
63572
+ pass(4, 0, 8, 8); // 2
63573
+ pass(0, 4, 4, 8); // 3
63574
+ pass(2, 0, 4, 4); // 4
63575
+ pass(0, 2, 2, 4); // 5
63576
+ pass(1, 0, 2, 2); // 6
63577
+ pass(0, 1, 1, 2); // 7
63578
+ } else {
63579
+ pass(0, 0, 1, 1, true);
63580
+ }
63581
+
63582
+ return fn(pixels);
63583
+ });
63584
+ }
63585
+
63586
+ decodePalette() {
63587
+ const { palette } = this;
63588
+ const { length } = palette;
63589
+ const transparency = this.transparency.indexed || [];
63590
+ const ret = Buffer.alloc(transparency.length + length);
63591
+ let pos = 0;
63592
+ let c = 0;
63593
+
63594
+ for (let i = 0; i < length; i += 3) {
63595
+ var left;
63596
+ ret[pos++] = palette[i];
63597
+ ret[pos++] = palette[i + 1];
63598
+ ret[pos++] = palette[i + 2];
63599
+ ret[pos++] = (left = transparency[c++]) != null ? left : 255;
63600
+ }
63601
+
63602
+ return ret;
63603
+ }
63604
+
63605
+ copyToImageData(imageData, pixels) {
63606
+ let j, k;
63607
+ let { colors } = this;
63608
+ let palette = null;
63609
+ let alpha = this.hasAlphaChannel;
63610
+
63611
+ if (this.palette.length) {
63612
+ palette =
63613
+ this._decodedPalette || (this._decodedPalette = this.decodePalette());
63614
+ colors = 4;
63615
+ alpha = true;
63616
+ }
63617
+
63618
+ const data = imageData.data || imageData;
63619
+ const { length } = data;
63620
+ const input = palette || pixels;
63621
+ let i = (j = 0);
63622
+
63623
+ if (colors === 1) {
63624
+ while (i < length) {
63625
+ k = palette ? pixels[i / 4] * 4 : j;
63626
+ const v = input[k++];
63627
+ data[i++] = v;
63628
+ data[i++] = v;
63629
+ data[i++] = v;
63630
+ data[i++] = alpha ? input[k++] : 255;
63631
+ j = k;
63632
+ }
63633
+ } else {
63634
+ while (i < length) {
63635
+ k = palette ? pixels[i / 4] * 4 : j;
63636
+ data[i++] = input[k++];
63637
+ data[i++] = input[k++];
63638
+ data[i++] = input[k++];
63639
+ data[i++] = alpha ? input[k++] : 255;
63640
+ j = k;
63641
+ }
63642
+ }
63643
+ }
63644
+
63645
+ decode(fn) {
63646
+ const ret = Buffer.alloc(this.width * this.height * 4);
63647
+ return this.decodePixels(pixels => {
63648
+ this.copyToImageData(ret, pixels);
63649
+ return fn(ret);
63650
+ });
63651
+ }
63652
+ }
63653
+
63654
+ module.exports = PNG;
63655
+
63656
+
63470
63657
  /***/ },
63471
63658
 
63472
63659
  /***/ 5233
@@ -65110,6 +65297,24 @@ function formatText(text, options) {
65110
65297
  exports["default"] = XmlDocument;
65111
65298
 
65112
65299
 
65300
+ /***/ },
65301
+
65302
+ /***/ 9294
65303
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
65304
+
65305
+ "use strict";
65306
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
65307
+ /* harmony export */ c: () => (/* reexport default export from named module */ _index_js__WEBPACK_IMPORTED_MODULE_0__)
65308
+ /* harmony export */ });
65309
+ /* unused harmony import specifier */ var getGeneratorFunction;
65310
+ /* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3011);
65311
+
65312
+
65313
+ /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (getGeneratorFunction)));
65314
+
65315
+
65316
+
65317
+
65113
65318
  /***/ },
65114
65319
 
65115
65320
  /***/ 1635
@@ -65447,10 +65652,10 @@ function __addDisposableResource(env, value, async) {
65447
65652
  return value;
65448
65653
  }
65449
65654
 
65450
- var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
65655
+ var _SuppressedError = (/* unused pure expression or super */ null && (typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
65451
65656
  var e = new Error(message);
65452
65657
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
65453
- };
65658
+ }));
65454
65659
 
65455
65660
  function __disposeResources(env) {
65456
65661
  function fail(e) {
@@ -65487,7 +65692,7 @@ function __rewriteRelativeImportExtension(path, preserveJsx) {
65487
65692
  return path;
65488
65693
  }
65489
65694
 
65490
- /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ({
65695
+ /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && ({
65491
65696
  __extends,
65492
65697
  __assign,
65493
65698
  __rest,
@@ -65520,7 +65725,7 @@ function __rewriteRelativeImportExtension(path, preserveJsx) {
65520
65725
  __addDisposableResource,
65521
65726
  __disposeResources,
65522
65727
  __rewriteRelativeImportExtension,
65523
- });
65728
+ })));
65524
65729
 
65525
65730
 
65526
65731
  /***/ }