aws-local-stepfunctions 1.3.1 → 2.0.1

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.
@@ -26,24 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var __accessCheck = (obj, member, msg) => {
30
- if (!member.has(obj))
31
- throw TypeError("Cannot " + msg);
32
- };
33
- var __privateGet = (obj, member, getter) => {
34
- __accessCheck(obj, member, "read from private field");
35
- return getter ? getter.call(obj) : member.get(obj);
36
- };
37
- var __privateAdd = (obj, member, value) => {
38
- if (member.has(obj))
39
- throw TypeError("Cannot add the same private member more than once");
40
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
41
- };
42
- var __privateSet = (obj, member, value, setter) => {
43
- __accessCheck(obj, member, "write to private field");
44
- setter ? setter.call(obj, value) : member.set(obj, value);
45
- return value;
46
- };
47
29
 
48
30
  // src/main.ts
49
31
  var main_exports = {};
@@ -71,22 +53,8 @@ var ExecutionTimeoutError = class extends Error {
71
53
  }
72
54
  };
73
55
 
74
- // src/error/ErrorWithCause.ts
75
- var _errorCause;
76
- var ErrorWithCause = class extends Error {
77
- constructor(message, options) {
78
- super(message);
79
- __privateAdd(this, _errorCause, void 0);
80
- __privateSet(this, _errorCause, options?.cause);
81
- }
82
- get cause() {
83
- return __privateGet(this, _errorCause);
84
- }
85
- };
86
- _errorCause = new WeakMap();
87
-
88
56
  // src/error/ExecutionError.ts
89
- var ExecutionError = class extends ErrorWithCause {
57
+ var ExecutionError = class extends Error {
90
58
  constructor(caughtError) {
91
59
  super(`Execution has failed with the following error: ${caughtError.message}`, { cause: caughtError });
92
60
  this.name = "ExecutionError";
@@ -135,8 +103,7 @@ function isPlainObj(value) {
135
103
  return !!value && Object.getPrototypeOf(value) === Object.prototype;
136
104
  }
137
105
  function sleep(ms, abortSignal) {
138
- if (ms === 0)
139
- return;
106
+ if (ms === 0) return;
140
107
  return new Promise((resolve) => {
141
108
  if (abortSignal?.aborted) {
142
109
  return resolve();
@@ -163,10 +130,8 @@ function stringifyJSONValue(value) {
163
130
  return JSON.stringify(value);
164
131
  }
165
132
  function clamp(value, min, max) {
166
- if (min && value < min)
167
- return min;
168
- if (max && value > max)
169
- return max;
133
+ if (min && value < min) return min;
134
+ if (max && value > max) return max;
170
135
  return value;
171
136
  }
172
137
 
@@ -175,13 +140,22 @@ var import_jsonpath_plus = require("jsonpath-plus");
175
140
 
176
141
  // src/stateMachine/jsonPath/constraints/BaseJsonPathConstraint.ts
177
142
  var BaseJSONPathConstraint = class {
143
+ pathExpression;
178
144
  constructor(pathExpression) {
179
145
  this.pathExpression = pathExpression;
180
146
  }
181
147
  };
182
148
 
183
149
  // src/error/RuntimeError.ts
184
- var RuntimeError = class extends ErrorWithCause {
150
+ var RuntimeError = class extends Error {
151
+ /**
152
+ * Whether this runtime error can be matched in a `Retry` field
153
+ */
154
+ retryable;
155
+ /**
156
+ * Whether this runtime error can be caught in a `Catch` field
157
+ */
158
+ catchable;
185
159
  constructor(message, cause) {
186
160
  super(message, { cause });
187
161
  this.name = "RuntimeError";
@@ -266,8 +240,7 @@ function validateArgumentType(allowedTypes, argPosition, funcArg, funcName) {
266
240
  matchesAllowedType = true;
267
241
  break;
268
242
  }
269
- if (matchesAllowedType)
270
- break;
243
+ if (matchesAllowedType) break;
271
244
  }
272
245
  const expectedType = allowedTypes.map((type) => `'${type}'`).join(" | ");
273
246
  if (!matchesAllowedType) {
@@ -294,8 +267,7 @@ function validateArgumentConstraints(argConstraints, argPosition, funcArg, funcN
294
267
  matchesAllConstraints = Number.isInteger(funcArg);
295
268
  break;
296
269
  }
297
- if (matchesAllConstraints)
298
- break;
270
+ if (matchesAllConstraints) break;
299
271
  }
300
272
  const expectedConstraints = argConstraints.map((constraint) => `'${constraint}'`).join(" | ");
301
273
  if (!matchesAllConstraints) {
@@ -325,8 +297,7 @@ function validateArguments(funcDefinition, ...args) {
325
297
  for (let i = 0; i < funcDefinition.arguments.length; i++) {
326
298
  const argDefinition = funcDefinition.arguments[i];
327
299
  const funcArg = args[i];
328
- if (funcArg === void 0)
329
- break;
300
+ if (funcArg === void 0) break;
330
301
  validateArgumentType(argDefinition.allowedTypes, i + 1, funcArg, funcDefinition.name);
331
302
  validateArgumentConstraints(argDefinition.constraints, i + 1, funcArg, funcDefinition.name);
332
303
  }
@@ -368,6 +339,7 @@ var BaseIntrinsicFunction = class {
368
339
 
369
340
  // src/stateMachine/intrinsicFunctions/StatesFormat.ts
370
341
  var StatesFormat = class extends BaseIntrinsicFunction {
342
+ funcDefinition;
371
343
  constructor() {
372
344
  super();
373
345
  this.funcDefinition = {
@@ -397,6 +369,7 @@ var StatesFormat = class extends BaseIntrinsicFunction {
397
369
 
398
370
  // src/stateMachine/intrinsicFunctions/StatesStringToJson.ts
399
371
  var StatesStringToJson = class extends BaseIntrinsicFunction {
372
+ funcDefinition;
400
373
  constructor() {
401
374
  super();
402
375
  this.funcDefinition = {
@@ -416,6 +389,7 @@ var StatesStringToJson = class extends BaseIntrinsicFunction {
416
389
 
417
390
  // src/stateMachine/intrinsicFunctions/StatesJsonToString.ts
418
391
  var StatesJsonToString = class extends BaseIntrinsicFunction {
392
+ funcDefinition;
419
393
  constructor() {
420
394
  super();
421
395
  this.funcDefinition = {
@@ -435,6 +409,7 @@ var StatesJsonToString = class extends BaseIntrinsicFunction {
435
409
 
436
410
  // src/stateMachine/intrinsicFunctions/StatesArray.ts
437
411
  var StatesArray = class extends BaseIntrinsicFunction {
412
+ funcDefinition;
438
413
  constructor() {
439
414
  super();
440
415
  this.funcDefinition = {
@@ -451,6 +426,7 @@ var StatesArray = class extends BaseIntrinsicFunction {
451
426
 
452
427
  // src/stateMachine/intrinsicFunctions/StatesArrayPartition.ts
453
428
  var StatesArrayPartition = class extends BaseIntrinsicFunction {
429
+ funcDefinition;
454
430
  constructor() {
455
431
  super();
456
432
  this.funcDefinition = {
@@ -480,6 +456,7 @@ var StatesArrayPartition = class extends BaseIntrinsicFunction {
480
456
  // src/stateMachine/intrinsicFunctions/StatesArrayContains.ts
481
457
  var import_isEqual = __toESM(require("lodash/isEqual.js"), 1);
482
458
  var StatesArrayContains = class extends BaseIntrinsicFunction {
459
+ funcDefinition;
483
460
  constructor() {
484
461
  super();
485
462
  this.funcDefinition = {
@@ -502,6 +479,7 @@ var StatesArrayContains = class extends BaseIntrinsicFunction {
502
479
 
503
480
  // src/stateMachine/intrinsicFunctions/StatesArrayRange.ts
504
481
  var StatesArrayRange = class extends BaseIntrinsicFunction {
482
+ funcDefinition;
505
483
  constructor() {
506
484
  super();
507
485
  this.funcDefinition = {
@@ -541,6 +519,7 @@ var StatesArrayRange = class extends BaseIntrinsicFunction {
541
519
 
542
520
  // src/stateMachine/intrinsicFunctions/StatesArrayGetItem.ts
543
521
  var StatesArrayGetItem = class extends BaseIntrinsicFunction {
522
+ funcDefinition;
544
523
  constructor() {
545
524
  super();
546
525
  this.funcDefinition = {
@@ -563,6 +542,7 @@ var StatesArrayGetItem = class extends BaseIntrinsicFunction {
563
542
 
564
543
  // src/stateMachine/intrinsicFunctions/StatesArrayLength.ts
565
544
  var StatesArrayLength = class extends BaseIntrinsicFunction {
545
+ funcDefinition;
566
546
  constructor() {
567
547
  super();
568
548
  this.funcDefinition = {
@@ -584,6 +564,7 @@ var StatesArrayLength = class extends BaseIntrinsicFunction {
584
564
  var import_isEqual2 = __toESM(require("lodash/isEqual.js"), 1);
585
565
  var import_uniqWith = __toESM(require("lodash/uniqWith.js"), 1);
586
566
  var StatesArrayUnique = class extends BaseIntrinsicFunction {
567
+ funcDefinition;
587
568
  constructor() {
588
569
  super();
589
570
  this.funcDefinition = {
@@ -603,6 +584,7 @@ var StatesArrayUnique = class extends BaseIntrinsicFunction {
603
584
 
604
585
  // src/stateMachine/intrinsicFunctions/StatesBase64Encode.ts
605
586
  var StatesBase64Encode = class extends BaseIntrinsicFunction {
587
+ funcDefinition;
606
588
  constructor() {
607
589
  super();
608
590
  this.funcDefinition = {
@@ -627,6 +609,7 @@ var StatesBase64Encode = class extends BaseIntrinsicFunction {
627
609
 
628
610
  // src/stateMachine/intrinsicFunctions/StatesBase64Decode.ts
629
611
  var StatesBase64Decode = class extends BaseIntrinsicFunction {
612
+ funcDefinition;
630
613
  constructor() {
631
614
  super();
632
615
  this.funcDefinition = {
@@ -649,13 +632,786 @@ var StatesBase64Decode = class extends BaseIntrinsicFunction {
649
632
  }
650
633
  };
651
634
 
635
+ // src/util/hash/BaseHash.ts
636
+ var BaseHashAlgorithm = class {
637
+ textEncoder;
638
+ constructor() {
639
+ this.textEncoder = new TextEncoder();
640
+ }
641
+ getDigest(input) {
642
+ const message = this.textEncoder.encode(input);
643
+ const paddedMessage = this.padMessage(message);
644
+ const hash = this.computeHash(paddedMessage);
645
+ const digest = this.hashToString(hash);
646
+ return digest;
647
+ }
648
+ rotl(n, x) {
649
+ if (typeof n === "number" && typeof x === "number") return x << n | x >>> 32 - n;
650
+ if (typeof n === "bigint" && typeof x === "bigint") return x << n | x >> 64n - n;
651
+ throw new Error("Both arguments must be of the same type");
652
+ }
653
+ rotr(n, x) {
654
+ if (typeof n === "number" && typeof x === "number") return x >>> n | x << 32 - n;
655
+ if (typeof n === "bigint" && typeof x === "bigint") return x >> n | x << 64n - n;
656
+ throw new Error("Both arguments must be of the same type");
657
+ }
658
+ ch(x, y, z) {
659
+ if (typeof x === typeof y && typeof y === typeof z) {
660
+ return x & y ^ ~x & z;
661
+ }
662
+ throw new Error("All arguments must be of the same type");
663
+ }
664
+ parity(x, y, z) {
665
+ if (typeof x === typeof y && typeof y === typeof z) {
666
+ return x ^ y ^ z;
667
+ }
668
+ throw new Error("All arguments must be of the same type");
669
+ }
670
+ maj(x, y, z) {
671
+ if (typeof x === typeof y && typeof y === typeof z) {
672
+ return x & y ^ x & z ^ y & z;
673
+ }
674
+ throw new Error("All arguments must be of the same type");
675
+ }
676
+ bigSigma0(x) {
677
+ if (typeof x === "number") {
678
+ return this.rotr(2, x) ^ this.rotr(13, x) ^ this.rotr(22, x);
679
+ }
680
+ return this.rotr(28n, x) ^ this.rotr(34n, x) ^ this.rotr(39n, x);
681
+ }
682
+ bigSigma1(x) {
683
+ if (typeof x === "number") {
684
+ return this.rotr(6, x) ^ this.rotr(11, x) ^ this.rotr(25, x);
685
+ }
686
+ return this.rotr(14n, x) ^ this.rotr(18n, x) ^ this.rotr(41n, x);
687
+ }
688
+ smallSigma0(x) {
689
+ if (typeof x === "number") {
690
+ return this.rotr(7, x) ^ this.rotr(18, x) ^ x >>> 3;
691
+ }
692
+ return this.rotr(1n, x) ^ this.rotr(8n, x) ^ x >> 7n;
693
+ }
694
+ smallSigma1(x) {
695
+ if (typeof x === "number") {
696
+ return this.rotr(17, x) ^ this.rotr(19, x) ^ x >>> 10;
697
+ }
698
+ return this.rotr(19n, x) ^ this.rotr(61n, x) ^ x >> 6n;
699
+ }
700
+ };
701
+
702
+ // src/util/hash/MD5.ts
703
+ var MD5 = class extends BaseHashAlgorithm {
704
+ padMessage(message) {
705
+ const msgLenMod64 = message.length % 64;
706
+ let bytesToAdd = 64 - msgLenMod64;
707
+ if (msgLenMod64 >= 56) {
708
+ bytesToAdd += 64;
709
+ }
710
+ const padding = new Uint8Array(bytesToAdd);
711
+ const paddedMsg = new Uint8Array([...message, ...padding]);
712
+ const dataView = new DataView(paddedMsg.buffer);
713
+ dataView.setUint8(message.length, 128);
714
+ dataView.setBigUint64(paddedMsg.length - 8, BigInt(message.length * 8), true);
715
+ return paddedMsg.buffer;
716
+ }
717
+ computeHash(paddedMessage) {
718
+ const b1 = new Uint32Array(4);
719
+ const b2 = new Uint32Array([1732584193, 4023233417, 2562383102, 271733878]);
720
+ const seq = new Uint32Array(16);
721
+ const table = new Uint32Array([
722
+ 3614090360,
723
+ 3905402710,
724
+ 606105819,
725
+ 3250441966,
726
+ 4118548399,
727
+ 1200080426,
728
+ 2821735955,
729
+ 4249261313,
730
+ 1770035416,
731
+ 2336552879,
732
+ 4294925233,
733
+ 2304563134,
734
+ 1804603682,
735
+ 4254626195,
736
+ 2792965006,
737
+ 1236535329,
738
+ 4129170786,
739
+ 3225465664,
740
+ 643717713,
741
+ 3921069994,
742
+ 3593408605,
743
+ 38016083,
744
+ 3634488961,
745
+ 3889429448,
746
+ 568446438,
747
+ 3275163606,
748
+ 4107603335,
749
+ 1163531501,
750
+ 2850285829,
751
+ 4243563512,
752
+ 1735328473,
753
+ 2368359562,
754
+ 4294588738,
755
+ 2272392833,
756
+ 1839030562,
757
+ 4259657740,
758
+ 2763975236,
759
+ 1272893353,
760
+ 4139469664,
761
+ 3200236656,
762
+ 681279174,
763
+ 3936430074,
764
+ 3572445317,
765
+ 76029189,
766
+ 3654602809,
767
+ 3873151461,
768
+ 530742520,
769
+ 3299628645,
770
+ 4096336452,
771
+ 1126891415,
772
+ 2878612391,
773
+ 4237533241,
774
+ 1700485571,
775
+ 2399980690,
776
+ 4293915773,
777
+ 2240044497,
778
+ 1873313359,
779
+ 4264355552,
780
+ 2734768916,
781
+ 1309151649,
782
+ 4149444226,
783
+ 3174756917,
784
+ 718787259,
785
+ 3951481745
786
+ ]);
787
+ const dataView = new DataView(paddedMessage);
788
+ for (let i = 0; i < paddedMessage.byteLength / 4; i += 16) {
789
+ for (let t = 0; t < 16; t++) {
790
+ seq[t] = dataView.getUint32(i + t * 4, true);
791
+ }
792
+ b1[0] = b2[0];
793
+ b1[1] = b2[1];
794
+ b1[2] = b2[2];
795
+ b1[3] = b2[3];
796
+ b1[0] = b1[1] + this.rotl(7, b1[0] + this.F(b1[1], b1[2], b1[3]) + seq[0] + table[0]);
797
+ b1[3] = b1[0] + this.rotl(12, b1[3] + this.F(b1[0], b1[1], b1[2]) + seq[1] + table[1]);
798
+ b1[2] = b1[3] + this.rotl(17, b1[2] + this.F(b1[3], b1[0], b1[1]) + seq[2] + table[2]);
799
+ b1[1] = b1[2] + this.rotl(22, b1[1] + this.F(b1[2], b1[3], b1[0]) + seq[3] + table[3]);
800
+ b1[0] = b1[1] + this.rotl(7, b1[0] + this.F(b1[1], b1[2], b1[3]) + seq[4] + table[4]);
801
+ b1[3] = b1[0] + this.rotl(12, b1[3] + this.F(b1[0], b1[1], b1[2]) + seq[5] + table[5]);
802
+ b1[2] = b1[3] + this.rotl(17, b1[2] + this.F(b1[3], b1[0], b1[1]) + seq[6] + table[6]);
803
+ b1[1] = b1[2] + this.rotl(22, b1[1] + this.F(b1[2], b1[3], b1[0]) + seq[7] + table[7]);
804
+ b1[0] = b1[1] + this.rotl(7, b1[0] + this.F(b1[1], b1[2], b1[3]) + seq[8] + table[8]);
805
+ b1[3] = b1[0] + this.rotl(12, b1[3] + this.F(b1[0], b1[1], b1[2]) + seq[9] + table[9]);
806
+ b1[2] = b1[3] + this.rotl(17, b1[2] + this.F(b1[3], b1[0], b1[1]) + seq[10] + table[10]);
807
+ b1[1] = b1[2] + this.rotl(22, b1[1] + this.F(b1[2], b1[3], b1[0]) + seq[11] + table[11]);
808
+ b1[0] = b1[1] + this.rotl(7, b1[0] + this.F(b1[1], b1[2], b1[3]) + seq[12] + table[12]);
809
+ b1[3] = b1[0] + this.rotl(12, b1[3] + this.F(b1[0], b1[1], b1[2]) + seq[13] + table[13]);
810
+ b1[2] = b1[3] + this.rotl(17, b1[2] + this.F(b1[3], b1[0], b1[1]) + seq[14] + table[14]);
811
+ b1[1] = b1[2] + this.rotl(22, b1[1] + this.F(b1[2], b1[3], b1[0]) + seq[15] + table[15]);
812
+ b1[0] = b1[1] + this.rotl(5, b1[0] + this.G(b1[1], b1[2], b1[3]) + seq[1] + table[16]);
813
+ b1[3] = b1[0] + this.rotl(9, b1[3] + this.G(b1[0], b1[1], b1[2]) + seq[6] + table[17]);
814
+ b1[2] = b1[3] + this.rotl(14, b1[2] + this.G(b1[3], b1[0], b1[1]) + seq[11] + table[18]);
815
+ b1[1] = b1[2] + this.rotl(20, b1[1] + this.G(b1[2], b1[3], b1[0]) + seq[0] + table[19]);
816
+ b1[0] = b1[1] + this.rotl(5, b1[0] + this.G(b1[1], b1[2], b1[3]) + seq[5] + table[20]);
817
+ b1[3] = b1[0] + this.rotl(9, b1[3] + this.G(b1[0], b1[1], b1[2]) + seq[10] + table[21]);
818
+ b1[2] = b1[3] + this.rotl(14, b1[2] + this.G(b1[3], b1[0], b1[1]) + seq[15] + table[22]);
819
+ b1[1] = b1[2] + this.rotl(20, b1[1] + this.G(b1[2], b1[3], b1[0]) + seq[4] + table[23]);
820
+ b1[0] = b1[1] + this.rotl(5, b1[0] + this.G(b1[1], b1[2], b1[3]) + seq[9] + table[24]);
821
+ b1[3] = b1[0] + this.rotl(9, b1[3] + this.G(b1[0], b1[1], b1[2]) + seq[14] + table[25]);
822
+ b1[2] = b1[3] + this.rotl(14, b1[2] + this.G(b1[3], b1[0], b1[1]) + seq[3] + table[26]);
823
+ b1[1] = b1[2] + this.rotl(20, b1[1] + this.G(b1[2], b1[3], b1[0]) + seq[8] + table[27]);
824
+ b1[0] = b1[1] + this.rotl(5, b1[0] + this.G(b1[1], b1[2], b1[3]) + seq[13] + table[28]);
825
+ b1[3] = b1[0] + this.rotl(9, b1[3] + this.G(b1[0], b1[1], b1[2]) + seq[2] + table[29]);
826
+ b1[2] = b1[3] + this.rotl(14, b1[2] + this.G(b1[3], b1[0], b1[1]) + seq[7] + table[30]);
827
+ b1[1] = b1[2] + this.rotl(20, b1[1] + this.G(b1[2], b1[3], b1[0]) + seq[12] + table[31]);
828
+ b1[0] = b1[1] + this.rotl(4, b1[0] + this.H(b1[1], b1[2], b1[3]) + seq[5] + table[32]);
829
+ b1[3] = b1[0] + this.rotl(11, b1[3] + this.H(b1[0], b1[1], b1[2]) + seq[8] + table[33]);
830
+ b1[2] = b1[3] + this.rotl(16, b1[2] + this.H(b1[3], b1[0], b1[1]) + seq[11] + table[34]);
831
+ b1[1] = b1[2] + this.rotl(23, b1[1] + this.H(b1[2], b1[3], b1[0]) + seq[14] + table[35]);
832
+ b1[0] = b1[1] + this.rotl(4, b1[0] + this.H(b1[1], b1[2], b1[3]) + seq[1] + table[36]);
833
+ b1[3] = b1[0] + this.rotl(11, b1[3] + this.H(b1[0], b1[1], b1[2]) + seq[4] + table[37]);
834
+ b1[2] = b1[3] + this.rotl(16, b1[2] + this.H(b1[3], b1[0], b1[1]) + seq[7] + table[38]);
835
+ b1[1] = b1[2] + this.rotl(23, b1[1] + this.H(b1[2], b1[3], b1[0]) + seq[10] + table[39]);
836
+ b1[0] = b1[1] + this.rotl(4, b1[0] + this.H(b1[1], b1[2], b1[3]) + seq[13] + table[40]);
837
+ b1[3] = b1[0] + this.rotl(11, b1[3] + this.H(b1[0], b1[1], b1[2]) + seq[0] + table[41]);
838
+ b1[2] = b1[3] + this.rotl(16, b1[2] + this.H(b1[3], b1[0], b1[1]) + seq[3] + table[42]);
839
+ b1[1] = b1[2] + this.rotl(23, b1[1] + this.H(b1[2], b1[3], b1[0]) + seq[6] + table[43]);
840
+ b1[0] = b1[1] + this.rotl(4, b1[0] + this.H(b1[1], b1[2], b1[3]) + seq[9] + table[44]);
841
+ b1[3] = b1[0] + this.rotl(11, b1[3] + this.H(b1[0], b1[1], b1[2]) + seq[12] + table[45]);
842
+ b1[2] = b1[3] + this.rotl(16, b1[2] + this.H(b1[3], b1[0], b1[1]) + seq[15] + table[46]);
843
+ b1[1] = b1[2] + this.rotl(23, b1[1] + this.H(b1[2], b1[3], b1[0]) + seq[2] + table[47]);
844
+ b1[0] = b1[1] + this.rotl(6, b1[0] + this.I(b1[1], b1[2], b1[3]) + seq[0] + table[48]);
845
+ b1[3] = b1[0] + this.rotl(10, b1[3] + this.I(b1[0], b1[1], b1[2]) + seq[7] + table[49]);
846
+ b1[2] = b1[3] + this.rotl(15, b1[2] + this.I(b1[3], b1[0], b1[1]) + seq[14] + table[50]);
847
+ b1[1] = b1[2] + this.rotl(21, b1[1] + this.I(b1[2], b1[3], b1[0]) + seq[5] + table[51]);
848
+ b1[0] = b1[1] + this.rotl(6, b1[0] + this.I(b1[1], b1[2], b1[3]) + seq[12] + table[52]);
849
+ b1[3] = b1[0] + this.rotl(10, b1[3] + this.I(b1[0], b1[1], b1[2]) + seq[3] + table[53]);
850
+ b1[2] = b1[3] + this.rotl(15, b1[2] + this.I(b1[3], b1[0], b1[1]) + seq[10] + table[54]);
851
+ b1[1] = b1[2] + this.rotl(21, b1[1] + this.I(b1[2], b1[3], b1[0]) + seq[1] + table[55]);
852
+ b1[0] = b1[1] + this.rotl(6, b1[0] + this.I(b1[1], b1[2], b1[3]) + seq[8] + table[56]);
853
+ b1[3] = b1[0] + this.rotl(10, b1[3] + this.I(b1[0], b1[1], b1[2]) + seq[15] + table[57]);
854
+ b1[2] = b1[3] + this.rotl(15, b1[2] + this.I(b1[3], b1[0], b1[1]) + seq[6] + table[58]);
855
+ b1[1] = b1[2] + this.rotl(21, b1[1] + this.I(b1[2], b1[3], b1[0]) + seq[13] + table[59]);
856
+ b1[0] = b1[1] + this.rotl(6, b1[0] + this.I(b1[1], b1[2], b1[3]) + seq[4] + table[60]);
857
+ b1[3] = b1[0] + this.rotl(10, b1[3] + this.I(b1[0], b1[1], b1[2]) + seq[11] + table[61]);
858
+ b1[2] = b1[3] + this.rotl(15, b1[2] + this.I(b1[3], b1[0], b1[1]) + seq[2] + table[62]);
859
+ b1[1] = b1[2] + this.rotl(21, b1[1] + this.I(b1[2], b1[3], b1[0]) + seq[9] + table[63]);
860
+ b2[0] += b1[0];
861
+ b2[1] += b1[1];
862
+ b2[2] += b1[2];
863
+ b2[3] += b1[3];
864
+ }
865
+ return b2.buffer;
866
+ }
867
+ hashToString(hash) {
868
+ const dataView = new DataView(hash);
869
+ dataView.setUint32(0, dataView.getUint32(0), true);
870
+ dataView.setUint32(4, dataView.getUint32(4), true);
871
+ dataView.setUint32(8, dataView.getUint32(8), true);
872
+ dataView.setUint32(12, dataView.getUint32(12), true);
873
+ return [...new Uint32Array(hash)].map((w) => w.toString(16).padStart(8, "0")).join("");
874
+ }
875
+ F(x, y, z) {
876
+ return this.ch(x, y, z);
877
+ }
878
+ G(x, y, z) {
879
+ return this.ch(z, x, y);
880
+ }
881
+ H(x, y, z) {
882
+ return this.parity(x, y, z);
883
+ }
884
+ I(x, y, z) {
885
+ return y ^ (x | ~z);
886
+ }
887
+ };
888
+
889
+ // src/util/hash/SHA1.ts
890
+ var SHA1 = class extends BaseHashAlgorithm {
891
+ padMessage(message) {
892
+ const msgLenMod64 = message.length % 64;
893
+ let bytesToAdd = 64 - msgLenMod64;
894
+ if (msgLenMod64 >= 56) {
895
+ bytesToAdd += 64;
896
+ }
897
+ const padding = new Uint8Array(bytesToAdd);
898
+ const paddedMsg = new Uint8Array([...message, ...padding]);
899
+ const dataView = new DataView(paddedMsg.buffer);
900
+ dataView.setUint8(message.length, 128);
901
+ dataView.setBigUint64(paddedMsg.length - 8, BigInt(message.length * 8));
902
+ return paddedMsg.buffer;
903
+ }
904
+ computeHash(paddedMessage) {
905
+ const b1 = new Uint32Array(5);
906
+ const b2 = new Uint32Array([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
907
+ const seq = new Uint32Array(80);
908
+ const dataView = new DataView(paddedMessage);
909
+ for (let i = 0; i < paddedMessage.byteLength / 4; i += 16) {
910
+ for (let t = 0; t < 16; t++) {
911
+ seq[t] = dataView.getUint32(i + t * 4);
912
+ }
913
+ for (let t = 16; t < 80; t++) {
914
+ seq[t] = this.rotl(1, seq[t - 3] ^ seq[t - 8] ^ seq[t - 14] ^ seq[t - 16]);
915
+ }
916
+ b1[0] = b2[0];
917
+ b1[1] = b2[1];
918
+ b1[2] = b2[2];
919
+ b1[3] = b2[3];
920
+ b1[4] = b2[4];
921
+ for (let t = 0; t < 80; t++) {
922
+ const temp = this.rotl(5, b1[0]) + this.lf(t, b1[1], b1[2], b1[3]) + b1[4] + seq[t] + this.cw(t);
923
+ b1[4] = b1[3];
924
+ b1[3] = b1[2];
925
+ b1[2] = this.rotl(30, b1[1]);
926
+ b1[1] = b1[0];
927
+ b1[0] = temp;
928
+ }
929
+ b2[0] += b1[0];
930
+ b2[1] += b1[1];
931
+ b2[2] += b1[2];
932
+ b2[3] += b1[3];
933
+ b2[4] += b1[4];
934
+ }
935
+ return b2.buffer;
936
+ }
937
+ hashToString(hash) {
938
+ return [...new Uint32Array(hash)].map((w) => w.toString(16).padStart(8, "0")).join("");
939
+ }
940
+ // logical function
941
+ lf(t, x, y, z) {
942
+ if (t < 20) return this.ch(x, y, z);
943
+ else if (t < 40) return this.parity(x, y, z);
944
+ else if (t < 60) return this.maj(x, y, z);
945
+ else return this.parity(x, y, z);
946
+ }
947
+ // constant words
948
+ cw(t) {
949
+ if (t < 20) return 1518500249;
950
+ else if (t < 40) return 1859775393;
951
+ else if (t < 60) return 2400959708;
952
+ else return 3395469782;
953
+ }
954
+ };
955
+
956
+ // src/util/hash/SHA256.ts
957
+ var SHA256 = class _SHA256 extends BaseHashAlgorithm {
958
+ // SHA-256 constants
959
+ static k = new Uint32Array([
960
+ 1116352408,
961
+ 1899447441,
962
+ 3049323471,
963
+ 3921009573,
964
+ 961987163,
965
+ 1508970993,
966
+ 2453635748,
967
+ 2870763221,
968
+ 3624381080,
969
+ 310598401,
970
+ 607225278,
971
+ 1426881987,
972
+ 1925078388,
973
+ 2162078206,
974
+ 2614888103,
975
+ 3248222580,
976
+ 3835390401,
977
+ 4022224774,
978
+ 264347078,
979
+ 604807628,
980
+ 770255983,
981
+ 1249150122,
982
+ 1555081692,
983
+ 1996064986,
984
+ 2554220882,
985
+ 2821834349,
986
+ 2952996808,
987
+ 3210313671,
988
+ 3336571891,
989
+ 3584528711,
990
+ 113926993,
991
+ 338241895,
992
+ 666307205,
993
+ 773529912,
994
+ 1294757372,
995
+ 1396182291,
996
+ 1695183700,
997
+ 1986661051,
998
+ 2177026350,
999
+ 2456956037,
1000
+ 2730485921,
1001
+ 2820302411,
1002
+ 3259730800,
1003
+ 3345764771,
1004
+ 3516065817,
1005
+ 3600352804,
1006
+ 4094571909,
1007
+ 275423344,
1008
+ 430227734,
1009
+ 506948616,
1010
+ 659060556,
1011
+ 883997877,
1012
+ 958139571,
1013
+ 1322822218,
1014
+ 1537002063,
1015
+ 1747873779,
1016
+ 1955562222,
1017
+ 2024104815,
1018
+ 2227730452,
1019
+ 2361852424,
1020
+ 2428436474,
1021
+ 2756734187,
1022
+ 3204031479,
1023
+ 3329325298
1024
+ ]);
1025
+ padMessage(message) {
1026
+ const msgLenMod64 = message.length % 64;
1027
+ let bytesToAdd = 64 - msgLenMod64;
1028
+ if (msgLenMod64 >= 56) {
1029
+ bytesToAdd += 64;
1030
+ }
1031
+ const padding = new Uint8Array(bytesToAdd);
1032
+ const paddedMsg = new Uint8Array([...message, ...padding]);
1033
+ const dataView = new DataView(paddedMsg.buffer);
1034
+ dataView.setUint8(message.length, 128);
1035
+ dataView.setBigUint64(paddedMsg.length - 8, BigInt(message.length * 8));
1036
+ return paddedMsg.buffer;
1037
+ }
1038
+ computeHash(paddedMessage) {
1039
+ const b1 = new Uint32Array(8);
1040
+ const b2 = new Uint32Array([
1041
+ 1779033703,
1042
+ 3144134277,
1043
+ 1013904242,
1044
+ 2773480762,
1045
+ 1359893119,
1046
+ 2600822924,
1047
+ 528734635,
1048
+ 1541459225
1049
+ ]);
1050
+ const seq = new Uint32Array(64);
1051
+ const dataView = new DataView(paddedMessage);
1052
+ for (let i = 0; i < paddedMessage.byteLength / 4; i += 16) {
1053
+ for (let t = 0; t < 16; t++) {
1054
+ seq[t] = dataView.getUint32(i + t * 4);
1055
+ }
1056
+ for (let t = 16; t < 64; t++) {
1057
+ seq[t] = this.smallSigma1(seq[t - 2]) + seq[t - 7] + this.smallSigma0(seq[t - 15]) + seq[t - 16];
1058
+ }
1059
+ b1[0] = b2[0];
1060
+ b1[1] = b2[1];
1061
+ b1[2] = b2[2];
1062
+ b1[3] = b2[3];
1063
+ b1[4] = b2[4];
1064
+ b1[5] = b2[5];
1065
+ b1[6] = b2[6];
1066
+ b1[7] = b2[7];
1067
+ for (let t = 0; t < 64; t++) {
1068
+ const temp1 = b1[7] + this.bigSigma1(b1[4]) + this.ch(b1[4], b1[5], b1[6]) + _SHA256.k[t] + seq[t];
1069
+ const temp2 = this.bigSigma0(b1[0]) + this.maj(b1[0], b1[1], b1[2]);
1070
+ b1[7] = b1[6];
1071
+ b1[6] = b1[5];
1072
+ b1[5] = b1[4];
1073
+ b1[4] = b1[3] + temp1;
1074
+ b1[3] = b1[2];
1075
+ b1[2] = b1[1];
1076
+ b1[1] = b1[0];
1077
+ b1[0] = temp1 + temp2;
1078
+ }
1079
+ b2[0] += b1[0];
1080
+ b2[1] += b1[1];
1081
+ b2[2] += b1[2];
1082
+ b2[3] += b1[3];
1083
+ b2[4] += b1[4];
1084
+ b2[5] += b1[5];
1085
+ b2[6] += b1[6];
1086
+ b2[7] += b1[7];
1087
+ }
1088
+ return b2.buffer;
1089
+ }
1090
+ hashToString(hash) {
1091
+ return [...new Uint32Array(hash)].map((w) => w.toString(16).padStart(8, "0")).join("");
1092
+ }
1093
+ };
1094
+
1095
+ // src/util/hash/SHA384.ts
1096
+ var SHA384 = class _SHA384 extends BaseHashAlgorithm {
1097
+ // SHA-384 constants
1098
+ static k = new BigUint64Array([
1099
+ 0x428a2f98d728ae22n,
1100
+ 0x7137449123ef65cdn,
1101
+ 0xb5c0fbcfec4d3b2fn,
1102
+ 0xe9b5dba58189dbbcn,
1103
+ 0x3956c25bf348b538n,
1104
+ 0x59f111f1b605d019n,
1105
+ 0x923f82a4af194f9bn,
1106
+ 0xab1c5ed5da6d8118n,
1107
+ 0xd807aa98a3030242n,
1108
+ 0x12835b0145706fben,
1109
+ 0x243185be4ee4b28cn,
1110
+ 0x550c7dc3d5ffb4e2n,
1111
+ 0x72be5d74f27b896fn,
1112
+ 0x80deb1fe3b1696b1n,
1113
+ 0x9bdc06a725c71235n,
1114
+ 0xc19bf174cf692694n,
1115
+ 0xe49b69c19ef14ad2n,
1116
+ 0xefbe4786384f25e3n,
1117
+ 0x0fc19dc68b8cd5b5n,
1118
+ 0x240ca1cc77ac9c65n,
1119
+ 0x2de92c6f592b0275n,
1120
+ 0x4a7484aa6ea6e483n,
1121
+ 0x5cb0a9dcbd41fbd4n,
1122
+ 0x76f988da831153b5n,
1123
+ 0x983e5152ee66dfabn,
1124
+ 0xa831c66d2db43210n,
1125
+ 0xb00327c898fb213fn,
1126
+ 0xbf597fc7beef0ee4n,
1127
+ 0xc6e00bf33da88fc2n,
1128
+ 0xd5a79147930aa725n,
1129
+ 0x06ca6351e003826fn,
1130
+ 0x142929670a0e6e70n,
1131
+ 0x27b70a8546d22ffcn,
1132
+ 0x2e1b21385c26c926n,
1133
+ 0x4d2c6dfc5ac42aedn,
1134
+ 0x53380d139d95b3dfn,
1135
+ 0x650a73548baf63den,
1136
+ 0x766a0abb3c77b2a8n,
1137
+ 0x81c2c92e47edaee6n,
1138
+ 0x92722c851482353bn,
1139
+ 0xa2bfe8a14cf10364n,
1140
+ 0xa81a664bbc423001n,
1141
+ 0xc24b8b70d0f89791n,
1142
+ 0xc76c51a30654be30n,
1143
+ 0xd192e819d6ef5218n,
1144
+ 0xd69906245565a910n,
1145
+ 0xf40e35855771202an,
1146
+ 0x106aa07032bbd1b8n,
1147
+ 0x19a4c116b8d2d0c8n,
1148
+ 0x1e376c085141ab53n,
1149
+ 0x2748774cdf8eeb99n,
1150
+ 0x34b0bcb5e19b48a8n,
1151
+ 0x391c0cb3c5c95a63n,
1152
+ 0x4ed8aa4ae3418acbn,
1153
+ 0x5b9cca4f7763e373n,
1154
+ 0x682e6ff3d6b2b8a3n,
1155
+ 0x748f82ee5defb2fcn,
1156
+ 0x78a5636f43172f60n,
1157
+ 0x84c87814a1f0ab72n,
1158
+ 0x8cc702081a6439ecn,
1159
+ 0x90befffa23631e28n,
1160
+ 0xa4506cebde82bde9n,
1161
+ 0xbef9a3f7b2c67915n,
1162
+ 0xc67178f2e372532bn,
1163
+ 0xca273eceea26619cn,
1164
+ 0xd186b8c721c0c207n,
1165
+ 0xeada7dd6cde0eb1en,
1166
+ 0xf57d4f7fee6ed178n,
1167
+ 0x06f067aa72176fban,
1168
+ 0x0a637dc5a2c898a6n,
1169
+ 0x113f9804bef90daen,
1170
+ 0x1b710b35131c471bn,
1171
+ 0x28db77f523047d84n,
1172
+ 0x32caab7b40c72493n,
1173
+ 0x3c9ebe0a15c9bebcn,
1174
+ 0x431d67c49c100d4cn,
1175
+ 0x4cc5d4becb3e42b6n,
1176
+ 0x597f299cfc657e2an,
1177
+ 0x5fcb6fab3ad6faecn,
1178
+ 0x6c44198c4a475817n
1179
+ ]);
1180
+ padMessage(message) {
1181
+ const msgLenMod128 = message.length % 128;
1182
+ let bytesToAdd = 128 - msgLenMod128;
1183
+ if (msgLenMod128 >= 112) {
1184
+ bytesToAdd += 128;
1185
+ }
1186
+ const padding = new Uint8Array(bytesToAdd);
1187
+ const paddedMsg = new Uint8Array([...message, ...padding]);
1188
+ const dataView = new DataView(paddedMsg.buffer);
1189
+ dataView.setUint8(message.length, 128);
1190
+ dataView.setBigUint64(paddedMsg.length - 8, BigInt(message.length * 8));
1191
+ return paddedMsg.buffer;
1192
+ }
1193
+ computeHash(paddedMessage) {
1194
+ const b1 = new BigUint64Array(8);
1195
+ const b2 = new BigUint64Array([
1196
+ 0xcbbb9d5dc1059ed8n,
1197
+ 0x629a292a367cd507n,
1198
+ 0x9159015a3070dd17n,
1199
+ 0x152fecd8f70e5939n,
1200
+ 0x67332667ffc00b31n,
1201
+ 0x8eb44a8768581511n,
1202
+ 0xdb0c2e0d64f98fa7n,
1203
+ 0x47b5481dbefa4fa4n
1204
+ ]);
1205
+ const seq = new BigUint64Array(80);
1206
+ const dataView = new DataView(paddedMessage);
1207
+ for (let i = 0; i < paddedMessage.byteLength / 8; i += 16) {
1208
+ for (let t = 0; t < 16; t++) {
1209
+ seq[t] = dataView.getBigUint64(i + t * 8);
1210
+ }
1211
+ for (let t = 16; t < 80; t++) {
1212
+ seq[t] = this.smallSigma1(seq[t - 2]) + seq[t - 7] + this.smallSigma0(seq[t - 15]) + seq[t - 16];
1213
+ }
1214
+ b1[0] = b2[0];
1215
+ b1[1] = b2[1];
1216
+ b1[2] = b2[2];
1217
+ b1[3] = b2[3];
1218
+ b1[4] = b2[4];
1219
+ b1[5] = b2[5];
1220
+ b1[6] = b2[6];
1221
+ b1[7] = b2[7];
1222
+ for (let t = 0; t < 80; t++) {
1223
+ const temp1 = b1[7] + this.bigSigma1(b1[4]) + this.ch(b1[4], b1[5], b1[6]) + _SHA384.k[t] + seq[t];
1224
+ const temp2 = this.bigSigma0(b1[0]) + this.maj(b1[0], b1[1], b1[2]);
1225
+ b1[7] = b1[6];
1226
+ b1[6] = b1[5];
1227
+ b1[5] = b1[4];
1228
+ b1[4] = b1[3] + temp1;
1229
+ b1[3] = b1[2];
1230
+ b1[2] = b1[1];
1231
+ b1[1] = b1[0];
1232
+ b1[0] = temp1 + temp2;
1233
+ }
1234
+ b2[0] += b1[0];
1235
+ b2[1] += b1[1];
1236
+ b2[2] += b1[2];
1237
+ b2[3] += b1[3];
1238
+ b2[4] += b1[4];
1239
+ b2[5] += b1[5];
1240
+ b2[6] += b1[6];
1241
+ b2[7] += b1[7];
1242
+ }
1243
+ return b2.slice(0, 6).buffer;
1244
+ }
1245
+ hashToString(hash) {
1246
+ return [...new BigUint64Array(hash)].map((w) => w.toString(16).padStart(16, "0")).join("");
1247
+ }
1248
+ };
1249
+
1250
+ // src/util/hash/SHA512.ts
1251
+ var SHA512 = class _SHA512 extends BaseHashAlgorithm {
1252
+ // SHA-512 constants
1253
+ static k = new BigUint64Array([
1254
+ 0x428a2f98d728ae22n,
1255
+ 0x7137449123ef65cdn,
1256
+ 0xb5c0fbcfec4d3b2fn,
1257
+ 0xe9b5dba58189dbbcn,
1258
+ 0x3956c25bf348b538n,
1259
+ 0x59f111f1b605d019n,
1260
+ 0x923f82a4af194f9bn,
1261
+ 0xab1c5ed5da6d8118n,
1262
+ 0xd807aa98a3030242n,
1263
+ 0x12835b0145706fben,
1264
+ 0x243185be4ee4b28cn,
1265
+ 0x550c7dc3d5ffb4e2n,
1266
+ 0x72be5d74f27b896fn,
1267
+ 0x80deb1fe3b1696b1n,
1268
+ 0x9bdc06a725c71235n,
1269
+ 0xc19bf174cf692694n,
1270
+ 0xe49b69c19ef14ad2n,
1271
+ 0xefbe4786384f25e3n,
1272
+ 0x0fc19dc68b8cd5b5n,
1273
+ 0x240ca1cc77ac9c65n,
1274
+ 0x2de92c6f592b0275n,
1275
+ 0x4a7484aa6ea6e483n,
1276
+ 0x5cb0a9dcbd41fbd4n,
1277
+ 0x76f988da831153b5n,
1278
+ 0x983e5152ee66dfabn,
1279
+ 0xa831c66d2db43210n,
1280
+ 0xb00327c898fb213fn,
1281
+ 0xbf597fc7beef0ee4n,
1282
+ 0xc6e00bf33da88fc2n,
1283
+ 0xd5a79147930aa725n,
1284
+ 0x06ca6351e003826fn,
1285
+ 0x142929670a0e6e70n,
1286
+ 0x27b70a8546d22ffcn,
1287
+ 0x2e1b21385c26c926n,
1288
+ 0x4d2c6dfc5ac42aedn,
1289
+ 0x53380d139d95b3dfn,
1290
+ 0x650a73548baf63den,
1291
+ 0x766a0abb3c77b2a8n,
1292
+ 0x81c2c92e47edaee6n,
1293
+ 0x92722c851482353bn,
1294
+ 0xa2bfe8a14cf10364n,
1295
+ 0xa81a664bbc423001n,
1296
+ 0xc24b8b70d0f89791n,
1297
+ 0xc76c51a30654be30n,
1298
+ 0xd192e819d6ef5218n,
1299
+ 0xd69906245565a910n,
1300
+ 0xf40e35855771202an,
1301
+ 0x106aa07032bbd1b8n,
1302
+ 0x19a4c116b8d2d0c8n,
1303
+ 0x1e376c085141ab53n,
1304
+ 0x2748774cdf8eeb99n,
1305
+ 0x34b0bcb5e19b48a8n,
1306
+ 0x391c0cb3c5c95a63n,
1307
+ 0x4ed8aa4ae3418acbn,
1308
+ 0x5b9cca4f7763e373n,
1309
+ 0x682e6ff3d6b2b8a3n,
1310
+ 0x748f82ee5defb2fcn,
1311
+ 0x78a5636f43172f60n,
1312
+ 0x84c87814a1f0ab72n,
1313
+ 0x8cc702081a6439ecn,
1314
+ 0x90befffa23631e28n,
1315
+ 0xa4506cebde82bde9n,
1316
+ 0xbef9a3f7b2c67915n,
1317
+ 0xc67178f2e372532bn,
1318
+ 0xca273eceea26619cn,
1319
+ 0xd186b8c721c0c207n,
1320
+ 0xeada7dd6cde0eb1en,
1321
+ 0xf57d4f7fee6ed178n,
1322
+ 0x06f067aa72176fban,
1323
+ 0x0a637dc5a2c898a6n,
1324
+ 0x113f9804bef90daen,
1325
+ 0x1b710b35131c471bn,
1326
+ 0x28db77f523047d84n,
1327
+ 0x32caab7b40c72493n,
1328
+ 0x3c9ebe0a15c9bebcn,
1329
+ 0x431d67c49c100d4cn,
1330
+ 0x4cc5d4becb3e42b6n,
1331
+ 0x597f299cfc657e2an,
1332
+ 0x5fcb6fab3ad6faecn,
1333
+ 0x6c44198c4a475817n
1334
+ ]);
1335
+ padMessage(message) {
1336
+ const msgLenMod128 = message.length % 128;
1337
+ let bytesToAdd = 128 - msgLenMod128;
1338
+ if (msgLenMod128 >= 112) {
1339
+ bytesToAdd += 128;
1340
+ }
1341
+ const padding = new Uint8Array(bytesToAdd);
1342
+ const paddedMsg = new Uint8Array([...message, ...padding]);
1343
+ const dataView = new DataView(paddedMsg.buffer);
1344
+ dataView.setUint8(message.length, 128);
1345
+ dataView.setBigUint64(paddedMsg.length - 8, BigInt(message.length * 8));
1346
+ return paddedMsg.buffer;
1347
+ }
1348
+ computeHash(paddedMessage) {
1349
+ const b1 = new BigUint64Array(8);
1350
+ const b2 = new BigUint64Array([
1351
+ 0x6a09e667f3bcc908n,
1352
+ 0xbb67ae8584caa73bn,
1353
+ 0x3c6ef372fe94f82bn,
1354
+ 0xa54ff53a5f1d36f1n,
1355
+ 0x510e527fade682d1n,
1356
+ 0x9b05688c2b3e6c1fn,
1357
+ 0x1f83d9abfb41bd6bn,
1358
+ 0x5be0cd19137e2179n
1359
+ ]);
1360
+ const seq = new BigUint64Array(80);
1361
+ const dataView = new DataView(paddedMessage);
1362
+ for (let i = 0; i < paddedMessage.byteLength / 8; i += 16) {
1363
+ for (let t = 0; t < 16; t++) {
1364
+ seq[t] = dataView.getBigUint64(i + t * 8);
1365
+ }
1366
+ for (let t = 16; t < 80; t++) {
1367
+ seq[t] = this.smallSigma1(seq[t - 2]) + seq[t - 7] + this.smallSigma0(seq[t - 15]) + seq[t - 16];
1368
+ }
1369
+ b1[0] = b2[0];
1370
+ b1[1] = b2[1];
1371
+ b1[2] = b2[2];
1372
+ b1[3] = b2[3];
1373
+ b1[4] = b2[4];
1374
+ b1[5] = b2[5];
1375
+ b1[6] = b2[6];
1376
+ b1[7] = b2[7];
1377
+ for (let t = 0; t < 80; t++) {
1378
+ const temp1 = b1[7] + this.bigSigma1(b1[4]) + this.ch(b1[4], b1[5], b1[6]) + _SHA512.k[t] + seq[t];
1379
+ const temp2 = this.bigSigma0(b1[0]) + this.maj(b1[0], b1[1], b1[2]);
1380
+ b1[7] = b1[6];
1381
+ b1[6] = b1[5];
1382
+ b1[5] = b1[4];
1383
+ b1[4] = b1[3] + temp1;
1384
+ b1[3] = b1[2];
1385
+ b1[2] = b1[1];
1386
+ b1[1] = b1[0];
1387
+ b1[0] = temp1 + temp2;
1388
+ }
1389
+ b2[0] += b1[0];
1390
+ b2[1] += b1[1];
1391
+ b2[2] += b1[2];
1392
+ b2[3] += b1[3];
1393
+ b2[4] += b1[4];
1394
+ b2[5] += b1[5];
1395
+ b2[6] += b1[6];
1396
+ b2[7] += b1[7];
1397
+ }
1398
+ return b2.buffer;
1399
+ }
1400
+ hashToString(hash) {
1401
+ return [...new BigUint64Array(hash)].map((w) => w.toString(16).padStart(16, "0")).join("");
1402
+ }
1403
+ };
1404
+
1405
+ // src/util/hash.ts
1406
+ var md5 = new MD5();
1407
+ var sha1 = new SHA1();
1408
+ var sha256 = new SHA256();
1409
+ var sha384 = new SHA384();
1410
+ var sha512 = new SHA512();
1411
+
652
1412
  // src/stateMachine/intrinsicFunctions/StatesHash.ts
653
- var import_md5 = __toESM(require("crypto-js/md5.js"), 1);
654
- var import_sha1 = __toESM(require("crypto-js/sha1.js"), 1);
655
- var import_sha256 = __toESM(require("crypto-js/sha256.js"), 1);
656
- var import_sha384 = __toESM(require("crypto-js/sha384.js"), 1);
657
- var import_sha512 = __toESM(require("crypto-js/sha512.js"), 1);
658
1413
  var StatesHash = class extends BaseIntrinsicFunction {
1414
+ funcDefinition;
659
1415
  constructor() {
660
1416
  super();
661
1417
  this.funcDefinition = {
@@ -681,26 +1437,27 @@ var StatesHash = class extends BaseIntrinsicFunction {
681
1437
  const supportedAlgorithms = algorithms.join(", ");
682
1438
  if (!algorithms.includes(algorithm)) {
683
1439
  throw new StatesRuntimeError(
684
- `Unsupported hashing algorithm provided to intrinsic function ${this.funcDefinition.name}. The supported algorithms are: ${supportedAlgorithms}`
1440
+ `Unsupported hash algorithm '${algorithm}' provided to intrinsic function ${this.funcDefinition.name}. The supported algorithms are: ${supportedAlgorithms}`
685
1441
  );
686
1442
  }
687
1443
  switch (algorithm) {
688
1444
  case "MD5":
689
- return (0, import_md5.default)(str).toString();
1445
+ return md5.getDigest(str);
690
1446
  case "SHA-1":
691
- return (0, import_sha1.default)(str).toString();
1447
+ return sha1.getDigest(str);
692
1448
  case "SHA-256":
693
- return (0, import_sha256.default)(str).toString();
1449
+ return sha256.getDigest(str);
694
1450
  case "SHA-384":
695
- return (0, import_sha384.default)(str).toString();
1451
+ return sha384.getDigest(str);
696
1452
  case "SHA-512":
697
- return (0, import_sha512.default)(str).toString();
1453
+ return sha512.getDigest(str);
698
1454
  }
699
1455
  }
700
1456
  };
701
1457
 
702
1458
  // src/stateMachine/intrinsicFunctions/StatesJsonMerge.ts
703
1459
  var StatesJsonMerge = class extends BaseIntrinsicFunction {
1460
+ funcDefinition;
704
1461
  constructor() {
705
1462
  super();
706
1463
  this.funcDefinition = {
@@ -731,6 +1488,7 @@ var StatesJsonMerge = class extends BaseIntrinsicFunction {
731
1488
 
732
1489
  // src/stateMachine/intrinsicFunctions/StatesMathRandom.ts
733
1490
  var StatesMathRandom = class extends BaseIntrinsicFunction {
1491
+ funcDefinition;
734
1492
  constructor() {
735
1493
  super();
736
1494
  this.funcDefinition = {
@@ -760,6 +1518,7 @@ var StatesMathRandom = class extends BaseIntrinsicFunction {
760
1518
 
761
1519
  // src/stateMachine/intrinsicFunctions/StatesMathAdd.ts
762
1520
  var StatesMathAdd = class extends BaseIntrinsicFunction {
1521
+ funcDefinition;
763
1522
  constructor() {
764
1523
  super();
765
1524
  this.funcDefinition = {
@@ -782,6 +1541,7 @@ var StatesMathAdd = class extends BaseIntrinsicFunction {
782
1541
 
783
1542
  // src/stateMachine/intrinsicFunctions/StatesStringSplit.ts
784
1543
  var StatesStringSplit = class extends BaseIntrinsicFunction {
1544
+ funcDefinition;
785
1545
  constructor() {
786
1546
  super();
787
1547
  this.funcDefinition = {
@@ -804,6 +1564,7 @@ var StatesStringSplit = class extends BaseIntrinsicFunction {
804
1564
 
805
1565
  // src/stateMachine/intrinsicFunctions/StatesUUID.ts
806
1566
  var StatesUUID = class extends BaseIntrinsicFunction {
1567
+ funcDefinition;
807
1568
  constructor() {
808
1569
  super();
809
1570
  this.funcDefinition = {
@@ -885,8 +1646,7 @@ function evaluateIntrinsicFunction(intrinsicFunction, input, context) {
885
1646
  }
886
1647
  }
887
1648
  if (char === "," && parensCount === 0 && apostropheCount === 0 || i === funcArgs.length - 1) {
888
- if (i === funcArgs.length - 1)
889
- partialArg += char;
1649
+ if (i === funcArgs.length - 1) partialArg += char;
890
1650
  partialArg = partialArg.trim();
891
1651
  if (partialArg.startsWith("States")) {
892
1652
  const evaluatedNestedFunction = evaluateIntrinsicFunction(partialArg, input, context);
@@ -968,6 +1728,8 @@ function processOutputPath(path, result, context) {
968
1728
 
969
1729
  // src/stateMachine/stateActions/BaseStateAction.ts
970
1730
  var BaseStateAction = class {
1731
+ stateDefinition;
1732
+ stateName;
971
1733
  constructor(stateDefinition, stateName) {
972
1734
  this.stateDefinition = stateDefinition;
973
1735
  this.stateName = stateName;
@@ -1368,13 +2130,13 @@ var IntegerConstraint = class extends BaseJSONPathConstraint {
1368
2130
  var import_p_limit = __toESM(require("p-limit"), 1);
1369
2131
  var DEFAULT_MAX_CONCURRENCY = 40;
1370
2132
  var MapStateAction = class extends BaseStateAction {
2133
+ executionAbortFuncs;
1371
2134
  constructor(stateDefinition, stateName) {
1372
2135
  super(stateDefinition, stateName);
1373
2136
  this.executionAbortFuncs = [];
1374
2137
  }
1375
2138
  async forwardEventsToRootEventLogger(eventLogger, executionEventLogs, index, parentStateRawInput) {
1376
- if (!eventLogger)
1377
- return;
2139
+ if (!eventLogger) return;
1378
2140
  for await (const event of executionEventLogs) {
1379
2141
  eventLogger.forwardNestedMapEvent(event, index, this.stateName, parentStateRawInput);
1380
2142
  }
@@ -1443,13 +2205,13 @@ var MapStateAction = class extends BaseStateAction {
1443
2205
  var import_p_limit2 = __toESM(require("p-limit"), 1);
1444
2206
  var DEFAULT_CONCURRENCY = 40;
1445
2207
  var ParallelStateAction = class extends BaseStateAction {
2208
+ executionAbortFuncs;
1446
2209
  constructor(stateDefinition, stateName) {
1447
2210
  super(stateDefinition, stateName);
1448
2211
  this.executionAbortFuncs = [];
1449
2212
  }
1450
2213
  async forwardEventsToRootEventLogger(eventLogger, executionEventLogs, parentStateRawInput) {
1451
- if (!eventLogger)
1452
- return;
2214
+ if (!eventLogger) return;
1453
2215
  for await (const event of executionEventLogs) {
1454
2216
  eventLogger.forwardNestedParallelEvent(event, this.stateName, parentStateRawInput);
1455
2217
  }
@@ -1528,6 +2290,7 @@ var LambdaInvocationError = class extends RuntimeError {
1528
2290
 
1529
2291
  // src/aws/LambdaClient.ts
1530
2292
  var LambdaClient = class {
2293
+ client;
1531
2294
  constructor(config) {
1532
2295
  this.client = new import_client_lambda.LambdaClient({});
1533
2296
  if (config) {
@@ -1595,14 +2358,14 @@ var LambdaClient = class {
1595
2358
 
1596
2359
  // src/stateMachine/stateActions/TaskStateAction.ts
1597
2360
  var TaskStateAction = class extends BaseStateAction {
2361
+ timeoutAbortController;
1598
2362
  constructor(stateDefinition, stateName) {
1599
2363
  super(stateDefinition, stateName);
1600
2364
  this.timeoutAbortController = new AbortController();
1601
2365
  }
1602
2366
  createTimeoutPromise(input, context) {
1603
2367
  const state = this.stateDefinition;
1604
- if (!state.TimeoutSeconds && !state.TimeoutSecondsPath)
1605
- return;
2368
+ if (!state.TimeoutSeconds && !state.TimeoutSecondsPath) return;
1606
2369
  let timeout;
1607
2370
  if (state.TimeoutSeconds) {
1608
2371
  timeout = state.TimeoutSeconds;
@@ -1686,6 +2449,22 @@ var DEFAULT_JITTER_STRATEGY = "NONE";
1686
2449
  var WILDCARD_ERROR = "States.ALL";
1687
2450
  var TASK_STATE_WILDCARD_ERROR = "States.TaskFailed";
1688
2451
  var StateExecutor = class {
2452
+ /**
2453
+ * The name of the state.
2454
+ */
2455
+ stateName;
2456
+ /**
2457
+ * The Amazon States Language definition of the state.
2458
+ */
2459
+ stateDefinition;
2460
+ /**
2461
+ * An array that stores the number of times each retrier in a Retryable state has been retried.
2462
+ */
2463
+ retrierAttempts;
2464
+ /**
2465
+ * A map of functions to execute each type of state.
2466
+ */
2467
+ stateHandlers;
1689
2468
  constructor(stateName, stateDefinition) {
1690
2469
  this.stateName = stateName;
1691
2470
  this.stateDefinition = stateDefinition;
@@ -1713,7 +2492,7 @@ var StateExecutor = class {
1713
2492
  nextState,
1714
2493
  isEndState
1715
2494
  } = await this.stateHandlers[this.stateDefinition.Type](
1716
- // @ts-expect-error Indexing `this.stateActions` by non-literal value produces a `never` type for the `this.stateDefinition` parameter of the handler being called
2495
+ // @ts-expect-error Indexing `this.stateHandlers` by non-literal value produces a `never` type for the `this.stateDefinition` parameter of the handler being called
1717
2496
  this.stateDefinition,
1718
2497
  rawInput,
1719
2498
  processedInput,
@@ -1823,8 +2602,7 @@ var StateExecutor = class {
1823
2602
  const isErrorTaskWildcard = retrierError === TASK_STATE_WILDCARD_ERROR && this.stateDefinition.Type === "Task" && !(error instanceof StatesTimeoutError);
1824
2603
  const maybeShouldRetry = retryable && (isErrorMatch || isErrorWildcard || isErrorTaskWildcard);
1825
2604
  if (maybeShouldRetry) {
1826
- if (this.retrierAttempts[i] >= maxAttempts)
1827
- return { shouldRetry: false };
2605
+ if (this.retrierAttempts[i] >= maxAttempts) return { shouldRetry: false };
1828
2606
  this.retrierAttempts[i]++;
1829
2607
  return { shouldRetry: true, waitTimeBeforeRetry, retrierIndex: i };
1830
2608
  }
@@ -1975,6 +2753,9 @@ var StateExecutor = class {
1975
2753
 
1976
2754
  // src/stateMachine/EventLogger.ts
1977
2755
  var EventLogger = class {
2756
+ eventTarget;
2757
+ eventQueue;
2758
+ isLoggerClosed;
1978
2759
  constructor() {
1979
2760
  this.eventTarget = new EventTarget();
1980
2761
  this.eventQueue = [];
@@ -1989,8 +2770,7 @@ var EventLogger = class {
1989
2770
  while (event = this.eventQueue.shift()) {
1990
2771
  yield event;
1991
2772
  }
1992
- if (this.isLoggerClosed)
1993
- return;
2773
+ if (this.isLoggerClosed) return;
1994
2774
  }
1995
2775
  }
1996
2776
  /**
@@ -2165,14 +2945,12 @@ var EventLogger = class {
2165
2945
  this.eventTarget.dispatchEvent(new Event("newEvent"));
2166
2946
  }
2167
2947
  dispatch(event) {
2168
- if (this.isLoggerClosed)
2169
- return;
2948
+ if (this.isLoggerClosed) return;
2170
2949
  this.eventQueue.push(event);
2171
2950
  this.eventTarget.dispatchEvent(new Event("newEvent"));
2172
2951
  }
2173
2952
  waitForNewEvent() {
2174
- if (this.isLoggerClosed)
2175
- return;
2953
+ if (this.isLoggerClosed) return;
2176
2954
  return new Promise((resolve) => {
2177
2955
  this.eventTarget.addEventListener("newEvent", resolve, { once: true });
2178
2956
  });
@@ -2183,6 +2961,14 @@ var EventLogger = class {
2183
2961
  var import_asl_validator = __toESM(require("asl-validator"), 1);
2184
2962
  var import_cloneDeep3 = __toESM(require("lodash/cloneDeep.js"), 1);
2185
2963
  var StateMachine = class {
2964
+ /**
2965
+ * The structure of the State Machine as represented by the Amazon States Language.
2966
+ */
2967
+ definition;
2968
+ /**
2969
+ * Options to control certain settings of the state machine.
2970
+ */
2971
+ stateMachineOptions;
2186
2972
  /**
2187
2973
  * Constructs a new state machine.
2188
2974
  * @param definition The state machine definition defined using the Amazon States Language (https://states-language.net/spec.html).