docx 9.0.2 → 9.1.0

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/index.mjs CHANGED
@@ -17,6 +17,18 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
20
32
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
33
  var __async = (__this, __arguments, generator) => {
22
34
  return new Promise((resolve2, reject) => {
@@ -219,10 +231,10 @@ function _getMaxListeners(that) {
219
231
  EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
220
232
  return _getMaxListeners(this);
221
233
  };
222
- EventEmitter.prototype.emit = function emit(type) {
234
+ EventEmitter.prototype.emit = function emit(type2) {
223
235
  var args = [];
224
236
  for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
225
- var doError = type === "error";
237
+ var doError = type2 === "error";
226
238
  var events2 = this._events;
227
239
  if (events2 !== void 0)
228
240
  doError = doError && events2.error === void 0;
@@ -239,7 +251,7 @@ EventEmitter.prototype.emit = function emit(type) {
239
251
  err.context = er;
240
252
  throw err;
241
253
  }
242
- var handler = events2[type];
254
+ var handler = events2[type2];
243
255
  if (handler === void 0)
244
256
  return false;
245
257
  if (typeof handler === "function") {
@@ -252,7 +264,7 @@ EventEmitter.prototype.emit = function emit(type) {
252
264
  }
253
265
  return true;
254
266
  };
255
- function _addListener(target, type, listener, prepend) {
267
+ function _addListener(target, type2, listener, prepend) {
256
268
  var m;
257
269
  var events2;
258
270
  var existing;
@@ -265,19 +277,19 @@ function _addListener(target, type, listener, prepend) {
265
277
  if (events2.newListener !== void 0) {
266
278
  target.emit(
267
279
  "newListener",
268
- type,
280
+ type2,
269
281
  listener.listener ? listener.listener : listener
270
282
  );
271
283
  events2 = target._events;
272
284
  }
273
- existing = events2[type];
285
+ existing = events2[type2];
274
286
  }
275
287
  if (existing === void 0) {
276
- existing = events2[type] = listener;
288
+ existing = events2[type2] = listener;
277
289
  ++target._eventsCount;
278
290
  } else {
279
291
  if (typeof existing === "function") {
280
- existing = events2[type] = prepend ? [listener, existing] : [existing, listener];
292
+ existing = events2[type2] = prepend ? [listener, existing] : [existing, listener];
281
293
  } else if (prepend) {
282
294
  existing.unshift(listener);
283
295
  } else {
@@ -286,22 +298,22 @@ function _addListener(target, type, listener, prepend) {
286
298
  m = _getMaxListeners(target);
287
299
  if (m > 0 && existing.length > m && !existing.warned) {
288
300
  existing.warned = true;
289
- var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");
301
+ var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type2) + " listeners added. Use emitter.setMaxListeners() to increase limit");
290
302
  w.name = "MaxListenersExceededWarning";
291
303
  w.emitter = target;
292
- w.type = type;
304
+ w.type = type2;
293
305
  w.count = existing.length;
294
306
  ProcessEmitWarning(w);
295
307
  }
296
308
  }
297
309
  return target;
298
310
  }
299
- EventEmitter.prototype.addListener = function addListener(type, listener) {
300
- return _addListener(this, type, listener, false);
311
+ EventEmitter.prototype.addListener = function addListener(type2, listener) {
312
+ return _addListener(this, type2, listener, false);
301
313
  };
302
314
  EventEmitter.prototype.on = EventEmitter.prototype.addListener;
303
- EventEmitter.prototype.prependListener = function prependListener(type, listener) {
304
- return _addListener(this, type, listener, true);
315
+ EventEmitter.prototype.prependListener = function prependListener(type2, listener) {
316
+ return _addListener(this, type2, listener, true);
305
317
  };
306
318
  function onceWrapper() {
307
319
  if (!this.fired) {
@@ -312,39 +324,39 @@ function onceWrapper() {
312
324
  return this.listener.apply(this.target, arguments);
313
325
  }
314
326
  }
315
- function _onceWrap(target, type, listener) {
316
- var state2 = { fired: false, wrapFn: void 0, target, type, listener };
327
+ function _onceWrap(target, type2, listener) {
328
+ var state2 = { fired: false, wrapFn: void 0, target, type: type2, listener };
317
329
  var wrapped = onceWrapper.bind(state2);
318
330
  wrapped.listener = listener;
319
331
  state2.wrapFn = wrapped;
320
332
  return wrapped;
321
333
  }
322
- EventEmitter.prototype.once = function once(type, listener) {
334
+ EventEmitter.prototype.once = function once(type2, listener) {
323
335
  checkListener(listener);
324
- this.on(type, _onceWrap(this, type, listener));
336
+ this.on(type2, _onceWrap(this, type2, listener));
325
337
  return this;
326
338
  };
327
- EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {
339
+ EventEmitter.prototype.prependOnceListener = function prependOnceListener(type2, listener) {
328
340
  checkListener(listener);
329
- this.prependListener(type, _onceWrap(this, type, listener));
341
+ this.prependListener(type2, _onceWrap(this, type2, listener));
330
342
  return this;
331
343
  };
332
- EventEmitter.prototype.removeListener = function removeListener(type, listener) {
344
+ EventEmitter.prototype.removeListener = function removeListener(type2, listener) {
333
345
  var list, events2, position, i, originalListener;
334
346
  checkListener(listener);
335
347
  events2 = this._events;
336
348
  if (events2 === void 0)
337
349
  return this;
338
- list = events2[type];
350
+ list = events2[type2];
339
351
  if (list === void 0)
340
352
  return this;
341
353
  if (list === listener || list.listener === listener) {
342
354
  if (--this._eventsCount === 0)
343
355
  this._events = /* @__PURE__ */ Object.create(null);
344
356
  else {
345
- delete events2[type];
357
+ delete events2[type2];
346
358
  if (events2.removeListener)
347
- this.emit("removeListener", type, list.listener || listener);
359
+ this.emit("removeListener", type2, list.listener || listener);
348
360
  }
349
361
  } else if (typeof list !== "function") {
350
362
  position = -1;
@@ -363,14 +375,14 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener)
363
375
  spliceOne(list, position);
364
376
  }
365
377
  if (list.length === 1)
366
- events2[type] = list[0];
378
+ events2[type2] = list[0];
367
379
  if (events2.removeListener !== void 0)
368
- this.emit("removeListener", type, originalListener || listener);
380
+ this.emit("removeListener", type2, originalListener || listener);
369
381
  }
370
382
  return this;
371
383
  };
372
384
  EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
373
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
385
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(type2) {
374
386
  var listeners2, events2, i;
375
387
  events2 = this._events;
376
388
  if (events2 === void 0)
@@ -379,11 +391,11 @@ EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
379
391
  if (arguments.length === 0) {
380
392
  this._events = /* @__PURE__ */ Object.create(null);
381
393
  this._eventsCount = 0;
382
- } else if (events2[type] !== void 0) {
394
+ } else if (events2[type2] !== void 0) {
383
395
  if (--this._eventsCount === 0)
384
396
  this._events = /* @__PURE__ */ Object.create(null);
385
397
  else
386
- delete events2[type];
398
+ delete events2[type2];
387
399
  }
388
400
  return this;
389
401
  }
@@ -400,45 +412,45 @@ EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
400
412
  this._eventsCount = 0;
401
413
  return this;
402
414
  }
403
- listeners2 = events2[type];
415
+ listeners2 = events2[type2];
404
416
  if (typeof listeners2 === "function") {
405
- this.removeListener(type, listeners2);
417
+ this.removeListener(type2, listeners2);
406
418
  } else if (listeners2 !== void 0) {
407
419
  for (i = listeners2.length - 1; i >= 0; i--) {
408
- this.removeListener(type, listeners2[i]);
420
+ this.removeListener(type2, listeners2[i]);
409
421
  }
410
422
  }
411
423
  return this;
412
424
  };
413
- function _listeners(target, type, unwrap) {
425
+ function _listeners(target, type2, unwrap) {
414
426
  var events2 = target._events;
415
427
  if (events2 === void 0)
416
428
  return [];
417
- var evlistener = events2[type];
429
+ var evlistener = events2[type2];
418
430
  if (evlistener === void 0)
419
431
  return [];
420
432
  if (typeof evlistener === "function")
421
433
  return unwrap ? [evlistener.listener || evlistener] : [evlistener];
422
434
  return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
423
435
  }
424
- EventEmitter.prototype.listeners = function listeners(type) {
425
- return _listeners(this, type, true);
436
+ EventEmitter.prototype.listeners = function listeners(type2) {
437
+ return _listeners(this, type2, true);
426
438
  };
427
- EventEmitter.prototype.rawListeners = function rawListeners(type) {
428
- return _listeners(this, type, false);
439
+ EventEmitter.prototype.rawListeners = function rawListeners(type2) {
440
+ return _listeners(this, type2, false);
429
441
  };
430
- EventEmitter.listenerCount = function(emitter, type) {
442
+ EventEmitter.listenerCount = function(emitter, type2) {
431
443
  if (typeof emitter.listenerCount === "function") {
432
- return emitter.listenerCount(type);
444
+ return emitter.listenerCount(type2);
433
445
  } else {
434
- return listenerCount.call(emitter, type);
446
+ return listenerCount.call(emitter, type2);
435
447
  }
436
448
  };
437
449
  EventEmitter.prototype.listenerCount = listenerCount;
438
- function listenerCount(type) {
450
+ function listenerCount(type2) {
439
451
  var events2 = this._events;
440
452
  if (events2 !== void 0) {
441
- var evlistener = events2[type];
453
+ var evlistener = events2[type2];
442
454
  if (typeof evlistener === "function") {
443
455
  return 1;
444
456
  } else if (evlistener !== void 0) {
@@ -2251,8 +2263,8 @@ function requireBuffer() {
2251
2263
  }
2252
2264
  return i;
2253
2265
  }
2254
- function isInstance(obj, type) {
2255
- return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
2266
+ function isInstance(obj, type2) {
2267
+ return obj instanceof type2 || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type2.name;
2256
2268
  }
2257
2269
  function numberIsNaN(obj) {
2258
2270
  return obj !== obj;
@@ -2336,6 +2348,62 @@ function requireShams() {
2336
2348
  };
2337
2349
  return shams;
2338
2350
  }
2351
+ var esErrors;
2352
+ var hasRequiredEsErrors;
2353
+ function requireEsErrors() {
2354
+ if (hasRequiredEsErrors) return esErrors;
2355
+ hasRequiredEsErrors = 1;
2356
+ esErrors = Error;
2357
+ return esErrors;
2358
+ }
2359
+ var _eval;
2360
+ var hasRequired_eval;
2361
+ function require_eval() {
2362
+ if (hasRequired_eval) return _eval;
2363
+ hasRequired_eval = 1;
2364
+ _eval = EvalError;
2365
+ return _eval;
2366
+ }
2367
+ var range;
2368
+ var hasRequiredRange;
2369
+ function requireRange() {
2370
+ if (hasRequiredRange) return range;
2371
+ hasRequiredRange = 1;
2372
+ range = RangeError;
2373
+ return range;
2374
+ }
2375
+ var ref;
2376
+ var hasRequiredRef;
2377
+ function requireRef() {
2378
+ if (hasRequiredRef) return ref;
2379
+ hasRequiredRef = 1;
2380
+ ref = ReferenceError;
2381
+ return ref;
2382
+ }
2383
+ var syntax;
2384
+ var hasRequiredSyntax;
2385
+ function requireSyntax() {
2386
+ if (hasRequiredSyntax) return syntax;
2387
+ hasRequiredSyntax = 1;
2388
+ syntax = SyntaxError;
2389
+ return syntax;
2390
+ }
2391
+ var type;
2392
+ var hasRequiredType;
2393
+ function requireType() {
2394
+ if (hasRequiredType) return type;
2395
+ hasRequiredType = 1;
2396
+ type = TypeError;
2397
+ return type;
2398
+ }
2399
+ var uri;
2400
+ var hasRequiredUri;
2401
+ function requireUri() {
2402
+ if (hasRequiredUri) return uri;
2403
+ hasRequiredUri = 1;
2404
+ uri = URIError;
2405
+ return uri;
2406
+ }
2339
2407
  var hasSymbols;
2340
2408
  var hasRequiredHasSymbols;
2341
2409
  function requireHasSymbols() {
@@ -2366,11 +2434,12 @@ function requireHasProto() {
2366
2434
  if (hasRequiredHasProto) return hasProto;
2367
2435
  hasRequiredHasProto = 1;
2368
2436
  var test = {
2437
+ __proto__: null,
2369
2438
  foo: {}
2370
2439
  };
2371
2440
  var $Object = Object;
2372
2441
  hasProto = function hasProto2() {
2373
- return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
2442
+ return { __proto__: test }.foo === test.foo && !(test instanceof $Object);
2374
2443
  };
2375
2444
  return hasProto;
2376
2445
  }
@@ -2476,9 +2545,14 @@ function requireGetIntrinsic() {
2476
2545
  if (hasRequiredGetIntrinsic) return getIntrinsic;
2477
2546
  hasRequiredGetIntrinsic = 1;
2478
2547
  var undefined$1;
2479
- var $SyntaxError = SyntaxError;
2548
+ var $Error = requireEsErrors();
2549
+ var $EvalError = require_eval();
2550
+ var $RangeError = requireRange();
2551
+ var $ReferenceError = requireRef();
2552
+ var $SyntaxError = requireSyntax();
2553
+ var $TypeError = requireType();
2554
+ var $URIError = requireUri();
2480
2555
  var $Function = Function;
2481
- var $TypeError = TypeError;
2482
2556
  var getEvalledConstructor = function(expressionSyntax) {
2483
2557
  try {
2484
2558
  return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
@@ -2516,6 +2590,7 @@ function requireGetIntrinsic() {
2516
2590
  var needsEval = {};
2517
2591
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
2518
2592
  var INTRINSICS = {
2593
+ __proto__: null,
2519
2594
  "%AggregateError%": typeof AggregateError === "undefined" ? undefined$1 : AggregateError,
2520
2595
  "%Array%": Array,
2521
2596
  "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$1 : ArrayBuffer,
@@ -2536,10 +2611,10 @@ function requireGetIntrinsic() {
2536
2611
  "%decodeURIComponent%": decodeURIComponent,
2537
2612
  "%encodeURI%": encodeURI,
2538
2613
  "%encodeURIComponent%": encodeURIComponent,
2539
- "%Error%": Error,
2614
+ "%Error%": $Error,
2540
2615
  "%eval%": eval,
2541
2616
  // eslint-disable-line no-eval
2542
- "%EvalError%": EvalError,
2617
+ "%EvalError%": $EvalError,
2543
2618
  "%Float32Array%": typeof Float32Array === "undefined" ? undefined$1 : Float32Array,
2544
2619
  "%Float64Array%": typeof Float64Array === "undefined" ? undefined$1 : Float64Array,
2545
2620
  "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined$1 : FinalizationRegistry,
@@ -2561,8 +2636,8 @@ function requireGetIntrinsic() {
2561
2636
  "%parseInt%": parseInt,
2562
2637
  "%Promise%": typeof Promise === "undefined" ? undefined$1 : Promise,
2563
2638
  "%Proxy%": typeof Proxy === "undefined" ? undefined$1 : Proxy,
2564
- "%RangeError%": RangeError,
2565
- "%ReferenceError%": ReferenceError,
2639
+ "%RangeError%": $RangeError,
2640
+ "%ReferenceError%": $ReferenceError,
2566
2641
  "%Reflect%": typeof Reflect === "undefined" ? undefined$1 : Reflect,
2567
2642
  "%RegExp%": RegExp,
2568
2643
  "%Set%": typeof Set === "undefined" ? undefined$1 : Set,
@@ -2579,7 +2654,7 @@ function requireGetIntrinsic() {
2579
2654
  "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined$1 : Uint8ClampedArray,
2580
2655
  "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined$1 : Uint16Array,
2581
2656
  "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined$1 : Uint32Array,
2582
- "%URIError%": URIError,
2657
+ "%URIError%": $URIError,
2583
2658
  "%WeakMap%": typeof WeakMap === "undefined" ? undefined$1 : WeakMap,
2584
2659
  "%WeakRef%": typeof WeakRef === "undefined" ? undefined$1 : WeakRef,
2585
2660
  "%WeakSet%": typeof WeakSet === "undefined" ? undefined$1 : WeakSet
@@ -2615,6 +2690,7 @@ function requireGetIntrinsic() {
2615
2690
  return value;
2616
2691
  };
2617
2692
  var LEGACY_ALIASES = {
2693
+ __proto__: null,
2618
2694
  "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
2619
2695
  "%ArrayPrototype%": ["Array", "prototype"],
2620
2696
  "%ArrayProto_entries%": ["Array", "prototype", "entries"],
@@ -2777,36 +2853,22 @@ function requireGetIntrinsic() {
2777
2853
  return getIntrinsic;
2778
2854
  }
2779
2855
  var callBind = { exports: {} };
2780
- var hasPropertyDescriptors_1;
2781
- var hasRequiredHasPropertyDescriptors;
2782
- function requireHasPropertyDescriptors() {
2783
- if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
2784
- hasRequiredHasPropertyDescriptors = 1;
2856
+ var esDefineProperty;
2857
+ var hasRequiredEsDefineProperty;
2858
+ function requireEsDefineProperty() {
2859
+ if (hasRequiredEsDefineProperty) return esDefineProperty;
2860
+ hasRequiredEsDefineProperty = 1;
2785
2861
  var GetIntrinsic = requireGetIntrinsic();
2786
- var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
2787
- var hasPropertyDescriptors = function hasPropertyDescriptors2() {
2788
- if ($defineProperty) {
2789
- try {
2790
- $defineProperty({}, "a", { value: 1 });
2791
- return true;
2792
- } catch (e) {
2793
- return false;
2794
- }
2795
- }
2796
- return false;
2797
- };
2798
- hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
2799
- if (!hasPropertyDescriptors()) {
2800
- return null;
2801
- }
2862
+ var $defineProperty = GetIntrinsic("%Object.defineProperty%", true) || false;
2863
+ if ($defineProperty) {
2802
2864
  try {
2803
- return $defineProperty([], "length", { value: 1 }).length !== 1;
2865
+ $defineProperty({}, "a", { value: 1 });
2804
2866
  } catch (e) {
2805
- return true;
2867
+ $defineProperty = false;
2806
2868
  }
2807
- };
2808
- hasPropertyDescriptors_1 = hasPropertyDescriptors;
2809
- return hasPropertyDescriptors_1;
2869
+ }
2870
+ esDefineProperty = $defineProperty;
2871
+ return esDefineProperty;
2810
2872
  }
2811
2873
  var gopd;
2812
2874
  var hasRequiredGopd;
@@ -2830,18 +2892,9 @@ var hasRequiredDefineDataProperty;
2830
2892
  function requireDefineDataProperty() {
2831
2893
  if (hasRequiredDefineDataProperty) return defineDataProperty;
2832
2894
  hasRequiredDefineDataProperty = 1;
2833
- var hasPropertyDescriptors = requireHasPropertyDescriptors()();
2834
- var GetIntrinsic = requireGetIntrinsic();
2835
- var $defineProperty = hasPropertyDescriptors && GetIntrinsic("%Object.defineProperty%", true);
2836
- if ($defineProperty) {
2837
- try {
2838
- $defineProperty({}, "a", { value: 1 });
2839
- } catch (e) {
2840
- $defineProperty = false;
2841
- }
2842
- }
2843
- var $SyntaxError = GetIntrinsic("%SyntaxError%");
2844
- var $TypeError = GetIntrinsic("%TypeError%");
2895
+ var $defineProperty = requireEsDefineProperty();
2896
+ var $SyntaxError = requireSyntax();
2897
+ var $TypeError = requireType();
2845
2898
  var gopd2 = requireGopd();
2846
2899
  defineDataProperty = function defineDataProperty2(obj, property, value) {
2847
2900
  if (!obj || typeof obj !== "object" && typeof obj !== "function") {
@@ -2882,6 +2935,28 @@ function requireDefineDataProperty() {
2882
2935
  };
2883
2936
  return defineDataProperty;
2884
2937
  }
2938
+ var hasPropertyDescriptors_1;
2939
+ var hasRequiredHasPropertyDescriptors;
2940
+ function requireHasPropertyDescriptors() {
2941
+ if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
2942
+ hasRequiredHasPropertyDescriptors = 1;
2943
+ var $defineProperty = requireEsDefineProperty();
2944
+ var hasPropertyDescriptors = function hasPropertyDescriptors2() {
2945
+ return !!$defineProperty;
2946
+ };
2947
+ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
2948
+ if (!$defineProperty) {
2949
+ return null;
2950
+ }
2951
+ try {
2952
+ return $defineProperty([], "length", { value: 1 }).length !== 1;
2953
+ } catch (e) {
2954
+ return true;
2955
+ }
2956
+ };
2957
+ hasPropertyDescriptors_1 = hasPropertyDescriptors;
2958
+ return hasPropertyDescriptors_1;
2959
+ }
2885
2960
  var setFunctionLength;
2886
2961
  var hasRequiredSetFunctionLength;
2887
2962
  function requireSetFunctionLength() {
@@ -2891,7 +2966,7 @@ function requireSetFunctionLength() {
2891
2966
  var define = requireDefineDataProperty();
2892
2967
  var hasDescriptors = requireHasPropertyDescriptors()();
2893
2968
  var gOPD = requireGopd();
2894
- var $TypeError = GetIntrinsic("%TypeError%");
2969
+ var $TypeError = requireType();
2895
2970
  var $floor = GetIntrinsic("%Math.floor%");
2896
2971
  setFunctionLength = function setFunctionLength2(fn, length) {
2897
2972
  if (typeof fn !== "function") {
@@ -2914,9 +2989,21 @@ function requireSetFunctionLength() {
2914
2989
  }
2915
2990
  if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
2916
2991
  if (hasDescriptors) {
2917
- define(fn, "length", length, true, true);
2992
+ define(
2993
+ /** @type {Parameters<define>[0]} */
2994
+ fn,
2995
+ "length",
2996
+ length,
2997
+ true,
2998
+ true
2999
+ );
2918
3000
  } else {
2919
- define(fn, "length", length);
3001
+ define(
3002
+ /** @type {Parameters<define>[0]} */
3003
+ fn,
3004
+ "length",
3005
+ length
3006
+ );
2920
3007
  }
2921
3008
  }
2922
3009
  return fn;
@@ -2931,19 +3018,12 @@ function requireCallBind() {
2931
3018
  var bind = requireFunctionBind();
2932
3019
  var GetIntrinsic = requireGetIntrinsic();
2933
3020
  var setFunctionLength2 = requireSetFunctionLength();
2934
- var $TypeError = GetIntrinsic("%TypeError%");
3021
+ var $TypeError = requireType();
2935
3022
  var $apply = GetIntrinsic("%Function.prototype.apply%");
2936
3023
  var $call = GetIntrinsic("%Function.prototype.call%");
2937
3024
  var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply);
2938
- var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
3025
+ var $defineProperty = requireEsDefineProperty();
2939
3026
  var $max = GetIntrinsic("%Math.max%");
2940
- if ($defineProperty) {
2941
- try {
2942
- $defineProperty({}, "a", { value: 1 });
2943
- } catch (e) {
2944
- $defineProperty = null;
2945
- }
2946
- }
2947
3027
  module.exports = function callBind2(originalFunction) {
2948
3028
  if (typeof originalFunction !== "function") {
2949
3029
  throw new $TypeError("a function is required");
@@ -3227,24 +3307,32 @@ function requireForEach() {
3227
3307
  forEach_1 = forEach;
3228
3308
  return forEach_1;
3229
3309
  }
3230
- var availableTypedArrays;
3231
- var hasRequiredAvailableTypedArrays;
3232
- function requireAvailableTypedArrays() {
3233
- if (hasRequiredAvailableTypedArrays) return availableTypedArrays;
3234
- hasRequiredAvailableTypedArrays = 1;
3235
- var possibleNames = [
3236
- "BigInt64Array",
3237
- "BigUint64Array",
3310
+ var possibleTypedArrayNames;
3311
+ var hasRequiredPossibleTypedArrayNames;
3312
+ function requirePossibleTypedArrayNames() {
3313
+ if (hasRequiredPossibleTypedArrayNames) return possibleTypedArrayNames;
3314
+ hasRequiredPossibleTypedArrayNames = 1;
3315
+ possibleTypedArrayNames = [
3238
3316
  "Float32Array",
3239
3317
  "Float64Array",
3318
+ "Int8Array",
3240
3319
  "Int16Array",
3241
3320
  "Int32Array",
3242
- "Int8Array",
3321
+ "Uint8Array",
3322
+ "Uint8ClampedArray",
3243
3323
  "Uint16Array",
3244
3324
  "Uint32Array",
3245
- "Uint8Array",
3246
- "Uint8ClampedArray"
3325
+ "BigInt64Array",
3326
+ "BigUint64Array"
3247
3327
  ];
3328
+ return possibleTypedArrayNames;
3329
+ }
3330
+ var availableTypedArrays;
3331
+ var hasRequiredAvailableTypedArrays;
3332
+ function requireAvailableTypedArrays() {
3333
+ if (hasRequiredAvailableTypedArrays) return availableTypedArrays;
3334
+ hasRequiredAvailableTypedArrays = 1;
3335
+ var possibleNames = requirePossibleTypedArrayNames();
3248
3336
  var g = typeof globalThis === "undefined" ? commonjsGlobal : globalThis;
3249
3337
  availableTypedArrays = function availableTypedArrays2() {
3250
3338
  var out = [];
@@ -3306,29 +3394,43 @@ function requireWhichTypedArray() {
3306
3394
  }
3307
3395
  var tryTypedArrays = function tryAllTypedArrays(value) {
3308
3396
  var found = false;
3309
- forEach(cache, function(getter, typedArray) {
3310
- if (!found) {
3311
- try {
3312
- if ("$" + getter(value) === typedArray) {
3313
- found = $slice(typedArray, 1);
3397
+ forEach(
3398
+ // eslint-disable-next-line no-extra-parens
3399
+ /** @type {Record<`\$${TypedArrayName}`, Getter>} */
3400
+ /** @type {any} */
3401
+ cache,
3402
+ /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
3403
+ function(getter, typedArray) {
3404
+ if (!found) {
3405
+ try {
3406
+ if ("$" + getter(value) === typedArray) {
3407
+ found = $slice(typedArray, 1);
3408
+ }
3409
+ } catch (e) {
3314
3410
  }
3315
- } catch (e) {
3316
3411
  }
3317
3412
  }
3318
- });
3413
+ );
3319
3414
  return found;
3320
3415
  };
3321
3416
  var trySlices = function tryAllSlices(value) {
3322
3417
  var found = false;
3323
- forEach(cache, function(getter, name) {
3324
- if (!found) {
3325
- try {
3326
- getter(value);
3327
- found = $slice(name, 1);
3328
- } catch (e) {
3418
+ forEach(
3419
+ // eslint-disable-next-line no-extra-parens
3420
+ /** @type {Record<`\$${TypedArrayName}`, Getter>} */
3421
+ /** @type {any} */
3422
+ cache,
3423
+ /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */
3424
+ function(getter, name) {
3425
+ if (!found) {
3426
+ try {
3427
+ getter(value);
3428
+ found = $slice(name, 1);
3429
+ } catch (e) {
3430
+ }
3329
3431
  }
3330
3432
  }
3331
- });
3433
+ );
3332
3434
  return found;
3333
3435
  };
3334
3436
  whichTypedArray = function whichTypedArray2(value) {
@@ -4565,8 +4667,8 @@ function requireErrorsBrowser() {
4565
4667
  if (endsWith(name, " argument")) {
4566
4668
  msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4567
4669
  } else {
4568
- var type = includes(name, ".") ? "property" : "argument";
4569
- msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4670
+ var type2 = includes(name, ".") ? "property" : "argument";
4671
+ msg = 'The "'.concat(name, '" ').concat(type2, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4570
4672
  }
4571
4673
  msg += ". Received type ".concat(typeof actual);
4572
4674
  return msg;
@@ -5781,8 +5883,8 @@ function require_stream_readable() {
5781
5883
  var Duplex;
5782
5884
  Readable.ReadableState = ReadableState;
5783
5885
  eventsExports.EventEmitter;
5784
- var EElistenerCount = function EElistenerCount2(emitter, type) {
5785
- return emitter.listeners(type).length;
5886
+ var EElistenerCount = function EElistenerCount2(emitter, type2) {
5887
+ return emitter.listeners(type2).length;
5786
5888
  };
5787
5889
  var Stream2 = requireStreamBrowser();
5788
5890
  var Buffer2 = requireBuffer().Buffer;
@@ -7508,15 +7610,15 @@ Stream$1.prototype.pipe = function(dest, options2) {
7508
7610
  var qualName = qname(name, true);
7509
7611
  var prefix = qualName.prefix;
7510
7612
  var local = qualName.local;
7511
- var uri = prefix === "" ? "" : tag.ns[prefix] || "";
7613
+ var uri2 = prefix === "" ? "" : tag.ns[prefix] || "";
7512
7614
  var a = {
7513
7615
  name,
7514
7616
  value,
7515
7617
  prefix,
7516
7618
  local,
7517
- uri
7619
+ uri: uri2
7518
7620
  };
7519
- if (prefix && prefix !== "xmlns" && !uri) {
7621
+ if (prefix && prefix !== "xmlns" && !uri2) {
7520
7622
  strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix));
7521
7623
  a.uri = prefix;
7522
7624
  }
@@ -8303,19 +8405,19 @@ function nativeType(value) {
8303
8405
  }
8304
8406
  return value;
8305
8407
  }
8306
- function addField(type, value) {
8408
+ function addField(type2, value) {
8307
8409
  var key;
8308
8410
  if (options.compact) {
8309
- if (!currentElement$1[options[type + "Key"]] && (isArray$1(options.alwaysArray) ? options.alwaysArray.indexOf(options[type + "Key"]) !== -1 : options.alwaysArray)) {
8310
- currentElement$1[options[type + "Key"]] = [];
8411
+ if (!currentElement$1[options[type2 + "Key"]] && (isArray$1(options.alwaysArray) ? options.alwaysArray.indexOf(options[type2 + "Key"]) !== -1 : options.alwaysArray)) {
8412
+ currentElement$1[options[type2 + "Key"]] = [];
8311
8413
  }
8312
- if (currentElement$1[options[type + "Key"]] && !isArray$1(currentElement$1[options[type + "Key"]])) {
8313
- currentElement$1[options[type + "Key"]] = [currentElement$1[options[type + "Key"]]];
8414
+ if (currentElement$1[options[type2 + "Key"]] && !isArray$1(currentElement$1[options[type2 + "Key"]])) {
8415
+ currentElement$1[options[type2 + "Key"]] = [currentElement$1[options[type2 + "Key"]]];
8314
8416
  }
8315
- if (type + "Fn" in options && typeof value === "string") {
8316
- value = options[type + "Fn"](value, currentElement$1);
8417
+ if (type2 + "Fn" in options && typeof value === "string") {
8418
+ value = options[type2 + "Fn"](value, currentElement$1);
8317
8419
  }
8318
- if (type === "instruction" && ("instructionFn" in options || "instructionNameFn" in options)) {
8420
+ if (type2 === "instruction" && ("instructionFn" in options || "instructionNameFn" in options)) {
8319
8421
  for (key in value) {
8320
8422
  if (value.hasOwnProperty(key)) {
8321
8423
  if ("instructionFn" in options) {
@@ -8328,18 +8430,18 @@ function addField(type, value) {
8328
8430
  }
8329
8431
  }
8330
8432
  }
8331
- if (isArray$1(currentElement$1[options[type + "Key"]])) {
8332
- currentElement$1[options[type + "Key"]].push(value);
8433
+ if (isArray$1(currentElement$1[options[type2 + "Key"]])) {
8434
+ currentElement$1[options[type2 + "Key"]].push(value);
8333
8435
  } else {
8334
- currentElement$1[options[type + "Key"]] = value;
8436
+ currentElement$1[options[type2 + "Key"]] = value;
8335
8437
  }
8336
8438
  } else {
8337
8439
  if (!currentElement$1[options.elementsKey]) {
8338
8440
  currentElement$1[options.elementsKey] = [];
8339
8441
  }
8340
8442
  var element2 = {};
8341
- element2[options.typeKey] = type;
8342
- if (type === "instruction") {
8443
+ element2[options.typeKey] = type2;
8444
+ if (type2 === "instruction") {
8343
8445
  for (key in value) {
8344
8446
  if (value.hasOwnProperty(key)) {
8345
8447
  break;
@@ -8358,10 +8460,10 @@ function addField(type, value) {
8358
8460
  element2[options.instructionKey] = value[key];
8359
8461
  }
8360
8462
  } else {
8361
- if (type + "Fn" in options) {
8362
- value = options[type + "Fn"](value, currentElement$1);
8463
+ if (type2 + "Fn" in options) {
8464
+ value = options[type2 + "Fn"](value, currentElement$1);
8363
8465
  }
8364
- element2[options[type + "Key"]] = value;
8466
+ element2[options[type2 + "Key"]] = value;
8365
8467
  }
8366
8468
  if (options.addParent) {
8367
8469
  element2[options.parentKey] = currentElement$1;
@@ -9161,9 +9263,9 @@ class AlignmentAttributes extends XmlAttributeComponent {
9161
9263
  }
9162
9264
  }
9163
9265
  class Alignment extends XmlComponent {
9164
- constructor(type) {
9266
+ constructor(type2) {
9165
9267
  super("w:jc");
9166
- this.root.push(new AlignmentAttributes({ val: type }));
9268
+ this.root.push(new AlignmentAttributes({ val: type2 }));
9167
9269
  }
9168
9270
  }
9169
9271
  class BorderElement extends XmlComponent {
@@ -9443,13 +9545,13 @@ class ShadingAttributes extends XmlAttributeComponent {
9443
9545
  }
9444
9546
  }
9445
9547
  class Shading extends XmlComponent {
9446
- constructor({ fill, color, type }) {
9548
+ constructor({ fill, color, type: type2 }) {
9447
9549
  super("w:shd");
9448
9550
  this.root.push(
9449
9551
  new ShadingAttributes({
9450
9552
  fill: fill === void 0 ? void 0 : hexColorValue(fill),
9451
9553
  color: color === void 0 ? void 0 : hexColorValue(color),
9452
- type
9554
+ type: type2
9453
9555
  })
9454
9556
  );
9455
9557
  }
@@ -9616,11 +9718,11 @@ class RunFonts extends XmlComponent {
9616
9718
  }
9617
9719
  }
9618
9720
  let VerticalAlign$1 = class VerticalAlign extends XmlComponent {
9619
- constructor(type) {
9721
+ constructor(type2) {
9620
9722
  super("w:vertAlign");
9621
9723
  this.root.push(
9622
9724
  new Attributes({
9623
- val: type
9725
+ val: type2
9624
9726
  })
9625
9727
  );
9626
9728
  }
@@ -9941,25 +10043,6 @@ class SymbolRun extends Run {
9941
10043
  this.root.push(new Symbol$1(options2.char, options2.symbolfont));
9942
10044
  }
9943
10045
  }
9944
- let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
9945
- let customAlphabet = (alphabet, defaultSize = 21) => {
9946
- return (size = defaultSize) => {
9947
- let id = "";
9948
- let i = size;
9949
- while (i--) {
9950
- id += alphabet[Math.random() * alphabet.length | 0];
9951
- }
9952
- return id;
9953
- };
9954
- };
9955
- let nanoid = (size = 21) => {
9956
- let id = "";
9957
- let i = size;
9958
- while (i--) {
9959
- id += urlAlphabet[Math.random() * 64 | 0];
9960
- }
9961
- return id;
9962
- };
9963
10046
  var hash$1 = {};
9964
10047
  var utils$9 = {};
9965
10048
  var minimalisticAssert = assert$5;
@@ -11520,6 +11603,25 @@ Hmac.prototype.digest = function digest8(enc) {
11520
11603
  hash2.ripemd160 = hash2.ripemd.ripemd160;
11521
11604
  })(hash$1);
11522
11605
  const hash = /* @__PURE__ */ getDefaultExportFromCjs$1(hash$1);
11606
+ let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
11607
+ let customAlphabet = (alphabet, defaultSize = 21) => {
11608
+ return (size = defaultSize) => {
11609
+ let id = "";
11610
+ let i = size;
11611
+ while (i--) {
11612
+ id += alphabet[Math.random() * alphabet.length | 0];
11613
+ }
11614
+ return id;
11615
+ };
11616
+ };
11617
+ let nanoid = (size = 21) => {
11618
+ let id = "";
11619
+ let i = size;
11620
+ while (i--) {
11621
+ id += urlAlphabet[Math.random() * 64 | 0];
11622
+ }
11623
+ return id;
11624
+ };
11523
11625
  const convertMillimetersToTwip = (millimeters) => Math.floor(millimeters / 25.4 * 72 * 20);
11524
11626
  const convertInchesToTwip = (inches) => Math.floor(inches * 72 * 20);
11525
11627
  const uniqueNumericIdCreator = (initial = 0) => {
@@ -11865,8 +11967,8 @@ class Form extends XmlComponent {
11865
11967
  }
11866
11968
  }
11867
11969
  const createNoFill = () => new BuilderElement({ name: "a:noFill" });
11868
- const createSchemeColor = (options2) => new BuilderElement({
11869
- name: "a:schemeClr",
11970
+ const createSolidRgbColor = (options2) => new BuilderElement({
11971
+ name: "a:srgbClr",
11870
11972
  attributes: {
11871
11973
  value: {
11872
11974
  key: "val",
@@ -11874,8 +11976,8 @@ const createSchemeColor = (options2) => new BuilderElement({
11874
11976
  }
11875
11977
  }
11876
11978
  });
11877
- const createSolidRgbColor = (options2) => new BuilderElement({
11878
- name: "a:srgbClr",
11979
+ const createSchemeColor = (options2) => new BuilderElement({
11980
+ name: "a:schemeClr",
11879
11981
  attributes: {
11880
11982
  value: {
11881
11983
  key: "val",
@@ -12681,7 +12783,6 @@ const PositionalTabLeader = {
12681
12783
  DOT: "dot",
12682
12784
  HYPHEN: "hyphen",
12683
12785
  UNDERSCORE: "underscore",
12684
- // eslint-disable-next-line @typescript-eslint/naming-convention
12685
12786
  MIDDLE_DOT: "middleDot"
12686
12787
  };
12687
12788
  class PositionalTab extends XmlComponent {
@@ -12711,11 +12812,11 @@ const BreakType = {
12711
12812
  // textWrapping breaks are the default and already exposed via the "Run" class
12712
12813
  };
12713
12814
  class Break2 extends XmlComponent {
12714
- constructor(type) {
12815
+ constructor(type2) {
12715
12816
  super("w:br");
12716
12817
  this.root.push(
12717
12818
  new Attributes({
12718
- type
12819
+ type: type2
12719
12820
  })
12720
12821
  );
12721
12822
  }
@@ -12738,7 +12839,6 @@ class PageBreakBefore extends XmlComponent {
12738
12839
  }
12739
12840
  }
12740
12841
  const LineRuleType = {
12741
- // eslint-disable-next-line @typescript-eslint/naming-convention
12742
12842
  AT_LEAST: "atLeast",
12743
12843
  EXACTLY: "exactly",
12744
12844
  EXACT: "exact",
@@ -12804,7 +12904,6 @@ const TabStopType = {
12804
12904
  const LeaderType = {
12805
12905
  DOT: "dot",
12806
12906
  HYPHEN: "hyphen",
12807
- // eslint-disable-next-line @typescript-eslint/naming-convention
12808
12907
  MIDDLE_DOT: "middleDot",
12809
12908
  NONE: "none",
12810
12909
  UNDERSCORE: "underscore"
@@ -12819,11 +12918,11 @@ class TabAttributes extends XmlAttributeComponent {
12819
12918
  }
12820
12919
  }
12821
12920
  class TabStopItem extends XmlComponent {
12822
- constructor({ type, position, leader }) {
12921
+ constructor({ type: type2, position, leader }) {
12823
12922
  super("w:tab");
12824
12923
  this.root.push(
12825
12924
  new TabAttributes({
12826
- val: type,
12925
+ val: type2,
12827
12926
  pos: position,
12828
12927
  leader
12829
12928
  })
@@ -12883,12 +12982,12 @@ const TargetModeType = {
12883
12982
  EXTERNAL: "External"
12884
12983
  };
12885
12984
  class Relationship extends XmlComponent {
12886
- constructor(id, type, target, targetMode) {
12985
+ constructor(id, type2, target, targetMode) {
12887
12986
  super("Relationship");
12888
12987
  this.root.push(
12889
12988
  new RelationshipAttributes({
12890
12989
  id,
12891
- type,
12990
+ type: type2,
12892
12991
  target,
12893
12992
  targetMode
12894
12993
  })
@@ -13036,35 +13135,6 @@ class VerticalAlignElement extends XmlComponent {
13036
13135
  this.root.push(new VerticalAlignAttributes({ verticalAlign: value }));
13037
13136
  }
13038
13137
  }
13039
- const HeaderFooterReferenceType = {
13040
- DEFAULT: "default",
13041
- FIRST: "first",
13042
- EVEN: "even"
13043
- };
13044
- class FooterReferenceAttributes extends XmlAttributeComponent {
13045
- constructor() {
13046
- super(...arguments);
13047
- __publicField(this, "xmlKeys", {
13048
- type: "w:type",
13049
- id: "r:id"
13050
- });
13051
- }
13052
- }
13053
- const HeaderFooterType = {
13054
- HEADER: "w:headerReference",
13055
- FOOTER: "w:footerReference"
13056
- };
13057
- class HeaderFooterReference extends XmlComponent {
13058
- constructor(type, options2) {
13059
- super(type);
13060
- this.root.push(
13061
- new FooterReferenceAttributes({
13062
- type: options2.type || HeaderFooterReferenceType.DEFAULT,
13063
- id: `rId${options2.id}`
13064
- })
13065
- );
13066
- }
13067
- }
13068
13138
  class Columns extends XmlComponent {
13069
13139
  constructor({ space, count, separate, equalWidth, children }) {
13070
13140
  super("w:cols");
@@ -13098,17 +13168,46 @@ class DocGridAttributes extends XmlAttributeComponent {
13098
13168
  }
13099
13169
  }
13100
13170
  class DocumentGrid extends XmlComponent {
13101
- constructor(linePitch, charSpace, type) {
13171
+ constructor(linePitch, charSpace, type2) {
13102
13172
  super("w:docGrid");
13103
13173
  this.root.push(
13104
13174
  new DocGridAttributes({
13105
- type,
13175
+ type: type2,
13106
13176
  linePitch: decimalNumber(linePitch),
13107
13177
  charSpace: charSpace ? decimalNumber(charSpace) : void 0
13108
13178
  })
13109
13179
  );
13110
13180
  }
13111
13181
  }
13182
+ const HeaderFooterReferenceType = {
13183
+ DEFAULT: "default",
13184
+ FIRST: "first",
13185
+ EVEN: "even"
13186
+ };
13187
+ class FooterReferenceAttributes extends XmlAttributeComponent {
13188
+ constructor() {
13189
+ super(...arguments);
13190
+ __publicField(this, "xmlKeys", {
13191
+ type: "w:type",
13192
+ id: "r:id"
13193
+ });
13194
+ }
13195
+ }
13196
+ const HeaderFooterType = {
13197
+ HEADER: "w:headerReference",
13198
+ FOOTER: "w:footerReference"
13199
+ };
13200
+ class HeaderFooterReference extends XmlComponent {
13201
+ constructor(type2, options2) {
13202
+ super(type2);
13203
+ this.root.push(
13204
+ new FooterReferenceAttributes({
13205
+ type: options2.type || HeaderFooterReferenceType.DEFAULT,
13206
+ id: `rId${options2.id}`
13207
+ })
13208
+ );
13209
+ }
13210
+ }
13112
13211
  const LineNumberRestartFormat = {
13113
13212
  NEW_PAGE: "newPage",
13114
13213
  NEW_SECTION: "newSection",
@@ -13327,13 +13426,13 @@ class SectionProperties extends XmlComponent {
13327
13426
  titlePage,
13328
13427
  verticalAlign,
13329
13428
  column,
13330
- type
13429
+ type: type2
13331
13430
  } = {}) {
13332
13431
  super("w:sectPr");
13333
13432
  this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup);
13334
13433
  this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup);
13335
- if (type) {
13336
- this.root.push(new Type(type));
13434
+ if (type2) {
13435
+ this.root.push(new Type(type2));
13337
13436
  }
13338
13437
  this.root.push(new PageSize(width, height, orientation));
13339
13438
  this.root.push(new PageMargin(top, right, bottom, left, header, footer, gutter));
@@ -13358,10 +13457,10 @@ class SectionProperties extends XmlComponent {
13358
13457
  }
13359
13458
  this.root.push(new DocumentGrid(linePitch, charSpace, gridType));
13360
13459
  }
13361
- addHeaderFooterGroup(type, group) {
13460
+ addHeaderFooterGroup(type2, group) {
13362
13461
  if (group.default) {
13363
13462
  this.root.push(
13364
- new HeaderFooterReference(type, {
13463
+ new HeaderFooterReference(type2, {
13365
13464
  type: HeaderFooterReferenceType.DEFAULT,
13366
13465
  id: group.default.View.ReferenceId
13367
13466
  })
@@ -13369,7 +13468,7 @@ class SectionProperties extends XmlComponent {
13369
13468
  }
13370
13469
  if (group.first) {
13371
13470
  this.root.push(
13372
- new HeaderFooterReference(type, {
13471
+ new HeaderFooterReference(type2, {
13373
13472
  type: HeaderFooterReferenceType.FIRST,
13374
13473
  id: group.first.View.ReferenceId
13375
13474
  })
@@ -13377,7 +13476,7 @@ class SectionProperties extends XmlComponent {
13377
13476
  }
13378
13477
  if (group.even) {
13379
13478
  this.root.push(
13380
- new HeaderFooterReference(type, {
13479
+ new HeaderFooterReference(type2, {
13381
13480
  type: HeaderFooterReferenceType.EVEN,
13382
13481
  id: group.even.View.ReferenceId
13383
13482
  })
@@ -13576,8 +13675,8 @@ class Relationships extends XmlComponent {
13576
13675
  })
13577
13676
  );
13578
13677
  }
13579
- createRelationship(id, type, target, targetMode) {
13580
- const relationship = new Relationship(`rId${id}`, type, target, targetMode);
13678
+ createRelationship(id, type2, target, targetMode) {
13679
+ const relationship = new Relationship(`rId${id}`, type2, target, targetMode);
13581
13680
  this.root.push(relationship);
13582
13681
  return relationship;
13583
13682
  }
@@ -13625,7 +13724,6 @@ const FrameWrap = {
13625
13724
  AROUND: "around",
13626
13725
  AUTO: "auto",
13627
13726
  NONE: "none",
13628
- // eslint-disable-next-line @typescript-eslint/naming-convention
13629
13727
  NOT_BESIDE: "notBeside",
13630
13728
  THROUGH: "through",
13631
13729
  TIGHT: "tight"
@@ -14253,12 +14351,11 @@ class GridCol extends XmlComponent {
14253
14351
  }
14254
14352
  const TableCellMarginElementType = {
14255
14353
  TABLE: "w:tblCellMar",
14256
- // eslint-disable-next-line @typescript-eslint/naming-convention
14257
14354
  TABLE_CELL: "w:tcMar"
14258
14355
  };
14259
14356
  class TableCellMargin extends IgnoreIfEmptyXmlComponent {
14260
- constructor(type, { marginUnitType = WidthType.DXA, top, left, bottom, right }) {
14261
- super(type);
14357
+ constructor(type2, { marginUnitType = WidthType.DXA, top, left, bottom, right }) {
14358
+ super(type2);
14262
14359
  if (top !== void 0) {
14263
14360
  this.root.push(new TableWidthElement("w:top", { type: marginUnitType, size: top }));
14264
14361
  }
@@ -14284,15 +14381,15 @@ const WidthType = {
14284
14381
  PERCENTAGE: "pct"
14285
14382
  };
14286
14383
  class TableWidthElement extends XmlComponent {
14287
- constructor(name, { type = WidthType.AUTO, size }) {
14384
+ constructor(name, { type: type2 = WidthType.AUTO, size }) {
14288
14385
  super(name);
14289
14386
  let tableWidthValue = size;
14290
- if (type === WidthType.PERCENTAGE && typeof size === "number") {
14387
+ if (type2 === WidthType.PERCENTAGE && typeof size === "number") {
14291
14388
  tableWidthValue = `${size}%`;
14292
14389
  }
14293
14390
  this.root.push(
14294
14391
  new NextAttributeComponent({
14295
- type: { key: "w:type", value: type },
14392
+ type: { key: "w:type", value: type2 },
14296
14393
  size: { key: "w:w", value: measurementOrPercentValue(tableWidthValue) }
14297
14394
  })
14298
14395
  );
@@ -14364,11 +14461,8 @@ class VerticalMerge extends XmlComponent {
14364
14461
  }
14365
14462
  }
14366
14463
  const TextDirection = {
14367
- // eslint-disable-next-line @typescript-eslint/naming-convention
14368
14464
  BOTTOM_TO_TOP_LEFT_TO_RIGHT: "btLr",
14369
- // eslint-disable-next-line @typescript-eslint/naming-convention
14370
14465
  LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb",
14371
- // eslint-disable-next-line @typescript-eslint/naming-convention
14372
14466
  TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl"
14373
14467
  };
14374
14468
  class TDirectionAttributes extends XmlAttributeComponent {
@@ -14586,9 +14680,9 @@ class TableLayoutAttributes extends XmlAttributeComponent {
14586
14680
  }
14587
14681
  }
14588
14682
  class TableLayout extends XmlComponent {
14589
- constructor(type) {
14683
+ constructor(type2) {
14590
14684
  super("w:tblLayout");
14591
- this.root.push(new TableLayoutAttributes({ type }));
14685
+ this.root.push(new TableLayoutAttributes({ type: type2 }));
14592
14686
  }
14593
14687
  }
14594
14688
  class TableProperties extends IgnoreIfEmptyXmlComponent {
@@ -14995,67 +15089,226 @@ class CustomProperties extends XmlComponent {
14995
15089
  this.properties.push(new CustomProperty(this.nextId++, property));
14996
15090
  }
14997
15091
  }
14998
- class FooterAttributes extends XmlAttributeComponent {
14999
- constructor() {
15000
- super(...arguments);
15001
- __publicField(this, "xmlKeys", {
15002
- wpc: "xmlns:wpc",
15003
- mc: "xmlns:mc",
15004
- o: "xmlns:o",
15005
- r: "xmlns:r",
15006
- m: "xmlns:m",
15007
- v: "xmlns:v",
15008
- wp14: "xmlns:wp14",
15009
- wp: "xmlns:wp",
15010
- w10: "xmlns:w10",
15011
- w: "xmlns:w",
15012
- w14: "xmlns:w14",
15013
- w15: "xmlns:w15",
15014
- wpg: "xmlns:wpg",
15015
- wpi: "xmlns:wpi",
15016
- wne: "xmlns:wne",
15017
- wps: "xmlns:wps",
15018
- cp: "xmlns:cp",
15019
- dc: "xmlns:dc",
15020
- dcterms: "xmlns:dcterms",
15021
- dcmitype: "xmlns:dcmitype",
15022
- xsi: "xmlns:xsi",
15023
- type: "xsi:type"
15024
- });
15025
- }
15026
- }
15027
- let Footer$1 = class Footer extends InitializableXmlComponent {
15028
- constructor(referenceNumber, initContent) {
15029
- super("w:ftr", initContent);
15030
- __publicField(this, "refId");
15031
- this.refId = referenceNumber;
15032
- if (!initContent) {
15033
- this.root.push(
15034
- new FooterAttributes({
15035
- wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
15036
- mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
15037
- o: "urn:schemas-microsoft-com:office:office",
15038
- r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
15039
- m: "http://schemas.openxmlformats.org/officeDocument/2006/math",
15040
- v: "urn:schemas-microsoft-com:vml",
15041
- wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
15042
- wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
15043
- w10: "urn:schemas-microsoft-com:office:word",
15044
- w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
15045
- w14: "http://schemas.microsoft.com/office/word/2010/wordml",
15046
- w15: "http://schemas.microsoft.com/office/word/2012/wordml",
15047
- wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
15048
- wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
15049
- wne: "http://schemas.microsoft.com/office/word/2006/wordml",
15050
- wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
15051
- })
15052
- );
15053
- }
15054
- }
15055
- get ReferenceId() {
15056
- return this.refId;
15057
- }
15058
- add(item) {
15092
+ const CharacterSet = {
15093
+ ANSI: "00",
15094
+ DEFAULT: "01",
15095
+ SYMBOL: "02",
15096
+ MAC: "4D",
15097
+ JIS: "80",
15098
+ HANGUL: "81",
15099
+ JOHAB: "82",
15100
+ GB_2312: "86",
15101
+ CHINESEBIG5: "88",
15102
+ GREEK: "A1",
15103
+ TURKISH: "A2",
15104
+ VIETNAMESE: "A3",
15105
+ HEBREW: "B1",
15106
+ ARABIC: "B2",
15107
+ BALTIC: "BA",
15108
+ RUSSIAN: "CC",
15109
+ THAI: "DE",
15110
+ EASTEUROPE: "EE",
15111
+ OEM: "FF"
15112
+ };
15113
+ const createFontRelationship = ({ id, fontKey, subsetted }, name) => new BuilderElement({
15114
+ name,
15115
+ attributes: __spreadValues({
15116
+ id: { key: "r:id", value: id }
15117
+ }, fontKey ? { fontKey: { key: "w:fontKey", value: `{${fontKey}}` } } : {}),
15118
+ children: [...subsetted ? [new OnOffElement("w:subsetted", subsetted)] : []]
15119
+ });
15120
+ const createFont = ({
15121
+ name,
15122
+ altName,
15123
+ panose1,
15124
+ charset,
15125
+ family,
15126
+ notTrueType,
15127
+ pitch,
15128
+ sig,
15129
+ embedRegular,
15130
+ embedBold,
15131
+ embedItalic,
15132
+ embedBoldItalic
15133
+ }) => (
15134
+ // http://www.datypic.com/sc/ooxml/e-w_font-1.html
15135
+ new BuilderElement({
15136
+ name: "w:font",
15137
+ attributes: {
15138
+ name: { key: "w:name", value: name }
15139
+ },
15140
+ children: [
15141
+ // http://www.datypic.com/sc/ooxml/e-w_altName-1.html
15142
+ ...altName ? [createStringElement("w:altName", altName)] : [],
15143
+ // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html
15144
+ ...panose1 ? [createStringElement("w:panose1", panose1)] : [],
15145
+ // http://www.datypic.com/sc/ooxml/e-w_charset-1.html
15146
+ ...charset ? [createStringElement("w:charset", charset)] : [],
15147
+ // http://www.datypic.com/sc/ooxml/e-w_family-1.html
15148
+ ...family ? [createStringElement("w:family", family)] : [],
15149
+ // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html
15150
+ ...notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : [],
15151
+ ...pitch ? [createStringElement("w:pitch", pitch)] : [],
15152
+ // http://www.datypic.com/sc/ooxml/e-w_sig-1.html
15153
+ ...sig ? [
15154
+ new BuilderElement({
15155
+ name: "w:sig",
15156
+ attributes: {
15157
+ usb0: { key: "w:usb0", value: sig.usb0 },
15158
+ usb1: { key: "w:usb1", value: sig.usb1 },
15159
+ usb2: { key: "w:usb2", value: sig.usb2 },
15160
+ usb3: { key: "w:usb3", value: sig.usb3 },
15161
+ csb0: { key: "w:csb0", value: sig.csb0 },
15162
+ csb1: { key: "w:csb1", value: sig.csb1 }
15163
+ }
15164
+ })
15165
+ ] : [],
15166
+ // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html
15167
+ ...embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : [],
15168
+ // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html
15169
+ ...embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : [],
15170
+ // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html
15171
+ ...embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : [],
15172
+ // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html
15173
+ ...embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : []
15174
+ ]
15175
+ })
15176
+ );
15177
+ const createRegularFont = ({
15178
+ name,
15179
+ index,
15180
+ fontKey,
15181
+ characterSet
15182
+ }) => createFont({
15183
+ name,
15184
+ sig: {
15185
+ usb0: "E0002AFF",
15186
+ usb1: "C000247B",
15187
+ usb2: "00000009",
15188
+ usb3: "00000000",
15189
+ csb0: "000001FF",
15190
+ csb1: "00000000"
15191
+ },
15192
+ charset: characterSet,
15193
+ family: "auto",
15194
+ pitch: "variable",
15195
+ embedRegular: {
15196
+ fontKey,
15197
+ id: `rId${index}`
15198
+ }
15199
+ });
15200
+ const createFontTable = (fonts) => (
15201
+ // https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_Font_topic_ID0ERNCU.html
15202
+ // http://www.datypic.com/sc/ooxml/e-w_fonts.html
15203
+ new BuilderElement({
15204
+ name: "w:fonts",
15205
+ attributes: {
15206
+ mc: { key: "xmlns:mc", value: "http://schemas.openxmlformats.org/markup-compatibility/2006" },
15207
+ r: { key: "xmlns:r", value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships" },
15208
+ w: { key: "xmlns:w", value: "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
15209
+ w14: { key: "xmlns:w14", value: "http://schemas.microsoft.com/office/word/2010/wordml" },
15210
+ w15: { key: "xmlns:w15", value: "http://schemas.microsoft.com/office/word/2012/wordml" },
15211
+ w16cex: { key: "xmlns:w16cex", value: "http://schemas.microsoft.com/office/word/2018/wordml/cex" },
15212
+ w16cid: { key: "xmlns:w16cid", value: "http://schemas.microsoft.com/office/word/2016/wordml/cid" },
15213
+ w16: { key: "xmlns:w16", value: "http://schemas.microsoft.com/office/word/2018/wordml" },
15214
+ w16sdtdh: { key: "xmlns:w16sdtdh", value: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" },
15215
+ w16se: { key: "xmlns:w16se", value: "http://schemas.microsoft.com/office/word/2015/wordml/symex" },
15216
+ Ignorable: { key: "mc:Ignorable", value: "w14 w15 w16se w16cid w16 w16cex w16sdtdh" }
15217
+ },
15218
+ children: fonts.map(
15219
+ (font, i) => createRegularFont({
15220
+ name: font.name,
15221
+ index: i + 1,
15222
+ fontKey: font.fontKey
15223
+ })
15224
+ )
15225
+ })
15226
+ );
15227
+ class FontWrapper {
15228
+ constructor(options2) {
15229
+ __publicField(this, "fontTable");
15230
+ __publicField(this, "relationships");
15231
+ __publicField(this, "fontOptionsWithKey", []);
15232
+ this.options = options2;
15233
+ this.fontOptionsWithKey = options2.map((o) => __spreadProps(__spreadValues({}, o), { fontKey: uniqueUuid() }));
15234
+ this.fontTable = createFontTable(this.fontOptionsWithKey);
15235
+ this.relationships = new Relationships();
15236
+ for (let i = 0; i < options2.length; i++) {
15237
+ this.relationships.createRelationship(
15238
+ i + 1,
15239
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",
15240
+ `fonts/${options2[i].name}.odttf`
15241
+ );
15242
+ }
15243
+ }
15244
+ get View() {
15245
+ return this.fontTable;
15246
+ }
15247
+ get Relationships() {
15248
+ return this.relationships;
15249
+ }
15250
+ }
15251
+ class FooterAttributes extends XmlAttributeComponent {
15252
+ constructor() {
15253
+ super(...arguments);
15254
+ __publicField(this, "xmlKeys", {
15255
+ wpc: "xmlns:wpc",
15256
+ mc: "xmlns:mc",
15257
+ o: "xmlns:o",
15258
+ r: "xmlns:r",
15259
+ m: "xmlns:m",
15260
+ v: "xmlns:v",
15261
+ wp14: "xmlns:wp14",
15262
+ wp: "xmlns:wp",
15263
+ w10: "xmlns:w10",
15264
+ w: "xmlns:w",
15265
+ w14: "xmlns:w14",
15266
+ w15: "xmlns:w15",
15267
+ wpg: "xmlns:wpg",
15268
+ wpi: "xmlns:wpi",
15269
+ wne: "xmlns:wne",
15270
+ wps: "xmlns:wps",
15271
+ cp: "xmlns:cp",
15272
+ dc: "xmlns:dc",
15273
+ dcterms: "xmlns:dcterms",
15274
+ dcmitype: "xmlns:dcmitype",
15275
+ xsi: "xmlns:xsi",
15276
+ type: "xsi:type"
15277
+ });
15278
+ }
15279
+ }
15280
+ let Footer$1 = class Footer extends InitializableXmlComponent {
15281
+ constructor(referenceNumber, initContent) {
15282
+ super("w:ftr", initContent);
15283
+ __publicField(this, "refId");
15284
+ this.refId = referenceNumber;
15285
+ if (!initContent) {
15286
+ this.root.push(
15287
+ new FooterAttributes({
15288
+ wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
15289
+ mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
15290
+ o: "urn:schemas-microsoft-com:office:office",
15291
+ r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
15292
+ m: "http://schemas.openxmlformats.org/officeDocument/2006/math",
15293
+ v: "urn:schemas-microsoft-com:vml",
15294
+ wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
15295
+ wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
15296
+ w10: "urn:schemas-microsoft-com:office:word",
15297
+ w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
15298
+ w14: "http://schemas.microsoft.com/office/word/2010/wordml",
15299
+ w15: "http://schemas.microsoft.com/office/word/2012/wordml",
15300
+ wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
15301
+ wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
15302
+ wne: "http://schemas.microsoft.com/office/word/2006/wordml",
15303
+ wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
15304
+ })
15305
+ );
15306
+ }
15307
+ }
15308
+ get ReferenceId() {
15309
+ return this.refId;
15310
+ }
15311
+ add(item) {
15059
15312
  this.root.push(item);
15060
15313
  }
15061
15314
  };
@@ -15107,7 +15360,6 @@ class FootnoteRefRun extends Run {
15107
15360
  }
15108
15361
  const FootnoteType = {
15109
15362
  SEPERATOR: "separator",
15110
- // eslint-disable-next-line @typescript-eslint/naming-convention
15111
15363
  CONTINUATION_SEPERATOR: "continuationSeparator"
15112
15364
  };
15113
15365
  class Footnote extends XmlComponent {
@@ -16100,7 +16352,7 @@ class SettingsAttributes extends XmlAttributeComponent {
16100
16352
  }
16101
16353
  class Settings extends XmlComponent {
16102
16354
  constructor(options2) {
16103
- var _a, _b, _c, _d;
16355
+ var _a, _b, _c, _d, _e, _f, _g, _h;
16104
16356
  super("w:settings");
16105
16357
  this.root.push(
16106
16358
  new SettingsAttributes({
@@ -16136,9 +16388,21 @@ class Settings extends XmlComponent {
16136
16388
  if (options2.defaultTabStop !== void 0) {
16137
16389
  this.root.push(new NumberValueElement("w:defaultTabStop", options2.defaultTabStop));
16138
16390
  }
16391
+ if (((_a = options2.hyphenation) == null ? void 0 : _a.autoHyphenation) !== void 0) {
16392
+ this.root.push(new OnOffElement("w:autoHyphenation", options2.hyphenation.autoHyphenation));
16393
+ }
16394
+ if (((_b = options2.hyphenation) == null ? void 0 : _b.hyphenationZone) !== void 0) {
16395
+ this.root.push(new NumberValueElement("w:hyphenationZone", options2.hyphenation.hyphenationZone));
16396
+ }
16397
+ if (((_c = options2.hyphenation) == null ? void 0 : _c.consecutiveHyphenLimit) !== void 0) {
16398
+ this.root.push(new NumberValueElement("w:consecutiveHyphenLimit", options2.hyphenation.consecutiveHyphenLimit));
16399
+ }
16400
+ if (((_d = options2.hyphenation) == null ? void 0 : _d.doNotHyphenateCaps) !== void 0) {
16401
+ this.root.push(new OnOffElement("w:doNotHyphenateCaps", options2.hyphenation.doNotHyphenateCaps));
16402
+ }
16139
16403
  this.root.push(
16140
- new Compatibility(__spreadProps(__spreadValues({}, (_a = options2.compatibility) != null ? _a : {}), {
16141
- version: (_d = (_c = (_b = options2.compatibility) == null ? void 0 : _b.version) != null ? _c : options2.compatibilityModeVersion) != null ? _d : 15
16404
+ new Compatibility(__spreadProps(__spreadValues({}, (_e = options2.compatibility) != null ? _e : {}), {
16405
+ version: (_h = (_g = (_f = options2.compatibility) == null ? void 0 : _f.version) != null ? _g : options2.compatibilityModeVersion) != null ? _h : 15
16142
16406
  }))
16143
16407
  );
16144
16408
  }
@@ -16483,212 +16747,53 @@ class DefaultStylesFactory {
16483
16747
  run: {
16484
16748
  size: 56
16485
16749
  }
16486
- }, options2.title)),
16487
- new Heading1Style(__spreadValues({
16488
- run: {
16489
- color: "2E74B5",
16490
- size: 32
16491
- }
16492
- }, options2.heading1)),
16493
- new Heading2Style(__spreadValues({
16494
- run: {
16495
- color: "2E74B5",
16496
- size: 26
16497
- }
16498
- }, options2.heading2)),
16499
- new Heading3Style(__spreadValues({
16500
- run: {
16501
- color: "1F4D78",
16502
- size: 24
16503
- }
16504
- }, options2.heading3)),
16505
- new Heading4Style(__spreadValues({
16506
- run: {
16507
- color: "2E74B5",
16508
- italics: true
16509
- }
16510
- }, options2.heading4)),
16511
- new Heading5Style(__spreadValues({
16512
- run: {
16513
- color: "2E74B5"
16514
- }
16515
- }, options2.heading5)),
16516
- new Heading6Style(__spreadValues({
16517
- run: {
16518
- color: "1F4D78"
16519
- }
16520
- }, options2.heading6)),
16521
- new StrongStyle(__spreadValues({
16522
- run: {
16523
- bold: true
16524
- }
16525
- }, options2.strong)),
16526
- new ListParagraph(options2.listParagraph || {}),
16527
- new HyperlinkStyle(options2.hyperlink || {}),
16528
- new FootnoteReferenceStyle(options2.footnoteReference || {}),
16529
- new FootnoteText(options2.footnoteText || {}),
16530
- new FootnoteTextChar(options2.footnoteTextChar || {})
16531
- ]
16532
- };
16533
- }
16534
- }
16535
- const CharacterSet = {
16536
- ANSI: "00",
16537
- DEFAULT: "01",
16538
- SYMBOL: "02",
16539
- MAC: "4D",
16540
- JIS: "80",
16541
- HANGUL: "81",
16542
- JOHAB: "82",
16543
- GB_2312: "86",
16544
- CHINESEBIG5: "88",
16545
- GREEK: "A1",
16546
- TURKISH: "A2",
16547
- VIETNAMESE: "A3",
16548
- HEBREW: "B1",
16549
- ARABIC: "B2",
16550
- BALTIC: "BA",
16551
- RUSSIAN: "CC",
16552
- THAI: "DE",
16553
- EASTEUROPE: "EE",
16554
- OEM: "FF"
16555
- };
16556
- const createFontRelationship = ({ id, fontKey, subsetted }, name) => new BuilderElement({
16557
- name,
16558
- attributes: __spreadValues({
16559
- id: { key: "r:id", value: id }
16560
- }, fontKey ? { fontKey: { key: "w:fontKey", value: `{${fontKey}}` } } : {}),
16561
- children: [...subsetted ? [new OnOffElement("w:subsetted", subsetted)] : []]
16562
- });
16563
- const createFont = ({
16564
- name,
16565
- altName,
16566
- panose1,
16567
- charset,
16568
- family,
16569
- notTrueType,
16570
- pitch,
16571
- sig,
16572
- embedRegular,
16573
- embedBold,
16574
- embedItalic,
16575
- embedBoldItalic
16576
- }) => (
16577
- // http://www.datypic.com/sc/ooxml/e-w_font-1.html
16578
- new BuilderElement({
16579
- name: "w:font",
16580
- attributes: {
16581
- name: { key: "w:name", value: name }
16582
- },
16583
- children: [
16584
- // http://www.datypic.com/sc/ooxml/e-w_altName-1.html
16585
- ...altName ? [createStringElement("w:altName", altName)] : [],
16586
- // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html
16587
- ...panose1 ? [createStringElement("w:panose1", panose1)] : [],
16588
- // http://www.datypic.com/sc/ooxml/e-w_charset-1.html
16589
- ...charset ? [createStringElement("w:charset", charset)] : [],
16590
- // http://www.datypic.com/sc/ooxml/e-w_family-1.html
16591
- ...family ? [createStringElement("w:family", family)] : [],
16592
- // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html
16593
- ...notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : [],
16594
- ...pitch ? [createStringElement("w:pitch", pitch)] : [],
16595
- // http://www.datypic.com/sc/ooxml/e-w_sig-1.html
16596
- ...sig ? [
16597
- new BuilderElement({
16598
- name: "w:sig",
16599
- attributes: {
16600
- usb0: { key: "w:usb0", value: sig.usb0 },
16601
- usb1: { key: "w:usb1", value: sig.usb1 },
16602
- usb2: { key: "w:usb2", value: sig.usb2 },
16603
- usb3: { key: "w:usb3", value: sig.usb3 },
16604
- csb0: { key: "w:csb0", value: sig.csb0 },
16605
- csb1: { key: "w:csb1", value: sig.csb1 }
16606
- }
16607
- })
16608
- ] : [],
16609
- // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html
16610
- ...embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : [],
16611
- // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html
16612
- ...embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : [],
16613
- // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html
16614
- ...embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : [],
16615
- // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html
16616
- ...embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : []
16617
- ]
16618
- })
16619
- );
16620
- const createRegularFont = ({
16621
- name,
16622
- index,
16623
- fontKey,
16624
- characterSet
16625
- }) => createFont({
16626
- name,
16627
- sig: {
16628
- usb0: "E0002AFF",
16629
- usb1: "C000247B",
16630
- usb2: "00000009",
16631
- usb3: "00000000",
16632
- csb0: "000001FF",
16633
- csb1: "00000000"
16634
- },
16635
- charset: characterSet,
16636
- family: "auto",
16637
- pitch: "variable",
16638
- embedRegular: {
16639
- fontKey,
16640
- id: `rId${index}`
16641
- }
16642
- });
16643
- const createFontTable = (fonts) => (
16644
- // https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_Font_topic_ID0ERNCU.html
16645
- // http://www.datypic.com/sc/ooxml/e-w_fonts.html
16646
- new BuilderElement({
16647
- name: "w:fonts",
16648
- attributes: {
16649
- mc: { key: "xmlns:mc", value: "http://schemas.openxmlformats.org/markup-compatibility/2006" },
16650
- r: { key: "xmlns:r", value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships" },
16651
- w: { key: "xmlns:w", value: "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
16652
- w14: { key: "xmlns:w14", value: "http://schemas.microsoft.com/office/word/2010/wordml" },
16653
- w15: { key: "xmlns:w15", value: "http://schemas.microsoft.com/office/word/2012/wordml" },
16654
- w16cex: { key: "xmlns:w16cex", value: "http://schemas.microsoft.com/office/word/2018/wordml/cex" },
16655
- w16cid: { key: "xmlns:w16cid", value: "http://schemas.microsoft.com/office/word/2016/wordml/cid" },
16656
- w16: { key: "xmlns:w16", value: "http://schemas.microsoft.com/office/word/2018/wordml" },
16657
- w16sdtdh: { key: "xmlns:w16sdtdh", value: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" },
16658
- w16se: { key: "xmlns:w16se", value: "http://schemas.microsoft.com/office/word/2015/wordml/symex" },
16659
- Ignorable: { key: "mc:Ignorable", value: "w14 w15 w16se w16cid w16 w16cex w16sdtdh" }
16660
- },
16661
- children: fonts.map(
16662
- (font, i) => createRegularFont({
16663
- name: font.name,
16664
- index: i + 1,
16665
- fontKey: font.fontKey
16666
- })
16667
- )
16668
- })
16669
- );
16670
- class FontWrapper {
16671
- constructor(options2) {
16672
- __publicField(this, "fontTable");
16673
- __publicField(this, "relationships");
16674
- __publicField(this, "fontOptionsWithKey", []);
16675
- this.options = options2;
16676
- this.fontOptionsWithKey = options2.map((o) => __spreadProps(__spreadValues({}, o), { fontKey: uniqueUuid() }));
16677
- this.fontTable = createFontTable(this.fontOptionsWithKey);
16678
- this.relationships = new Relationships();
16679
- for (let i = 0; i < options2.length; i++) {
16680
- this.relationships.createRelationship(
16681
- i + 1,
16682
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",
16683
- `fonts/${options2[i].name}.odttf`
16684
- );
16685
- }
16686
- }
16687
- get View() {
16688
- return this.fontTable;
16689
- }
16690
- get Relationships() {
16691
- return this.relationships;
16750
+ }, options2.title)),
16751
+ new Heading1Style(__spreadValues({
16752
+ run: {
16753
+ color: "2E74B5",
16754
+ size: 32
16755
+ }
16756
+ }, options2.heading1)),
16757
+ new Heading2Style(__spreadValues({
16758
+ run: {
16759
+ color: "2E74B5",
16760
+ size: 26
16761
+ }
16762
+ }, options2.heading2)),
16763
+ new Heading3Style(__spreadValues({
16764
+ run: {
16765
+ color: "1F4D78",
16766
+ size: 24
16767
+ }
16768
+ }, options2.heading3)),
16769
+ new Heading4Style(__spreadValues({
16770
+ run: {
16771
+ color: "2E74B5",
16772
+ italics: true
16773
+ }
16774
+ }, options2.heading4)),
16775
+ new Heading5Style(__spreadValues({
16776
+ run: {
16777
+ color: "2E74B5"
16778
+ }
16779
+ }, options2.heading5)),
16780
+ new Heading6Style(__spreadValues({
16781
+ run: {
16782
+ color: "1F4D78"
16783
+ }
16784
+ }, options2.heading6)),
16785
+ new StrongStyle(__spreadValues({
16786
+ run: {
16787
+ bold: true
16788
+ }
16789
+ }, options2.strong)),
16790
+ new ListParagraph(options2.listParagraph || {}),
16791
+ new HyperlinkStyle(options2.hyperlink || {}),
16792
+ new FootnoteReferenceStyle(options2.footnoteReference || {}),
16793
+ new FootnoteText(options2.footnoteText || {}),
16794
+ new FootnoteTextChar(options2.footnoteTextChar || {})
16795
+ ]
16796
+ };
16692
16797
  }
16693
16798
  }
16694
16799
  class File {
@@ -16712,7 +16817,7 @@ class File {
16712
16817
  __publicField(this, "styles");
16713
16818
  __publicField(this, "comments");
16714
16819
  __publicField(this, "fontWrapper");
16715
- var _a, _b, _c, _d, _e, _f, _g, _h;
16820
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
16716
16821
  this.coreProperties = new CoreProperties(__spreadProps(__spreadValues({}, options2), {
16717
16822
  creator: (_a = options2.creator) != null ? _a : "Un-named",
16718
16823
  revision: (_b = options2.revision) != null ? _b : 1,
@@ -16732,7 +16837,13 @@ class File {
16732
16837
  evenAndOddHeaders: options2.evenAndOddHeaderAndFooters ? true : false,
16733
16838
  trackRevisions: (_f = options2.features) == null ? void 0 : _f.trackRevisions,
16734
16839
  updateFields: (_g = options2.features) == null ? void 0 : _g.updateFields,
16735
- defaultTabStop: options2.defaultTabStop
16840
+ defaultTabStop: options2.defaultTabStop,
16841
+ hyphenation: {
16842
+ autoHyphenation: (_h = options2.hyphenation) == null ? void 0 : _h.autoHyphenation,
16843
+ hyphenationZone: (_i = options2.hyphenation) == null ? void 0 : _i.hyphenationZone,
16844
+ consecutiveHyphenLimit: (_j = options2.hyphenation) == null ? void 0 : _j.consecutiveHyphenLimit,
16845
+ doNotHyphenateCaps: (_k = options2.hyphenation) == null ? void 0 : _k.doNotHyphenateCaps
16846
+ }
16736
16847
  });
16737
16848
  this.media = new Media();
16738
16849
  if (options2.externalStyles !== void 0) {
@@ -16755,7 +16866,7 @@ class File {
16755
16866
  this.footnotesWrapper.View.createFootNote(parseFloat(key), options2.footnotes[key].children);
16756
16867
  }
16757
16868
  }
16758
- this.fontWrapper = new FontWrapper((_h = options2.fonts) != null ? _h : []);
16869
+ this.fontWrapper = new FontWrapper((_l = options2.fonts) != null ? _l : []);
16759
16870
  }
16760
16871
  addSection({ headers = {}, footers = {}, children, properties }) {
16761
16872
  this.documentWrapper.View.Body.addSection(__spreadProps(__spreadValues({}, properties), {
@@ -16790,8 +16901,8 @@ class File {
16790
16901
  this.addFooterToDocument(wrapper);
16791
16902
  return wrapper;
16792
16903
  }
16793
- addHeaderToDocument(header, type = HeaderFooterReferenceType.DEFAULT) {
16794
- this.headers.push({ header, type });
16904
+ addHeaderToDocument(header, type2 = HeaderFooterReferenceType.DEFAULT) {
16905
+ this.headers.push({ header, type: type2 });
16795
16906
  this.documentWrapper.Relationships.createRelationship(
16796
16907
  header.View.ReferenceId,
16797
16908
  "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",
@@ -16799,8 +16910,8 @@ class File {
16799
16910
  );
16800
16911
  this.contentTypes.addHeader(this.headers.length);
16801
16912
  }
16802
- addFooterToDocument(footer, type = HeaderFooterReferenceType.DEFAULT) {
16803
- this.footers.push({ footer, type });
16913
+ addFooterToDocument(footer, type2 = HeaderFooterReferenceType.DEFAULT) {
16914
+ this.footers.push({ footer, type: type2 });
16804
16915
  this.documentWrapper.Relationships.createRelationship(
16805
16916
  footer.View.ReferenceId,
16806
16917
  "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",
@@ -17217,6 +17328,98 @@ class CheckBox extends XmlComponent {
17217
17328
  this.root.push(content);
17218
17329
  }
17219
17330
  }
17331
+ const createPictElement = ({ shape }) => new BuilderElement({
17332
+ name: "w:pict",
17333
+ children: [shape]
17334
+ });
17335
+ const createTextboxContent = ({ children = [] }) => new BuilderElement({
17336
+ name: "w:txbxContent",
17337
+ children
17338
+ });
17339
+ const createVmlTextbox = ({ style, children, inset }) => new BuilderElement({
17340
+ name: "v:textbox",
17341
+ attributes: {
17342
+ style: {
17343
+ key: "style",
17344
+ value: style
17345
+ },
17346
+ insetMode: {
17347
+ key: "insetmode",
17348
+ value: inset ? "custom" : "auto"
17349
+ },
17350
+ inset: {
17351
+ key: "inset",
17352
+ value: inset ? `${inset.left}, ${inset.top}, ${inset.right}, ${inset.bottom}` : void 0
17353
+ }
17354
+ },
17355
+ children: [createTextboxContent({ children })]
17356
+ });
17357
+ const SHAPE_TYPE = "#_x0000_t202";
17358
+ const styleToKeyMap = {
17359
+ flip: "flip",
17360
+ height: "height",
17361
+ left: "left",
17362
+ marginBottom: "margin-bottom",
17363
+ marginLeft: "margin-left",
17364
+ marginRight: "margin-right",
17365
+ marginTop: "margin-top",
17366
+ positionHorizontal: "mso-position-horizontal",
17367
+ positionHorizontalRelative: "mso-position-horizontal-relative",
17368
+ positionVertical: "mso-position-vertical",
17369
+ positionVerticalRelative: "mso-position-vertical-relative",
17370
+ wrapDistanceBottom: "mso-wrap-distance-bottom",
17371
+ wrapDistanceLeft: "mso-wrap-distance-left",
17372
+ wrapDistanceRight: "mso-wrap-distance-right",
17373
+ wrapDistanceTop: "mso-wrap-distance-top",
17374
+ wrapEdited: "mso-wrap-edited",
17375
+ wrapStyle: "mso-wrap-style",
17376
+ position: "position",
17377
+ rotation: "rotation",
17378
+ top: "top",
17379
+ visibility: "visibility",
17380
+ width: "width",
17381
+ zIndex: "z-index"
17382
+ };
17383
+ const formatShapeStyle = (style) => style ? Object.entries(style).map(([key, value]) => `${styleToKeyMap[key]}:${value}`).join(";") : void 0;
17384
+ const createShape = ({
17385
+ id,
17386
+ children,
17387
+ type: type2 = SHAPE_TYPE,
17388
+ style
17389
+ }) => new BuilderElement({
17390
+ name: "v:shape",
17391
+ attributes: {
17392
+ id: {
17393
+ key: "id",
17394
+ value: id
17395
+ },
17396
+ type: {
17397
+ key: "type",
17398
+ value: type2
17399
+ },
17400
+ style: {
17401
+ key: "style",
17402
+ value: formatShapeStyle(style)
17403
+ }
17404
+ },
17405
+ children: [createVmlTextbox({ style: "mso-fit-shape-to-text:t;", children })]
17406
+ });
17407
+ class Textbox extends FileChild {
17408
+ constructor(_a) {
17409
+ var _b = _a, { style, children } = _b, rest = __objRest(_b, ["style", "children"]);
17410
+ super("w:p");
17411
+ this.root.push(new ParagraphProperties(rest));
17412
+ this.root.push(
17413
+ createPictElement({
17414
+ shape: createShape({
17415
+ children,
17416
+ id: uniqueId(),
17417
+ style
17418
+ })
17419
+ })
17420
+ );
17421
+ }
17422
+ }
17220
17423
  function commonjsRequire(path) {
17221
17424
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
17222
17425
  }
@@ -19789,7 +19992,6 @@ const obfuscate = (buf, fontKey) => {
19789
19992
  return out;
19790
19993
  };
19791
19994
  class Formatter {
19792
- // tslint:disable-next-line: no-object-literal-type-assertion
19793
19995
  format(input, context = { stack: [] }) {
19794
19996
  const output = input.prepForXml(context);
19795
19997
  if (output) {
@@ -19886,6 +20088,11 @@ class Compiler {
19886
20088
  `media/${mediaData.fileName}`
19887
20089
  );
19888
20090
  });
20091
+ file.Document.Relationships.createRelationship(
20092
+ file.Document.Relationships.RelationshipCount + 1,
20093
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",
20094
+ "fontTable.xml"
20095
+ );
19889
20096
  return xml$1(
19890
20097
  this.formatter.format(file.Document.Relationships, {
19891
20098
  viewWrapper: file.Document,
@@ -20259,7 +20466,6 @@ const PrettifyType = {
20259
20466
  NONE: "",
20260
20467
  WITH_2_BLANKS: " ",
20261
20468
  WITH_4_BLANKS: " ",
20262
- // eslint-disable-next-line @typescript-eslint/naming-convention
20263
20469
  WITH_TAB: " "
20264
20470
  };
20265
20471
  const convertPrettifyType = (prettify) => prettify === true ? PrettifyType.WITH_2_BLANKS : prettify === false ? void 0 : prettify;
@@ -20342,6 +20548,94 @@ const getFirstLevelElements = (relationships, id) => {
20342
20548
  var _a, _b;
20343
20549
  return (_b = (_a = relationships.elements) == null ? void 0 : _a.filter((e) => e.name === id)[0].elements) != null ? _b : [];
20344
20550
  };
20551
+ const appendContentType = (element2, contentType, extension) => {
20552
+ const relationshipElements = getFirstLevelElements(element2, "Types");
20553
+ const exist = relationshipElements.some(
20554
+ (el) => {
20555
+ var _a, _b;
20556
+ 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;
20557
+ }
20558
+ );
20559
+ if (exist) {
20560
+ return;
20561
+ }
20562
+ relationshipElements.push({
20563
+ attributes: {
20564
+ ContentType: contentType,
20565
+ Extension: extension
20566
+ },
20567
+ name: "Default",
20568
+ type: "element"
20569
+ });
20570
+ };
20571
+ const getIdFromRelationshipId = (relationshipId) => {
20572
+ const output = parseInt(relationshipId.substring(3), 10);
20573
+ return isNaN(output) ? 0 : output;
20574
+ };
20575
+ const getNextRelationshipIndex = (relationships) => {
20576
+ const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20577
+ return relationshipElements.map((e) => {
20578
+ var _a, _b, _c;
20579
+ return getIdFromRelationshipId((_c = (_b = (_a = e.attributes) == null ? void 0 : _a.Id) == null ? void 0 : _b.toString()) != null ? _c : "");
20580
+ }).reduce((acc, curr) => Math.max(acc, curr), 0) + 1;
20581
+ };
20582
+ const appendRelationship = (relationships, id, type2, target, targetMode) => {
20583
+ const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20584
+ relationshipElements.push({
20585
+ attributes: {
20586
+ Id: `rId${id}`,
20587
+ Type: type2,
20588
+ Target: target,
20589
+ TargetMode: targetMode
20590
+ },
20591
+ name: "Relationship",
20592
+ type: "element"
20593
+ });
20594
+ return relationshipElements;
20595
+ };
20596
+ const findRunElementIndexWithToken = (paragraphElement, token) => {
20597
+ var _a, _b, _c, _d;
20598
+ for (let i = 0; i < ((_a = paragraphElement.elements) != null ? _a : []).length; i++) {
20599
+ const element2 = paragraphElement.elements[i];
20600
+ if (element2.type === "element" && element2.name === "w:r") {
20601
+ const textElement = ((_b = element2.elements) != null ? _b : []).filter((e) => e.type === "element" && e.name === "w:t");
20602
+ for (const text of textElement) {
20603
+ if (!((_c = text.elements) == null ? void 0 : _c[0])) {
20604
+ continue;
20605
+ }
20606
+ if ((_d = text.elements[0].text) == null ? void 0 : _d.includes(token)) {
20607
+ return i;
20608
+ }
20609
+ }
20610
+ }
20611
+ }
20612
+ throw new Error("Token not found");
20613
+ };
20614
+ const splitRunElement = (runElement, token) => {
20615
+ var _a, _b;
20616
+ let splitIndex = 0;
20617
+ const splitElements = (_b = (_a = runElement.elements) == null ? void 0 : _a.map((e, i) => {
20618
+ var _a2, _b2, _c;
20619
+ if (e.type === "element" && e.name === "w:t") {
20620
+ const text = (_c = (_b2 = (_a2 = e.elements) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.text) != null ? _c : "";
20621
+ const splitText = text.split(token);
20622
+ const newElements = splitText.map((t) => __spreadProps(__spreadValues(__spreadValues({}, e), patchSpaceAttribute(e)), {
20623
+ elements: createTextElementContents(t)
20624
+ }));
20625
+ splitIndex = i;
20626
+ return newElements;
20627
+ } else {
20628
+ return e;
20629
+ }
20630
+ }).flat()) != null ? _b : [];
20631
+ const leftRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20632
+ elements: splitElements.slice(0, splitIndex + 1)
20633
+ });
20634
+ const rightRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20635
+ elements: splitElements.slice(splitIndex + 1)
20636
+ });
20637
+ return { left: leftRunElement, right: rightRunElement };
20638
+ };
20345
20639
  const ReplaceMode = {
20346
20640
  START: 0,
20347
20641
  MIDDLE: 1,
@@ -20393,49 +20687,6 @@ const patchTextElement = (element2, text) => {
20393
20687
  element2.elements = createTextElementContents(text);
20394
20688
  return element2;
20395
20689
  };
20396
- const findRunElementIndexWithToken = (paragraphElement, token) => {
20397
- var _a, _b, _c, _d;
20398
- for (let i = 0; i < ((_a = paragraphElement.elements) != null ? _a : []).length; i++) {
20399
- const element2 = paragraphElement.elements[i];
20400
- if (element2.type === "element" && element2.name === "w:r") {
20401
- const textElement = ((_b = element2.elements) != null ? _b : []).filter((e) => e.type === "element" && e.name === "w:t");
20402
- for (const text of textElement) {
20403
- if (!((_c = text.elements) == null ? void 0 : _c[0])) {
20404
- continue;
20405
- }
20406
- if ((_d = text.elements[0].text) == null ? void 0 : _d.includes(token)) {
20407
- return i;
20408
- }
20409
- }
20410
- }
20411
- }
20412
- throw new Error("Token not found");
20413
- };
20414
- const splitRunElement = (runElement, token) => {
20415
- var _a, _b;
20416
- let splitIndex = 0;
20417
- const splitElements = (_b = (_a = runElement.elements) == null ? void 0 : _a.map((e, i) => {
20418
- var _a2, _b2, _c;
20419
- if (e.type === "element" && e.name === "w:t") {
20420
- const text = (_c = (_b2 = (_a2 = e.elements) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.text) != null ? _c : "";
20421
- const splitText = text.split(token);
20422
- const newElements = splitText.map((t) => __spreadProps(__spreadValues(__spreadValues({}, e), patchSpaceAttribute(e)), {
20423
- elements: createTextElementContents(t)
20424
- }));
20425
- splitIndex = i;
20426
- return newElements;
20427
- } else {
20428
- return e;
20429
- }
20430
- }).flat()) != null ? _b : [];
20431
- const leftRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20432
- elements: splitElements.slice(0, splitIndex + 1)
20433
- });
20434
- const rightRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20435
- elements: splitElements.slice(splitIndex + 1)
20436
- });
20437
- return { left: leftRunElement, right: rightRunElement };
20438
- };
20439
20690
  const renderParagraphNode = (node) => {
20440
20691
  if (node.element.name !== "w:p") {
20441
20692
  throw new Error(`Invalid node type: ${node.element.name}`);
@@ -20538,7 +20789,7 @@ const replacer = ({
20538
20789
  }) => {
20539
20790
  const renderedParagraphs = findLocationOfText(json, patchText);
20540
20791
  if (renderedParagraphs.length === 0) {
20541
- throw new Error(`Could not find text ${patchText}`);
20792
+ return { element: json, didFindOccurrence: false };
20542
20793
  }
20543
20794
  for (const renderedParagraph of renderedParagraphs) {
20544
20795
  const textJson = patch.children.map((c) => toJson(xml$1(formatter.format(c, context)))).map((c) => c.elements[0]);
@@ -20565,7 +20816,7 @@ const replacer = ({
20565
20816
  let patchedRightElement = right;
20566
20817
  if (keepOriginalStyles) {
20567
20818
  const runElementNonTextualElements = runElementToBeReplaced.elements.filter(
20568
- (e) => e.type === "element" && e.name !== "w:t" && e.name !== "w:br"
20819
+ (e) => e.type === "element" && e.name === "w:rPr"
20569
20820
  );
20570
20821
  newRunElements = textJson.map((e) => __spreadProps(__spreadValues({}, e), {
20571
20822
  elements: [...runElementNonTextualElements, ...e.elements]
@@ -20579,7 +20830,7 @@ const replacer = ({
20579
20830
  }
20580
20831
  }
20581
20832
  }
20582
- return json;
20833
+ return { element: json, didFindOccurrence: true };
20583
20834
  };
20584
20835
  const goToElementFromPath = (json, path) => {
20585
20836
  let element2 = json;
@@ -20592,51 +20843,6 @@ const goToElementFromPath = (json, path) => {
20592
20843
  };
20593
20844
  const goToParentElementFromPath = (json, path) => goToElementFromPath(json, path.slice(0, path.length - 1));
20594
20845
  const getLastElementIndexFromPath = (path) => path[path.length - 1];
20595
- const getIdFromRelationshipId = (relationshipId) => {
20596
- const output = parseInt(relationshipId.substring(3), 10);
20597
- return isNaN(output) ? 0 : output;
20598
- };
20599
- const getNextRelationshipIndex = (relationships) => {
20600
- const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20601
- return relationshipElements.map((e) => {
20602
- var _a, _b, _c;
20603
- return getIdFromRelationshipId((_c = (_b = (_a = e.attributes) == null ? void 0 : _a.Id) == null ? void 0 : _b.toString()) != null ? _c : "");
20604
- }).reduce((acc, curr) => Math.max(acc, curr), 0) + 1;
20605
- };
20606
- const appendRelationship = (relationships, id, type, target, targetMode) => {
20607
- const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20608
- relationshipElements.push({
20609
- attributes: {
20610
- Id: `rId${id}`,
20611
- Type: type,
20612
- Target: target,
20613
- TargetMode: targetMode
20614
- },
20615
- name: "Relationship",
20616
- type: "element"
20617
- });
20618
- return relationshipElements;
20619
- };
20620
- const appendContentType = (element2, contentType, extension) => {
20621
- const relationshipElements = getFirstLevelElements(element2, "Types");
20622
- const exist = relationshipElements.some(
20623
- (el) => {
20624
- var _a, _b;
20625
- 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;
20626
- }
20627
- );
20628
- if (exist) {
20629
- return;
20630
- }
20631
- relationshipElements.push({
20632
- attributes: {
20633
- ContentType: contentType,
20634
- Extension: extension
20635
- },
20636
- name: "Default",
20637
- type: "element"
20638
- });
20639
- };
20640
20846
  const PatchType = {
20641
20847
  DOCUMENT: "file",
20642
20848
  PARAGRAPH: "paragraph"
@@ -20687,32 +20893,31 @@ const patchDocument = (_0) => __async(void 0, [_0], function* ({
20687
20893
  for (const [patchKey, patchValue] of Object.entries(patches)) {
20688
20894
  const patchText = `{{${patchKey}}}`;
20689
20895
  while (true) {
20690
- try {
20691
- replacer({
20692
- json,
20693
- patch: __spreadProps(__spreadValues({}, patchValue), {
20694
- children: patchValue.children.map((element2) => {
20695
- if (element2 instanceof ExternalHyperlink) {
20696
- const concreteHyperlink = new ConcreteHyperlink(element2.options.children, uniqueId());
20697
- hyperlinkRelationshipAdditions.push({
20698
- key,
20699
- hyperlink: {
20700
- id: concreteHyperlink.linkId,
20701
- link: element2.options.link
20702
- }
20703
- });
20704
- return concreteHyperlink;
20705
- } else {
20706
- return element2;
20707
- }
20708
- })
20709
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
20710
- }),
20711
- patchText,
20712
- context,
20713
- keepOriginalStyles
20714
- });
20715
- } catch (e) {
20896
+ const { didFindOccurrence } = replacer({
20897
+ json,
20898
+ patch: __spreadProps(__spreadValues({}, patchValue), {
20899
+ children: patchValue.children.map((element2) => {
20900
+ if (element2 instanceof ExternalHyperlink) {
20901
+ const concreteHyperlink = new ConcreteHyperlink(element2.options.children, uniqueId());
20902
+ hyperlinkRelationshipAdditions.push({
20903
+ key,
20904
+ hyperlink: {
20905
+ id: concreteHyperlink.linkId,
20906
+ link: element2.options.link
20907
+ }
20908
+ });
20909
+ return concreteHyperlink;
20910
+ } else {
20911
+ return element2;
20912
+ }
20913
+ })
20914
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20915
+ }),
20916
+ patchText,
20917
+ context,
20918
+ keepOriginalStyles
20919
+ });
20920
+ if (!didFindOccurrence) {
20716
20921
  break;
20717
20922
  }
20718
20923
  }
@@ -21053,6 +21258,7 @@ export {
21053
21258
  TextRun,
21054
21259
  TextWrappingSide,
21055
21260
  TextWrappingType,
21261
+ Textbox,
21056
21262
  ThematicBreak,
21057
21263
  Type,
21058
21264
  Underline,