pdfmake 0.2.15 → 0.2.16

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.2.15, @license MIT, @link http://pdfmake.org */
1
+ /*! pdfmake v0.2.16, @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();
@@ -15374,31 +15374,34 @@ LayoutBuilder.prototype.addWatermark = function (watermark, fontProvider, defaul
15374
15374
  // empty watermark text
15375
15375
  return;
15376
15376
  }
15377
- watermark.font = watermark.font || defaultStyle.font || 'Roboto';
15378
- watermark.fontSize = watermark.fontSize || 'auto';
15379
- watermark.color = watermark.color || 'black';
15380
- watermark.opacity = isNumber(watermark.opacity) ? watermark.opacity : 0.6;
15381
- watermark.bold = watermark.bold || false;
15382
- watermark.italics = watermark.italics || false;
15383
- watermark.angle = !isUndefined(watermark.angle) && !isNull(watermark.angle) ? watermark.angle : null;
15384
- if (watermark.angle === null) {
15385
- watermark.angle = Math.atan2(this.pageSize.height, this.pageSize.width) * -180 / Math.PI;
15386
- }
15387
- if (watermark.fontSize === 'auto') {
15388
- watermark.fontSize = getWatermarkFontSize(this.pageSize, watermark, fontProvider);
15389
- }
15390
- var watermarkObject = {
15391
- text: watermark.text,
15392
- font: fontProvider.provideFont(watermark.font, watermark.bold, watermark.italics),
15393
- fontSize: watermark.fontSize,
15394
- color: watermark.color,
15395
- opacity: watermark.opacity,
15396
- angle: watermark.angle
15397
- };
15398
- watermarkObject._size = getWatermarkSize(watermark, fontProvider);
15399
15377
  var pages = this.writer.context().pages;
15400
15378
  for (var i = 0, l = pages.length; i < l; i++) {
15401
- pages[i].watermark = watermarkObject;
15379
+ pages[i].watermark = getWatermarkObject(Object.assign({}, watermark), pages[i].pageSize, fontProvider, defaultStyle);
15380
+ }
15381
+ function getWatermarkObject(watermark, pageSize, fontProvider, defaultStyle) {
15382
+ watermark.font = watermark.font || defaultStyle.font || 'Roboto';
15383
+ watermark.fontSize = watermark.fontSize || 'auto';
15384
+ watermark.color = watermark.color || 'black';
15385
+ watermark.opacity = isNumber(watermark.opacity) ? watermark.opacity : 0.6;
15386
+ watermark.bold = watermark.bold || false;
15387
+ watermark.italics = watermark.italics || false;
15388
+ watermark.angle = !isUndefined(watermark.angle) && !isNull(watermark.angle) ? watermark.angle : null;
15389
+ if (watermark.angle === null) {
15390
+ watermark.angle = Math.atan2(pageSize.height, pageSize.width) * -180 / Math.PI;
15391
+ }
15392
+ if (watermark.fontSize === 'auto') {
15393
+ watermark.fontSize = getWatermarkFontSize(pageSize, watermark, fontProvider);
15394
+ }
15395
+ var watermarkObject = {
15396
+ text: watermark.text,
15397
+ font: fontProvider.provideFont(watermark.font, watermark.bold, watermark.italics),
15398
+ fontSize: watermark.fontSize,
15399
+ color: watermark.color,
15400
+ opacity: watermark.opacity,
15401
+ angle: watermark.angle
15402
+ };
15403
+ watermarkObject._size = getWatermarkSize(watermark, fontProvider);
15404
+ return watermarkObject;
15402
15405
  }
15403
15406
  function getWatermarkSize(watermark, fontProvider) {
15404
15407
  var textTools = new TextTools(fontProvider);
@@ -21110,6 +21113,101 @@ util.inherits(DeflateRaw, Zlib);
21110
21113
  util.inherits(InflateRaw, Zlib);
21111
21114
  util.inherits(Unzip, Zlib);
21112
21115
 
21116
+ /***/ }),
21117
+
21118
+ /***/ 17802:
21119
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
21120
+
21121
+ "use strict";
21122
+
21123
+
21124
+ var bind = __webpack_require__(5049);
21125
+
21126
+ var $apply = __webpack_require__(73036);
21127
+ var $call = __webpack_require__(10078);
21128
+ var $reflectApply = __webpack_require__(61909);
21129
+
21130
+ /** @type {import('./actualApply')} */
21131
+ module.exports = $reflectApply || bind.call($call, $apply);
21132
+
21133
+
21134
+ /***/ }),
21135
+
21136
+ /***/ 28619:
21137
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
21138
+
21139
+ "use strict";
21140
+
21141
+
21142
+ var bind = __webpack_require__(5049);
21143
+ var $apply = __webpack_require__(73036);
21144
+ var actualApply = __webpack_require__(17802);
21145
+
21146
+ /** @type {import('./applyBind')} */
21147
+ module.exports = function applyBind() {
21148
+ return actualApply(bind, $apply, arguments);
21149
+ };
21150
+
21151
+
21152
+ /***/ }),
21153
+
21154
+ /***/ 73036:
21155
+ /***/ (function(module) {
21156
+
21157
+ "use strict";
21158
+
21159
+
21160
+ /** @type {import('./functionApply')} */
21161
+ module.exports = Function.prototype.apply;
21162
+
21163
+
21164
+ /***/ }),
21165
+
21166
+ /***/ 10078:
21167
+ /***/ (function(module) {
21168
+
21169
+ "use strict";
21170
+
21171
+
21172
+ /** @type {import('./functionCall')} */
21173
+ module.exports = Function.prototype.call;
21174
+
21175
+
21176
+ /***/ }),
21177
+
21178
+ /***/ 36688:
21179
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
21180
+
21181
+ "use strict";
21182
+
21183
+
21184
+ var bind = __webpack_require__(5049);
21185
+ var $TypeError = __webpack_require__(96785);
21186
+
21187
+ var $call = __webpack_require__(10078);
21188
+ var $actualApply = __webpack_require__(17802);
21189
+
21190
+ /** @type {import('.')} */
21191
+ module.exports = function callBindBasic(args) {
21192
+ if (args.length < 1 || typeof args[0] !== 'function') {
21193
+ throw new $TypeError('a function is required');
21194
+ }
21195
+ return $actualApply(bind, $call, args);
21196
+ };
21197
+
21198
+
21199
+ /***/ }),
21200
+
21201
+ /***/ 61909:
21202
+ /***/ (function(module) {
21203
+
21204
+ "use strict";
21205
+
21206
+
21207
+ /** @type {import('./reflectApply')} */
21208
+ module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply;
21209
+
21210
+
21113
21211
  /***/ }),
21114
21212
 
21115
21213
  /***/ 67913:
@@ -21141,34 +21239,23 @@ module.exports = function callBoundIntrinsic(name, allowMissing) {
21141
21239
  "use strict";
21142
21240
 
21143
21241
 
21144
- var bind = __webpack_require__(5049);
21145
- var GetIntrinsic = __webpack_require__(28651);
21146
21242
  var setFunctionLength = __webpack_require__(86255);
21147
21243
 
21148
- var $TypeError = __webpack_require__(96785);
21149
- var $apply = GetIntrinsic('%Function.prototype.apply%');
21150
- var $call = GetIntrinsic('%Function.prototype.call%');
21151
- var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
21152
-
21153
21244
  var $defineProperty = __webpack_require__(56649);
21154
- var $max = GetIntrinsic('%Math.max%');
21245
+
21246
+ var callBindBasic = __webpack_require__(36688);
21247
+ var applyBind = __webpack_require__(28619);
21155
21248
 
21156
21249
  module.exports = function callBind(originalFunction) {
21157
- if (typeof originalFunction !== 'function') {
21158
- throw new $TypeError('a function is required');
21159
- }
21160
- var func = $reflectApply(bind, $call, arguments);
21250
+ var func = callBindBasic(arguments);
21251
+ var adjustedLength = originalFunction.length - (arguments.length - 1);
21161
21252
  return setFunctionLength(
21162
21253
  func,
21163
- 1 + $max(0, originalFunction.length - (arguments.length - 1)),
21254
+ 1 + (adjustedLength > 0 ? adjustedLength : 0),
21164
21255
  true
21165
21256
  );
21166
21257
  };
21167
21258
 
21168
- var applyBind = function applyBind() {
21169
- return $reflectApply(bind, $apply, arguments);
21170
- };
21171
-
21172
21259
  if ($defineProperty) {
21173
21260
  $defineProperty(module.exports, 'apply', { value: applyBind });
21174
21261
  } else {
@@ -21176,6 +21263,32 @@ if ($defineProperty) {
21176
21263
  }
21177
21264
 
21178
21265
 
21266
+ /***/ }),
21267
+
21268
+ /***/ 22774:
21269
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
21270
+
21271
+ "use strict";
21272
+
21273
+
21274
+ var GetIntrinsic = __webpack_require__(28651);
21275
+
21276
+ var callBind = __webpack_require__(26601);
21277
+
21278
+ // eslint-disable-next-line no-extra-parens
21279
+ var $indexOf = callBind(/** @type {typeof String.prototype.indexOf} */ (GetIntrinsic('String.prototype.indexOf')));
21280
+
21281
+ /** @type {import('.')} */
21282
+ module.exports = function callBoundIntrinsic(name, allowMissing) {
21283
+ // eslint-disable-next-line no-extra-parens
21284
+ var intrinsic = /** @type {Parameters<typeof callBind>[0]} */ (GetIntrinsic(name, !!allowMissing));
21285
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
21286
+ return callBind(intrinsic);
21287
+ }
21288
+ return intrinsic;
21289
+ };
21290
+
21291
+
21179
21292
  /***/ }),
21180
21293
 
21181
21294
  /***/ 41613:
@@ -30644,16 +30757,45 @@ module.exports = defineProperties;
30644
30757
 
30645
30758
  /***/ }),
30646
30759
 
30647
- /***/ 56649:
30760
+ /***/ 89302:
30648
30761
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
30649
30762
 
30650
30763
  "use strict";
30651
30764
 
30652
30765
 
30653
- var GetIntrinsic = __webpack_require__(28651);
30766
+ var callBind = __webpack_require__(36688);
30767
+ var gOPD = __webpack_require__(68109);
30768
+
30769
+ // eslint-disable-next-line no-extra-parens, no-proto
30770
+ var hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
30771
+
30772
+ // eslint-disable-next-line no-extra-parens
30773
+ var desc = hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
30774
+
30775
+ var $Object = Object;
30776
+ var $getPrototypeOf = $Object.getPrototypeOf;
30777
+
30778
+ /** @type {import('./get')} */
30779
+ module.exports = desc && typeof desc.get === 'function'
30780
+ ? callBind([desc.get])
30781
+ : typeof $getPrototypeOf === 'function'
30782
+ ? /** @type {import('./get')} */ function getDunder(value) {
30783
+ // eslint-disable-next-line eqeqeq
30784
+ return $getPrototypeOf(value == null ? value : $Object(value));
30785
+ }
30786
+ : false;
30787
+
30788
+
30789
+ /***/ }),
30790
+
30791
+ /***/ 56649:
30792
+ /***/ (function(module) {
30793
+
30794
+ "use strict";
30795
+
30654
30796
 
30655
30797
  /** @type {import('.')} */
30656
- var $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false;
30798
+ var $defineProperty = Object.defineProperty || false;
30657
30799
  if ($defineProperty) {
30658
30800
  try {
30659
30801
  $defineProperty({}, 'a', { value: 1 });
@@ -30750,6 +30892,18 @@ module.exports = TypeError;
30750
30892
  module.exports = URIError;
30751
30893
 
30752
30894
 
30895
+ /***/ }),
30896
+
30897
+ /***/ 75846:
30898
+ /***/ (function(module) {
30899
+
30900
+ "use strict";
30901
+
30902
+
30903
+ /** @type {import('.')} */
30904
+ module.exports = Object;
30905
+
30906
+
30753
30907
  /***/ }),
30754
30908
 
30755
30909
  /***/ 64785:
@@ -31516,6 +31670,8 @@ module.exports = functionsHaveNames;
31516
31670
 
31517
31671
  var undefined;
31518
31672
 
31673
+ var $Object = __webpack_require__(75846);
31674
+
31519
31675
  var $Error = __webpack_require__(15293);
31520
31676
  var $EvalError = __webpack_require__(29055);
31521
31677
  var $RangeError = __webpack_require__(18888);
@@ -31524,6 +31680,12 @@ var $SyntaxError = __webpack_require__(57770);
31524
31680
  var $TypeError = __webpack_require__(96785);
31525
31681
  var $URIError = __webpack_require__(54055);
31526
31682
 
31683
+ var abs = __webpack_require__(50716);
31684
+ var floor = __webpack_require__(77450);
31685
+ var max = __webpack_require__(3774);
31686
+ var min = __webpack_require__(47552);
31687
+ var pow = __webpack_require__(75874);
31688
+
31527
31689
  var $Function = Function;
31528
31690
 
31529
31691
  // eslint-disable-next-line consistent-return
@@ -31533,14 +31695,8 @@ var getEvalledConstructor = function (expressionSyntax) {
31533
31695
  } catch (e) {}
31534
31696
  };
31535
31697
 
31536
- var $gOPD = Object.getOwnPropertyDescriptor;
31537
- if ($gOPD) {
31538
- try {
31539
- $gOPD({}, '');
31540
- } catch (e) {
31541
- $gOPD = null; // this is IE 8, which has a broken gOPD
31542
- }
31543
- }
31698
+ var $gOPD = __webpack_require__(68109);
31699
+ var $defineProperty = __webpack_require__(56649);
31544
31700
 
31545
31701
  var throwTypeError = function () {
31546
31702
  throw new $TypeError();
@@ -31563,13 +31719,14 @@ var ThrowTypeError = $gOPD
31563
31719
  : throwTypeError;
31564
31720
 
31565
31721
  var hasSymbols = __webpack_require__(73257)();
31566
- var hasProto = __webpack_require__(85726)();
31722
+ var getDunderProto = __webpack_require__(89302);
31567
31723
 
31568
- var getProto = Object.getPrototypeOf || (
31569
- hasProto
31570
- ? function (x) { return x.__proto__; } // eslint-disable-line no-proto
31571
- : null
31572
- );
31724
+ var getProto = (typeof Reflect === 'function' && Reflect.getPrototypeOf)
31725
+ || $Object.getPrototypeOf
31726
+ || getDunderProto;
31727
+
31728
+ var $apply = __webpack_require__(73036);
31729
+ var $call = __webpack_require__(10078);
31573
31730
 
31574
31731
  var needsEval = {};
31575
31732
 
@@ -31616,7 +31773,8 @@ var INTRINSICS = {
31616
31773
  '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
31617
31774
  '%Math%': Math,
31618
31775
  '%Number%': Number,
31619
- '%Object%': Object,
31776
+ '%Object%': $Object,
31777
+ '%Object.getOwnPropertyDescriptor%': $gOPD,
31620
31778
  '%parseFloat%': parseFloat,
31621
31779
  '%parseInt%': parseInt,
31622
31780
  '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
@@ -31642,7 +31800,16 @@ var INTRINSICS = {
31642
31800
  '%URIError%': $URIError,
31643
31801
  '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
31644
31802
  '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
31645
- '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
31803
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet,
31804
+
31805
+ '%Function.prototype.call%': $call,
31806
+ '%Function.prototype.apply%': $apply,
31807
+ '%Object.defineProperty%': $defineProperty,
31808
+ '%Math.abs%': abs,
31809
+ '%Math.floor%': floor,
31810
+ '%Math.max%': max,
31811
+ '%Math.min%': min,
31812
+ '%Math.pow%': pow
31646
31813
  };
31647
31814
 
31648
31815
  if (getProto) {
@@ -31737,11 +31904,11 @@ var LEGACY_ALIASES = {
31737
31904
 
31738
31905
  var bind = __webpack_require__(5049);
31739
31906
  var hasOwn = __webpack_require__(55215);
31740
- var $concat = bind.call(Function.call, Array.prototype.concat);
31741
- var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
31742
- var $replace = bind.call(Function.call, String.prototype.replace);
31743
- var $strSlice = bind.call(Function.call, String.prototype.slice);
31744
- var $exec = bind.call(Function.call, RegExp.prototype.exec);
31907
+ var $concat = bind.call($call, Array.prototype.concat);
31908
+ var $spliceApply = bind.call($apply, Array.prototype.splice);
31909
+ var $replace = bind.call($call, String.prototype.replace);
31910
+ var $strSlice = bind.call($call, String.prototype.slice);
31911
+ var $exec = bind.call($call, RegExp.prototype.exec);
31745
31912
 
31746
31913
  /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
31747
31914
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
@@ -31873,6 +32040,18 @@ module.exports = function GetIntrinsic(name, allowMissing) {
31873
32040
  };
31874
32041
 
31875
32042
 
32043
+ /***/ }),
32044
+
32045
+ /***/ 85567:
32046
+ /***/ (function(module) {
32047
+
32048
+ "use strict";
32049
+
32050
+
32051
+ /** @type {import('./gOPD')} */
32052
+ module.exports = Object.getOwnPropertyDescriptor;
32053
+
32054
+
31876
32055
  /***/ }),
31877
32056
 
31878
32057
  /***/ 68109:
@@ -31881,9 +32060,8 @@ module.exports = function GetIntrinsic(name, allowMissing) {
31881
32060
  "use strict";
31882
32061
 
31883
32062
 
31884
- var GetIntrinsic = __webpack_require__(28651);
31885
-
31886
- var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
32063
+ /** @type {import('.')} */
32064
+ var $gOPD = __webpack_require__(85567);
31887
32065
 
31888
32066
  if ($gOPD) {
31889
32067
  try {
@@ -31927,29 +32105,6 @@ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBu
31927
32105
  module.exports = hasPropertyDescriptors;
31928
32106
 
31929
32107
 
31930
- /***/ }),
31931
-
31932
- /***/ 85726:
31933
- /***/ (function(module) {
31934
-
31935
- "use strict";
31936
-
31937
-
31938
- var test = {
31939
- __proto__: null,
31940
- foo: {}
31941
- };
31942
-
31943
- var $Object = Object;
31944
-
31945
- /** @type {import('.')} */
31946
- module.exports = function hasProto() {
31947
- // @ts-expect-error: TS errors on an inherited property for some reason
31948
- return { __proto__: test }.foo === test.foo
31949
- && !(test instanceof $Object);
31950
- };
31951
-
31952
-
31953
32108
  /***/ }),
31954
32109
 
31955
32110
  /***/ 73257:
@@ -31961,6 +32116,7 @@ module.exports = function hasProto() {
31961
32116
  var origSymbol = typeof Symbol !== 'undefined' && Symbol;
31962
32117
  var hasSymbolSham = __webpack_require__(12843);
31963
32118
 
32119
+ /** @type {import('.')} */
31964
32120
  module.exports = function hasNativeSymbols() {
31965
32121
  if (typeof origSymbol !== 'function') { return false; }
31966
32122
  if (typeof Symbol !== 'function') { return false; }
@@ -31979,11 +32135,13 @@ module.exports = function hasNativeSymbols() {
31979
32135
  "use strict";
31980
32136
 
31981
32137
 
32138
+ /** @type {import('./shams')} */
31982
32139
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
31983
32140
  module.exports = function hasSymbols() {
31984
32141
  if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
31985
32142
  if (typeof Symbol.iterator === 'symbol') { return true; }
31986
32143
 
32144
+ /** @type {{ [k in symbol]?: unknown }} */
31987
32145
  var obj = {};
31988
32146
  var sym = Symbol('test');
31989
32147
  var symObj = Object(sym);
@@ -32002,7 +32160,7 @@ module.exports = function hasSymbols() {
32002
32160
 
32003
32161
  var symVal = 42;
32004
32162
  obj[sym] = symVal;
32005
- for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
32163
+ for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
32006
32164
  if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
32007
32165
 
32008
32166
  if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
@@ -32013,7 +32171,8 @@ module.exports = function hasSymbols() {
32013
32171
  if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
32014
32172
 
32015
32173
  if (typeof Object.getOwnPropertyDescriptor === 'function') {
32016
- var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
32174
+ // eslint-disable-next-line no-extra-parens
32175
+ var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym));
32017
32176
  if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
32018
32177
  }
32019
32178
 
@@ -35144,35 +35303,46 @@ if (typeof Object.create === 'function') {
35144
35303
 
35145
35304
 
35146
35305
  var hasToStringTag = __webpack_require__(26626)();
35147
- var callBound = __webpack_require__(67913);
35306
+ var callBound = __webpack_require__(22774);
35148
35307
 
35149
35308
  var $toString = callBound('Object.prototype.toString');
35150
35309
 
35310
+ /** @type {import('.')} */
35151
35311
  var isStandardArguments = function isArguments(value) {
35152
- if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {
35312
+ if (
35313
+ hasToStringTag
35314
+ && value
35315
+ && typeof value === 'object'
35316
+ && Symbol.toStringTag in value
35317
+ ) {
35153
35318
  return false;
35154
35319
  }
35155
35320
  return $toString(value) === '[object Arguments]';
35156
35321
  };
35157
35322
 
35323
+ /** @type {import('.')} */
35158
35324
  var isLegacyArguments = function isArguments(value) {
35159
35325
  if (isStandardArguments(value)) {
35160
35326
  return true;
35161
35327
  }
35162
- return value !== null &&
35163
- typeof value === 'object' &&
35164
- typeof value.length === 'number' &&
35165
- value.length >= 0 &&
35166
- $toString(value) !== '[object Array]' &&
35167
- $toString(value.callee) === '[object Function]';
35328
+ return value !== null
35329
+ && typeof value === 'object'
35330
+ && 'length' in value
35331
+ && typeof value.length === 'number'
35332
+ && value.length >= 0
35333
+ && $toString(value) !== '[object Array]'
35334
+ && 'callee' in value
35335
+ && $toString(value.callee) === '[object Function]';
35168
35336
  };
35169
35337
 
35170
35338
  var supportsStandardArguments = (function () {
35171
35339
  return isStandardArguments(arguments);
35172
35340
  }());
35173
35341
 
35342
+ // @ts-expect-error TODO make this not error
35174
35343
  isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
35175
35344
 
35345
+ /** @type {import('.')} */
35176
35346
  module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
35177
35347
 
35178
35348
 
@@ -35293,25 +35463,30 @@ module.exports = reflectApply
35293
35463
  "use strict";
35294
35464
 
35295
35465
 
35296
- var getDay = Date.prototype.getDay;
35466
+ var callBound = __webpack_require__(22774);
35467
+
35468
+ var getDay = callBound('Date.prototype.getDay');
35469
+ /** @type {import('.')} */
35297
35470
  var tryDateObject = function tryDateGetDayCall(value) {
35298
35471
  try {
35299
- getDay.call(value);
35472
+ getDay(value);
35300
35473
  return true;
35301
35474
  } catch (e) {
35302
35475
  return false;
35303
35476
  }
35304
35477
  };
35305
35478
 
35306
- var toStr = Object.prototype.toString;
35479
+ /** @type {(value: unknown) => string} */
35480
+ var toStr = callBound('Object.prototype.toString');
35307
35481
  var dateClass = '[object Date]';
35308
35482
  var hasToStringTag = __webpack_require__(26626)();
35309
35483
 
35484
+ /** @type {import('.')} */
35310
35485
  module.exports = function isDateObject(value) {
35311
35486
  if (typeof value !== 'object' || value === null) {
35312
35487
  return false;
35313
35488
  }
35314
- return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
35489
+ return hasToStringTag ? tryDateObject(value) : toStr(value) === dateClass;
35315
35490
  };
35316
35491
 
35317
35492
 
@@ -35454,22 +35629,25 @@ module.exports = function shimNumberIsNaN() {
35454
35629
  "use strict";
35455
35630
 
35456
35631
 
35457
- var callBound = __webpack_require__(67913);
35632
+ var callBound = __webpack_require__(22774);
35458
35633
  var hasToStringTag = __webpack_require__(26626)();
35459
- var has;
35460
- var $exec;
35461
- var isRegexMarker;
35462
- var badStringifier;
35634
+ var hasOwn = __webpack_require__(55215);
35635
+ var gOPD = __webpack_require__(68109);
35636
+
35637
+ /** @type {import('.')} */
35638
+ var fn;
35463
35639
 
35464
35640
  if (hasToStringTag) {
35465
- has = callBound('Object.prototype.hasOwnProperty');
35466
- $exec = callBound('RegExp.prototype.exec');
35467
- isRegexMarker = {};
35641
+ /** @type {(receiver: ThisParameterType<typeof RegExp.prototype.exec>, ...args: Parameters<typeof RegExp.prototype.exec>) => ReturnType<typeof RegExp.prototype.exec>} */
35642
+ var $exec = callBound('RegExp.prototype.exec');
35643
+ /** @type {object} */
35644
+ var isRegexMarker = {};
35468
35645
 
35469
35646
  var throwRegexMarker = function () {
35470
35647
  throw isRegexMarker;
35471
35648
  };
35472
- badStringifier = {
35649
+ /** @type {{ toString(): never, valueOf(): never, [Symbol.toPrimitive]?(): never }} */
35650
+ var badStringifier = {
35473
35651
  toString: throwRegexMarker,
35474
35652
  valueOf: throwRegexMarker
35475
35653
  };
@@ -35477,32 +35655,37 @@ if (hasToStringTag) {
35477
35655
  if (typeof Symbol.toPrimitive === 'symbol') {
35478
35656
  badStringifier[Symbol.toPrimitive] = throwRegexMarker;
35479
35657
  }
35480
- }
35481
-
35482
- var $toString = callBound('Object.prototype.toString');
35483
- var gOPD = Object.getOwnPropertyDescriptor;
35484
- var regexClass = '[object RegExp]';
35485
35658
 
35486
- module.exports = hasToStringTag
35659
+ /** @type {import('.')} */
35660
+ // @ts-expect-error TS can't figure out that the $exec call always throws
35487
35661
  // eslint-disable-next-line consistent-return
35488
- ? function isRegex(value) {
35662
+ fn = function isRegex(value) {
35489
35663
  if (!value || typeof value !== 'object') {
35490
35664
  return false;
35491
35665
  }
35492
35666
 
35493
- var descriptor = gOPD(value, 'lastIndex');
35494
- var hasLastIndexDataProperty = descriptor && has(descriptor, 'value');
35667
+ // eslint-disable-next-line no-extra-parens
35668
+ var descriptor = /** @type {NonNullable<typeof gOPD>} */ (gOPD)(/** @type {{ lastIndex?: unknown }} */ (value), 'lastIndex');
35669
+ var hasLastIndexDataProperty = descriptor && hasOwn(descriptor, 'value');
35495
35670
  if (!hasLastIndexDataProperty) {
35496
35671
  return false;
35497
35672
  }
35498
35673
 
35499
35674
  try {
35500
- $exec(value, badStringifier);
35675
+ // eslint-disable-next-line no-extra-parens
35676
+ $exec(value, /** @type {string} */ (/** @type {unknown} */ (badStringifier)));
35501
35677
  } catch (e) {
35502
35678
  return e === isRegexMarker;
35503
35679
  }
35504
- }
35505
- : function isRegex(value) {
35680
+ };
35681
+ } else {
35682
+ /** @type {(receiver: ThisParameterType<typeof Object.prototype.toString>, ...args: Parameters<typeof Object.prototype.toString>) => ReturnType<typeof Object.prototype.toString>} */
35683
+ var $toString = callBound('Object.prototype.toString');
35684
+ /** @const @type {'[object RegExp]'} */
35685
+ var regexClass = '[object RegExp]';
35686
+
35687
+ /** @type {import('.')} */
35688
+ fn = function isRegex(value) {
35506
35689
  // In older browsers, typeof regex incorrectly returns 'function'
35507
35690
  if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
35508
35691
  return false;
@@ -35510,6 +35693,9 @@ module.exports = hasToStringTag
35510
35693
 
35511
35694
  return $toString(value) === regexClass;
35512
35695
  };
35696
+ }
35697
+
35698
+ module.exports = fn;
35513
35699
 
35514
35700
 
35515
35701
  /***/ }),
@@ -35911,6 +36097,66 @@ exports.parse = async;
35911
36097
  exports.parseSync = sync;
35912
36098
 
35913
36099
 
36100
+ /***/ }),
36101
+
36102
+ /***/ 50716:
36103
+ /***/ (function(module) {
36104
+
36105
+ "use strict";
36106
+
36107
+
36108
+ /** @type {import('./abs')} */
36109
+ module.exports = Math.abs;
36110
+
36111
+
36112
+ /***/ }),
36113
+
36114
+ /***/ 77450:
36115
+ /***/ (function(module) {
36116
+
36117
+ "use strict";
36118
+
36119
+
36120
+ /** @type {import('./abs')} */
36121
+ module.exports = Math.floor;
36122
+
36123
+
36124
+ /***/ }),
36125
+
36126
+ /***/ 3774:
36127
+ /***/ (function(module) {
36128
+
36129
+ "use strict";
36130
+
36131
+
36132
+ /** @type {import('./max')} */
36133
+ module.exports = Math.max;
36134
+
36135
+
36136
+ /***/ }),
36137
+
36138
+ /***/ 47552:
36139
+ /***/ (function(module) {
36140
+
36141
+ "use strict";
36142
+
36143
+
36144
+ /** @type {import('./min')} */
36145
+ module.exports = Math.min;
36146
+
36147
+
36148
+ /***/ }),
36149
+
36150
+ /***/ 75874:
36151
+ /***/ (function(module) {
36152
+
36153
+ "use strict";
36154
+
36155
+
36156
+ /** @type {import('./pow')} */
36157
+ module.exports = Math.pow;
36158
+
36159
+
35914
36160
  /***/ }),
35915
36161
 
35916
36162
  /***/ 63249:
@@ -49520,7 +49766,7 @@ var isFunction = (__webpack_require__(91867).isFunction);
49520
49766
  var isUndefined = (__webpack_require__(91867).isUndefined);
49521
49767
  //var isNull = require('../helpers').isNull;
49522
49768
  var pack = (__webpack_require__(91867).pack);
49523
- var FileSaver = __webpack_require__(76036);
49769
+ var FileSaver = __webpack_require__(88268);
49524
49770
  var saveAs = FileSaver.saveAs;
49525
49771
 
49526
49772
  var defaultClientFonts = {
@@ -52132,7 +52378,16 @@ ImageMeasure.prototype.measureImage = function (src) {
52132
52378
  image = this.pdfKitDoc._imageRegistry[src];
52133
52379
  }
52134
52380
 
52135
- return { width: image.width, height: image.height };
52381
+ var imageSize = { width: image.width, height: image.height };
52382
+
52383
+ if (typeof image === 'object' && image.constructor.name === 'JPEG') {
52384
+ // If EXIF orientation calls for it, swap width and height
52385
+ if (image.orientation > 4) {
52386
+ imageSize = { width: image.height, height: image.width };
52387
+ }
52388
+ }
52389
+
52390
+ return imageSize;
52136
52391
 
52137
52392
  function realImageSrc(src) {
52138
52393
  var img = that.imageDictionary[src];
@@ -52454,7 +52709,7 @@ function _interopDefault(ex) {
52454
52709
  return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex;
52455
52710
  }
52456
52711
 
52457
- var PdfKit = _interopDefault(__webpack_require__(47008));
52712
+ var PdfKit = _interopDefault(__webpack_require__(93027));
52458
52713
 
52459
52714
  function getEngineInstance() {
52460
52715
  return PdfKit;
@@ -55507,7 +55762,7 @@ module.exports = TraversalTracker;
55507
55762
 
55508
55763
  /***/ }),
55509
55764
 
55510
- /***/ 76036:
55765
+ /***/ 88268:
55511
55766
  /***/ (function(module, exports, __webpack_require__) {
55512
55767
 
55513
55768
  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),
@@ -68181,7 +68436,7 @@ module.exports = LineBreaker;
68181
68436
 
68182
68437
  /***/ }),
68183
68438
 
68184
- /***/ 47008:
68439
+ /***/ 93027:
68185
68440
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
68186
68441
 
68187
68442
  "use strict";
@@ -71070,7 +71325,7 @@ var EmbeddedFont = /*#__PURE__*/function (_PDFFont2) {
71070
71325
  } else {
71071
71326
  descriptor.data.FontFile2 = fontFile;
71072
71327
  }
71073
- if (this.document.subset) {
71328
+ if (this.document.subset && this.document.subset === 1) {
71074
71329
  var CIDSet = Buffer.from('FFFFFFFFC0', 'hex');
71075
71330
  var CIDSetRef = this.document.ref();
71076
71331
  CIDSetRef.write(CIDSet);
@@ -71691,12 +71946,11 @@ var TextMixin = {
71691
71946
  return text + ".";
71692
71947
  }
71693
71948
  };
71694
- var drawListItem = function drawListItem(listItem) {
71949
+ var drawListItem = function drawListItem(listItem, i) {
71695
71950
  var _this13 = this;
71696
71951
  wrapper = new LineWrapper(this, options);
71697
71952
  wrapper.on('line', this._line);
71698
71953
  level = 1;
71699
- var i = 0;
71700
71954
  wrapper.once('firstLine', function () {
71701
71955
  var item, itemType, labelType, bodyType;
71702
71956
  if (options.structParent) {
@@ -71758,7 +72012,7 @@ var TextMixin = {
71758
72012
  wrapper.wrap(listItem, options);
71759
72013
  };
71760
72014
  for (var i = 0; i < items.length; i++) {
71761
- drawListItem.call(this, items[i]);
72015
+ drawListItem.call(this, items[i], i);
71762
72016
  }
71763
72017
  return this;
71764
72018
  },
@@ -73467,7 +73721,7 @@ var AcroFormMixin = {
73467
73721
  },
73468
73722
  _resolveFont: function _resolveFont(options) {
73469
73723
  // add current font to document-level AcroForm dict if necessary
73470
- if (this._acroform.fonts[this._font.id] === null) {
73724
+ if (this._acroform.fonts[this._font.id] == null) {
73471
73725
  this._acroform.fonts[this._font.id] = this._font.ref();
73472
73726
  }
73473
73727
 
@@ -73538,11 +73792,13 @@ var AttachmentsMixin = {
73538
73792
  * * options.hidden: if true, do not add attachment to EmbeddedFiles dictionary. Useful for file attachment annotations
73539
73793
  * * options.creationDate: override creation date
73540
73794
  * * options.modifiedDate: override modified date
73795
+ * * options.relationship: Relationship between the PDF document and its attached file. Can be 'Alternative', 'Data', 'Source', 'Supplement' or 'Unspecified'.
73541
73796
  * @returns filespec reference
73542
73797
  */
73543
73798
  file: function file(src) {
73544
73799
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
73545
73800
  options.name = options.name || src;
73801
+ options.relationship = options.relationship || 'Unspecified';
73546
73802
  var refBody = {
73547
73803
  Type: 'EmbeddedFile',
73548
73804
  Params: {}
@@ -73611,6 +73867,7 @@ var AttachmentsMixin = {
73611
73867
  // add filespec for embedded file
73612
73868
  var fileSpecBody = {
73613
73869
  Type: 'Filespec',
73870
+ AFRelationship: options.relationship,
73614
73871
  F: new String(options.name),
73615
73872
  EF: {
73616
73873
  F: ref
@@ -73625,13 +73882,20 @@ var AttachmentsMixin = {
73625
73882
  if (!options.hidden) {
73626
73883
  this.addNamedEmbeddedFile(options.name, filespec);
73627
73884
  }
73885
+
73886
+ // Add file to the catalogue to be PDF/A3 compliant
73887
+ if (this._root.data.AF) {
73888
+ this._root.data.AF.push(filespec);
73889
+ } else {
73890
+ this._root.data.AF = [filespec];
73891
+ }
73628
73892
  return filespec;
73629
73893
  }
73630
73894
  };
73631
73895
 
73632
73896
  /** check two embedded file metadata objects for equality */
73633
73897
  function isEqual(a, b) {
73634
- return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && a.Params.CreationDate.getTime() === b.Params.CreationDate.getTime() && a.Params.ModDate.getTime() === b.Params.ModDate.getTime();
73898
+ return a.Subtype === b.Subtype && a.Params.CheckSum.toString() === b.Params.CheckSum.toString() && a.Params.Size === b.Params.Size && a.Params.CreationDate.getTime() === b.Params.CreationDate.getTime() && (a.Params.ModDate === undefined && b.Params.ModDate === undefined || a.Params.ModDate.getTime() === b.Params.ModDate.getTime());
73635
73899
  }
73636
73900
  var PDFA = {
73637
73901
  initPDFA: function initPDFA(pSubset) {