docx 9.0.2 → 9.0.3

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.
@@ -221,10 +221,10 @@ var __async = (__this, __arguments, generator) => {
221
221
  EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
222
222
  return _getMaxListeners(this);
223
223
  };
224
- EventEmitter.prototype.emit = function emit(type) {
224
+ EventEmitter.prototype.emit = function emit(type2) {
225
225
  var args = [];
226
226
  for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
227
- var doError = type === "error";
227
+ var doError = type2 === "error";
228
228
  var events2 = this._events;
229
229
  if (events2 !== void 0)
230
230
  doError = doError && events2.error === void 0;
@@ -241,7 +241,7 @@ var __async = (__this, __arguments, generator) => {
241
241
  err.context = er;
242
242
  throw err;
243
243
  }
244
- var handler = events2[type];
244
+ var handler = events2[type2];
245
245
  if (handler === void 0)
246
246
  return false;
247
247
  if (typeof handler === "function") {
@@ -254,7 +254,7 @@ var __async = (__this, __arguments, generator) => {
254
254
  }
255
255
  return true;
256
256
  };
257
- function _addListener(target, type, listener, prepend) {
257
+ function _addListener(target, type2, listener, prepend) {
258
258
  var m;
259
259
  var events2;
260
260
  var existing;
@@ -267,19 +267,19 @@ var __async = (__this, __arguments, generator) => {
267
267
  if (events2.newListener !== void 0) {
268
268
  target.emit(
269
269
  "newListener",
270
- type,
270
+ type2,
271
271
  listener.listener ? listener.listener : listener
272
272
  );
273
273
  events2 = target._events;
274
274
  }
275
- existing = events2[type];
275
+ existing = events2[type2];
276
276
  }
277
277
  if (existing === void 0) {
278
- existing = events2[type] = listener;
278
+ existing = events2[type2] = listener;
279
279
  ++target._eventsCount;
280
280
  } else {
281
281
  if (typeof existing === "function") {
282
- existing = events2[type] = prepend ? [listener, existing] : [existing, listener];
282
+ existing = events2[type2] = prepend ? [listener, existing] : [existing, listener];
283
283
  } else if (prepend) {
284
284
  existing.unshift(listener);
285
285
  } else {
@@ -288,22 +288,22 @@ var __async = (__this, __arguments, generator) => {
288
288
  m = _getMaxListeners(target);
289
289
  if (m > 0 && existing.length > m && !existing.warned) {
290
290
  existing.warned = true;
291
- var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");
291
+ var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type2) + " listeners added. Use emitter.setMaxListeners() to increase limit");
292
292
  w.name = "MaxListenersExceededWarning";
293
293
  w.emitter = target;
294
- w.type = type;
294
+ w.type = type2;
295
295
  w.count = existing.length;
296
296
  ProcessEmitWarning(w);
297
297
  }
298
298
  }
299
299
  return target;
300
300
  }
301
- EventEmitter.prototype.addListener = function addListener(type, listener) {
302
- return _addListener(this, type, listener, false);
301
+ EventEmitter.prototype.addListener = function addListener(type2, listener) {
302
+ return _addListener(this, type2, listener, false);
303
303
  };
304
304
  EventEmitter.prototype.on = EventEmitter.prototype.addListener;
305
- EventEmitter.prototype.prependListener = function prependListener(type, listener) {
306
- return _addListener(this, type, listener, true);
305
+ EventEmitter.prototype.prependListener = function prependListener(type2, listener) {
306
+ return _addListener(this, type2, listener, true);
307
307
  };
308
308
  function onceWrapper() {
309
309
  if (!this.fired) {
@@ -314,39 +314,39 @@ var __async = (__this, __arguments, generator) => {
314
314
  return this.listener.apply(this.target, arguments);
315
315
  }
316
316
  }
317
- function _onceWrap(target, type, listener) {
318
- var state2 = { fired: false, wrapFn: void 0, target, type, listener };
317
+ function _onceWrap(target, type2, listener) {
318
+ var state2 = { fired: false, wrapFn: void 0, target, type: type2, listener };
319
319
  var wrapped = onceWrapper.bind(state2);
320
320
  wrapped.listener = listener;
321
321
  state2.wrapFn = wrapped;
322
322
  return wrapped;
323
323
  }
324
- EventEmitter.prototype.once = function once2(type, listener) {
324
+ EventEmitter.prototype.once = function once2(type2, listener) {
325
325
  checkListener(listener);
326
- this.on(type, _onceWrap(this, type, listener));
326
+ this.on(type2, _onceWrap(this, type2, listener));
327
327
  return this;
328
328
  };
329
- EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {
329
+ EventEmitter.prototype.prependOnceListener = function prependOnceListener(type2, listener) {
330
330
  checkListener(listener);
331
- this.prependListener(type, _onceWrap(this, type, listener));
331
+ this.prependListener(type2, _onceWrap(this, type2, listener));
332
332
  return this;
333
333
  };
334
- EventEmitter.prototype.removeListener = function removeListener(type, listener) {
334
+ EventEmitter.prototype.removeListener = function removeListener(type2, listener) {
335
335
  var list, events2, position, i, originalListener;
336
336
  checkListener(listener);
337
337
  events2 = this._events;
338
338
  if (events2 === void 0)
339
339
  return this;
340
- list = events2[type];
340
+ list = events2[type2];
341
341
  if (list === void 0)
342
342
  return this;
343
343
  if (list === listener || list.listener === listener) {
344
344
  if (--this._eventsCount === 0)
345
345
  this._events = /* @__PURE__ */ Object.create(null);
346
346
  else {
347
- delete events2[type];
347
+ delete events2[type2];
348
348
  if (events2.removeListener)
349
- this.emit("removeListener", type, list.listener || listener);
349
+ this.emit("removeListener", type2, list.listener || listener);
350
350
  }
351
351
  } else if (typeof list !== "function") {
352
352
  position = -1;
@@ -365,14 +365,14 @@ var __async = (__this, __arguments, generator) => {
365
365
  spliceOne(list, position);
366
366
  }
367
367
  if (list.length === 1)
368
- events2[type] = list[0];
368
+ events2[type2] = list[0];
369
369
  if (events2.removeListener !== void 0)
370
- this.emit("removeListener", type, originalListener || listener);
370
+ this.emit("removeListener", type2, originalListener || listener);
371
371
  }
372
372
  return this;
373
373
  };
374
374
  EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
375
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
375
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(type2) {
376
376
  var listeners, events2, i;
377
377
  events2 = this._events;
378
378
  if (events2 === void 0)
@@ -381,11 +381,11 @@ var __async = (__this, __arguments, generator) => {
381
381
  if (arguments.length === 0) {
382
382
  this._events = /* @__PURE__ */ Object.create(null);
383
383
  this._eventsCount = 0;
384
- } else if (events2[type] !== void 0) {
384
+ } else if (events2[type2] !== void 0) {
385
385
  if (--this._eventsCount === 0)
386
386
  this._events = /* @__PURE__ */ Object.create(null);
387
387
  else
388
- delete events2[type];
388
+ delete events2[type2];
389
389
  }
390
390
  return this;
391
391
  }
@@ -402,45 +402,45 @@ var __async = (__this, __arguments, generator) => {
402
402
  this._eventsCount = 0;
403
403
  return this;
404
404
  }
405
- listeners = events2[type];
405
+ listeners = events2[type2];
406
406
  if (typeof listeners === "function") {
407
- this.removeListener(type, listeners);
407
+ this.removeListener(type2, listeners);
408
408
  } else if (listeners !== void 0) {
409
409
  for (i = listeners.length - 1; i >= 0; i--) {
410
- this.removeListener(type, listeners[i]);
410
+ this.removeListener(type2, listeners[i]);
411
411
  }
412
412
  }
413
413
  return this;
414
414
  };
415
- function _listeners(target, type, unwrap) {
415
+ function _listeners(target, type2, unwrap) {
416
416
  var events2 = target._events;
417
417
  if (events2 === void 0)
418
418
  return [];
419
- var evlistener = events2[type];
419
+ var evlistener = events2[type2];
420
420
  if (evlistener === void 0)
421
421
  return [];
422
422
  if (typeof evlistener === "function")
423
423
  return unwrap ? [evlistener.listener || evlistener] : [evlistener];
424
424
  return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
425
425
  }
426
- EventEmitter.prototype.listeners = function listeners(type) {
427
- return _listeners(this, type, true);
426
+ EventEmitter.prototype.listeners = function listeners(type2) {
427
+ return _listeners(this, type2, true);
428
428
  };
429
- EventEmitter.prototype.rawListeners = function rawListeners(type) {
430
- return _listeners(this, type, false);
429
+ EventEmitter.prototype.rawListeners = function rawListeners(type2) {
430
+ return _listeners(this, type2, false);
431
431
  };
432
- EventEmitter.listenerCount = function(emitter, type) {
432
+ EventEmitter.listenerCount = function(emitter, type2) {
433
433
  if (typeof emitter.listenerCount === "function") {
434
- return emitter.listenerCount(type);
434
+ return emitter.listenerCount(type2);
435
435
  } else {
436
- return listenerCount.call(emitter, type);
436
+ return listenerCount.call(emitter, type2);
437
437
  }
438
438
  };
439
439
  EventEmitter.prototype.listenerCount = listenerCount;
440
- function listenerCount(type) {
440
+ function listenerCount(type2) {
441
441
  var events2 = this._events;
442
442
  if (events2 !== void 0) {
443
- var evlistener = events2[type];
443
+ var evlistener = events2[type2];
444
444
  if (typeof evlistener === "function") {
445
445
  return 1;
446
446
  } else if (evlistener !== void 0) {
@@ -2253,8 +2253,8 @@ var __async = (__this, __arguments, generator) => {
2253
2253
  }
2254
2254
  return i;
2255
2255
  }
2256
- function isInstance(obj, type) {
2257
- return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
2256
+ function isInstance(obj, type2) {
2257
+ return obj instanceof type2 || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type2.name;
2258
2258
  }
2259
2259
  function numberIsNaN(obj) {
2260
2260
  return obj !== obj;
@@ -2338,6 +2338,62 @@ var __async = (__this, __arguments, generator) => {
2338
2338
  };
2339
2339
  return shams;
2340
2340
  }
2341
+ var esErrors;
2342
+ var hasRequiredEsErrors;
2343
+ function requireEsErrors() {
2344
+ if (hasRequiredEsErrors) return esErrors;
2345
+ hasRequiredEsErrors = 1;
2346
+ esErrors = Error;
2347
+ return esErrors;
2348
+ }
2349
+ var _eval;
2350
+ var hasRequired_eval;
2351
+ function require_eval() {
2352
+ if (hasRequired_eval) return _eval;
2353
+ hasRequired_eval = 1;
2354
+ _eval = EvalError;
2355
+ return _eval;
2356
+ }
2357
+ var range;
2358
+ var hasRequiredRange;
2359
+ function requireRange() {
2360
+ if (hasRequiredRange) return range;
2361
+ hasRequiredRange = 1;
2362
+ range = RangeError;
2363
+ return range;
2364
+ }
2365
+ var ref;
2366
+ var hasRequiredRef;
2367
+ function requireRef() {
2368
+ if (hasRequiredRef) return ref;
2369
+ hasRequiredRef = 1;
2370
+ ref = ReferenceError;
2371
+ return ref;
2372
+ }
2373
+ var syntax;
2374
+ var hasRequiredSyntax;
2375
+ function requireSyntax() {
2376
+ if (hasRequiredSyntax) return syntax;
2377
+ hasRequiredSyntax = 1;
2378
+ syntax = SyntaxError;
2379
+ return syntax;
2380
+ }
2381
+ var type;
2382
+ var hasRequiredType;
2383
+ function requireType() {
2384
+ if (hasRequiredType) return type;
2385
+ hasRequiredType = 1;
2386
+ type = TypeError;
2387
+ return type;
2388
+ }
2389
+ var uri;
2390
+ var hasRequiredUri;
2391
+ function requireUri() {
2392
+ if (hasRequiredUri) return uri;
2393
+ hasRequiredUri = 1;
2394
+ uri = URIError;
2395
+ return uri;
2396
+ }
2341
2397
  var hasSymbols;
2342
2398
  var hasRequiredHasSymbols;
2343
2399
  function requireHasSymbols() {
@@ -2368,11 +2424,12 @@ var __async = (__this, __arguments, generator) => {
2368
2424
  if (hasRequiredHasProto) return hasProto;
2369
2425
  hasRequiredHasProto = 1;
2370
2426
  var test = {
2427
+ __proto__: null,
2371
2428
  foo: {}
2372
2429
  };
2373
2430
  var $Object = Object;
2374
2431
  hasProto = function hasProto2() {
2375
- return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
2432
+ return { __proto__: test }.foo === test.foo && !(test instanceof $Object);
2376
2433
  };
2377
2434
  return hasProto;
2378
2435
  }
@@ -2478,9 +2535,14 @@ var __async = (__this, __arguments, generator) => {
2478
2535
  if (hasRequiredGetIntrinsic) return getIntrinsic;
2479
2536
  hasRequiredGetIntrinsic = 1;
2480
2537
  var undefined$1;
2481
- var $SyntaxError = SyntaxError;
2538
+ var $Error = requireEsErrors();
2539
+ var $EvalError = require_eval();
2540
+ var $RangeError = requireRange();
2541
+ var $ReferenceError = requireRef();
2542
+ var $SyntaxError = requireSyntax();
2543
+ var $TypeError = requireType();
2544
+ var $URIError = requireUri();
2482
2545
  var $Function = Function;
2483
- var $TypeError = TypeError;
2484
2546
  var getEvalledConstructor = function(expressionSyntax) {
2485
2547
  try {
2486
2548
  return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
@@ -2518,6 +2580,7 @@ var __async = (__this, __arguments, generator) => {
2518
2580
  var needsEval = {};
2519
2581
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
2520
2582
  var INTRINSICS = {
2583
+ __proto__: null,
2521
2584
  "%AggregateError%": typeof AggregateError === "undefined" ? undefined$1 : AggregateError,
2522
2585
  "%Array%": Array,
2523
2586
  "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$1 : ArrayBuffer,
@@ -2538,10 +2601,10 @@ var __async = (__this, __arguments, generator) => {
2538
2601
  "%decodeURIComponent%": decodeURIComponent,
2539
2602
  "%encodeURI%": encodeURI,
2540
2603
  "%encodeURIComponent%": encodeURIComponent,
2541
- "%Error%": Error,
2604
+ "%Error%": $Error,
2542
2605
  "%eval%": eval,
2543
2606
  // eslint-disable-line no-eval
2544
- "%EvalError%": EvalError,
2607
+ "%EvalError%": $EvalError,
2545
2608
  "%Float32Array%": typeof Float32Array === "undefined" ? undefined$1 : Float32Array,
2546
2609
  "%Float64Array%": typeof Float64Array === "undefined" ? undefined$1 : Float64Array,
2547
2610
  "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined$1 : FinalizationRegistry,
@@ -2563,8 +2626,8 @@ var __async = (__this, __arguments, generator) => {
2563
2626
  "%parseInt%": parseInt,
2564
2627
  "%Promise%": typeof Promise === "undefined" ? undefined$1 : Promise,
2565
2628
  "%Proxy%": typeof Proxy === "undefined" ? undefined$1 : Proxy,
2566
- "%RangeError%": RangeError,
2567
- "%ReferenceError%": ReferenceError,
2629
+ "%RangeError%": $RangeError,
2630
+ "%ReferenceError%": $ReferenceError,
2568
2631
  "%Reflect%": typeof Reflect === "undefined" ? undefined$1 : Reflect,
2569
2632
  "%RegExp%": RegExp,
2570
2633
  "%Set%": typeof Set === "undefined" ? undefined$1 : Set,
@@ -2581,7 +2644,7 @@ var __async = (__this, __arguments, generator) => {
2581
2644
  "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined$1 : Uint8ClampedArray,
2582
2645
  "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined$1 : Uint16Array,
2583
2646
  "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined$1 : Uint32Array,
2584
- "%URIError%": URIError,
2647
+ "%URIError%": $URIError,
2585
2648
  "%WeakMap%": typeof WeakMap === "undefined" ? undefined$1 : WeakMap,
2586
2649
  "%WeakRef%": typeof WeakRef === "undefined" ? undefined$1 : WeakRef,
2587
2650
  "%WeakSet%": typeof WeakSet === "undefined" ? undefined$1 : WeakSet
@@ -2617,6 +2680,7 @@ var __async = (__this, __arguments, generator) => {
2617
2680
  return value;
2618
2681
  };
2619
2682
  var LEGACY_ALIASES = {
2683
+ __proto__: null,
2620
2684
  "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
2621
2685
  "%ArrayPrototype%": ["Array", "prototype"],
2622
2686
  "%ArrayProto_entries%": ["Array", "prototype", "entries"],
@@ -2779,36 +2843,22 @@ var __async = (__this, __arguments, generator) => {
2779
2843
  return getIntrinsic;
2780
2844
  }
2781
2845
  var callBind = { exports: {} };
2782
- var hasPropertyDescriptors_1;
2783
- var hasRequiredHasPropertyDescriptors;
2784
- function requireHasPropertyDescriptors() {
2785
- if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
2786
- hasRequiredHasPropertyDescriptors = 1;
2846
+ var esDefineProperty;
2847
+ var hasRequiredEsDefineProperty;
2848
+ function requireEsDefineProperty() {
2849
+ if (hasRequiredEsDefineProperty) return esDefineProperty;
2850
+ hasRequiredEsDefineProperty = 1;
2787
2851
  var GetIntrinsic = requireGetIntrinsic();
2788
- var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
2789
- var hasPropertyDescriptors = function hasPropertyDescriptors2() {
2790
- if ($defineProperty) {
2791
- try {
2792
- $defineProperty({}, "a", { value: 1 });
2793
- return true;
2794
- } catch (e) {
2795
- return false;
2796
- }
2797
- }
2798
- return false;
2799
- };
2800
- hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
2801
- if (!hasPropertyDescriptors()) {
2802
- return null;
2803
- }
2852
+ var $defineProperty = GetIntrinsic("%Object.defineProperty%", true) || false;
2853
+ if ($defineProperty) {
2804
2854
  try {
2805
- return $defineProperty([], "length", { value: 1 }).length !== 1;
2855
+ $defineProperty({}, "a", { value: 1 });
2806
2856
  } catch (e) {
2807
- return true;
2857
+ $defineProperty = false;
2808
2858
  }
2809
- };
2810
- hasPropertyDescriptors_1 = hasPropertyDescriptors;
2811
- return hasPropertyDescriptors_1;
2859
+ }
2860
+ esDefineProperty = $defineProperty;
2861
+ return esDefineProperty;
2812
2862
  }
2813
2863
  var gopd;
2814
2864
  var hasRequiredGopd;
@@ -2832,18 +2882,9 @@ var __async = (__this, __arguments, generator) => {
2832
2882
  function requireDefineDataProperty() {
2833
2883
  if (hasRequiredDefineDataProperty) return defineDataProperty;
2834
2884
  hasRequiredDefineDataProperty = 1;
2835
- var hasPropertyDescriptors = requireHasPropertyDescriptors()();
2836
- var GetIntrinsic = requireGetIntrinsic();
2837
- var $defineProperty = hasPropertyDescriptors && GetIntrinsic("%Object.defineProperty%", true);
2838
- if ($defineProperty) {
2839
- try {
2840
- $defineProperty({}, "a", { value: 1 });
2841
- } catch (e) {
2842
- $defineProperty = false;
2843
- }
2844
- }
2845
- var $SyntaxError = GetIntrinsic("%SyntaxError%");
2846
- var $TypeError = GetIntrinsic("%TypeError%");
2885
+ var $defineProperty = requireEsDefineProperty();
2886
+ var $SyntaxError = requireSyntax();
2887
+ var $TypeError = requireType();
2847
2888
  var gopd2 = requireGopd();
2848
2889
  defineDataProperty = function defineDataProperty2(obj, property, value) {
2849
2890
  if (!obj || typeof obj !== "object" && typeof obj !== "function") {
@@ -2884,6 +2925,28 @@ var __async = (__this, __arguments, generator) => {
2884
2925
  };
2885
2926
  return defineDataProperty;
2886
2927
  }
2928
+ var hasPropertyDescriptors_1;
2929
+ var hasRequiredHasPropertyDescriptors;
2930
+ function requireHasPropertyDescriptors() {
2931
+ if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
2932
+ hasRequiredHasPropertyDescriptors = 1;
2933
+ var $defineProperty = requireEsDefineProperty();
2934
+ var hasPropertyDescriptors = function hasPropertyDescriptors2() {
2935
+ return !!$defineProperty;
2936
+ };
2937
+ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
2938
+ if (!$defineProperty) {
2939
+ return null;
2940
+ }
2941
+ try {
2942
+ return $defineProperty([], "length", { value: 1 }).length !== 1;
2943
+ } catch (e) {
2944
+ return true;
2945
+ }
2946
+ };
2947
+ hasPropertyDescriptors_1 = hasPropertyDescriptors;
2948
+ return hasPropertyDescriptors_1;
2949
+ }
2887
2950
  var setFunctionLength;
2888
2951
  var hasRequiredSetFunctionLength;
2889
2952
  function requireSetFunctionLength() {
@@ -2893,7 +2956,7 @@ var __async = (__this, __arguments, generator) => {
2893
2956
  var define = requireDefineDataProperty();
2894
2957
  var hasDescriptors = requireHasPropertyDescriptors()();
2895
2958
  var gOPD = requireGopd();
2896
- var $TypeError = GetIntrinsic("%TypeError%");
2959
+ var $TypeError = requireType();
2897
2960
  var $floor = GetIntrinsic("%Math.floor%");
2898
2961
  setFunctionLength = function setFunctionLength2(fn, length) {
2899
2962
  if (typeof fn !== "function") {
@@ -2916,9 +2979,21 @@ var __async = (__this, __arguments, generator) => {
2916
2979
  }
2917
2980
  if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
2918
2981
  if (hasDescriptors) {
2919
- define(fn, "length", length, true, true);
2982
+ define(
2983
+ /** @type {Parameters<define>[0]} */
2984
+ fn,
2985
+ "length",
2986
+ length,
2987
+ true,
2988
+ true
2989
+ );
2920
2990
  } else {
2921
- define(fn, "length", length);
2991
+ define(
2992
+ /** @type {Parameters<define>[0]} */
2993
+ fn,
2994
+ "length",
2995
+ length
2996
+ );
2922
2997
  }
2923
2998
  }
2924
2999
  return fn;
@@ -2933,19 +3008,12 @@ var __async = (__this, __arguments, generator) => {
2933
3008
  var bind = requireFunctionBind();
2934
3009
  var GetIntrinsic = requireGetIntrinsic();
2935
3010
  var setFunctionLength2 = requireSetFunctionLength();
2936
- var $TypeError = GetIntrinsic("%TypeError%");
3011
+ var $TypeError = requireType();
2937
3012
  var $apply = GetIntrinsic("%Function.prototype.apply%");
2938
3013
  var $call = GetIntrinsic("%Function.prototype.call%");
2939
3014
  var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply);
2940
- var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
3015
+ var $defineProperty = requireEsDefineProperty();
2941
3016
  var $max = GetIntrinsic("%Math.max%");
2942
- if ($defineProperty) {
2943
- try {
2944
- $defineProperty({}, "a", { value: 1 });
2945
- } catch (e) {
2946
- $defineProperty = null;
2947
- }
2948
- }
2949
3017
  module.exports = function callBind2(originalFunction) {
2950
3018
  if (typeof originalFunction !== "function") {
2951
3019
  throw new $TypeError("a function is required");
@@ -3229,24 +3297,32 @@ var __async = (__this, __arguments, generator) => {
3229
3297
  forEach_1 = forEach;
3230
3298
  return forEach_1;
3231
3299
  }
3232
- var availableTypedArrays;
3233
- var hasRequiredAvailableTypedArrays;
3234
- function requireAvailableTypedArrays() {
3235
- if (hasRequiredAvailableTypedArrays) return availableTypedArrays;
3236
- hasRequiredAvailableTypedArrays = 1;
3237
- var possibleNames = [
3238
- "BigInt64Array",
3239
- "BigUint64Array",
3300
+ var possibleTypedArrayNames;
3301
+ var hasRequiredPossibleTypedArrayNames;
3302
+ function requirePossibleTypedArrayNames() {
3303
+ if (hasRequiredPossibleTypedArrayNames) return possibleTypedArrayNames;
3304
+ hasRequiredPossibleTypedArrayNames = 1;
3305
+ possibleTypedArrayNames = [
3240
3306
  "Float32Array",
3241
3307
  "Float64Array",
3308
+ "Int8Array",
3242
3309
  "Int16Array",
3243
3310
  "Int32Array",
3244
- "Int8Array",
3311
+ "Uint8Array",
3312
+ "Uint8ClampedArray",
3245
3313
  "Uint16Array",
3246
3314
  "Uint32Array",
3247
- "Uint8Array",
3248
- "Uint8ClampedArray"
3315
+ "BigInt64Array",
3316
+ "BigUint64Array"
3249
3317
  ];
3318
+ return possibleTypedArrayNames;
3319
+ }
3320
+ var availableTypedArrays;
3321
+ var hasRequiredAvailableTypedArrays;
3322
+ function requireAvailableTypedArrays() {
3323
+ if (hasRequiredAvailableTypedArrays) return availableTypedArrays;
3324
+ hasRequiredAvailableTypedArrays = 1;
3325
+ var possibleNames = requirePossibleTypedArrayNames();
3250
3326
  var g = typeof globalThis === "undefined" ? commonjsGlobal : globalThis;
3251
3327
  availableTypedArrays = function availableTypedArrays2() {
3252
3328
  var out = [];
@@ -3308,29 +3384,43 @@ var __async = (__this, __arguments, generator) => {
3308
3384
  }
3309
3385
  var tryTypedArrays = function tryAllTypedArrays(value) {
3310
3386
  var found = false;
3311
- forEach(cache, function(getter, typedArray) {
3312
- if (!found) {
3313
- try {
3314
- if ("$" + getter(value) === typedArray) {
3315
- found = $slice(typedArray, 1);
3387
+ forEach(
3388
+ // eslint-disable-next-line no-extra-parens
3389
+ /** @type {Record<`\$${TypedArrayName}`, Getter>} */
3390
+ /** @type {any} */
3391
+ cache,
3392
+ /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
3393
+ function(getter, typedArray) {
3394
+ if (!found) {
3395
+ try {
3396
+ if ("$" + getter(value) === typedArray) {
3397
+ found = $slice(typedArray, 1);
3398
+ }
3399
+ } catch (e) {
3316
3400
  }
3317
- } catch (e) {
3318
3401
  }
3319
3402
  }
3320
- });
3403
+ );
3321
3404
  return found;
3322
3405
  };
3323
3406
  var trySlices = function tryAllSlices(value) {
3324
3407
  var found = false;
3325
- forEach(cache, function(getter, name) {
3326
- if (!found) {
3327
- try {
3328
- getter(value);
3329
- found = $slice(name, 1);
3330
- } catch (e) {
3408
+ forEach(
3409
+ // eslint-disable-next-line no-extra-parens
3410
+ /** @type {Record<`\$${TypedArrayName}`, Getter>} */
3411
+ /** @type {any} */
3412
+ cache,
3413
+ /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */
3414
+ function(getter, name) {
3415
+ if (!found) {
3416
+ try {
3417
+ getter(value);
3418
+ found = $slice(name, 1);
3419
+ } catch (e) {
3420
+ }
3331
3421
  }
3332
3422
  }
3333
- });
3423
+ );
3334
3424
  return found;
3335
3425
  };
3336
3426
  whichTypedArray = function whichTypedArray2(value) {
@@ -4567,8 +4657,8 @@ var __async = (__this, __arguments, generator) => {
4567
4657
  if (endsWith(name, " argument")) {
4568
4658
  msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4569
4659
  } else {
4570
- var type = includes(name, ".") ? "property" : "argument";
4571
- msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4660
+ var type2 = includes(name, ".") ? "property" : "argument";
4661
+ msg = 'The "'.concat(name, '" ').concat(type2, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4572
4662
  }
4573
4663
  msg += ". Received type ".concat(typeof actual);
4574
4664
  return msg;
@@ -5783,8 +5873,8 @@ var __async = (__this, __arguments, generator) => {
5783
5873
  var Duplex;
5784
5874
  Readable.ReadableState = ReadableState;
5785
5875
  eventsExports.EventEmitter;
5786
- var EElistenerCount = function EElistenerCount2(emitter, type) {
5787
- return emitter.listeners(type).length;
5876
+ var EElistenerCount = function EElistenerCount2(emitter, type2) {
5877
+ return emitter.listeners(type2).length;
5788
5878
  };
5789
5879
  var Stream2 = requireStreamBrowser();
5790
5880
  var Buffer2 = requireBuffer().Buffer;
@@ -7510,15 +7600,15 @@ var __async = (__this, __arguments, generator) => {
7510
7600
  var qualName = qname(name, true);
7511
7601
  var prefix = qualName.prefix;
7512
7602
  var local = qualName.local;
7513
- var uri = prefix === "" ? "" : tag.ns[prefix] || "";
7603
+ var uri2 = prefix === "" ? "" : tag.ns[prefix] || "";
7514
7604
  var a = {
7515
7605
  name,
7516
7606
  value,
7517
7607
  prefix,
7518
7608
  local,
7519
- uri
7609
+ uri: uri2
7520
7610
  };
7521
- if (prefix && prefix !== "xmlns" && !uri) {
7611
+ if (prefix && prefix !== "xmlns" && !uri2) {
7522
7612
  strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix));
7523
7613
  a.uri = prefix;
7524
7614
  }
@@ -8305,19 +8395,19 @@ var __async = (__this, __arguments, generator) => {
8305
8395
  }
8306
8396
  return value;
8307
8397
  }
8308
- function addField(type, value) {
8398
+ function addField(type2, value) {
8309
8399
  var key;
8310
8400
  if (options.compact) {
8311
- if (!currentElement$1[options[type + "Key"]] && (isArray$1(options.alwaysArray) ? options.alwaysArray.indexOf(options[type + "Key"]) !== -1 : options.alwaysArray)) {
8312
- currentElement$1[options[type + "Key"]] = [];
8401
+ if (!currentElement$1[options[type2 + "Key"]] && (isArray$1(options.alwaysArray) ? options.alwaysArray.indexOf(options[type2 + "Key"]) !== -1 : options.alwaysArray)) {
8402
+ currentElement$1[options[type2 + "Key"]] = [];
8313
8403
  }
8314
- if (currentElement$1[options[type + "Key"]] && !isArray$1(currentElement$1[options[type + "Key"]])) {
8315
- currentElement$1[options[type + "Key"]] = [currentElement$1[options[type + "Key"]]];
8404
+ if (currentElement$1[options[type2 + "Key"]] && !isArray$1(currentElement$1[options[type2 + "Key"]])) {
8405
+ currentElement$1[options[type2 + "Key"]] = [currentElement$1[options[type2 + "Key"]]];
8316
8406
  }
8317
- if (type + "Fn" in options && typeof value === "string") {
8318
- value = options[type + "Fn"](value, currentElement$1);
8407
+ if (type2 + "Fn" in options && typeof value === "string") {
8408
+ value = options[type2 + "Fn"](value, currentElement$1);
8319
8409
  }
8320
- if (type === "instruction" && ("instructionFn" in options || "instructionNameFn" in options)) {
8410
+ if (type2 === "instruction" && ("instructionFn" in options || "instructionNameFn" in options)) {
8321
8411
  for (key in value) {
8322
8412
  if (value.hasOwnProperty(key)) {
8323
8413
  if ("instructionFn" in options) {
@@ -8330,18 +8420,18 @@ var __async = (__this, __arguments, generator) => {
8330
8420
  }
8331
8421
  }
8332
8422
  }
8333
- if (isArray$1(currentElement$1[options[type + "Key"]])) {
8334
- currentElement$1[options[type + "Key"]].push(value);
8423
+ if (isArray$1(currentElement$1[options[type2 + "Key"]])) {
8424
+ currentElement$1[options[type2 + "Key"]].push(value);
8335
8425
  } else {
8336
- currentElement$1[options[type + "Key"]] = value;
8426
+ currentElement$1[options[type2 + "Key"]] = value;
8337
8427
  }
8338
8428
  } else {
8339
8429
  if (!currentElement$1[options.elementsKey]) {
8340
8430
  currentElement$1[options.elementsKey] = [];
8341
8431
  }
8342
8432
  var element2 = {};
8343
- element2[options.typeKey] = type;
8344
- if (type === "instruction") {
8433
+ element2[options.typeKey] = type2;
8434
+ if (type2 === "instruction") {
8345
8435
  for (key in value) {
8346
8436
  if (value.hasOwnProperty(key)) {
8347
8437
  break;
@@ -8360,10 +8450,10 @@ var __async = (__this, __arguments, generator) => {
8360
8450
  element2[options.instructionKey] = value[key];
8361
8451
  }
8362
8452
  } else {
8363
- if (type + "Fn" in options) {
8364
- value = options[type + "Fn"](value, currentElement$1);
8453
+ if (type2 + "Fn" in options) {
8454
+ value = options[type2 + "Fn"](value, currentElement$1);
8365
8455
  }
8366
- element2[options[type + "Key"]] = value;
8456
+ element2[options[type2 + "Key"]] = value;
8367
8457
  }
8368
8458
  if (options.addParent) {
8369
8459
  element2[options.parentKey] = currentElement$1;
@@ -9163,9 +9253,9 @@ var __async = (__this, __arguments, generator) => {
9163
9253
  }
9164
9254
  }
9165
9255
  class Alignment extends XmlComponent {
9166
- constructor(type) {
9256
+ constructor(type2) {
9167
9257
  super("w:jc");
9168
- this.root.push(new AlignmentAttributes({ val: type }));
9258
+ this.root.push(new AlignmentAttributes({ val: type2 }));
9169
9259
  }
9170
9260
  }
9171
9261
  class BorderElement extends XmlComponent {
@@ -9445,13 +9535,13 @@ var __async = (__this, __arguments, generator) => {
9445
9535
  }
9446
9536
  }
9447
9537
  class Shading extends XmlComponent {
9448
- constructor({ fill, color, type }) {
9538
+ constructor({ fill, color, type: type2 }) {
9449
9539
  super("w:shd");
9450
9540
  this.root.push(
9451
9541
  new ShadingAttributes({
9452
9542
  fill: fill === void 0 ? void 0 : hexColorValue(fill),
9453
9543
  color: color === void 0 ? void 0 : hexColorValue(color),
9454
- type
9544
+ type: type2
9455
9545
  })
9456
9546
  );
9457
9547
  }
@@ -9618,11 +9708,11 @@ var __async = (__this, __arguments, generator) => {
9618
9708
  }
9619
9709
  }
9620
9710
  let VerticalAlign$1 = class VerticalAlign extends XmlComponent {
9621
- constructor(type) {
9711
+ constructor(type2) {
9622
9712
  super("w:vertAlign");
9623
9713
  this.root.push(
9624
9714
  new Attributes({
9625
- val: type
9715
+ val: type2
9626
9716
  })
9627
9717
  );
9628
9718
  }
@@ -9943,25 +10033,6 @@ var __async = (__this, __arguments, generator) => {
9943
10033
  this.root.push(new Symbol$1(options2.char, options2.symbolfont));
9944
10034
  }
9945
10035
  }
9946
- let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
9947
- let customAlphabet = (alphabet, defaultSize = 21) => {
9948
- return (size = defaultSize) => {
9949
- let id = "";
9950
- let i = size;
9951
- while (i--) {
9952
- id += alphabet[Math.random() * alphabet.length | 0];
9953
- }
9954
- return id;
9955
- };
9956
- };
9957
- let nanoid = (size = 21) => {
9958
- let id = "";
9959
- let i = size;
9960
- while (i--) {
9961
- id += urlAlphabet[Math.random() * 64 | 0];
9962
- }
9963
- return id;
9964
- };
9965
10036
  var hash$1 = {};
9966
10037
  var utils$9 = {};
9967
10038
  var minimalisticAssert = assert$5;
@@ -11522,6 +11593,25 @@ var __async = (__this, __arguments, generator) => {
11522
11593
  hash2.ripemd160 = hash2.ripemd.ripemd160;
11523
11594
  })(hash$1);
11524
11595
  const hash = /* @__PURE__ */ getDefaultExportFromCjs$1(hash$1);
11596
+ let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
11597
+ let customAlphabet = (alphabet, defaultSize = 21) => {
11598
+ return (size = defaultSize) => {
11599
+ let id = "";
11600
+ let i = size;
11601
+ while (i--) {
11602
+ id += alphabet[Math.random() * alphabet.length | 0];
11603
+ }
11604
+ return id;
11605
+ };
11606
+ };
11607
+ let nanoid = (size = 21) => {
11608
+ let id = "";
11609
+ let i = size;
11610
+ while (i--) {
11611
+ id += urlAlphabet[Math.random() * 64 | 0];
11612
+ }
11613
+ return id;
11614
+ };
11525
11615
  const convertMillimetersToTwip = (millimeters) => Math.floor(millimeters / 25.4 * 72 * 20);
11526
11616
  const convertInchesToTwip = (inches) => Math.floor(inches * 72 * 20);
11527
11617
  const uniqueNumericIdCreator = (initial = 0) => {
@@ -11867,8 +11957,8 @@ var __async = (__this, __arguments, generator) => {
11867
11957
  }
11868
11958
  }
11869
11959
  const createNoFill = () => new BuilderElement({ name: "a:noFill" });
11870
- const createSchemeColor = (options2) => new BuilderElement({
11871
- name: "a:schemeClr",
11960
+ const createSolidRgbColor = (options2) => new BuilderElement({
11961
+ name: "a:srgbClr",
11872
11962
  attributes: {
11873
11963
  value: {
11874
11964
  key: "val",
@@ -11876,8 +11966,8 @@ var __async = (__this, __arguments, generator) => {
11876
11966
  }
11877
11967
  }
11878
11968
  });
11879
- const createSolidRgbColor = (options2) => new BuilderElement({
11880
- name: "a:srgbClr",
11969
+ const createSchemeColor = (options2) => new BuilderElement({
11970
+ name: "a:schemeClr",
11881
11971
  attributes: {
11882
11972
  value: {
11883
11973
  key: "val",
@@ -12683,7 +12773,6 @@ var __async = (__this, __arguments, generator) => {
12683
12773
  DOT: "dot",
12684
12774
  HYPHEN: "hyphen",
12685
12775
  UNDERSCORE: "underscore",
12686
- // eslint-disable-next-line @typescript-eslint/naming-convention
12687
12776
  MIDDLE_DOT: "middleDot"
12688
12777
  };
12689
12778
  class PositionalTab extends XmlComponent {
@@ -12713,11 +12802,11 @@ var __async = (__this, __arguments, generator) => {
12713
12802
  // textWrapping breaks are the default and already exposed via the "Run" class
12714
12803
  };
12715
12804
  class Break extends XmlComponent {
12716
- constructor(type) {
12805
+ constructor(type2) {
12717
12806
  super("w:br");
12718
12807
  this.root.push(
12719
12808
  new Attributes({
12720
- type
12809
+ type: type2
12721
12810
  })
12722
12811
  );
12723
12812
  }
@@ -12740,7 +12829,6 @@ var __async = (__this, __arguments, generator) => {
12740
12829
  }
12741
12830
  }
12742
12831
  const LineRuleType = {
12743
- // eslint-disable-next-line @typescript-eslint/naming-convention
12744
12832
  AT_LEAST: "atLeast",
12745
12833
  EXACTLY: "exactly",
12746
12834
  EXACT: "exact",
@@ -12806,7 +12894,6 @@ var __async = (__this, __arguments, generator) => {
12806
12894
  const LeaderType = {
12807
12895
  DOT: "dot",
12808
12896
  HYPHEN: "hyphen",
12809
- // eslint-disable-next-line @typescript-eslint/naming-convention
12810
12897
  MIDDLE_DOT: "middleDot",
12811
12898
  NONE: "none",
12812
12899
  UNDERSCORE: "underscore"
@@ -12821,11 +12908,11 @@ var __async = (__this, __arguments, generator) => {
12821
12908
  }
12822
12909
  }
12823
12910
  class TabStopItem extends XmlComponent {
12824
- constructor({ type, position, leader }) {
12911
+ constructor({ type: type2, position, leader }) {
12825
12912
  super("w:tab");
12826
12913
  this.root.push(
12827
12914
  new TabAttributes({
12828
- val: type,
12915
+ val: type2,
12829
12916
  pos: position,
12830
12917
  leader
12831
12918
  })
@@ -12885,12 +12972,12 @@ var __async = (__this, __arguments, generator) => {
12885
12972
  EXTERNAL: "External"
12886
12973
  };
12887
12974
  class Relationship extends XmlComponent {
12888
- constructor(id, type, target, targetMode) {
12975
+ constructor(id, type2, target, targetMode) {
12889
12976
  super("Relationship");
12890
12977
  this.root.push(
12891
12978
  new RelationshipAttributes({
12892
12979
  id,
12893
- type,
12980
+ type: type2,
12894
12981
  target,
12895
12982
  targetMode
12896
12983
  })
@@ -13038,35 +13125,6 @@ var __async = (__this, __arguments, generator) => {
13038
13125
  this.root.push(new VerticalAlignAttributes({ verticalAlign: value }));
13039
13126
  }
13040
13127
  }
13041
- const HeaderFooterReferenceType = {
13042
- DEFAULT: "default",
13043
- FIRST: "first",
13044
- EVEN: "even"
13045
- };
13046
- class FooterReferenceAttributes extends XmlAttributeComponent {
13047
- constructor() {
13048
- super(...arguments);
13049
- __publicField(this, "xmlKeys", {
13050
- type: "w:type",
13051
- id: "r:id"
13052
- });
13053
- }
13054
- }
13055
- const HeaderFooterType = {
13056
- HEADER: "w:headerReference",
13057
- FOOTER: "w:footerReference"
13058
- };
13059
- class HeaderFooterReference extends XmlComponent {
13060
- constructor(type, options2) {
13061
- super(type);
13062
- this.root.push(
13063
- new FooterReferenceAttributes({
13064
- type: options2.type || HeaderFooterReferenceType.DEFAULT,
13065
- id: `rId${options2.id}`
13066
- })
13067
- );
13068
- }
13069
- }
13070
13128
  class Columns extends XmlComponent {
13071
13129
  constructor({ space, count, separate, equalWidth, children }) {
13072
13130
  super("w:cols");
@@ -13100,17 +13158,46 @@ var __async = (__this, __arguments, generator) => {
13100
13158
  }
13101
13159
  }
13102
13160
  class DocumentGrid extends XmlComponent {
13103
- constructor(linePitch, charSpace, type) {
13161
+ constructor(linePitch, charSpace, type2) {
13104
13162
  super("w:docGrid");
13105
13163
  this.root.push(
13106
13164
  new DocGridAttributes({
13107
- type,
13165
+ type: type2,
13108
13166
  linePitch: decimalNumber(linePitch),
13109
13167
  charSpace: charSpace ? decimalNumber(charSpace) : void 0
13110
13168
  })
13111
13169
  );
13112
13170
  }
13113
13171
  }
13172
+ const HeaderFooterReferenceType = {
13173
+ DEFAULT: "default",
13174
+ FIRST: "first",
13175
+ EVEN: "even"
13176
+ };
13177
+ class FooterReferenceAttributes extends XmlAttributeComponent {
13178
+ constructor() {
13179
+ super(...arguments);
13180
+ __publicField(this, "xmlKeys", {
13181
+ type: "w:type",
13182
+ id: "r:id"
13183
+ });
13184
+ }
13185
+ }
13186
+ const HeaderFooterType = {
13187
+ HEADER: "w:headerReference",
13188
+ FOOTER: "w:footerReference"
13189
+ };
13190
+ class HeaderFooterReference extends XmlComponent {
13191
+ constructor(type2, options2) {
13192
+ super(type2);
13193
+ this.root.push(
13194
+ new FooterReferenceAttributes({
13195
+ type: options2.type || HeaderFooterReferenceType.DEFAULT,
13196
+ id: `rId${options2.id}`
13197
+ })
13198
+ );
13199
+ }
13200
+ }
13114
13201
  const LineNumberRestartFormat = {
13115
13202
  NEW_PAGE: "newPage",
13116
13203
  NEW_SECTION: "newSection",
@@ -13329,13 +13416,13 @@ var __async = (__this, __arguments, generator) => {
13329
13416
  titlePage,
13330
13417
  verticalAlign,
13331
13418
  column,
13332
- type
13419
+ type: type2
13333
13420
  } = {}) {
13334
13421
  super("w:sectPr");
13335
13422
  this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup);
13336
13423
  this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup);
13337
- if (type) {
13338
- this.root.push(new Type(type));
13424
+ if (type2) {
13425
+ this.root.push(new Type(type2));
13339
13426
  }
13340
13427
  this.root.push(new PageSize(width, height, orientation));
13341
13428
  this.root.push(new PageMargin(top, right, bottom, left, header, footer, gutter));
@@ -13360,10 +13447,10 @@ var __async = (__this, __arguments, generator) => {
13360
13447
  }
13361
13448
  this.root.push(new DocumentGrid(linePitch, charSpace, gridType));
13362
13449
  }
13363
- addHeaderFooterGroup(type, group) {
13450
+ addHeaderFooterGroup(type2, group) {
13364
13451
  if (group.default) {
13365
13452
  this.root.push(
13366
- new HeaderFooterReference(type, {
13453
+ new HeaderFooterReference(type2, {
13367
13454
  type: HeaderFooterReferenceType.DEFAULT,
13368
13455
  id: group.default.View.ReferenceId
13369
13456
  })
@@ -13371,7 +13458,7 @@ var __async = (__this, __arguments, generator) => {
13371
13458
  }
13372
13459
  if (group.first) {
13373
13460
  this.root.push(
13374
- new HeaderFooterReference(type, {
13461
+ new HeaderFooterReference(type2, {
13375
13462
  type: HeaderFooterReferenceType.FIRST,
13376
13463
  id: group.first.View.ReferenceId
13377
13464
  })
@@ -13379,7 +13466,7 @@ var __async = (__this, __arguments, generator) => {
13379
13466
  }
13380
13467
  if (group.even) {
13381
13468
  this.root.push(
13382
- new HeaderFooterReference(type, {
13469
+ new HeaderFooterReference(type2, {
13383
13470
  type: HeaderFooterReferenceType.EVEN,
13384
13471
  id: group.even.View.ReferenceId
13385
13472
  })
@@ -13578,8 +13665,8 @@ var __async = (__this, __arguments, generator) => {
13578
13665
  })
13579
13666
  );
13580
13667
  }
13581
- createRelationship(id, type, target, targetMode) {
13582
- const relationship = new Relationship(`rId${id}`, type, target, targetMode);
13668
+ createRelationship(id, type2, target, targetMode) {
13669
+ const relationship = new Relationship(`rId${id}`, type2, target, targetMode);
13583
13670
  this.root.push(relationship);
13584
13671
  return relationship;
13585
13672
  }
@@ -13627,7 +13714,6 @@ var __async = (__this, __arguments, generator) => {
13627
13714
  AROUND: "around",
13628
13715
  AUTO: "auto",
13629
13716
  NONE: "none",
13630
- // eslint-disable-next-line @typescript-eslint/naming-convention
13631
13717
  NOT_BESIDE: "notBeside",
13632
13718
  THROUGH: "through",
13633
13719
  TIGHT: "tight"
@@ -14255,12 +14341,11 @@ var __async = (__this, __arguments, generator) => {
14255
14341
  }
14256
14342
  const TableCellMarginElementType = {
14257
14343
  TABLE: "w:tblCellMar",
14258
- // eslint-disable-next-line @typescript-eslint/naming-convention
14259
14344
  TABLE_CELL: "w:tcMar"
14260
14345
  };
14261
14346
  class TableCellMargin extends IgnoreIfEmptyXmlComponent {
14262
- constructor(type, { marginUnitType = WidthType.DXA, top, left, bottom, right }) {
14263
- super(type);
14347
+ constructor(type2, { marginUnitType = WidthType.DXA, top, left, bottom, right }) {
14348
+ super(type2);
14264
14349
  if (top !== void 0) {
14265
14350
  this.root.push(new TableWidthElement("w:top", { type: marginUnitType, size: top }));
14266
14351
  }
@@ -14286,15 +14371,15 @@ var __async = (__this, __arguments, generator) => {
14286
14371
  PERCENTAGE: "pct"
14287
14372
  };
14288
14373
  class TableWidthElement extends XmlComponent {
14289
- constructor(name, { type = WidthType.AUTO, size }) {
14374
+ constructor(name, { type: type2 = WidthType.AUTO, size }) {
14290
14375
  super(name);
14291
14376
  let tableWidthValue = size;
14292
- if (type === WidthType.PERCENTAGE && typeof size === "number") {
14377
+ if (type2 === WidthType.PERCENTAGE && typeof size === "number") {
14293
14378
  tableWidthValue = `${size}%`;
14294
14379
  }
14295
14380
  this.root.push(
14296
14381
  new NextAttributeComponent({
14297
- type: { key: "w:type", value: type },
14382
+ type: { key: "w:type", value: type2 },
14298
14383
  size: { key: "w:w", value: measurementOrPercentValue(tableWidthValue) }
14299
14384
  })
14300
14385
  );
@@ -14366,11 +14451,8 @@ var __async = (__this, __arguments, generator) => {
14366
14451
  }
14367
14452
  }
14368
14453
  const TextDirection = {
14369
- // eslint-disable-next-line @typescript-eslint/naming-convention
14370
14454
  BOTTOM_TO_TOP_LEFT_TO_RIGHT: "btLr",
14371
- // eslint-disable-next-line @typescript-eslint/naming-convention
14372
14455
  LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb",
14373
- // eslint-disable-next-line @typescript-eslint/naming-convention
14374
14456
  TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl"
14375
14457
  };
14376
14458
  class TDirectionAttributes extends XmlAttributeComponent {
@@ -14588,9 +14670,9 @@ var __async = (__this, __arguments, generator) => {
14588
14670
  }
14589
14671
  }
14590
14672
  class TableLayout extends XmlComponent {
14591
- constructor(type) {
14673
+ constructor(type2) {
14592
14674
  super("w:tblLayout");
14593
- this.root.push(new TableLayoutAttributes({ type }));
14675
+ this.root.push(new TableLayoutAttributes({ type: type2 }));
14594
14676
  }
14595
14677
  }
14596
14678
  class TableProperties extends IgnoreIfEmptyXmlComponent {
@@ -14997,70 +15079,229 @@ var __async = (__this, __arguments, generator) => {
14997
15079
  this.properties.push(new CustomProperty(this.nextId++, property));
14998
15080
  }
14999
15081
  }
15000
- class FooterAttributes extends XmlAttributeComponent {
15001
- constructor() {
15002
- super(...arguments);
15003
- __publicField(this, "xmlKeys", {
15004
- wpc: "xmlns:wpc",
15005
- mc: "xmlns:mc",
15006
- o: "xmlns:o",
15007
- r: "xmlns:r",
15008
- m: "xmlns:m",
15009
- v: "xmlns:v",
15010
- wp14: "xmlns:wp14",
15011
- wp: "xmlns:wp",
15012
- w10: "xmlns:w10",
15013
- w: "xmlns:w",
15014
- w14: "xmlns:w14",
15015
- w15: "xmlns:w15",
15016
- wpg: "xmlns:wpg",
15017
- wpi: "xmlns:wpi",
15018
- wne: "xmlns:wne",
15019
- wps: "xmlns:wps",
15020
- cp: "xmlns:cp",
15021
- dc: "xmlns:dc",
15022
- dcterms: "xmlns:dcterms",
15023
- dcmitype: "xmlns:dcmitype",
15024
- xsi: "xmlns:xsi",
15025
- type: "xsi:type"
15026
- });
15027
- }
15028
- }
15029
- let Footer$1 = class Footer extends InitializableXmlComponent {
15030
- constructor(referenceNumber, initContent) {
15031
- super("w:ftr", initContent);
15032
- __publicField(this, "refId");
15033
- this.refId = referenceNumber;
15034
- if (!initContent) {
15035
- this.root.push(
15036
- new FooterAttributes({
15037
- wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
15038
- mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
15039
- o: "urn:schemas-microsoft-com:office:office",
15040
- r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
15041
- m: "http://schemas.openxmlformats.org/officeDocument/2006/math",
15042
- v: "urn:schemas-microsoft-com:vml",
15043
- wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
15044
- wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
15045
- w10: "urn:schemas-microsoft-com:office:word",
15046
- w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
15047
- w14: "http://schemas.microsoft.com/office/word/2010/wordml",
15048
- w15: "http://schemas.microsoft.com/office/word/2012/wordml",
15049
- wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
15050
- wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
15051
- wne: "http://schemas.microsoft.com/office/word/2006/wordml",
15052
- wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
15053
- })
15054
- );
15055
- }
15056
- }
15057
- get ReferenceId() {
15058
- return this.refId;
15059
- }
15060
- add(item) {
15061
- this.root.push(item);
15062
- }
15063
- };
15082
+ const CharacterSet = {
15083
+ ANSI: "00",
15084
+ DEFAULT: "01",
15085
+ SYMBOL: "02",
15086
+ MAC: "4D",
15087
+ JIS: "80",
15088
+ HANGUL: "81",
15089
+ JOHAB: "82",
15090
+ GB_2312: "86",
15091
+ CHINESEBIG5: "88",
15092
+ GREEK: "A1",
15093
+ TURKISH: "A2",
15094
+ VIETNAMESE: "A3",
15095
+ HEBREW: "B1",
15096
+ ARABIC: "B2",
15097
+ BALTIC: "BA",
15098
+ RUSSIAN: "CC",
15099
+ THAI: "DE",
15100
+ EASTEUROPE: "EE",
15101
+ OEM: "FF"
15102
+ };
15103
+ const createFontRelationship = ({ id, fontKey, subsetted }, name) => new BuilderElement({
15104
+ name,
15105
+ attributes: __spreadValues({
15106
+ id: { key: "r:id", value: id }
15107
+ }, fontKey ? { fontKey: { key: "w:fontKey", value: `{${fontKey}}` } } : {}),
15108
+ children: [...subsetted ? [new OnOffElement("w:subsetted", subsetted)] : []]
15109
+ });
15110
+ const createFont = ({
15111
+ name,
15112
+ altName,
15113
+ panose1,
15114
+ charset,
15115
+ family,
15116
+ notTrueType,
15117
+ pitch,
15118
+ sig,
15119
+ embedRegular,
15120
+ embedBold,
15121
+ embedItalic,
15122
+ embedBoldItalic
15123
+ }) => (
15124
+ // http://www.datypic.com/sc/ooxml/e-w_font-1.html
15125
+ new BuilderElement({
15126
+ name: "w:font",
15127
+ attributes: {
15128
+ name: { key: "w:name", value: name }
15129
+ },
15130
+ children: [
15131
+ // http://www.datypic.com/sc/ooxml/e-w_altName-1.html
15132
+ ...altName ? [createStringElement("w:altName", altName)] : [],
15133
+ // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html
15134
+ ...panose1 ? [createStringElement("w:panose1", panose1)] : [],
15135
+ // http://www.datypic.com/sc/ooxml/e-w_charset-1.html
15136
+ ...charset ? [createStringElement("w:charset", charset)] : [],
15137
+ // http://www.datypic.com/sc/ooxml/e-w_family-1.html
15138
+ ...family ? [createStringElement("w:family", family)] : [],
15139
+ // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html
15140
+ ...notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : [],
15141
+ ...pitch ? [createStringElement("w:pitch", pitch)] : [],
15142
+ // http://www.datypic.com/sc/ooxml/e-w_sig-1.html
15143
+ ...sig ? [
15144
+ new BuilderElement({
15145
+ name: "w:sig",
15146
+ attributes: {
15147
+ usb0: { key: "w:usb0", value: sig.usb0 },
15148
+ usb1: { key: "w:usb1", value: sig.usb1 },
15149
+ usb2: { key: "w:usb2", value: sig.usb2 },
15150
+ usb3: { key: "w:usb3", value: sig.usb3 },
15151
+ csb0: { key: "w:csb0", value: sig.csb0 },
15152
+ csb1: { key: "w:csb1", value: sig.csb1 }
15153
+ }
15154
+ })
15155
+ ] : [],
15156
+ // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html
15157
+ ...embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : [],
15158
+ // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html
15159
+ ...embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : [],
15160
+ // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html
15161
+ ...embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : [],
15162
+ // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html
15163
+ ...embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : []
15164
+ ]
15165
+ })
15166
+ );
15167
+ const createRegularFont = ({
15168
+ name,
15169
+ index,
15170
+ fontKey,
15171
+ characterSet
15172
+ }) => createFont({
15173
+ name,
15174
+ sig: {
15175
+ usb0: "E0002AFF",
15176
+ usb1: "C000247B",
15177
+ usb2: "00000009",
15178
+ usb3: "00000000",
15179
+ csb0: "000001FF",
15180
+ csb1: "00000000"
15181
+ },
15182
+ charset: characterSet,
15183
+ family: "auto",
15184
+ pitch: "variable",
15185
+ embedRegular: {
15186
+ fontKey,
15187
+ id: `rId${index}`
15188
+ }
15189
+ });
15190
+ const createFontTable = (fonts) => (
15191
+ // https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_Font_topic_ID0ERNCU.html
15192
+ // http://www.datypic.com/sc/ooxml/e-w_fonts.html
15193
+ new BuilderElement({
15194
+ name: "w:fonts",
15195
+ attributes: {
15196
+ mc: { key: "xmlns:mc", value: "http://schemas.openxmlformats.org/markup-compatibility/2006" },
15197
+ r: { key: "xmlns:r", value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships" },
15198
+ w: { key: "xmlns:w", value: "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
15199
+ w14: { key: "xmlns:w14", value: "http://schemas.microsoft.com/office/word/2010/wordml" },
15200
+ w15: { key: "xmlns:w15", value: "http://schemas.microsoft.com/office/word/2012/wordml" },
15201
+ w16cex: { key: "xmlns:w16cex", value: "http://schemas.microsoft.com/office/word/2018/wordml/cex" },
15202
+ w16cid: { key: "xmlns:w16cid", value: "http://schemas.microsoft.com/office/word/2016/wordml/cid" },
15203
+ w16: { key: "xmlns:w16", value: "http://schemas.microsoft.com/office/word/2018/wordml" },
15204
+ w16sdtdh: { key: "xmlns:w16sdtdh", value: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" },
15205
+ w16se: { key: "xmlns:w16se", value: "http://schemas.microsoft.com/office/word/2015/wordml/symex" },
15206
+ Ignorable: { key: "mc:Ignorable", value: "w14 w15 w16se w16cid w16 w16cex w16sdtdh" }
15207
+ },
15208
+ children: fonts.map(
15209
+ (font, i) => createRegularFont({
15210
+ name: font.name,
15211
+ index: i + 1,
15212
+ fontKey: font.fontKey
15213
+ })
15214
+ )
15215
+ })
15216
+ );
15217
+ class FontWrapper {
15218
+ constructor(options2) {
15219
+ __publicField(this, "fontTable");
15220
+ __publicField(this, "relationships");
15221
+ __publicField(this, "fontOptionsWithKey", []);
15222
+ this.options = options2;
15223
+ this.fontOptionsWithKey = options2.map((o) => __spreadProps(__spreadValues({}, o), { fontKey: uniqueUuid() }));
15224
+ this.fontTable = createFontTable(this.fontOptionsWithKey);
15225
+ this.relationships = new Relationships();
15226
+ for (let i = 0; i < options2.length; i++) {
15227
+ this.relationships.createRelationship(
15228
+ i + 1,
15229
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",
15230
+ `fonts/${options2[i].name}.odttf`
15231
+ );
15232
+ }
15233
+ }
15234
+ get View() {
15235
+ return this.fontTable;
15236
+ }
15237
+ get Relationships() {
15238
+ return this.relationships;
15239
+ }
15240
+ }
15241
+ class FooterAttributes extends XmlAttributeComponent {
15242
+ constructor() {
15243
+ super(...arguments);
15244
+ __publicField(this, "xmlKeys", {
15245
+ wpc: "xmlns:wpc",
15246
+ mc: "xmlns:mc",
15247
+ o: "xmlns:o",
15248
+ r: "xmlns:r",
15249
+ m: "xmlns:m",
15250
+ v: "xmlns:v",
15251
+ wp14: "xmlns:wp14",
15252
+ wp: "xmlns:wp",
15253
+ w10: "xmlns:w10",
15254
+ w: "xmlns:w",
15255
+ w14: "xmlns:w14",
15256
+ w15: "xmlns:w15",
15257
+ wpg: "xmlns:wpg",
15258
+ wpi: "xmlns:wpi",
15259
+ wne: "xmlns:wne",
15260
+ wps: "xmlns:wps",
15261
+ cp: "xmlns:cp",
15262
+ dc: "xmlns:dc",
15263
+ dcterms: "xmlns:dcterms",
15264
+ dcmitype: "xmlns:dcmitype",
15265
+ xsi: "xmlns:xsi",
15266
+ type: "xsi:type"
15267
+ });
15268
+ }
15269
+ }
15270
+ let Footer$1 = class Footer extends InitializableXmlComponent {
15271
+ constructor(referenceNumber, initContent) {
15272
+ super("w:ftr", initContent);
15273
+ __publicField(this, "refId");
15274
+ this.refId = referenceNumber;
15275
+ if (!initContent) {
15276
+ this.root.push(
15277
+ new FooterAttributes({
15278
+ wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
15279
+ mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
15280
+ o: "urn:schemas-microsoft-com:office:office",
15281
+ r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
15282
+ m: "http://schemas.openxmlformats.org/officeDocument/2006/math",
15283
+ v: "urn:schemas-microsoft-com:vml",
15284
+ wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
15285
+ wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
15286
+ w10: "urn:schemas-microsoft-com:office:word",
15287
+ w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
15288
+ w14: "http://schemas.microsoft.com/office/word/2010/wordml",
15289
+ w15: "http://schemas.microsoft.com/office/word/2012/wordml",
15290
+ wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
15291
+ wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
15292
+ wne: "http://schemas.microsoft.com/office/word/2006/wordml",
15293
+ wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
15294
+ })
15295
+ );
15296
+ }
15297
+ }
15298
+ get ReferenceId() {
15299
+ return this.refId;
15300
+ }
15301
+ add(item) {
15302
+ this.root.push(item);
15303
+ }
15304
+ };
15064
15305
  class FooterWrapper {
15065
15306
  constructor(media, referenceId, initContent) {
15066
15307
  __publicField(this, "footer");
@@ -15109,7 +15350,6 @@ var __async = (__this, __arguments, generator) => {
15109
15350
  }
15110
15351
  const FootnoteType = {
15111
15352
  SEPERATOR: "separator",
15112
- // eslint-disable-next-line @typescript-eslint/naming-convention
15113
15353
  CONTINUATION_SEPERATOR: "continuationSeparator"
15114
15354
  };
15115
15355
  class Footnote extends XmlComponent {
@@ -16451,246 +16691,87 @@ var __async = (__this, __arguments, generator) => {
16451
16691
  const xmlObj = lib.xml2js(xmlData, { compact: false });
16452
16692
  let stylesXmlElement;
16453
16693
  for (const xmlElm of xmlObj.elements || []) {
16454
- if (xmlElm.name === "w:styles") {
16455
- stylesXmlElement = xmlElm;
16456
- }
16457
- }
16458
- if (stylesXmlElement === void 0) {
16459
- throw new Error("can not find styles element");
16460
- }
16461
- const stylesElements = stylesXmlElement.elements || [];
16462
- const importedStyle = new Styles({
16463
- initialStyles: new ImportedRootElementAttributes(stylesXmlElement.attributes),
16464
- importedStyles: stylesElements.map((childElm) => convertToXmlComponent(childElm))
16465
- });
16466
- return importedStyle;
16467
- }
16468
- }
16469
- class DefaultStylesFactory {
16470
- newInstance(options2 = {}) {
16471
- var _a;
16472
- const documentAttributes = new DocumentAttributes({
16473
- mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
16474
- r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
16475
- w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
16476
- w14: "http://schemas.microsoft.com/office/word/2010/wordml",
16477
- w15: "http://schemas.microsoft.com/office/word/2012/wordml",
16478
- Ignorable: "w14 w15"
16479
- });
16480
- return {
16481
- initialStyles: documentAttributes,
16482
- importedStyles: [
16483
- new DocumentDefaults((_a = options2.document) != null ? _a : {}),
16484
- new TitleStyle(__spreadValues({
16485
- run: {
16486
- size: 56
16487
- }
16488
- }, options2.title)),
16489
- new Heading1Style(__spreadValues({
16490
- run: {
16491
- color: "2E74B5",
16492
- size: 32
16493
- }
16494
- }, options2.heading1)),
16495
- new Heading2Style(__spreadValues({
16496
- run: {
16497
- color: "2E74B5",
16498
- size: 26
16499
- }
16500
- }, options2.heading2)),
16501
- new Heading3Style(__spreadValues({
16502
- run: {
16503
- color: "1F4D78",
16504
- size: 24
16505
- }
16506
- }, options2.heading3)),
16507
- new Heading4Style(__spreadValues({
16508
- run: {
16509
- color: "2E74B5",
16510
- italics: true
16511
- }
16512
- }, options2.heading4)),
16513
- new Heading5Style(__spreadValues({
16514
- run: {
16515
- color: "2E74B5"
16516
- }
16517
- }, options2.heading5)),
16518
- new Heading6Style(__spreadValues({
16519
- run: {
16520
- color: "1F4D78"
16521
- }
16522
- }, options2.heading6)),
16523
- new StrongStyle(__spreadValues({
16524
- run: {
16525
- bold: true
16526
- }
16527
- }, options2.strong)),
16528
- new ListParagraph(options2.listParagraph || {}),
16529
- new HyperlinkStyle(options2.hyperlink || {}),
16530
- new FootnoteReferenceStyle(options2.footnoteReference || {}),
16531
- new FootnoteText(options2.footnoteText || {}),
16532
- new FootnoteTextChar(options2.footnoteTextChar || {})
16533
- ]
16534
- };
16535
- }
16536
- }
16537
- const CharacterSet = {
16538
- ANSI: "00",
16539
- DEFAULT: "01",
16540
- SYMBOL: "02",
16541
- MAC: "4D",
16542
- JIS: "80",
16543
- HANGUL: "81",
16544
- JOHAB: "82",
16545
- GB_2312: "86",
16546
- CHINESEBIG5: "88",
16547
- GREEK: "A1",
16548
- TURKISH: "A2",
16549
- VIETNAMESE: "A3",
16550
- HEBREW: "B1",
16551
- ARABIC: "B2",
16552
- BALTIC: "BA",
16553
- RUSSIAN: "CC",
16554
- THAI: "DE",
16555
- EASTEUROPE: "EE",
16556
- OEM: "FF"
16557
- };
16558
- const createFontRelationship = ({ id, fontKey, subsetted }, name) => new BuilderElement({
16559
- name,
16560
- attributes: __spreadValues({
16561
- id: { key: "r:id", value: id }
16562
- }, fontKey ? { fontKey: { key: "w:fontKey", value: `{${fontKey}}` } } : {}),
16563
- children: [...subsetted ? [new OnOffElement("w:subsetted", subsetted)] : []]
16564
- });
16565
- const createFont = ({
16566
- name,
16567
- altName,
16568
- panose1,
16569
- charset,
16570
- family,
16571
- notTrueType,
16572
- pitch,
16573
- sig,
16574
- embedRegular,
16575
- embedBold,
16576
- embedItalic,
16577
- embedBoldItalic
16578
- }) => (
16579
- // http://www.datypic.com/sc/ooxml/e-w_font-1.html
16580
- new BuilderElement({
16581
- name: "w:font",
16582
- attributes: {
16583
- name: { key: "w:name", value: name }
16584
- },
16585
- children: [
16586
- // http://www.datypic.com/sc/ooxml/e-w_altName-1.html
16587
- ...altName ? [createStringElement("w:altName", altName)] : [],
16588
- // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html
16589
- ...panose1 ? [createStringElement("w:panose1", panose1)] : [],
16590
- // http://www.datypic.com/sc/ooxml/e-w_charset-1.html
16591
- ...charset ? [createStringElement("w:charset", charset)] : [],
16592
- // http://www.datypic.com/sc/ooxml/e-w_family-1.html
16593
- ...family ? [createStringElement("w:family", family)] : [],
16594
- // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html
16595
- ...notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : [],
16596
- ...pitch ? [createStringElement("w:pitch", pitch)] : [],
16597
- // http://www.datypic.com/sc/ooxml/e-w_sig-1.html
16598
- ...sig ? [
16599
- new BuilderElement({
16600
- name: "w:sig",
16601
- attributes: {
16602
- usb0: { key: "w:usb0", value: sig.usb0 },
16603
- usb1: { key: "w:usb1", value: sig.usb1 },
16604
- usb2: { key: "w:usb2", value: sig.usb2 },
16605
- usb3: { key: "w:usb3", value: sig.usb3 },
16606
- csb0: { key: "w:csb0", value: sig.csb0 },
16607
- csb1: { key: "w:csb1", value: sig.csb1 }
16608
- }
16609
- })
16610
- ] : [],
16611
- // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html
16612
- ...embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : [],
16613
- // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html
16614
- ...embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : [],
16615
- // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html
16616
- ...embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : [],
16617
- // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html
16618
- ...embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : []
16619
- ]
16620
- })
16621
- );
16622
- const createRegularFont = ({
16623
- name,
16624
- index,
16625
- fontKey,
16626
- characterSet
16627
- }) => createFont({
16628
- name,
16629
- sig: {
16630
- usb0: "E0002AFF",
16631
- usb1: "C000247B",
16632
- usb2: "00000009",
16633
- usb3: "00000000",
16634
- csb0: "000001FF",
16635
- csb1: "00000000"
16636
- },
16637
- charset: characterSet,
16638
- family: "auto",
16639
- pitch: "variable",
16640
- embedRegular: {
16641
- fontKey,
16642
- id: `rId${index}`
16643
- }
16644
- });
16645
- const createFontTable = (fonts) => (
16646
- // https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_Font_topic_ID0ERNCU.html
16647
- // http://www.datypic.com/sc/ooxml/e-w_fonts.html
16648
- new BuilderElement({
16649
- name: "w:fonts",
16650
- attributes: {
16651
- mc: { key: "xmlns:mc", value: "http://schemas.openxmlformats.org/markup-compatibility/2006" },
16652
- r: { key: "xmlns:r", value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships" },
16653
- w: { key: "xmlns:w", value: "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
16654
- w14: { key: "xmlns:w14", value: "http://schemas.microsoft.com/office/word/2010/wordml" },
16655
- w15: { key: "xmlns:w15", value: "http://schemas.microsoft.com/office/word/2012/wordml" },
16656
- w16cex: { key: "xmlns:w16cex", value: "http://schemas.microsoft.com/office/word/2018/wordml/cex" },
16657
- w16cid: { key: "xmlns:w16cid", value: "http://schemas.microsoft.com/office/word/2016/wordml/cid" },
16658
- w16: { key: "xmlns:w16", value: "http://schemas.microsoft.com/office/word/2018/wordml" },
16659
- w16sdtdh: { key: "xmlns:w16sdtdh", value: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" },
16660
- w16se: { key: "xmlns:w16se", value: "http://schemas.microsoft.com/office/word/2015/wordml/symex" },
16661
- Ignorable: { key: "mc:Ignorable", value: "w14 w15 w16se w16cid w16 w16cex w16sdtdh" }
16662
- },
16663
- children: fonts.map(
16664
- (font, i) => createRegularFont({
16665
- name: font.name,
16666
- index: i + 1,
16667
- fontKey: font.fontKey
16668
- })
16669
- )
16670
- })
16671
- );
16672
- class FontWrapper {
16673
- constructor(options2) {
16674
- __publicField(this, "fontTable");
16675
- __publicField(this, "relationships");
16676
- __publicField(this, "fontOptionsWithKey", []);
16677
- this.options = options2;
16678
- this.fontOptionsWithKey = options2.map((o) => __spreadProps(__spreadValues({}, o), { fontKey: uniqueUuid() }));
16679
- this.fontTable = createFontTable(this.fontOptionsWithKey);
16680
- this.relationships = new Relationships();
16681
- for (let i = 0; i < options2.length; i++) {
16682
- this.relationships.createRelationship(
16683
- i + 1,
16684
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",
16685
- `fonts/${options2[i].name}.odttf`
16686
- );
16694
+ if (xmlElm.name === "w:styles") {
16695
+ stylesXmlElement = xmlElm;
16696
+ }
16687
16697
  }
16698
+ if (stylesXmlElement === void 0) {
16699
+ throw new Error("can not find styles element");
16700
+ }
16701
+ const stylesElements = stylesXmlElement.elements || [];
16702
+ const importedStyle = new Styles({
16703
+ initialStyles: new ImportedRootElementAttributes(stylesXmlElement.attributes),
16704
+ importedStyles: stylesElements.map((childElm) => convertToXmlComponent(childElm))
16705
+ });
16706
+ return importedStyle;
16688
16707
  }
16689
- get View() {
16690
- return this.fontTable;
16691
- }
16692
- get Relationships() {
16693
- return this.relationships;
16708
+ }
16709
+ class DefaultStylesFactory {
16710
+ newInstance(options2 = {}) {
16711
+ var _a;
16712
+ const documentAttributes = new DocumentAttributes({
16713
+ mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
16714
+ r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
16715
+ w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
16716
+ w14: "http://schemas.microsoft.com/office/word/2010/wordml",
16717
+ w15: "http://schemas.microsoft.com/office/word/2012/wordml",
16718
+ Ignorable: "w14 w15"
16719
+ });
16720
+ return {
16721
+ initialStyles: documentAttributes,
16722
+ importedStyles: [
16723
+ new DocumentDefaults((_a = options2.document) != null ? _a : {}),
16724
+ new TitleStyle(__spreadValues({
16725
+ run: {
16726
+ size: 56
16727
+ }
16728
+ }, options2.title)),
16729
+ new Heading1Style(__spreadValues({
16730
+ run: {
16731
+ color: "2E74B5",
16732
+ size: 32
16733
+ }
16734
+ }, options2.heading1)),
16735
+ new Heading2Style(__spreadValues({
16736
+ run: {
16737
+ color: "2E74B5",
16738
+ size: 26
16739
+ }
16740
+ }, options2.heading2)),
16741
+ new Heading3Style(__spreadValues({
16742
+ run: {
16743
+ color: "1F4D78",
16744
+ size: 24
16745
+ }
16746
+ }, options2.heading3)),
16747
+ new Heading4Style(__spreadValues({
16748
+ run: {
16749
+ color: "2E74B5",
16750
+ italics: true
16751
+ }
16752
+ }, options2.heading4)),
16753
+ new Heading5Style(__spreadValues({
16754
+ run: {
16755
+ color: "2E74B5"
16756
+ }
16757
+ }, options2.heading5)),
16758
+ new Heading6Style(__spreadValues({
16759
+ run: {
16760
+ color: "1F4D78"
16761
+ }
16762
+ }, options2.heading6)),
16763
+ new StrongStyle(__spreadValues({
16764
+ run: {
16765
+ bold: true
16766
+ }
16767
+ }, options2.strong)),
16768
+ new ListParagraph(options2.listParagraph || {}),
16769
+ new HyperlinkStyle(options2.hyperlink || {}),
16770
+ new FootnoteReferenceStyle(options2.footnoteReference || {}),
16771
+ new FootnoteText(options2.footnoteText || {}),
16772
+ new FootnoteTextChar(options2.footnoteTextChar || {})
16773
+ ]
16774
+ };
16694
16775
  }
16695
16776
  }
16696
16777
  class File {
@@ -16792,8 +16873,8 @@ var __async = (__this, __arguments, generator) => {
16792
16873
  this.addFooterToDocument(wrapper);
16793
16874
  return wrapper;
16794
16875
  }
16795
- addHeaderToDocument(header, type = HeaderFooterReferenceType.DEFAULT) {
16796
- this.headers.push({ header, type });
16876
+ addHeaderToDocument(header, type2 = HeaderFooterReferenceType.DEFAULT) {
16877
+ this.headers.push({ header, type: type2 });
16797
16878
  this.documentWrapper.Relationships.createRelationship(
16798
16879
  header.View.ReferenceId,
16799
16880
  "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",
@@ -16801,8 +16882,8 @@ var __async = (__this, __arguments, generator) => {
16801
16882
  );
16802
16883
  this.contentTypes.addHeader(this.headers.length);
16803
16884
  }
16804
- addFooterToDocument(footer, type = HeaderFooterReferenceType.DEFAULT) {
16805
- this.footers.push({ footer, type });
16885
+ addFooterToDocument(footer, type2 = HeaderFooterReferenceType.DEFAULT) {
16886
+ this.footers.push({ footer, type: type2 });
16806
16887
  this.documentWrapper.Relationships.createRelationship(
16807
16888
  footer.View.ReferenceId,
16808
16889
  "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",
@@ -19791,7 +19872,6 @@ var __async = (__this, __arguments, generator) => {
19791
19872
  return out;
19792
19873
  };
19793
19874
  class Formatter {
19794
- // tslint:disable-next-line: no-object-literal-type-assertion
19795
19875
  format(input, context = { stack: [] }) {
19796
19876
  const output = input.prepForXml(context);
19797
19877
  if (output) {
@@ -20261,7 +20341,6 @@ var __async = (__this, __arguments, generator) => {
20261
20341
  NONE: "",
20262
20342
  WITH_2_BLANKS: " ",
20263
20343
  WITH_4_BLANKS: " ",
20264
- // eslint-disable-next-line @typescript-eslint/naming-convention
20265
20344
  WITH_TAB: " "
20266
20345
  };
20267
20346
  const convertPrettifyType = (prettify) => prettify === true ? PrettifyType.WITH_2_BLANKS : prettify === false ? void 0 : prettify;
@@ -20344,6 +20423,94 @@ var __async = (__this, __arguments, generator) => {
20344
20423
  var _a, _b;
20345
20424
  return (_b = (_a = relationships.elements) == null ? void 0 : _a.filter((e) => e.name === id)[0].elements) != null ? _b : [];
20346
20425
  };
20426
+ const appendContentType = (element2, contentType, extension) => {
20427
+ const relationshipElements = getFirstLevelElements(element2, "Types");
20428
+ const exist = relationshipElements.some(
20429
+ (el) => {
20430
+ var _a, _b;
20431
+ return el.type === "element" && el.name === "Default" && ((_a = el == null ? void 0 : el.attributes) == null ? void 0 : _a.ContentType) === contentType && ((_b = el == null ? void 0 : el.attributes) == null ? void 0 : _b.Extension) === extension;
20432
+ }
20433
+ );
20434
+ if (exist) {
20435
+ return;
20436
+ }
20437
+ relationshipElements.push({
20438
+ attributes: {
20439
+ ContentType: contentType,
20440
+ Extension: extension
20441
+ },
20442
+ name: "Default",
20443
+ type: "element"
20444
+ });
20445
+ };
20446
+ const getIdFromRelationshipId = (relationshipId) => {
20447
+ const output = parseInt(relationshipId.substring(3), 10);
20448
+ return isNaN(output) ? 0 : output;
20449
+ };
20450
+ const getNextRelationshipIndex = (relationships) => {
20451
+ const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20452
+ return relationshipElements.map((e) => {
20453
+ var _a, _b, _c;
20454
+ return getIdFromRelationshipId((_c = (_b = (_a = e.attributes) == null ? void 0 : _a.Id) == null ? void 0 : _b.toString()) != null ? _c : "");
20455
+ }).reduce((acc, curr) => Math.max(acc, curr), 0) + 1;
20456
+ };
20457
+ const appendRelationship = (relationships, id, type2, target, targetMode) => {
20458
+ const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20459
+ relationshipElements.push({
20460
+ attributes: {
20461
+ Id: `rId${id}`,
20462
+ Type: type2,
20463
+ Target: target,
20464
+ TargetMode: targetMode
20465
+ },
20466
+ name: "Relationship",
20467
+ type: "element"
20468
+ });
20469
+ return relationshipElements;
20470
+ };
20471
+ const findRunElementIndexWithToken = (paragraphElement, token) => {
20472
+ var _a, _b, _c, _d;
20473
+ for (let i = 0; i < ((_a = paragraphElement.elements) != null ? _a : []).length; i++) {
20474
+ const element2 = paragraphElement.elements[i];
20475
+ if (element2.type === "element" && element2.name === "w:r") {
20476
+ const textElement = ((_b = element2.elements) != null ? _b : []).filter((e) => e.type === "element" && e.name === "w:t");
20477
+ for (const text of textElement) {
20478
+ if (!((_c = text.elements) == null ? void 0 : _c[0])) {
20479
+ continue;
20480
+ }
20481
+ if ((_d = text.elements[0].text) == null ? void 0 : _d.includes(token)) {
20482
+ return i;
20483
+ }
20484
+ }
20485
+ }
20486
+ }
20487
+ throw new Error("Token not found");
20488
+ };
20489
+ const splitRunElement = (runElement, token) => {
20490
+ var _a, _b;
20491
+ let splitIndex = 0;
20492
+ const splitElements = (_b = (_a = runElement.elements) == null ? void 0 : _a.map((e, i) => {
20493
+ var _a2, _b2, _c;
20494
+ if (e.type === "element" && e.name === "w:t") {
20495
+ const text = (_c = (_b2 = (_a2 = e.elements) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.text) != null ? _c : "";
20496
+ const splitText = text.split(token);
20497
+ const newElements = splitText.map((t) => __spreadProps(__spreadValues(__spreadValues({}, e), patchSpaceAttribute(e)), {
20498
+ elements: createTextElementContents(t)
20499
+ }));
20500
+ splitIndex = i;
20501
+ return newElements;
20502
+ } else {
20503
+ return e;
20504
+ }
20505
+ }).flat()) != null ? _b : [];
20506
+ const leftRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20507
+ elements: splitElements.slice(0, splitIndex + 1)
20508
+ });
20509
+ const rightRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20510
+ elements: splitElements.slice(splitIndex + 1)
20511
+ });
20512
+ return { left: leftRunElement, right: rightRunElement };
20513
+ };
20347
20514
  const ReplaceMode = {
20348
20515
  START: 0,
20349
20516
  MIDDLE: 1,
@@ -20395,49 +20562,6 @@ var __async = (__this, __arguments, generator) => {
20395
20562
  element2.elements = createTextElementContents(text);
20396
20563
  return element2;
20397
20564
  };
20398
- const findRunElementIndexWithToken = (paragraphElement, token) => {
20399
- var _a, _b, _c, _d;
20400
- for (let i = 0; i < ((_a = paragraphElement.elements) != null ? _a : []).length; i++) {
20401
- const element2 = paragraphElement.elements[i];
20402
- if (element2.type === "element" && element2.name === "w:r") {
20403
- const textElement = ((_b = element2.elements) != null ? _b : []).filter((e) => e.type === "element" && e.name === "w:t");
20404
- for (const text of textElement) {
20405
- if (!((_c = text.elements) == null ? void 0 : _c[0])) {
20406
- continue;
20407
- }
20408
- if ((_d = text.elements[0].text) == null ? void 0 : _d.includes(token)) {
20409
- return i;
20410
- }
20411
- }
20412
- }
20413
- }
20414
- throw new Error("Token not found");
20415
- };
20416
- const splitRunElement = (runElement, token) => {
20417
- var _a, _b;
20418
- let splitIndex = 0;
20419
- const splitElements = (_b = (_a = runElement.elements) == null ? void 0 : _a.map((e, i) => {
20420
- var _a2, _b2, _c;
20421
- if (e.type === "element" && e.name === "w:t") {
20422
- const text = (_c = (_b2 = (_a2 = e.elements) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.text) != null ? _c : "";
20423
- const splitText = text.split(token);
20424
- const newElements = splitText.map((t) => __spreadProps(__spreadValues(__spreadValues({}, e), patchSpaceAttribute(e)), {
20425
- elements: createTextElementContents(t)
20426
- }));
20427
- splitIndex = i;
20428
- return newElements;
20429
- } else {
20430
- return e;
20431
- }
20432
- }).flat()) != null ? _b : [];
20433
- const leftRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20434
- elements: splitElements.slice(0, splitIndex + 1)
20435
- });
20436
- const rightRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20437
- elements: splitElements.slice(splitIndex + 1)
20438
- });
20439
- return { left: leftRunElement, right: rightRunElement };
20440
- };
20441
20565
  const renderParagraphNode = (node) => {
20442
20566
  if (node.element.name !== "w:p") {
20443
20567
  throw new Error(`Invalid node type: ${node.element.name}`);
@@ -20567,7 +20691,7 @@ var __async = (__this, __arguments, generator) => {
20567
20691
  let patchedRightElement = right;
20568
20692
  if (keepOriginalStyles) {
20569
20693
  const runElementNonTextualElements = runElementToBeReplaced.elements.filter(
20570
- (e) => e.type === "element" && e.name !== "w:t" && e.name !== "w:br"
20694
+ (e) => e.type === "element" && e.name !== "w:t" && e.name !== "w:br" && e.name !== "w:tab"
20571
20695
  );
20572
20696
  newRunElements = textJson.map((e) => __spreadProps(__spreadValues({}, e), {
20573
20697
  elements: [...runElementNonTextualElements, ...e.elements]
@@ -20594,51 +20718,6 @@ var __async = (__this, __arguments, generator) => {
20594
20718
  };
20595
20719
  const goToParentElementFromPath = (json, path) => goToElementFromPath(json, path.slice(0, path.length - 1));
20596
20720
  const getLastElementIndexFromPath = (path) => path[path.length - 1];
20597
- const getIdFromRelationshipId = (relationshipId) => {
20598
- const output = parseInt(relationshipId.substring(3), 10);
20599
- return isNaN(output) ? 0 : output;
20600
- };
20601
- const getNextRelationshipIndex = (relationships) => {
20602
- const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20603
- return relationshipElements.map((e) => {
20604
- var _a, _b, _c;
20605
- return getIdFromRelationshipId((_c = (_b = (_a = e.attributes) == null ? void 0 : _a.Id) == null ? void 0 : _b.toString()) != null ? _c : "");
20606
- }).reduce((acc, curr) => Math.max(acc, curr), 0) + 1;
20607
- };
20608
- const appendRelationship = (relationships, id, type, target, targetMode) => {
20609
- const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20610
- relationshipElements.push({
20611
- attributes: {
20612
- Id: `rId${id}`,
20613
- Type: type,
20614
- Target: target,
20615
- TargetMode: targetMode
20616
- },
20617
- name: "Relationship",
20618
- type: "element"
20619
- });
20620
- return relationshipElements;
20621
- };
20622
- const appendContentType = (element2, contentType, extension) => {
20623
- const relationshipElements = getFirstLevelElements(element2, "Types");
20624
- const exist = relationshipElements.some(
20625
- (el) => {
20626
- var _a, _b;
20627
- return el.type === "element" && el.name === "Default" && ((_a = el == null ? void 0 : el.attributes) == null ? void 0 : _a.ContentType) === contentType && ((_b = el == null ? void 0 : el.attributes) == null ? void 0 : _b.Extension) === extension;
20628
- }
20629
- );
20630
- if (exist) {
20631
- return;
20632
- }
20633
- relationshipElements.push({
20634
- attributes: {
20635
- ContentType: contentType,
20636
- Extension: extension
20637
- },
20638
- name: "Default",
20639
- type: "element"
20640
- });
20641
- };
20642
20721
  const PatchType = {
20643
20722
  DOCUMENT: "file",
20644
20723
  PARAGRAPH: "paragraph"