@ssv-labs/ssv-sdk 0.0.3 → 0.0.5

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/dist/main.mjs CHANGED
@@ -1,168 +1,7 @@
1
- import { d as decodeOperatorPublicKey, M as MapCache, S as Symbol$1, e as eq, U as Uint8Array$1, g as getAllKeys, a as getTag, i as isBuffer, b as Stack, c as isTypedArray$1, f as isArray$1, h as isObjectLike$1, s as stringifyBigints, j as isUndefined$1, t as tryCatch$1, k as configArgsSchema, l as getClusterSnapshot$1, m as isKeySharesItem, n as createClusterId, o as createEmptyCluster, r as roundOperatorFee, p as bigintMax, q as ensureNoKeysharesErrors, u as ensureValidatorsUniqueness, v as validateConsistentOperatorPublicKeys, w as validateConsistentOperatorIds, x as sortNumbers, K as KeysharesValidationError, y as KeysharesValidationErrors } from "./config-DlwfpwZd.mjs";
1
+ import { p as process$1, d as decodeOperatorPublicKey, M as MapCache, S as Symbol$1, e as eq, U as Uint8Array$1, g as getAllKeys, a as getTag, i as isBuffer, b as Stack, c as isTypedArray$1, f as isArray$1, h as isObjectLike$1, s as stringifyBigints, j as isUndefined$1, t as tryCatch$1, k as configArgsSchema, l as chainIds, m as contracts, n as graph_endpoints, r as rest_endpoints, o as getClusterSnapshot$1, q as isKeySharesItem, u as registerValidatorsByClusterSizeLimits, v as createClusterId, w as createEmptyCluster, x as roundOperatorFee, y as globals, z as bigintMax, A as ensureNoKeysharesErrors, B as ensureValidatorsUniqueness, C as validateConsistentOperatorPublicKeys, D as validateConsistentOperatorIds, E as sortNumbers, K as KeysharesValidationError, F as KeysharesValidationErrors } from "./globals-DsbufPrE.mjs";
2
+ import { H, G as G2, I } from "./globals-DsbufPrE.mjs";
2
3
  import { decodeEventLog, encodeAbiParameters, parseAbiParameters, isAddressEqual, zeroAddress } from "viem";
3
4
  import { SSVKeys, KeyShares, KeySharesItem } from "ssv-keys";
4
- function getDefaultExportFromCjs$1(x) {
5
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
6
- }
7
- var browser$e = { exports: {} };
8
- var process = browser$e.exports = {};
9
- var cachedSetTimeout;
10
- var cachedClearTimeout;
11
- function defaultSetTimout() {
12
- throw new Error("setTimeout has not been defined");
13
- }
14
- function defaultClearTimeout() {
15
- throw new Error("clearTimeout has not been defined");
16
- }
17
- (function() {
18
- try {
19
- if (typeof setTimeout === "function") {
20
- cachedSetTimeout = setTimeout;
21
- } else {
22
- cachedSetTimeout = defaultSetTimout;
23
- }
24
- } catch (e) {
25
- cachedSetTimeout = defaultSetTimout;
26
- }
27
- try {
28
- if (typeof clearTimeout === "function") {
29
- cachedClearTimeout = clearTimeout;
30
- } else {
31
- cachedClearTimeout = defaultClearTimeout;
32
- }
33
- } catch (e) {
34
- cachedClearTimeout = defaultClearTimeout;
35
- }
36
- })();
37
- function runTimeout(fun) {
38
- if (cachedSetTimeout === setTimeout) {
39
- return setTimeout(fun, 0);
40
- }
41
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
42
- cachedSetTimeout = setTimeout;
43
- return setTimeout(fun, 0);
44
- }
45
- try {
46
- return cachedSetTimeout(fun, 0);
47
- } catch (e) {
48
- try {
49
- return cachedSetTimeout.call(null, fun, 0);
50
- } catch (e2) {
51
- return cachedSetTimeout.call(this, fun, 0);
52
- }
53
- }
54
- }
55
- function runClearTimeout(marker) {
56
- if (cachedClearTimeout === clearTimeout) {
57
- return clearTimeout(marker);
58
- }
59
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
60
- cachedClearTimeout = clearTimeout;
61
- return clearTimeout(marker);
62
- }
63
- try {
64
- return cachedClearTimeout(marker);
65
- } catch (e) {
66
- try {
67
- return cachedClearTimeout.call(null, marker);
68
- } catch (e2) {
69
- return cachedClearTimeout.call(this, marker);
70
- }
71
- }
72
- }
73
- var queue = [];
74
- var draining = false;
75
- var currentQueue;
76
- var queueIndex = -1;
77
- function cleanUpNextTick() {
78
- if (!draining || !currentQueue) {
79
- return;
80
- }
81
- draining = false;
82
- if (currentQueue.length) {
83
- queue = currentQueue.concat(queue);
84
- } else {
85
- queueIndex = -1;
86
- }
87
- if (queue.length) {
88
- drainQueue();
89
- }
90
- }
91
- function drainQueue() {
92
- if (draining) {
93
- return;
94
- }
95
- var timeout = runTimeout(cleanUpNextTick);
96
- draining = true;
97
- var len = queue.length;
98
- while (len) {
99
- currentQueue = queue;
100
- queue = [];
101
- while (++queueIndex < len) {
102
- if (currentQueue) {
103
- currentQueue[queueIndex].run();
104
- }
105
- }
106
- queueIndex = -1;
107
- len = queue.length;
108
- }
109
- currentQueue = null;
110
- draining = false;
111
- runClearTimeout(timeout);
112
- }
113
- process.nextTick = function(fun) {
114
- var args = new Array(arguments.length - 1);
115
- if (arguments.length > 1) {
116
- for (var i = 1; i < arguments.length; i++) {
117
- args[i - 1] = arguments[i];
118
- }
119
- }
120
- queue.push(new Item(fun, args));
121
- if (queue.length === 1 && !draining) {
122
- runTimeout(drainQueue);
123
- }
124
- };
125
- function Item(fun, array) {
126
- this.fun = fun;
127
- this.array = array;
128
- }
129
- Item.prototype.run = function() {
130
- this.fun.apply(null, this.array);
131
- };
132
- process.title = "browser";
133
- process.browser = true;
134
- process.env = {};
135
- process.argv = [];
136
- process.version = "";
137
- process.versions = {};
138
- function noop() {
139
- }
140
- process.on = noop;
141
- process.addListener = noop;
142
- process.once = noop;
143
- process.off = noop;
144
- process.removeListener = noop;
145
- process.removeAllListeners = noop;
146
- process.emit = noop;
147
- process.prependListener = noop;
148
- process.prependOnceListener = noop;
149
- process.listeners = function(name2) {
150
- return [];
151
- };
152
- process.binding = function(name2) {
153
- throw new Error("process.binding is not supported");
154
- };
155
- process.cwd = function() {
156
- return "/";
157
- };
158
- process.chdir = function(dir) {
159
- throw new Error("process.chdir is not supported");
160
- };
161
- process.umask = function() {
162
- return 0;
163
- };
164
- var browserExports$1 = browser$e.exports;
165
- const process$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(browserExports$1);
166
5
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
167
6
  function getDefaultExportFromCjs(x) {
168
7
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -943,7 +782,7 @@ var dist = {};
943
782
  }
944
783
  return -1;
945
784
  }
946
- Buffer3.prototype.includes = function includes(val, byteOffset, encoding) {
785
+ Buffer3.prototype.includes = function includes2(val, byteOffset, encoding) {
947
786
  return this.indexOf(val, byteOffset, encoding) !== -1;
948
787
  };
949
788
  Buffer3.prototype.indexOf = function indexOf3(val, byteOffset, encoding) {
@@ -2555,7 +2394,7 @@ function EventEmitter() {
2555
2394
  EventEmitter.init.call(this);
2556
2395
  }
2557
2396
  events.exports = EventEmitter;
2558
- events.exports.once = once;
2397
+ events.exports.once = once$2;
2559
2398
  EventEmitter.EventEmitter = EventEmitter;
2560
2399
  EventEmitter.prototype._events = void 0;
2561
2400
  EventEmitter.prototype._eventsCount = 0;
@@ -2849,7 +2688,7 @@ function unwrapListeners(arr) {
2849
2688
  }
2850
2689
  return ret;
2851
2690
  }
2852
- function once(emitter, name2) {
2691
+ function once$2(emitter, name2) {
2853
2692
  return new Promise(function(resolve2, reject) {
2854
2693
  function errorListener(err) {
2855
2694
  emitter.removeListener(name2, resolver);
@@ -2891,14 +2730,7 @@ function eventTargetAgnosticAddListener(emitter, name2, listener, flags) {
2891
2730
  }
2892
2731
  }
2893
2732
  var eventsExports = events.exports;
2894
- var streamBrowser$1;
2895
- var hasRequiredStreamBrowser;
2896
- function requireStreamBrowser() {
2897
- if (hasRequiredStreamBrowser) return streamBrowser$1;
2898
- hasRequiredStreamBrowser = 1;
2899
- streamBrowser$1 = eventsExports.EventEmitter;
2900
- return streamBrowser$1;
2901
- }
2733
+ var streamBrowser$1 = eventsExports.EventEmitter;
2902
2734
  var util$3 = {};
2903
2735
  var types$1 = {};
2904
2736
  var shams$1 = function hasSymbols2() {
@@ -3053,10 +2885,10 @@ var implementation$1 = function bind2(that) {
3053
2885
  };
3054
2886
  var implementation = implementation$1;
3055
2887
  var functionBind = Function.prototype.bind || implementation;
3056
- var call = Function.prototype.call;
2888
+ var call$1 = Function.prototype.call;
3057
2889
  var $hasOwn = Object.prototype.hasOwnProperty;
3058
2890
  var bind$1 = functionBind;
3059
- var hasown = bind$1.call(call, $hasOwn);
2891
+ var hasown = bind$1.call(call$1, $hasOwn);
3060
2892
  var undefined$1;
3061
2893
  var $Error = esErrors;
3062
2894
  var $EvalError = _eval;
@@ -4897,229 +4729,209 @@ function requireBuffer_list() {
4897
4729
  }();
4898
4730
  return buffer_list;
4899
4731
  }
4900
- var destroy_1$1;
4901
- var hasRequiredDestroy;
4902
- function requireDestroy() {
4903
- if (hasRequiredDestroy) return destroy_1$1;
4904
- hasRequiredDestroy = 1;
4905
- function destroy2(err, cb) {
4906
- var _this = this;
4907
- var readableDestroyed = this._readableState && this._readableState.destroyed;
4908
- var writableDestroyed = this._writableState && this._writableState.destroyed;
4909
- if (readableDestroyed || writableDestroyed) {
4910
- if (cb) {
4911
- cb(err);
4912
- } else if (err) {
4913
- if (!this._writableState) {
4914
- process$1.nextTick(emitErrorNT2, this, err);
4915
- } else if (!this._writableState.errorEmitted) {
4916
- this._writableState.errorEmitted = true;
4917
- process$1.nextTick(emitErrorNT2, this, err);
4918
- }
4732
+ function destroy$1(err, cb) {
4733
+ var _this = this;
4734
+ var readableDestroyed = this._readableState && this._readableState.destroyed;
4735
+ var writableDestroyed = this._writableState && this._writableState.destroyed;
4736
+ if (readableDestroyed || writableDestroyed) {
4737
+ if (cb) {
4738
+ cb(err);
4739
+ } else if (err) {
4740
+ if (!this._writableState) {
4741
+ process$1.nextTick(emitErrorNT$1, this, err);
4742
+ } else if (!this._writableState.errorEmitted) {
4743
+ this._writableState.errorEmitted = true;
4744
+ process$1.nextTick(emitErrorNT$1, this, err);
4919
4745
  }
4920
- return this;
4921
- }
4922
- if (this._readableState) {
4923
- this._readableState.destroyed = true;
4924
4746
  }
4925
- if (this._writableState) {
4926
- this._writableState.destroyed = true;
4927
- }
4928
- this._destroy(err || null, function(err2) {
4929
- if (!cb && err2) {
4930
- if (!_this._writableState) {
4931
- process$1.nextTick(emitErrorAndCloseNT, _this, err2);
4932
- } else if (!_this._writableState.errorEmitted) {
4933
- _this._writableState.errorEmitted = true;
4934
- process$1.nextTick(emitErrorAndCloseNT, _this, err2);
4935
- } else {
4936
- process$1.nextTick(emitCloseNT, _this);
4937
- }
4938
- } else if (cb) {
4939
- process$1.nextTick(emitCloseNT, _this);
4940
- cb(err2);
4941
- } else {
4942
- process$1.nextTick(emitCloseNT, _this);
4943
- }
4944
- });
4945
4747
  return this;
4946
4748
  }
4947
- function emitErrorAndCloseNT(self2, err) {
4948
- emitErrorNT2(self2, err);
4949
- emitCloseNT(self2);
4950
- }
4951
- function emitCloseNT(self2) {
4952
- if (self2._writableState && !self2._writableState.emitClose) return;
4953
- if (self2._readableState && !self2._readableState.emitClose) return;
4954
- self2.emit("close");
4955
- }
4956
- function undestroy2() {
4957
- if (this._readableState) {
4958
- this._readableState.destroyed = false;
4959
- this._readableState.reading = false;
4960
- this._readableState.ended = false;
4961
- this._readableState.endEmitted = false;
4962
- }
4963
- if (this._writableState) {
4964
- this._writableState.destroyed = false;
4965
- this._writableState.ended = false;
4966
- this._writableState.ending = false;
4967
- this._writableState.finalCalled = false;
4968
- this._writableState.prefinished = false;
4969
- this._writableState.finished = false;
4970
- this._writableState.errorEmitted = false;
4971
- }
4972
- }
4973
- function emitErrorNT2(self2, err) {
4974
- self2.emit("error", err);
4975
- }
4976
- function errorOrDestroy(stream, err) {
4977
- var rState = stream._readableState;
4978
- var wState = stream._writableState;
4979
- if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);
4980
- else stream.emit("error", err);
4981
- }
4982
- destroy_1$1 = {
4983
- destroy: destroy2,
4984
- undestroy: undestroy2,
4985
- errorOrDestroy
4986
- };
4987
- return destroy_1$1;
4988
- }
4989
- var errorsBrowser = {};
4990
- var hasRequiredErrorsBrowser;
4991
- function requireErrorsBrowser() {
4992
- if (hasRequiredErrorsBrowser) return errorsBrowser;
4993
- hasRequiredErrorsBrowser = 1;
4994
- function _inheritsLoose(subClass, superClass) {
4995
- subClass.prototype = Object.create(superClass.prototype);
4996
- subClass.prototype.constructor = subClass;
4997
- subClass.__proto__ = superClass;
4998
- }
4999
- var codes = {};
5000
- function createErrorType(code, message, Base2) {
5001
- if (!Base2) {
5002
- Base2 = Error;
5003
- }
5004
- function getMessage(arg1, arg2, arg3) {
5005
- if (typeof message === "string") {
5006
- return message;
5007
- } else {
5008
- return message(arg1, arg2, arg3);
5009
- }
5010
- }
5011
- var NodeError = /* @__PURE__ */ function(_Base) {
5012
- _inheritsLoose(NodeError2, _Base);
5013
- function NodeError2(arg1, arg2, arg3) {
5014
- return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
5015
- }
5016
- return NodeError2;
5017
- }(Base2);
5018
- NodeError.prototype.name = Base2.name;
5019
- NodeError.prototype.code = code;
5020
- codes[code] = NodeError;
4749
+ if (this._readableState) {
4750
+ this._readableState.destroyed = true;
5021
4751
  }
5022
- function oneOf(expected, thing) {
5023
- if (Array.isArray(expected)) {
5024
- var len = expected.length;
5025
- expected = expected.map(function(i) {
5026
- return String(i);
5027
- });
5028
- if (len > 2) {
5029
- return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1];
5030
- } else if (len === 2) {
5031
- return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
4752
+ if (this._writableState) {
4753
+ this._writableState.destroyed = true;
4754
+ }
4755
+ this._destroy(err || null, function(err2) {
4756
+ if (!cb && err2) {
4757
+ if (!_this._writableState) {
4758
+ process$1.nextTick(emitErrorAndCloseNT, _this, err2);
4759
+ } else if (!_this._writableState.errorEmitted) {
4760
+ _this._writableState.errorEmitted = true;
4761
+ process$1.nextTick(emitErrorAndCloseNT, _this, err2);
5032
4762
  } else {
5033
- return "of ".concat(thing, " ").concat(expected[0]);
4763
+ process$1.nextTick(emitCloseNT, _this);
5034
4764
  }
4765
+ } else if (cb) {
4766
+ process$1.nextTick(emitCloseNT, _this);
4767
+ cb(err2);
5035
4768
  } else {
5036
- return "of ".concat(thing, " ").concat(String(expected));
4769
+ process$1.nextTick(emitCloseNT, _this);
5037
4770
  }
4771
+ });
4772
+ return this;
4773
+ }
4774
+ function emitErrorAndCloseNT(self2, err) {
4775
+ emitErrorNT$1(self2, err);
4776
+ emitCloseNT(self2);
4777
+ }
4778
+ function emitCloseNT(self2) {
4779
+ if (self2._writableState && !self2._writableState.emitClose) return;
4780
+ if (self2._readableState && !self2._readableState.emitClose) return;
4781
+ self2.emit("close");
4782
+ }
4783
+ function undestroy$1() {
4784
+ if (this._readableState) {
4785
+ this._readableState.destroyed = false;
4786
+ this._readableState.reading = false;
4787
+ this._readableState.ended = false;
4788
+ this._readableState.endEmitted = false;
5038
4789
  }
5039
- function startsWith(str, search, pos) {
5040
- return str.substr(0, search.length) === search;
5041
- }
5042
- function endsWith(str, search, this_len) {
5043
- if (this_len === void 0 || this_len > str.length) {
5044
- this_len = str.length;
5045
- }
5046
- return str.substring(this_len - search.length, this_len) === search;
4790
+ if (this._writableState) {
4791
+ this._writableState.destroyed = false;
4792
+ this._writableState.ended = false;
4793
+ this._writableState.ending = false;
4794
+ this._writableState.finalCalled = false;
4795
+ this._writableState.prefinished = false;
4796
+ this._writableState.finished = false;
4797
+ this._writableState.errorEmitted = false;
5047
4798
  }
5048
- function includes(str, search, start) {
5049
- if (typeof start !== "number") {
5050
- start = 0;
5051
- }
5052
- if (start + search.length > str.length) {
5053
- return false;
4799
+ }
4800
+ function emitErrorNT$1(self2, err) {
4801
+ self2.emit("error", err);
4802
+ }
4803
+ function errorOrDestroy(stream, err) {
4804
+ var rState = stream._readableState;
4805
+ var wState = stream._writableState;
4806
+ if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);
4807
+ else stream.emit("error", err);
4808
+ }
4809
+ var destroy_1$1 = {
4810
+ destroy: destroy$1,
4811
+ undestroy: undestroy$1,
4812
+ errorOrDestroy
4813
+ };
4814
+ var errorsBrowser = {};
4815
+ function _inheritsLoose(subClass, superClass) {
4816
+ subClass.prototype = Object.create(superClass.prototype);
4817
+ subClass.prototype.constructor = subClass;
4818
+ subClass.__proto__ = superClass;
4819
+ }
4820
+ var codes = {};
4821
+ function createErrorType(code, message, Base2) {
4822
+ if (!Base2) {
4823
+ Base2 = Error;
4824
+ }
4825
+ function getMessage(arg1, arg2, arg3) {
4826
+ if (typeof message === "string") {
4827
+ return message;
5054
4828
  } else {
5055
- return str.indexOf(search, start) !== -1;
4829
+ return message(arg1, arg2, arg3);
5056
4830
  }
5057
4831
  }
5058
- createErrorType("ERR_INVALID_OPT_VALUE", function(name2, value) {
5059
- return 'The value "' + value + '" is invalid for option "' + name2 + '"';
5060
- }, TypeError);
5061
- createErrorType("ERR_INVALID_ARG_TYPE", function(name2, expected, actual) {
5062
- var determiner;
5063
- if (typeof expected === "string" && startsWith(expected, "not ")) {
5064
- determiner = "must not be";
5065
- expected = expected.replace(/^not /, "");
5066
- } else {
5067
- determiner = "must be";
4832
+ var NodeError = /* @__PURE__ */ function(_Base) {
4833
+ _inheritsLoose(NodeError2, _Base);
4834
+ function NodeError2(arg1, arg2, arg3) {
4835
+ return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
5068
4836
  }
5069
- var msg;
5070
- if (endsWith(name2, " argument")) {
5071
- msg = "The ".concat(name2, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4837
+ return NodeError2;
4838
+ }(Base2);
4839
+ NodeError.prototype.name = Base2.name;
4840
+ NodeError.prototype.code = code;
4841
+ codes[code] = NodeError;
4842
+ }
4843
+ function oneOf(expected, thing) {
4844
+ if (Array.isArray(expected)) {
4845
+ var len = expected.length;
4846
+ expected = expected.map(function(i) {
4847
+ return String(i);
4848
+ });
4849
+ if (len > 2) {
4850
+ return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1];
4851
+ } else if (len === 2) {
4852
+ return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
5072
4853
  } else {
5073
- var type2 = includes(name2, ".") ? "property" : "argument";
5074
- msg = 'The "'.concat(name2, '" ').concat(type2, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4854
+ return "of ".concat(thing, " ").concat(expected[0]);
5075
4855
  }
5076
- msg += ". Received type ".concat(typeof actual);
5077
- return msg;
5078
- }, TypeError);
5079
- createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
5080
- createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name2) {
5081
- return "The " + name2 + " method is not implemented";
5082
- });
5083
- createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");
5084
- createErrorType("ERR_STREAM_DESTROYED", function(name2) {
5085
- return "Cannot call " + name2 + " after a stream was destroyed";
5086
- });
5087
- createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");
5088
- createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");
5089
- createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
5090
- createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
5091
- createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {
5092
- return "Unknown encoding: " + arg;
5093
- }, TypeError);
5094
- createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
5095
- errorsBrowser.codes = codes;
5096
- return errorsBrowser;
5097
- }
5098
- var state;
5099
- var hasRequiredState;
5100
- function requireState() {
5101
- if (hasRequiredState) return state;
5102
- hasRequiredState = 1;
5103
- var ERR_INVALID_OPT_VALUE = requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;
5104
- function highWaterMarkFrom(options2, isDuplex, duplexKey) {
5105
- return options2.highWaterMark != null ? options2.highWaterMark : isDuplex ? options2[duplexKey] : null;
5106
- }
5107
- function getHighWaterMark(state2, options2, duplexKey, isDuplex) {
5108
- var hwm = highWaterMarkFrom(options2, isDuplex, duplexKey);
5109
- if (hwm != null) {
5110
- if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
5111
- var name2 = isDuplex ? duplexKey : "highWaterMark";
5112
- throw new ERR_INVALID_OPT_VALUE(name2, hwm);
5113
- }
5114
- return Math.floor(hwm);
5115
- }
5116
- return state2.objectMode ? 16 : 16 * 1024;
5117
- }
5118
- state = {
5119
- getHighWaterMark
5120
- };
5121
- return state;
4856
+ } else {
4857
+ return "of ".concat(thing, " ").concat(String(expected));
4858
+ }
4859
+ }
4860
+ function startsWith(str, search, pos) {
4861
+ return str.substr(0, search.length) === search;
4862
+ }
4863
+ function endsWith(str, search, this_len) {
4864
+ if (this_len === void 0 || this_len > str.length) {
4865
+ this_len = str.length;
4866
+ }
4867
+ return str.substring(this_len - search.length, this_len) === search;
4868
+ }
4869
+ function includes(str, search, start) {
4870
+ if (typeof start !== "number") {
4871
+ start = 0;
4872
+ }
4873
+ if (start + search.length > str.length) {
4874
+ return false;
4875
+ } else {
4876
+ return str.indexOf(search, start) !== -1;
4877
+ }
5122
4878
  }
4879
+ createErrorType("ERR_INVALID_OPT_VALUE", function(name2, value) {
4880
+ return 'The value "' + value + '" is invalid for option "' + name2 + '"';
4881
+ }, TypeError);
4882
+ createErrorType("ERR_INVALID_ARG_TYPE", function(name2, expected, actual) {
4883
+ var determiner;
4884
+ if (typeof expected === "string" && startsWith(expected, "not ")) {
4885
+ determiner = "must not be";
4886
+ expected = expected.replace(/^not /, "");
4887
+ } else {
4888
+ determiner = "must be";
4889
+ }
4890
+ var msg;
4891
+ if (endsWith(name2, " argument")) {
4892
+ msg = "The ".concat(name2, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4893
+ } else {
4894
+ var type2 = includes(name2, ".") ? "property" : "argument";
4895
+ msg = 'The "'.concat(name2, '" ').concat(type2, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4896
+ }
4897
+ msg += ". Received type ".concat(typeof actual);
4898
+ return msg;
4899
+ }, TypeError);
4900
+ createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
4901
+ createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name2) {
4902
+ return "The " + name2 + " method is not implemented";
4903
+ });
4904
+ createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");
4905
+ createErrorType("ERR_STREAM_DESTROYED", function(name2) {
4906
+ return "Cannot call " + name2 + " after a stream was destroyed";
4907
+ });
4908
+ createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");
4909
+ createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");
4910
+ createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
4911
+ createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
4912
+ createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {
4913
+ return "Unknown encoding: " + arg;
4914
+ }, TypeError);
4915
+ createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
4916
+ errorsBrowser.codes = codes;
4917
+ var ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
4918
+ function highWaterMarkFrom(options2, isDuplex, duplexKey) {
4919
+ return options2.highWaterMark != null ? options2.highWaterMark : isDuplex ? options2[duplexKey] : null;
4920
+ }
4921
+ function getHighWaterMark(state2, options2, duplexKey, isDuplex) {
4922
+ var hwm = highWaterMarkFrom(options2, isDuplex, duplexKey);
4923
+ if (hwm != null) {
4924
+ if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
4925
+ var name2 = isDuplex ? duplexKey : "highWaterMark";
4926
+ throw new ERR_INVALID_OPT_VALUE(name2, hwm);
4927
+ }
4928
+ return Math.floor(hwm);
4929
+ }
4930
+ return state2.objectMode ? 16 : 16 * 1024;
4931
+ }
4932
+ var state = {
4933
+ getHighWaterMark
4934
+ };
5123
4935
  var browser$b = deprecate;
5124
4936
  function deprecate(fn, msg) {
5125
4937
  if (config$1("noDeprecation")) {
@@ -5170,7 +4982,7 @@ function require_stream_writable$1() {
5170
4982
  var internalUtil = {
5171
4983
  deprecate: browser$b
5172
4984
  };
5173
- var Stream2 = requireStreamBrowser();
4985
+ var Stream2 = streamBrowser$1;
5174
4986
  var Buffer2 = dist.Buffer;
5175
4987
  var OurUint8Array = (typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
5176
4988
  };
@@ -5180,10 +4992,10 @@ function require_stream_writable$1() {
5180
4992
  function _isUint8Array(obj) {
5181
4993
  return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
5182
4994
  }
5183
- var destroyImpl = requireDestroy();
5184
- var _require = requireState(), getHighWaterMark = _require.getHighWaterMark;
5185
- var _require$codes = requireErrorsBrowser().codes, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
5186
- var errorOrDestroy = destroyImpl.errorOrDestroy;
4995
+ var destroyImpl = destroy_1$1;
4996
+ var _require = state, getHighWaterMark2 = _require.getHighWaterMark;
4997
+ var _require$codes2 = errorsBrowser.codes, ERR_INVALID_ARG_TYPE = _require$codes2.ERR_INVALID_ARG_TYPE, ERR_METHOD_NOT_IMPLEMENTED2 = _require$codes2.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK2 = _require$codes2.ERR_MULTIPLE_CALLBACK, ERR_STREAM_CANNOT_PIPE = _require$codes2.ERR_STREAM_CANNOT_PIPE, ERR_STREAM_DESTROYED2 = _require$codes2.ERR_STREAM_DESTROYED, ERR_STREAM_NULL_VALUES = _require$codes2.ERR_STREAM_NULL_VALUES, ERR_STREAM_WRITE_AFTER_END = _require$codes2.ERR_STREAM_WRITE_AFTER_END, ERR_UNKNOWN_ENCODING = _require$codes2.ERR_UNKNOWN_ENCODING;
4998
+ var errorOrDestroy2 = destroyImpl.errorOrDestroy;
5187
4999
  inherits_browserExports(Writable, Stream2);
5188
5000
  function nop() {
5189
5001
  }
@@ -5193,7 +5005,7 @@ function require_stream_writable$1() {
5193
5005
  if (typeof isDuplex !== "boolean") isDuplex = stream instanceof Duplex2;
5194
5006
  this.objectMode = !!options2.objectMode;
5195
5007
  if (isDuplex) this.objectMode = this.objectMode || !!options2.writableObjectMode;
5196
- this.highWaterMark = getHighWaterMark(this, options2, "writableHighWaterMark", isDuplex);
5008
+ this.highWaterMark = getHighWaterMark2(this, options2, "writableHighWaterMark", isDuplex);
5197
5009
  this.finalCalled = false;
5198
5010
  this.needDrain = false;
5199
5011
  this.ending = false;
@@ -5272,11 +5084,11 @@ function require_stream_writable$1() {
5272
5084
  Stream2.call(this);
5273
5085
  }
5274
5086
  Writable.prototype.pipe = function() {
5275
- errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
5087
+ errorOrDestroy2(this, new ERR_STREAM_CANNOT_PIPE());
5276
5088
  };
5277
5089
  function writeAfterEnd(stream, cb) {
5278
5090
  var er = new ERR_STREAM_WRITE_AFTER_END();
5279
- errorOrDestroy(stream, er);
5091
+ errorOrDestroy2(stream, er);
5280
5092
  process$1.nextTick(cb, er);
5281
5093
  }
5282
5094
  function validChunk(stream, state2, chunk, cb) {
@@ -5287,7 +5099,7 @@ function require_stream_writable$1() {
5287
5099
  er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
5288
5100
  }
5289
5101
  if (er) {
5290
- errorOrDestroy(stream, er);
5102
+ errorOrDestroy2(stream, er);
5291
5103
  process$1.nextTick(cb, er);
5292
5104
  return false;
5293
5105
  }
@@ -5392,7 +5204,7 @@ function require_stream_writable$1() {
5392
5204
  state2.writecb = cb;
5393
5205
  state2.writing = true;
5394
5206
  state2.sync = true;
5395
- if (state2.destroyed) state2.onwrite(new ERR_STREAM_DESTROYED("write"));
5207
+ if (state2.destroyed) state2.onwrite(new ERR_STREAM_DESTROYED2("write"));
5396
5208
  else if (writev) stream._writev(chunk, state2.onwrite);
5397
5209
  else stream._write(chunk, encoding, state2.onwrite);
5398
5210
  state2.sync = false;
@@ -5403,11 +5215,11 @@ function require_stream_writable$1() {
5403
5215
  process$1.nextTick(cb, er);
5404
5216
  process$1.nextTick(finishMaybe, stream, state2);
5405
5217
  stream._writableState.errorEmitted = true;
5406
- errorOrDestroy(stream, er);
5218
+ errorOrDestroy2(stream, er);
5407
5219
  } else {
5408
5220
  cb(er);
5409
5221
  stream._writableState.errorEmitted = true;
5410
- errorOrDestroy(stream, er);
5222
+ errorOrDestroy2(stream, er);
5411
5223
  finishMaybe(stream, state2);
5412
5224
  }
5413
5225
  }
@@ -5421,7 +5233,7 @@ function require_stream_writable$1() {
5421
5233
  var state2 = stream._writableState;
5422
5234
  var sync2 = state2.sync;
5423
5235
  var cb = state2.writecb;
5424
- if (typeof cb !== "function") throw new ERR_MULTIPLE_CALLBACK();
5236
+ if (typeof cb !== "function") throw new ERR_MULTIPLE_CALLBACK2();
5425
5237
  onwriteStateUpdate(state2);
5426
5238
  if (er) onwriteError(stream, state2, sync2, er, cb);
5427
5239
  else {
@@ -5494,7 +5306,7 @@ function require_stream_writable$1() {
5494
5306
  state2.bufferProcessing = false;
5495
5307
  }
5496
5308
  Writable.prototype._write = function(chunk, encoding, cb) {
5497
- cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));
5309
+ cb(new ERR_METHOD_NOT_IMPLEMENTED2("_write()"));
5498
5310
  };
5499
5311
  Writable.prototype._writev = null;
5500
5312
  Writable.prototype.end = function(chunk, encoding, cb) {
@@ -5531,7 +5343,7 @@ function require_stream_writable$1() {
5531
5343
  stream._final(function(err) {
5532
5344
  state2.pendingcb--;
5533
5345
  if (err) {
5534
- errorOrDestroy(stream, err);
5346
+ errorOrDestroy2(stream, err);
5535
5347
  }
5536
5348
  state2.prefinished = true;
5537
5349
  stream.emit("prefinish");
@@ -5935,95 +5747,88 @@ function simpleWrite(buf) {
5935
5747
  function simpleEnd(buf) {
5936
5748
  return buf && buf.length ? this.write(buf) : "";
5937
5749
  }
5938
- var endOfStream;
5939
- var hasRequiredEndOfStream;
5940
- function requireEndOfStream() {
5941
- if (hasRequiredEndOfStream) return endOfStream;
5942
- hasRequiredEndOfStream = 1;
5943
- var ERR_STREAM_PREMATURE_CLOSE = requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;
5944
- function once3(callback) {
5945
- var called = false;
5946
- return function() {
5947
- if (called) return;
5948
- called = true;
5949
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5950
- args[_key] = arguments[_key];
5951
- }
5952
- callback.apply(this, args);
5953
- };
5954
- }
5955
- function noop2() {
5956
- }
5957
- function isRequest(stream) {
5958
- return stream.setHeader && typeof stream.abort === "function";
5959
- }
5960
- function eos(stream, opts, callback) {
5961
- if (typeof opts === "function") return eos(stream, null, opts);
5962
- if (!opts) opts = {};
5963
- callback = once3(callback || noop2);
5964
- var readable = opts.readable || opts.readable !== false && stream.readable;
5965
- var writable = opts.writable || opts.writable !== false && stream.writable;
5966
- var onlegacyfinish = function onlegacyfinish2() {
5967
- if (!stream.writable) onfinish();
5968
- };
5969
- var writableEnded = stream._writableState && stream._writableState.finished;
5970
- var onfinish = function onfinish2() {
5971
- writable = false;
5972
- writableEnded = true;
5973
- if (!readable) callback.call(stream);
5974
- };
5975
- var readableEnded = stream._readableState && stream._readableState.endEmitted;
5976
- var onend = function onend2() {
5977
- readable = false;
5978
- readableEnded = true;
5979
- if (!writable) callback.call(stream);
5980
- };
5981
- var onerror = function onerror2(err) {
5982
- callback.call(stream, err);
5983
- };
5984
- var onclose = function onclose2() {
5985
- var err;
5986
- if (readable && !readableEnded) {
5987
- if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
5988
- return callback.call(stream, err);
5989
- }
5990
- if (writable && !writableEnded) {
5991
- if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
5992
- return callback.call(stream, err);
5993
- }
5994
- };
5995
- var onrequest = function onrequest2() {
5996
- stream.req.on("finish", onfinish);
5997
- };
5998
- if (isRequest(stream)) {
5999
- stream.on("complete", onfinish);
6000
- stream.on("abort", onclose);
6001
- if (stream.req) onrequest();
6002
- else stream.on("request", onrequest);
6003
- } else if (writable && !stream._writableState) {
6004
- stream.on("end", onlegacyfinish);
6005
- stream.on("close", onlegacyfinish);
6006
- }
6007
- stream.on("end", onend);
6008
- stream.on("finish", onfinish);
6009
- if (opts.error !== false) stream.on("error", onerror);
6010
- stream.on("close", onclose);
6011
- return function() {
6012
- stream.removeListener("complete", onfinish);
6013
- stream.removeListener("abort", onclose);
6014
- stream.removeListener("request", onrequest);
6015
- if (stream.req) stream.req.removeListener("finish", onfinish);
6016
- stream.removeListener("end", onlegacyfinish);
6017
- stream.removeListener("close", onlegacyfinish);
6018
- stream.removeListener("finish", onfinish);
6019
- stream.removeListener("end", onend);
6020
- stream.removeListener("error", onerror);
6021
- stream.removeListener("close", onclose);
6022
- };
6023
- }
6024
- endOfStream = eos;
6025
- return endOfStream;
5750
+ var ERR_STREAM_PREMATURE_CLOSE = errorsBrowser.codes.ERR_STREAM_PREMATURE_CLOSE;
5751
+ function once$1(callback) {
5752
+ var called = false;
5753
+ return function() {
5754
+ if (called) return;
5755
+ called = true;
5756
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5757
+ args[_key] = arguments[_key];
5758
+ }
5759
+ callback.apply(this, args);
5760
+ };
5761
+ }
5762
+ function noop$1() {
5763
+ }
5764
+ function isRequest$1(stream) {
5765
+ return stream.setHeader && typeof stream.abort === "function";
5766
+ }
5767
+ function eos$1(stream, opts, callback) {
5768
+ if (typeof opts === "function") return eos$1(stream, null, opts);
5769
+ if (!opts) opts = {};
5770
+ callback = once$1(callback || noop$1);
5771
+ var readable = opts.readable || opts.readable !== false && stream.readable;
5772
+ var writable = opts.writable || opts.writable !== false && stream.writable;
5773
+ var onlegacyfinish = function onlegacyfinish2() {
5774
+ if (!stream.writable) onfinish();
5775
+ };
5776
+ var writableEnded = stream._writableState && stream._writableState.finished;
5777
+ var onfinish = function onfinish2() {
5778
+ writable = false;
5779
+ writableEnded = true;
5780
+ if (!readable) callback.call(stream);
5781
+ };
5782
+ var readableEnded = stream._readableState && stream._readableState.endEmitted;
5783
+ var onend = function onend2() {
5784
+ readable = false;
5785
+ readableEnded = true;
5786
+ if (!writable) callback.call(stream);
5787
+ };
5788
+ var onerror = function onerror2(err) {
5789
+ callback.call(stream, err);
5790
+ };
5791
+ var onclose = function onclose2() {
5792
+ var err;
5793
+ if (readable && !readableEnded) {
5794
+ if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
5795
+ return callback.call(stream, err);
5796
+ }
5797
+ if (writable && !writableEnded) {
5798
+ if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
5799
+ return callback.call(stream, err);
5800
+ }
5801
+ };
5802
+ var onrequest = function onrequest2() {
5803
+ stream.req.on("finish", onfinish);
5804
+ };
5805
+ if (isRequest$1(stream)) {
5806
+ stream.on("complete", onfinish);
5807
+ stream.on("abort", onclose);
5808
+ if (stream.req) onrequest();
5809
+ else stream.on("request", onrequest);
5810
+ } else if (writable && !stream._writableState) {
5811
+ stream.on("end", onlegacyfinish);
5812
+ stream.on("close", onlegacyfinish);
5813
+ }
5814
+ stream.on("end", onend);
5815
+ stream.on("finish", onfinish);
5816
+ if (opts.error !== false) stream.on("error", onerror);
5817
+ stream.on("close", onclose);
5818
+ return function() {
5819
+ stream.removeListener("complete", onfinish);
5820
+ stream.removeListener("abort", onclose);
5821
+ stream.removeListener("request", onrequest);
5822
+ if (stream.req) stream.req.removeListener("finish", onfinish);
5823
+ stream.removeListener("end", onlegacyfinish);
5824
+ stream.removeListener("close", onlegacyfinish);
5825
+ stream.removeListener("finish", onfinish);
5826
+ stream.removeListener("end", onend);
5827
+ stream.removeListener("error", onerror);
5828
+ stream.removeListener("close", onclose);
5829
+ };
6026
5830
  }
5831
+ var endOfStream = eos$1;
6027
5832
  var async_iterator;
6028
5833
  var hasRequiredAsync_iterator;
6029
5834
  function requireAsync_iterator() {
@@ -6053,7 +5858,7 @@ function requireAsync_iterator() {
6053
5858
  }
6054
5859
  return (hint === "string" ? String : Number)(input);
6055
5860
  }
6056
- var finished = requireEndOfStream();
5861
+ var finished = endOfStream;
6057
5862
  var kLastResolve = Symbol("lastResolve");
6058
5863
  var kLastReject = Symbol("lastReject");
6059
5864
  var kError = Symbol("error");
@@ -6229,7 +6034,7 @@ function require_stream_readable$1() {
6229
6034
  var EElistenerCount = function EElistenerCount2(emitter, type2) {
6230
6035
  return emitter.listeners(type2).length;
6231
6036
  };
6232
- var Stream2 = requireStreamBrowser();
6037
+ var Stream2 = streamBrowser$1;
6233
6038
  var Buffer2 = dist.Buffer;
6234
6039
  var OurUint8Array = (typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
6235
6040
  };
@@ -6248,14 +6053,14 @@ function require_stream_readable$1() {
6248
6053
  };
6249
6054
  }
6250
6055
  var BufferList2 = requireBuffer_list();
6251
- var destroyImpl = requireDestroy();
6252
- var _require = requireState(), getHighWaterMark = _require.getHighWaterMark;
6253
- var _require$codes = requireErrorsBrowser().codes, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
6056
+ var destroyImpl = destroy_1$1;
6057
+ var _require = state, getHighWaterMark2 = _require.getHighWaterMark;
6058
+ var _require$codes2 = errorsBrowser.codes, ERR_INVALID_ARG_TYPE = _require$codes2.ERR_INVALID_ARG_TYPE, ERR_STREAM_PUSH_AFTER_EOF = _require$codes2.ERR_STREAM_PUSH_AFTER_EOF, ERR_METHOD_NOT_IMPLEMENTED2 = _require$codes2.ERR_METHOD_NOT_IMPLEMENTED, ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes2.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
6254
6059
  var StringDecoder2;
6255
6060
  var createReadableStreamAsyncIterator;
6256
6061
  var from;
6257
6062
  inherits_browserExports(Readable, Stream2);
6258
- var errorOrDestroy = destroyImpl.errorOrDestroy;
6063
+ var errorOrDestroy2 = destroyImpl.errorOrDestroy;
6259
6064
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
6260
6065
  function prependListener2(emitter, event, fn) {
6261
6066
  if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
@@ -6269,7 +6074,7 @@ function require_stream_readable$1() {
6269
6074
  if (typeof isDuplex !== "boolean") isDuplex = stream instanceof Duplex2;
6270
6075
  this.objectMode = !!options2.objectMode;
6271
6076
  if (isDuplex) this.objectMode = this.objectMode || !!options2.readableObjectMode;
6272
- this.highWaterMark = getHighWaterMark(this, options2, "readableHighWaterMark", isDuplex);
6077
+ this.highWaterMark = getHighWaterMark2(this, options2, "readableHighWaterMark", isDuplex);
6273
6078
  this.buffer = new BufferList2();
6274
6079
  this.length = 0;
6275
6080
  this.pipes = null;
@@ -6363,16 +6168,16 @@ function require_stream_readable$1() {
6363
6168
  var er;
6364
6169
  if (!skipChunkCheck) er = chunkInvalid(state2, chunk);
6365
6170
  if (er) {
6366
- errorOrDestroy(stream, er);
6171
+ errorOrDestroy2(stream, er);
6367
6172
  } else if (state2.objectMode || chunk && chunk.length > 0) {
6368
6173
  if (typeof chunk !== "string" && !state2.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
6369
6174
  chunk = _uint8ArrayToBuffer(chunk);
6370
6175
  }
6371
6176
  if (addToFront) {
6372
- if (state2.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
6177
+ if (state2.endEmitted) errorOrDestroy2(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
6373
6178
  else addChunk(stream, state2, chunk, true);
6374
6179
  } else if (state2.ended) {
6375
- errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
6180
+ errorOrDestroy2(stream, new ERR_STREAM_PUSH_AFTER_EOF());
6376
6181
  } else if (state2.destroyed) {
6377
6182
  return false;
6378
6183
  } else {
@@ -6570,7 +6375,7 @@ function require_stream_readable$1() {
6570
6375
  state2.readingMore = false;
6571
6376
  }
6572
6377
  Readable.prototype._read = function(n) {
6573
- errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));
6378
+ errorOrDestroy2(this, new ERR_METHOD_NOT_IMPLEMENTED2("_read()"));
6574
6379
  };
6575
6380
  Readable.prototype.pipe = function(dest, pipeOpts) {
6576
6381
  var src = this;
@@ -6639,7 +6444,7 @@ function require_stream_readable$1() {
6639
6444
  debug("onerror", er);
6640
6445
  unpipe();
6641
6446
  dest.removeListener("error", onerror);
6642
- if (EElistenerCount(dest, "error") === 0) errorOrDestroy(dest, er);
6447
+ if (EElistenerCount(dest, "error") === 0) errorOrDestroy2(dest, er);
6643
6448
  }
6644
6449
  prependListener2(dest, "error", onerror);
6645
6450
  function onclose() {
@@ -6945,213 +6750,192 @@ function require_stream_readable$1() {
6945
6750
  }
6946
6751
  return _stream_readable$1;
6947
6752
  }
6948
- var _stream_transform$1;
6949
- var hasRequired_stream_transform;
6950
- function require_stream_transform() {
6951
- if (hasRequired_stream_transform) return _stream_transform$1;
6952
- hasRequired_stream_transform = 1;
6953
- _stream_transform$1 = Transform2;
6954
- var _require$codes = requireErrorsBrowser().codes, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
6955
- var Duplex2 = require_stream_duplex$1();
6956
- inherits_browserExports(Transform2, Duplex2);
6957
- function afterTransform2(er, data) {
6958
- var ts = this._transformState;
6959
- ts.transforming = false;
6960
- var cb = ts.writecb;
6961
- if (cb === null) {
6962
- return this.emit("error", new ERR_MULTIPLE_CALLBACK());
6963
- }
6964
- ts.writechunk = null;
6965
- ts.writecb = null;
6966
- if (data != null)
6967
- this.push(data);
6968
- cb(er);
6969
- var rs = this._readableState;
6970
- rs.reading = false;
6971
- if (rs.needReadable || rs.length < rs.highWaterMark) {
6972
- this._read(rs.highWaterMark);
6973
- }
6974
- }
6975
- function Transform2(options2) {
6976
- if (!(this instanceof Transform2)) return new Transform2(options2);
6977
- Duplex2.call(this, options2);
6978
- this._transformState = {
6979
- afterTransform: afterTransform2.bind(this),
6980
- needTransform: false,
6981
- transforming: false,
6982
- writecb: null,
6983
- writechunk: null,
6984
- writeencoding: null
6985
- };
6986
- this._readableState.needReadable = true;
6987
- this._readableState.sync = false;
6988
- if (options2) {
6989
- if (typeof options2.transform === "function") this._transform = options2.transform;
6990
- if (typeof options2.flush === "function") this._flush = options2.flush;
6991
- }
6992
- this.on("prefinish", prefinish2);
6753
+ var _stream_transform$1 = Transform$9;
6754
+ var _require$codes$1 = errorsBrowser.codes, ERR_METHOD_NOT_IMPLEMENTED = _require$codes$1.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes$1.ERR_MULTIPLE_CALLBACK, ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes$1.ERR_TRANSFORM_ALREADY_TRANSFORMING, ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes$1.ERR_TRANSFORM_WITH_LENGTH_0;
6755
+ var Duplex$1 = require_stream_duplex$1();
6756
+ inherits_browserExports(Transform$9, Duplex$1);
6757
+ function afterTransform$1(er, data) {
6758
+ var ts = this._transformState;
6759
+ ts.transforming = false;
6760
+ var cb = ts.writecb;
6761
+ if (cb === null) {
6762
+ return this.emit("error", new ERR_MULTIPLE_CALLBACK());
6993
6763
  }
6994
- function prefinish2() {
6995
- var _this = this;
6996
- if (typeof this._flush === "function" && !this._readableState.destroyed) {
6997
- this._flush(function(er, data) {
6998
- done2(_this, er, data);
6999
- });
7000
- } else {
7001
- done2(this, null, null);
7002
- }
6764
+ ts.writechunk = null;
6765
+ ts.writecb = null;
6766
+ if (data != null)
6767
+ this.push(data);
6768
+ cb(er);
6769
+ var rs = this._readableState;
6770
+ rs.reading = false;
6771
+ if (rs.needReadable || rs.length < rs.highWaterMark) {
6772
+ this._read(rs.highWaterMark);
7003
6773
  }
7004
- Transform2.prototype.push = function(chunk, encoding) {
7005
- this._transformState.needTransform = false;
7006
- return Duplex2.prototype.push.call(this, chunk, encoding);
7007
- };
7008
- Transform2.prototype._transform = function(chunk, encoding, cb) {
7009
- cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
7010
- };
7011
- Transform2.prototype._write = function(chunk, encoding, cb) {
7012
- var ts = this._transformState;
7013
- ts.writecb = cb;
7014
- ts.writechunk = chunk;
7015
- ts.writeencoding = encoding;
7016
- if (!ts.transforming) {
7017
- var rs = this._readableState;
7018
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
7019
- }
7020
- };
7021
- Transform2.prototype._read = function(n) {
7022
- var ts = this._transformState;
7023
- if (ts.writechunk !== null && !ts.transforming) {
7024
- ts.transforming = true;
7025
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
7026
- } else {
7027
- ts.needTransform = true;
7028
- }
6774
+ }
6775
+ function Transform$9(options2) {
6776
+ if (!(this instanceof Transform$9)) return new Transform$9(options2);
6777
+ Duplex$1.call(this, options2);
6778
+ this._transformState = {
6779
+ afterTransform: afterTransform$1.bind(this),
6780
+ needTransform: false,
6781
+ transforming: false,
6782
+ writecb: null,
6783
+ writechunk: null,
6784
+ writeencoding: null
7029
6785
  };
7030
- Transform2.prototype._destroy = function(err, cb) {
7031
- Duplex2.prototype._destroy.call(this, err, function(err2) {
7032
- cb(err2);
6786
+ this._readableState.needReadable = true;
6787
+ this._readableState.sync = false;
6788
+ if (options2) {
6789
+ if (typeof options2.transform === "function") this._transform = options2.transform;
6790
+ if (typeof options2.flush === "function") this._flush = options2.flush;
6791
+ }
6792
+ this.on("prefinish", prefinish$1);
6793
+ }
6794
+ function prefinish$1() {
6795
+ var _this = this;
6796
+ if (typeof this._flush === "function" && !this._readableState.destroyed) {
6797
+ this._flush(function(er, data) {
6798
+ done$1(_this, er, data);
7033
6799
  });
7034
- };
7035
- function done2(stream, er, data) {
7036
- if (er) return stream.emit("error", er);
7037
- if (data != null)
7038
- stream.push(data);
7039
- if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
7040
- if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
7041
- return stream.push(null);
7042
- }
7043
- return _stream_transform$1;
7044
- }
7045
- var _stream_passthrough$1;
7046
- var hasRequired_stream_passthrough;
7047
- function require_stream_passthrough() {
7048
- if (hasRequired_stream_passthrough) return _stream_passthrough$1;
7049
- hasRequired_stream_passthrough = 1;
7050
- _stream_passthrough$1 = PassThrough2;
7051
- var Transform2 = require_stream_transform();
7052
- inherits_browserExports(PassThrough2, Transform2);
7053
- function PassThrough2(options2) {
7054
- if (!(this instanceof PassThrough2)) return new PassThrough2(options2);
7055
- Transform2.call(this, options2);
7056
- }
7057
- PassThrough2.prototype._transform = function(chunk, encoding, cb) {
7058
- cb(null, chunk);
7059
- };
7060
- return _stream_passthrough$1;
7061
- }
7062
- var pipeline_1;
7063
- var hasRequiredPipeline;
7064
- function requirePipeline() {
7065
- if (hasRequiredPipeline) return pipeline_1;
7066
- hasRequiredPipeline = 1;
7067
- var eos;
7068
- function once3(callback) {
7069
- var called = false;
7070
- return function() {
7071
- if (called) return;
7072
- called = true;
7073
- callback.apply(void 0, arguments);
7074
- };
6800
+ } else {
6801
+ done$1(this, null, null);
7075
6802
  }
7076
- var _require$codes = requireErrorsBrowser().codes, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
7077
- function noop2(err) {
7078
- if (err) throw err;
6803
+ }
6804
+ Transform$9.prototype.push = function(chunk, encoding) {
6805
+ this._transformState.needTransform = false;
6806
+ return Duplex$1.prototype.push.call(this, chunk, encoding);
6807
+ };
6808
+ Transform$9.prototype._transform = function(chunk, encoding, cb) {
6809
+ cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
6810
+ };
6811
+ Transform$9.prototype._write = function(chunk, encoding, cb) {
6812
+ var ts = this._transformState;
6813
+ ts.writecb = cb;
6814
+ ts.writechunk = chunk;
6815
+ ts.writeencoding = encoding;
6816
+ if (!ts.transforming) {
6817
+ var rs = this._readableState;
6818
+ if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
7079
6819
  }
7080
- function isRequest(stream) {
7081
- return stream.setHeader && typeof stream.abort === "function";
6820
+ };
6821
+ Transform$9.prototype._read = function(n) {
6822
+ var ts = this._transformState;
6823
+ if (ts.writechunk !== null && !ts.transforming) {
6824
+ ts.transforming = true;
6825
+ this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
6826
+ } else {
6827
+ ts.needTransform = true;
7082
6828
  }
7083
- function destroyer(stream, reading, writing, callback) {
7084
- callback = once3(callback);
7085
- var closed = false;
7086
- stream.on("close", function() {
7087
- closed = true;
7088
- });
7089
- if (eos === void 0) eos = requireEndOfStream();
7090
- eos(stream, {
7091
- readable: reading,
7092
- writable: writing
7093
- }, function(err) {
7094
- if (err) return callback(err);
7095
- closed = true;
7096
- callback();
7097
- });
7098
- var destroyed = false;
7099
- return function(err) {
7100
- if (closed) return;
7101
- if (destroyed) return;
7102
- destroyed = true;
7103
- if (isRequest(stream)) return stream.abort();
7104
- if (typeof stream.destroy === "function") return stream.destroy();
7105
- callback(err || new ERR_STREAM_DESTROYED("pipe"));
7106
- };
7107
- }
7108
- function call2(fn) {
7109
- fn();
7110
- }
7111
- function pipe(from, to) {
7112
- return from.pipe(to);
7113
- }
7114
- function popCallback(streams) {
7115
- if (!streams.length) return noop2;
7116
- if (typeof streams[streams.length - 1] !== "function") return noop2;
7117
- return streams.pop();
7118
- }
7119
- function pipeline() {
7120
- for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
7121
- streams[_key] = arguments[_key];
7122
- }
7123
- var callback = popCallback(streams);
7124
- if (Array.isArray(streams[0])) streams = streams[0];
7125
- if (streams.length < 2) {
7126
- throw new ERR_MISSING_ARGS("streams");
7127
- }
7128
- var error2;
7129
- var destroys = streams.map(function(stream, i) {
7130
- var reading = i < streams.length - 1;
7131
- var writing = i > 0;
7132
- return destroyer(stream, reading, writing, function(err) {
7133
- if (!error2) error2 = err;
7134
- if (err) destroys.forEach(call2);
7135
- if (reading) return;
7136
- destroys.forEach(call2);
7137
- callback(error2);
7138
- });
6829
+ };
6830
+ Transform$9.prototype._destroy = function(err, cb) {
6831
+ Duplex$1.prototype._destroy.call(this, err, function(err2) {
6832
+ cb(err2);
6833
+ });
6834
+ };
6835
+ function done$1(stream, er, data) {
6836
+ if (er) return stream.emit("error", er);
6837
+ if (data != null)
6838
+ stream.push(data);
6839
+ if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
6840
+ if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
6841
+ return stream.push(null);
6842
+ }
6843
+ var _stream_passthrough$1 = PassThrough$1;
6844
+ var Transform$8 = _stream_transform$1;
6845
+ inherits_browserExports(PassThrough$1, Transform$8);
6846
+ function PassThrough$1(options2) {
6847
+ if (!(this instanceof PassThrough$1)) return new PassThrough$1(options2);
6848
+ Transform$8.call(this, options2);
6849
+ }
6850
+ PassThrough$1.prototype._transform = function(chunk, encoding, cb) {
6851
+ cb(null, chunk);
6852
+ };
6853
+ var eos;
6854
+ function once(callback) {
6855
+ var called = false;
6856
+ return function() {
6857
+ if (called) return;
6858
+ called = true;
6859
+ callback.apply(void 0, arguments);
6860
+ };
6861
+ }
6862
+ var _require$codes = errorsBrowser.codes, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
6863
+ function noop(err) {
6864
+ if (err) throw err;
6865
+ }
6866
+ function isRequest(stream) {
6867
+ return stream.setHeader && typeof stream.abort === "function";
6868
+ }
6869
+ function destroyer(stream, reading, writing, callback) {
6870
+ callback = once(callback);
6871
+ var closed = false;
6872
+ stream.on("close", function() {
6873
+ closed = true;
6874
+ });
6875
+ if (eos === void 0) eos = endOfStream;
6876
+ eos(stream, {
6877
+ readable: reading,
6878
+ writable: writing
6879
+ }, function(err) {
6880
+ if (err) return callback(err);
6881
+ closed = true;
6882
+ callback();
6883
+ });
6884
+ var destroyed = false;
6885
+ return function(err) {
6886
+ if (closed) return;
6887
+ if (destroyed) return;
6888
+ destroyed = true;
6889
+ if (isRequest(stream)) return stream.abort();
6890
+ if (typeof stream.destroy === "function") return stream.destroy();
6891
+ callback(err || new ERR_STREAM_DESTROYED("pipe"));
6892
+ };
6893
+ }
6894
+ function call(fn) {
6895
+ fn();
6896
+ }
6897
+ function pipe(from, to) {
6898
+ return from.pipe(to);
6899
+ }
6900
+ function popCallback(streams) {
6901
+ if (!streams.length) return noop;
6902
+ if (typeof streams[streams.length - 1] !== "function") return noop;
6903
+ return streams.pop();
6904
+ }
6905
+ function pipeline() {
6906
+ for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
6907
+ streams[_key] = arguments[_key];
6908
+ }
6909
+ var callback = popCallback(streams);
6910
+ if (Array.isArray(streams[0])) streams = streams[0];
6911
+ if (streams.length < 2) {
6912
+ throw new ERR_MISSING_ARGS("streams");
6913
+ }
6914
+ var error2;
6915
+ var destroys = streams.map(function(stream, i) {
6916
+ var reading = i < streams.length - 1;
6917
+ var writing = i > 0;
6918
+ return destroyer(stream, reading, writing, function(err) {
6919
+ if (!error2) error2 = err;
6920
+ if (err) destroys.forEach(call);
6921
+ if (reading) return;
6922
+ destroys.forEach(call);
6923
+ callback(error2);
7139
6924
  });
7140
- return streams.reduce(pipe);
7141
- }
7142
- pipeline_1 = pipeline;
7143
- return pipeline_1;
6925
+ });
6926
+ return streams.reduce(pipe);
7144
6927
  }
6928
+ var pipeline_1 = pipeline;
7145
6929
  (function(module, exports2) {
7146
6930
  exports2 = module.exports = require_stream_readable$1();
7147
6931
  exports2.Stream = exports2;
7148
6932
  exports2.Readable = exports2;
7149
6933
  exports2.Writable = require_stream_writable$1();
7150
6934
  exports2.Duplex = require_stream_duplex$1();
7151
- exports2.Transform = require_stream_transform();
7152
- exports2.PassThrough = require_stream_passthrough();
7153
- exports2.finished = requireEndOfStream();
7154
- exports2.pipeline = requirePipeline();
6935
+ exports2.Transform = _stream_transform$1;
6936
+ exports2.PassThrough = _stream_passthrough$1;
6937
+ exports2.finished = endOfStream;
6938
+ exports2.pipeline = pipeline_1;
7155
6939
  })(readableBrowser$1, readableBrowser$1.exports);
7156
6940
  var readableBrowserExports$1 = readableBrowser$1.exports;
7157
6941
  var Buffer$z = safeBufferExports$1.Buffer;
@@ -7895,13 +7679,13 @@ Sha.prototype._update = function(M) {
7895
7679
  this._e = e + this._e | 0;
7896
7680
  };
7897
7681
  Sha.prototype._hash = function() {
7898
- var H = Buffer$v.allocUnsafe(20);
7899
- H.writeInt32BE(this._a | 0, 0);
7900
- H.writeInt32BE(this._b | 0, 4);
7901
- H.writeInt32BE(this._c | 0, 8);
7902
- H.writeInt32BE(this._d | 0, 12);
7903
- H.writeInt32BE(this._e | 0, 16);
7904
- return H;
7682
+ var H2 = Buffer$v.allocUnsafe(20);
7683
+ H2.writeInt32BE(this._a | 0, 0);
7684
+ H2.writeInt32BE(this._b | 0, 4);
7685
+ H2.writeInt32BE(this._c | 0, 8);
7686
+ H2.writeInt32BE(this._d | 0, 12);
7687
+ H2.writeInt32BE(this._e | 0, 16);
7688
+ return H2;
7905
7689
  };
7906
7690
  var sha$4 = Sha;
7907
7691
  var inherits$m = inherits_browserExports;
@@ -7967,13 +7751,13 @@ Sha1.prototype._update = function(M) {
7967
7751
  this._e = e + this._e | 0;
7968
7752
  };
7969
7753
  Sha1.prototype._hash = function() {
7970
- var H = Buffer$u.allocUnsafe(20);
7971
- H.writeInt32BE(this._a | 0, 0);
7972
- H.writeInt32BE(this._b | 0, 4);
7973
- H.writeInt32BE(this._c | 0, 8);
7974
- H.writeInt32BE(this._d | 0, 12);
7975
- H.writeInt32BE(this._e | 0, 16);
7976
- return H;
7754
+ var H2 = Buffer$u.allocUnsafe(20);
7755
+ H2.writeInt32BE(this._a | 0, 0);
7756
+ H2.writeInt32BE(this._b | 0, 4);
7757
+ H2.writeInt32BE(this._c | 0, 8);
7758
+ H2.writeInt32BE(this._d | 0, 12);
7759
+ H2.writeInt32BE(this._e | 0, 16);
7760
+ return H2;
7977
7761
  };
7978
7762
  var sha1 = Sha1;
7979
7763
  var inherits$l = inherits_browserExports;
@@ -8115,16 +7899,16 @@ Sha256$1.prototype._update = function(M) {
8115
7899
  this._h = h + this._h | 0;
8116
7900
  };
8117
7901
  Sha256$1.prototype._hash = function() {
8118
- var H = Buffer$t.allocUnsafe(32);
8119
- H.writeInt32BE(this._a, 0);
8120
- H.writeInt32BE(this._b, 4);
8121
- H.writeInt32BE(this._c, 8);
8122
- H.writeInt32BE(this._d, 12);
8123
- H.writeInt32BE(this._e, 16);
8124
- H.writeInt32BE(this._f, 20);
8125
- H.writeInt32BE(this._g, 24);
8126
- H.writeInt32BE(this._h, 28);
8127
- return H;
7902
+ var H2 = Buffer$t.allocUnsafe(32);
7903
+ H2.writeInt32BE(this._a, 0);
7904
+ H2.writeInt32BE(this._b, 4);
7905
+ H2.writeInt32BE(this._c, 8);
7906
+ H2.writeInt32BE(this._d, 12);
7907
+ H2.writeInt32BE(this._e, 16);
7908
+ H2.writeInt32BE(this._f, 20);
7909
+ H2.writeInt32BE(this._g, 24);
7910
+ H2.writeInt32BE(this._h, 28);
7911
+ return H2;
8128
7912
  };
8129
7913
  var sha256$1 = Sha256$1;
8130
7914
  var inherits$k = inherits_browserExports;
@@ -8150,15 +7934,15 @@ Sha224.prototype.init = function() {
8150
7934
  return this;
8151
7935
  };
8152
7936
  Sha224.prototype._hash = function() {
8153
- var H = Buffer$s.allocUnsafe(28);
8154
- H.writeInt32BE(this._a, 0);
8155
- H.writeInt32BE(this._b, 4);
8156
- H.writeInt32BE(this._c, 8);
8157
- H.writeInt32BE(this._d, 12);
8158
- H.writeInt32BE(this._e, 16);
8159
- H.writeInt32BE(this._f, 20);
8160
- H.writeInt32BE(this._g, 24);
8161
- return H;
7937
+ var H2 = Buffer$s.allocUnsafe(28);
7938
+ H2.writeInt32BE(this._a, 0);
7939
+ H2.writeInt32BE(this._b, 4);
7940
+ H2.writeInt32BE(this._c, 8);
7941
+ H2.writeInt32BE(this._d, 12);
7942
+ H2.writeInt32BE(this._e, 16);
7943
+ H2.writeInt32BE(this._f, 20);
7944
+ H2.writeInt32BE(this._g, 24);
7945
+ return H2;
8162
7946
  };
8163
7947
  var sha224$1 = Sha224;
8164
7948
  var inherits$j = inherits_browserExports;
@@ -8481,10 +8265,10 @@ Sha512.prototype._update = function(M) {
8481
8265
  this._hh = this._hh + hh + getCarry(this._hl, hl2) | 0;
8482
8266
  };
8483
8267
  Sha512.prototype._hash = function() {
8484
- var H = Buffer$r.allocUnsafe(64);
8268
+ var H2 = Buffer$r.allocUnsafe(64);
8485
8269
  function writeInt64BE(h, l, offset) {
8486
- H.writeInt32BE(h, offset);
8487
- H.writeInt32BE(l, offset + 4);
8270
+ H2.writeInt32BE(h, offset);
8271
+ H2.writeInt32BE(l, offset + 4);
8488
8272
  }
8489
8273
  writeInt64BE(this._ah, this._al, 0);
8490
8274
  writeInt64BE(this._bh, this._bl, 8);
@@ -8494,7 +8278,7 @@ Sha512.prototype._hash = function() {
8494
8278
  writeInt64BE(this._fh, this._fl, 40);
8495
8279
  writeInt64BE(this._gh, this._gl, 48);
8496
8280
  writeInt64BE(this._hh, this._hl, 56);
8497
- return H;
8281
+ return H2;
8498
8282
  };
8499
8283
  var sha512$1 = Sha512;
8500
8284
  var inherits$i = inherits_browserExports;
@@ -8528,10 +8312,10 @@ Sha384.prototype.init = function() {
8528
8312
  return this;
8529
8313
  };
8530
8314
  Sha384.prototype._hash = function() {
8531
- var H = Buffer$q.allocUnsafe(48);
8315
+ var H2 = Buffer$q.allocUnsafe(48);
8532
8316
  function writeInt64BE(h, l, offset) {
8533
- H.writeInt32BE(h, offset);
8534
- H.writeInt32BE(l, offset + 4);
8317
+ H2.writeInt32BE(h, offset);
8318
+ H2.writeInt32BE(l, offset + 4);
8535
8319
  }
8536
8320
  writeInt64BE(this._ah, this._al, 0);
8537
8321
  writeInt64BE(this._bh, this._bl, 8);
@@ -8539,7 +8323,7 @@ Sha384.prototype._hash = function() {
8539
8323
  writeInt64BE(this._dh, this._dl, 24);
8540
8324
  writeInt64BE(this._eh, this._el, 32);
8541
8325
  writeInt64BE(this._fh, this._fl, 40);
8542
- return H;
8326
+ return H2;
8543
8327
  };
8544
8328
  var sha384$1 = Sha384;
8545
8329
  var exports$1 = sha_js.exports = function SHA(algorithm) {
@@ -8562,10 +8346,10 @@ inherits$h(Stream, EE);
8562
8346
  Stream.Readable = require_stream_readable$1();
8563
8347
  Stream.Writable = require_stream_writable$1();
8564
8348
  Stream.Duplex = require_stream_duplex$1();
8565
- Stream.Transform = require_stream_transform();
8566
- Stream.PassThrough = require_stream_passthrough();
8567
- Stream.finished = requireEndOfStream();
8568
- Stream.pipeline = requirePipeline();
8349
+ Stream.Transform = _stream_transform$1;
8350
+ Stream.PassThrough = _stream_passthrough$1;
8351
+ Stream.finished = endOfStream;
8352
+ Stream.pipeline = pipeline_1;
8569
8353
  Stream.Stream = Stream;
8570
8354
  function Stream() {
8571
8355
  EE.call(this);
@@ -19366,8 +19150,8 @@ BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
19366
19150
  assert$d(p.precomputed);
19367
19151
  var doubles = p._getDoubles();
19368
19152
  var naf = getNAF(k, 1, this._bitLength);
19369
- var I = (1 << doubles.step + 1) - (doubles.step % 2 === 0 ? 2 : 1);
19370
- I /= 3;
19153
+ var I2 = (1 << doubles.step + 1) - (doubles.step % 2 === 0 ? 2 : 1);
19154
+ I2 /= 3;
19371
19155
  var repr = [];
19372
19156
  var j;
19373
19157
  var nafW;
@@ -19379,7 +19163,7 @@ BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
19379
19163
  }
19380
19164
  var a = this.jpoint(null, null, null);
19381
19165
  var b = this.jpoint(null, null, null);
19382
- for (var i = I; i > 0; i--) {
19166
+ for (var i = I2; i > 0; i--) {
19383
19167
  for (j = 0; j < repr.length; j++) {
19384
19168
  nafW = repr[j];
19385
19169
  if (nafW === i)
@@ -26005,13 +25789,13 @@ function requireSign() {
26005
25789
  var g2 = priv2.params.g;
26006
25790
  var r2 = new BN2(0);
26007
25791
  var k;
26008
- var H = bits2int(hash3, q).mod(q);
25792
+ var H2 = bits2int(hash3, q).mod(q);
26009
25793
  var s2 = false;
26010
25794
  var kv = getKey(x, q, hash3, algo);
26011
25795
  while (s2 === false) {
26012
25796
  k = makeKey(q, kv, algo);
26013
25797
  r2 = makeR(g2, k, p, q);
26014
- s2 = k.invm(q).imul(H.add(x.mul(r2))).mod(q);
25798
+ s2 = k.invm(q).imul(H2.add(x.mul(r2))).mod(q);
26015
25799
  if (s2.cmpn(0) === 0) {
26016
25800
  s2 = false;
26017
25801
  r2 = new BN2(0);
@@ -27177,7 +26961,7 @@ const GetValidatorDocument = { "kind": "Document", "definitions": [{ "kind": "Op
27177
26961
  const GetClusterBalanceDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetClusterBalance" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "clusterId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } }, "type": { "kind": "NonNullType", "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_meta" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "block" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "number" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "daovalues" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "networkFee" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexBlockNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "liquidationThreshold" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minimumLiquidationCollateral" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "operators" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "where" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "id_in" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "fee" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndexBlockNumber" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "cluster" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "clusterId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "index" } }, { "kind": "Field", "name": { "kind": "Name", "value": "balance" } }] } }] } }] };
27178
26962
  const getOwnerNonce = (client, args) => {
27179
26963
  const document2 = typeof args.block === "number" ? GetOwnerNonceByBlockDocument : GetOwnerNonceDocument;
27180
- return client.request(document2, args).then((r2) => r2.account?.nonce);
26964
+ return client.request(document2, args).then((r2) => r2.account?.nonce || "0").catch(() => "0");
27181
26965
  };
27182
26966
  const getClusterSnapshot = (client, args) => client.request(GetClusterSnapshotDocument, args).then((res) => res.cluster);
27183
26967
  const getCluster = (client, args) => client.request(GetClusterDocument, args).then((res) => res.cluster);
@@ -27211,101 +26995,6 @@ const getQueries = (client) => ({
27211
26995
  getValidator: getValidator.bind(null, client),
27212
26996
  getClusterBalance: getClusterBalance$1.bind(null, client)
27213
26997
  });
27214
- function defineChain(chain) {
27215
- return {
27216
- formatters: void 0,
27217
- fees: void 0,
27218
- serializers: void 0,
27219
- ...chain
27220
- };
27221
- }
27222
- const holesky = /* @__PURE__ */ defineChain({
27223
- id: 17e3,
27224
- name: "Holesky",
27225
- nativeCurrency: { name: "Holesky Ether", symbol: "ETH", decimals: 18 },
27226
- rpcUrls: {
27227
- default: {
27228
- http: ["https://ethereum-holesky-rpc.publicnode.com"]
27229
- }
27230
- },
27231
- blockExplorers: {
27232
- default: {
27233
- name: "Etherscan",
27234
- url: "https://holesky.etherscan.io",
27235
- apiUrl: "https://api-holesky.etherscan.io/api"
27236
- }
27237
- },
27238
- contracts: {
27239
- multicall3: {
27240
- address: "0xca11bde05977b3631167028862be2a173976ca11",
27241
- blockCreated: 77
27242
- },
27243
- ensRegistry: {
27244
- address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
27245
- blockCreated: 801613
27246
- },
27247
- ensUniversalResolver: {
27248
- address: "0xa6AC935D4971E3CD133b950aE053bECD16fE7f3b",
27249
- blockCreated: 973484
27250
- }
27251
- },
27252
- testnet: true
27253
- });
27254
- const mainnet = /* @__PURE__ */ defineChain({
27255
- id: 1,
27256
- name: "Ethereum",
27257
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
27258
- rpcUrls: {
27259
- default: {
27260
- http: ["https://cloudflare-eth.com"]
27261
- }
27262
- },
27263
- blockExplorers: {
27264
- default: {
27265
- name: "Etherscan",
27266
- url: "https://etherscan.io",
27267
- apiUrl: "https://api.etherscan.io/api"
27268
- }
27269
- },
27270
- contracts: {
27271
- ensRegistry: {
27272
- address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
27273
- },
27274
- ensUniversalResolver: {
27275
- address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67",
27276
- blockCreated: 19258213
27277
- },
27278
- multicall3: {
27279
- address: "0xca11bde05977b3631167028862be2a173976ca11",
27280
- blockCreated: 14353601
27281
- }
27282
- }
27283
- });
27284
- const chains = {
27285
- mainnet,
27286
- holesky
27287
- };
27288
- const chainIds = Object.values(chains).map((chain) => chain.id);
27289
- const graph_endpoints = {
27290
- [mainnet.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-ethereum/version/latest",
27291
- [holesky.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-holesky/version/latest"
27292
- };
27293
- const rest_endpoints = {
27294
- [mainnet.id]: "https://api.ssv.network/api/v4/mainnet",
27295
- [holesky.id]: "https://api.ssv.network/api/v4/holesky"
27296
- };
27297
- const contracts = {
27298
- [mainnet.id]: {
27299
- setter: "0xDD9BC35aE942eF0cFa76930954a156B3fF30a4E1",
27300
- getter: "0xafE830B6Ee262ba11cce5F32fDCd760FFE6a66e4",
27301
- token: "0x9D65fF81a3c488d585bBfb0Bfe3c7707c7917f54"
27302
- },
27303
- [holesky.id]: {
27304
- setter: "0x38A4794cCEd47d3baf7370CcC43B560D3a1beEFA",
27305
- getter: "0x352A18AEe90cdcd825d1E37d9939dCA86C00e281",
27306
- token: "0xad45A78180961079BFaeEe349704F411dfF947C6"
27307
- }
27308
- };
27309
26998
  const MainnetV4GetterABI = [
27310
26999
  {
27311
27000
  inputs: [],
@@ -35912,22 +35601,27 @@ const createContractInteractions = ({
35912
35601
  };
35913
35602
  const createConfig = (props) => {
35914
35603
  const parsed = configArgsSchema.parse(props);
35915
- const { walletClient, publicClient } = parsed;
35916
- if (!walletClient.chain || !publicClient.chain || !chainIds.includes(walletClient.chain?.id) || !chainIds.includes(publicClient.chain?.id))
35604
+ if (!parsed.walletClient.chain || !parsed.publicClient.chain || !chainIds.includes(parsed.walletClient.chain?.id) || !chainIds.includes(parsed.publicClient.chain?.id))
35917
35605
  throw new Error(`Chain must be one of ${chainIds.join(", ")}`);
35918
- const chainId = walletClient.chain.id;
35606
+ const chainId = parsed.walletClient.chain.id;
35607
+ const chainContracts = contracts[chainId];
35608
+ const addresses = {
35609
+ setter: parsed._?.contractAddresses?.setter || chainContracts.setter,
35610
+ getter: parsed._?.contractAddresses?.getter || chainContracts.getter,
35611
+ token: parsed._?.contractAddresses?.token || chainContracts.token
35612
+ };
35919
35613
  const contract = createContractInteractions({
35920
- walletClient,
35921
- publicClient,
35922
- addresses: contracts[chainId]
35614
+ walletClient: parsed.walletClient,
35615
+ publicClient: parsed.publicClient,
35616
+ addresses
35923
35617
  });
35924
- const graphEndpoint = graph_endpoints[chainId];
35925
- const restEndpoint = rest_endpoints[chainId];
35618
+ const graphEndpoint = parsed._?.graphUrl || graph_endpoints[chainId];
35619
+ const restEndpoint = parsed._?.restUrl || rest_endpoints[chainId];
35926
35620
  const graphQLClient = new GraphQLClient(graphEndpoint);
35927
35621
  return {
35928
- publicClient,
35929
- walletClient,
35930
- chain: walletClient.chain,
35622
+ publicClient: parsed.publicClient,
35623
+ walletClient: parsed.walletClient,
35624
+ chain: parsed.walletClient.chain,
35931
35625
  graphEndpoint,
35932
35626
  restEndpoint,
35933
35627
  api: {
@@ -35935,42 +35629,10 @@ const createConfig = (props) => {
35935
35629
  ...createSSVAPI(restEndpoint)
35936
35630
  },
35937
35631
  graphQLClient,
35938
- contractAddresses: contracts[chainId],
35632
+ contractAddresses: addresses,
35939
35633
  contract
35940
35634
  };
35941
35635
  };
35942
- const globals = {
35943
- MAX_WEI_AMOUNT: 115792089237316195423570985008687907853269984665640564039457584007913129639935n,
35944
- CLUSTER_SIZES: {
35945
- QUAD_CLUSTER: 4,
35946
- SEPT_CLUSTER: 7,
35947
- DECA_CLUSTER: 10,
35948
- TRISKAIDEKA_CLUSTER: 13
35949
- },
35950
- FIXED_VALIDATORS_COUNT_PER_CLUSTER_SIZE: {
35951
- QUAD_CLUSTER: 80,
35952
- SEPT_CLUSTER: 40,
35953
- DECA_CLUSTER: 30,
35954
- TRISKAIDEKA_CLUSTER: 20
35955
- },
35956
- BLOCKS_PER_DAY: 7160n,
35957
- OPERATORS_PER_PAGE: 50,
35958
- BLOCKS_PER_YEAR: 2613400n,
35959
- DEFAULT_CLUSTER_PERIOD: 730,
35960
- NUMBERS_OF_WEEKS_IN_YEAR: 52.1429,
35961
- MAX_VALIDATORS_COUNT_MULTI_FLOW: 50,
35962
- CLUSTER_VALIDITY_PERIOD_MINIMUM: 30,
35963
- OPERATOR_VALIDATORS_LIMIT_PRESERVE: 5,
35964
- MINIMUM_OPERATOR_FEE_PER_BLOCK: 1000000000n,
35965
- MIN_VALIDATORS_COUNT_PER_BULK_REGISTRATION: 1,
35966
- DEFAULT_ADDRESS_WHITELIST: "0x0000000000000000000000000000000000000000"
35967
- };
35968
- const registerValidatorsByClusterSizeLimits = {
35969
- [globals.CLUSTER_SIZES.QUAD_CLUSTER]: globals.FIXED_VALIDATORS_COUNT_PER_CLUSTER_SIZE.QUAD_CLUSTER,
35970
- [globals.CLUSTER_SIZES.SEPT_CLUSTER]: globals.FIXED_VALIDATORS_COUNT_PER_CLUSTER_SIZE.SEPT_CLUSTER,
35971
- [globals.CLUSTER_SIZES.DECA_CLUSTER]: globals.FIXED_VALIDATORS_COUNT_PER_CLUSTER_SIZE.DECA_CLUSTER,
35972
- [globals.CLUSTER_SIZES.TRISKAIDEKA_CLUSTER]: globals.FIXED_VALIDATORS_COUNT_PER_CLUSTER_SIZE.TRISKAIDEKA_CLUSTER
35973
- };
35974
35636
  const deposit = async (config2, { args: { id, amount }, ...writeOptions }, options2 = {}) => {
35975
35637
  const cluster = await config2.api.getCluster({ id });
35976
35638
  console.log("cluster:", cluster);
@@ -36463,7 +36125,7 @@ class SSVSDK {
36463
36125
  export {
36464
36126
  SSVSDK,
36465
36127
  chainIds,
36466
- chains,
36128
+ H as chains,
36467
36129
  contracts,
36468
36130
  createClusterManager,
36469
36131
  createConfig,
@@ -36486,7 +36148,9 @@ export {
36486
36148
  getValidators,
36487
36149
  globals,
36488
36150
  graph_endpoints,
36151
+ G2 as hoodi,
36489
36152
  isConfig,
36153
+ I as networks,
36490
36154
  registerValidatorsByClusterSizeLimits,
36491
36155
  rest_endpoints
36492
36156
  };