@orbs-network/spot-ui 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/spot-ui.js CHANGED
@@ -1,9 +1,9 @@
1
1
  var ht = Object.defineProperty;
2
2
  var xt = (e, t, n) => t in e ? ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Ee = (e, t, n) => xt(e, typeof t != "symbol" ? t + "" : t, n);
4
- var v = /* @__PURE__ */ ((e) => (e.TWAP = "TWAP", e.LIMIT = "LIMIT", e.STOP_LOSS = "STOP_LOSS", e.TAKE_PROFIT = "TAKE_PROFIT", e))(v || {}), ce = /* @__PURE__ */ ((e) => (e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(ce || {}), Tt = /* @__PURE__ */ ((e) => (e.All = "ALL", e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(Tt || {}), se = /* @__PURE__ */ ((e) => (e[e.Minutes = 6e4] = "Minutes", e[e.Hours = 36e5] = "Hours", e[e.Weeks = 6048e5] = "Weeks", e[e.Days = 864e5] = "Days", e[e.Months = 2592e6] = "Months", e[e.Years = 31536e6] = "Years", e))(se || {}), N = /* @__PURE__ */ ((e) => (e.LIMIT = "limit", e.TWAP_LIMIT = "twap-limit", e.TWAP_MARKET = "twap-market", e.TAKE_PROFIT_MARKET = "take-profit-market", e.TAKE_PROFIT_LIMIT = "take-profit-limit", e.STOP_LOSS_LIMIT = "stop-loss-limit", e.STOP_LOSS_MARKET = "stop-loss-market", e))(N || {}), Q = /* @__PURE__ */ ((e) => (e.Arbidex = "arbidex", e.Blackhole = "blackhole", e.Chronos = "chronos", e.Dragon = "dragon", e.Kodiak = "kodiak", e.Lynex = "lynex", e.Nami = "nami", e.Newera = "newera", e.Omni = "omni", e.Pancake = "pancake", e.Quick = "quick", e.Ramses = "ramses", e.Shadow = "shadow", e.Spark = "spark", e.Spooky = "spooky", e.Swapx = "swapx", e.Teafi = "teafi", e.Thena = "thena", e.Yowie = "yowie", e.Pangolin = "pangolin", e.Sushiswap = "sushiswap", e.Agent = "agent", e.Utila = "utila", e.Ring = "ring", e.EfficientFrontier = "ef", e.HtDigital = "ht", e.Ginco = "ginco", e.Katana = "katana", e.Unknown = "unknown", e))(Q || {}), J = /* @__PURE__ */ ((e) => (e.MAX_TRADES = "maxTradesError", e.MIN_TRADES = "minTradesError", e.MIN_TRADE_SIZE = "minTradeSizeError", e.MAX_FILL_DELAY = "maxFillDelayError", e.MIN_FILL_DELAY = "minFillDelayError", e.MAX_ORDER_DURATION = "maxDurationError", e.MIN_ORDER_DURATION = "minDurationError", e.MISSING_LIMIT_PRICE = "missingLimitPrice", e.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE = "StopLossTriggerPriceError", e.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE = "triggerLimitPriceError", e.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE = "TakeProfitTriggerPriceError", e.EMPTY_TRIGGER_PRICE = "emptyTriggerPrice", e.INSUFFICIENT_BALANCE = "insufficientFunds", e.MAX_ORDER_SIZE = "maxOrderSize", e))(J || {}), gt = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, Ne = Math.ceil, ne = Math.floor, Z = "[BigNumber Error] ", Qe = Z + "Number primitive has more than 15 significant digits: ", ae = 1e14, k = 14, Le = 9007199254740991, Ue = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], pe = 1e7, q = 1e9;
4
+ var v = /* @__PURE__ */ ((e) => (e.TWAP = "TWAP", e.LIMIT = "LIMIT", e.STOP_LOSS = "STOP_LOSS", e.TAKE_PROFIT = "TAKE_PROFIT", e))(v || {}), ce = /* @__PURE__ */ ((e) => (e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(ce || {}), Tt = /* @__PURE__ */ ((e) => (e.All = "ALL", e.Open = "OPEN", e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Expired = "EXPIRED", e))(Tt || {}), se = /* @__PURE__ */ ((e) => (e[e.Minutes = 6e4] = "Minutes", e[e.Hours = 36e5] = "Hours", e[e.Weeks = 6048e5] = "Weeks", e[e.Days = 864e5] = "Days", e[e.Months = 2592e6] = "Months", e[e.Years = 31536e6] = "Years", e))(se || {}), N = /* @__PURE__ */ ((e) => (e.LIMIT = "limit", e.TWAP_LIMIT = "twap-limit", e.TWAP_MARKET = "twap-market", e.TAKE_PROFIT_MARKET = "take-profit-market", e.TAKE_PROFIT_LIMIT = "take-profit-limit", e.STOP_LOSS_LIMIT = "stop-loss-limit", e.STOP_LOSS_MARKET = "stop-loss-market", e))(N || {}), Q = /* @__PURE__ */ ((e) => (e.Arbidex = "arbidex", e.Blackhole = "blackhole", e.Chronos = "chronos", e.Dragon = "dragon", e.Kodiak = "kodiak", e.Lynex = "lynex", e.Nami = "nami", e.Newera = "newera", e.Omni = "omni", e.Pancake = "pancake", e.Quick = "quick", e.Ramses = "ramses", e.Shadow = "shadow", e.Spark = "spark", e.Spooky = "spooky", e.Swapx = "swapx", e.Teafi = "teafi", e.Thena = "thena", e.Yowie = "yowie", e.Pangolin = "pangolin", e.Sushiswap = "sushiswap", e.Agent = "agent", e.Utila = "utila", e.Ring = "ring", e.EfficientFrontier = "ef", e.HtDigital = "ht", e.Ginco = "ginco", e.Katana = "katana", e.Unknown = "unknown", e.Orvex = "orvex", e))(Q || {}), J = /* @__PURE__ */ ((e) => (e.MAX_TRADES = "maxTradesError", e.MIN_TRADES = "minTradesError", e.MIN_TRADE_SIZE = "minTradeSizeError", e.MAX_FILL_DELAY = "maxFillDelayError", e.MIN_FILL_DELAY = "minFillDelayError", e.MAX_ORDER_DURATION = "maxDurationError", e.MIN_ORDER_DURATION = "minDurationError", e.MISSING_LIMIT_PRICE = "missingLimitPrice", e.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE = "StopLossTriggerPriceError", e.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE = "triggerLimitPriceError", e.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE = "TakeProfitTriggerPriceError", e.EMPTY_TRIGGER_PRICE = "emptyTriggerPrice", e.INSUFFICIENT_BALANCE = "insufficientFunds", e.MAX_ORDER_SIZE = "maxOrderSize", e))(J || {}), gt = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, Me = Math.ceil, ne = Math.floor, Z = "[BigNumber Error] ", Qe = Z + "Number primitive has more than 15 significant digits: ", ae = 1e14, k = 14, Ne = 9007199254740991, Le = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], pe = 1e7, q = 1e9;
5
5
  function ut(e) {
6
- var t, n, i, a = g.prototype = { constructor: g, toString: null, valueOf: null }, d = new g(1), b = 20, m = 4, D = -7, C = 21, O = -1e7, F = 1e7, h = !1, w = 1, B = 0, V = {
6
+ var t, n, i, a = D.prototype = { constructor: D, toString: null, valueOf: null }, d = new D(1), b = 20, m = 4, F = -7, C = 21, O = -1e7, T = 1e7, g = !1, B = 1, P = 0, V = {
7
7
  prefix: "",
8
8
  groupSize: 3,
9
9
  secondaryGroupSize: 0,
@@ -13,19 +13,19 @@ function ut(e) {
13
13
  fractionGroupSeparator: " ",
14
14
  // non-breaking space
15
15
  suffix: ""
16
- }, K = "0123456789abcdefghijklmnopqrstuvwxyz", z = !0;
17
- function g(r, s) {
16
+ }, U = "0123456789abcdefghijklmnopqrstuvwxyz", j = !0;
17
+ function D(r, s) {
18
18
  var o, A, u, f, E, c, l, y, p = this;
19
- if (!(p instanceof g)) return new g(r, s);
19
+ if (!(p instanceof D)) return new D(r, s);
20
20
  if (s == null) {
21
21
  if (r && r._isBigNumber === !0) {
22
- p.s = r.s, !r.c || r.e > F ? p.c = p.e = null : r.e < O ? p.c = [p.e = 0] : (p.e = r.e, p.c = r.c.slice());
22
+ p.s = r.s, !r.c || r.e > T ? p.c = p.e = null : r.e < O ? p.c = [p.e = 0] : (p.e = r.e, p.c = r.c.slice());
23
23
  return;
24
24
  }
25
25
  if ((c = typeof r == "number") && r * 0 == 0) {
26
26
  if (p.s = 1 / r < 0 ? (r = -r, -1) : 1, r === ~~r) {
27
27
  for (f = 0, E = r; E >= 10; E /= 10, f++) ;
28
- f > F ? p.c = p.e = null : (p.e = f, p.c = [r]);
28
+ f > T ? p.c = p.e = null : (p.e = f, p.c = [r]);
29
29
  return;
30
30
  }
31
31
  y = String(r);
@@ -35,15 +35,15 @@ function ut(e) {
35
35
  }
36
36
  (f = y.indexOf(".")) > -1 && (y = y.replace(".", "")), (E = y.search(/e/i)) > 0 ? (f < 0 && (f = E), f += +y.slice(E + 1), y = y.substring(0, E)) : f < 0 && (f = y.length);
37
37
  } else {
38
- if (L(s, 2, K.length, "Base"), s == 10 && z)
39
- return p = new g(r), Y(p, b + p.e + 1, m);
38
+ if (L(s, 2, U.length, "Base"), s == 10 && j)
39
+ return p = new D(r), Y(p, b + p.e + 1, m);
40
40
  if (y = String(r), c = typeof r == "number") {
41
41
  if (r * 0 != 0) return i(p, y, c, s);
42
- if (p.s = 1 / r < 0 ? (y = y.slice(1), -1) : 1, g.DEBUG && y.replace(/^0\.0*|\./, "").length > 15)
42
+ if (p.s = 1 / r < 0 ? (y = y.slice(1), -1) : 1, D.DEBUG && y.replace(/^0\.0*|\./, "").length > 15)
43
43
  throw Error(Qe + r);
44
44
  } else
45
45
  p.s = y.charCodeAt(0) === 45 ? (y = y.slice(1), -1) : 1;
46
- for (o = K.slice(0, s), f = E = 0, l = y.length; E < l; E++)
46
+ for (o = U.slice(0, s), f = E = 0, l = y.length; E < l; E++)
47
47
  if (o.indexOf(A = y.charAt(E)) < 0) {
48
48
  if (A == ".") {
49
49
  if (E > f) {
@@ -61,9 +61,9 @@ function ut(e) {
61
61
  for (E = 0; y.charCodeAt(E) === 48; E++) ;
62
62
  for (l = y.length; y.charCodeAt(--l) === 48; ) ;
63
63
  if (y = y.slice(E, ++l)) {
64
- if (l -= E, c && g.DEBUG && l > 15 && (r > Le || r !== ne(r)))
64
+ if (l -= E, c && D.DEBUG && l > 15 && (r > Ne || r !== ne(r)))
65
65
  throw Error(Qe + p.s * r);
66
- if ((f = f - E - 1) > F)
66
+ if ((f = f - E - 1) > T)
67
67
  p.c = p.e = null;
68
68
  else if (f < O)
69
69
  p.c = [p.e = 0];
@@ -80,34 +80,34 @@ function ut(e) {
80
80
  } else
81
81
  p.c = [p.e = 0];
82
82
  }
83
- g.clone = ut, g.ROUND_UP = 0, g.ROUND_DOWN = 1, g.ROUND_CEIL = 2, g.ROUND_FLOOR = 3, g.ROUND_HALF_UP = 4, g.ROUND_HALF_DOWN = 5, g.ROUND_HALF_EVEN = 6, g.ROUND_HALF_CEIL = 7, g.ROUND_HALF_FLOOR = 8, g.EUCLID = 9, g.config = g.set = function(r) {
83
+ D.clone = ut, D.ROUND_UP = 0, D.ROUND_DOWN = 1, D.ROUND_CEIL = 2, D.ROUND_FLOOR = 3, D.ROUND_HALF_UP = 4, D.ROUND_HALF_DOWN = 5, D.ROUND_HALF_EVEN = 6, D.ROUND_HALF_CEIL = 7, D.ROUND_HALF_FLOOR = 8, D.EUCLID = 9, D.config = D.set = function(r) {
84
84
  var s, o;
85
85
  if (r != null)
86
86
  if (typeof r == "object") {
87
- if (r.hasOwnProperty(s = "DECIMAL_PLACES") && (o = r[s], L(o, 0, q, s), b = o), r.hasOwnProperty(s = "ROUNDING_MODE") && (o = r[s], L(o, 0, 8, s), m = o), r.hasOwnProperty(s = "EXPONENTIAL_AT") && (o = r[s], o && o.pop ? (L(o[0], -q, 0, s), L(o[1], 0, q, s), D = o[0], C = o[1]) : (L(o, -q, q, s), D = -(C = o < 0 ? -o : o))), r.hasOwnProperty(s = "RANGE"))
87
+ if (r.hasOwnProperty(s = "DECIMAL_PLACES") && (o = r[s], L(o, 0, q, s), b = o), r.hasOwnProperty(s = "ROUNDING_MODE") && (o = r[s], L(o, 0, 8, s), m = o), r.hasOwnProperty(s = "EXPONENTIAL_AT") && (o = r[s], o && o.pop ? (L(o[0], -q, 0, s), L(o[1], 0, q, s), F = o[0], C = o[1]) : (L(o, -q, q, s), F = -(C = o < 0 ? -o : o))), r.hasOwnProperty(s = "RANGE"))
88
88
  if (o = r[s], o && o.pop)
89
- L(o[0], -q, -1, s), L(o[1], 1, q, s), O = o[0], F = o[1];
89
+ L(o[0], -q, -1, s), L(o[1], 1, q, s), O = o[0], T = o[1];
90
90
  else if (L(o, -q, q, s), o)
91
- O = -(F = o < 0 ? -o : o);
91
+ O = -(T = o < 0 ? -o : o);
92
92
  else
93
93
  throw Error(Z + s + " cannot be zero: " + o);
94
94
  if (r.hasOwnProperty(s = "CRYPTO"))
95
95
  if (o = r[s], o === !!o)
96
96
  if (o)
97
97
  if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
98
- h = o;
98
+ g = o;
99
99
  else
100
- throw h = !o, Error(Z + "crypto unavailable");
100
+ throw g = !o, Error(Z + "crypto unavailable");
101
101
  else
102
- h = o;
102
+ g = o;
103
103
  else
104
104
  throw Error(Z + s + " not true or false: " + o);
105
- if (r.hasOwnProperty(s = "MODULO_MODE") && (o = r[s], L(o, 0, 9, s), w = o), r.hasOwnProperty(s = "POW_PRECISION") && (o = r[s], L(o, 0, q, s), B = o), r.hasOwnProperty(s = "FORMAT"))
105
+ if (r.hasOwnProperty(s = "MODULO_MODE") && (o = r[s], L(o, 0, 9, s), B = o), r.hasOwnProperty(s = "POW_PRECISION") && (o = r[s], L(o, 0, q, s), P = o), r.hasOwnProperty(s = "FORMAT"))
106
106
  if (o = r[s], typeof o == "object") V = o;
107
107
  else throw Error(Z + s + " not an object: " + o);
108
108
  if (r.hasOwnProperty(s = "ALPHABET"))
109
109
  if (o = r[s], typeof o == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(o))
110
- z = o.slice(0, 10) == "0123456789", K = o;
110
+ j = o.slice(0, 10) == "0123456789", U = o;
111
111
  else
112
112
  throw Error(Z + s + " invalid: " + o);
113
113
  } else
@@ -115,17 +115,17 @@ function ut(e) {
115
115
  return {
116
116
  DECIMAL_PLACES: b,
117
117
  ROUNDING_MODE: m,
118
- EXPONENTIAL_AT: [D, C],
119
- RANGE: [O, F],
120
- CRYPTO: h,
121
- MODULO_MODE: w,
122
- POW_PRECISION: B,
118
+ EXPONENTIAL_AT: [F, C],
119
+ RANGE: [O, T],
120
+ CRYPTO: g,
121
+ MODULO_MODE: B,
122
+ POW_PRECISION: P,
123
123
  FORMAT: V,
124
- ALPHABET: K
124
+ ALPHABET: U
125
125
  };
126
- }, g.isBigNumber = function(r) {
126
+ }, D.isBigNumber = function(r) {
127
127
  if (!r || r._isBigNumber !== !0) return !1;
128
- if (!g.DEBUG) return !0;
128
+ if (!D.DEBUG) return !0;
129
129
  var s, o, A = r.c, u = r.e, f = r.s;
130
130
  e: if ({}.toString.call(A) == "[object Array]") {
131
131
  if ((f === 1 || f === -1) && u >= -q && u <= q && u === ne(u)) {
@@ -142,19 +142,19 @@ function ut(e) {
142
142
  } else if (A === null && u === null && (f === null || f === 1 || f === -1))
143
143
  return !0;
144
144
  throw Error(Z + "Invalid BigNumber: " + r);
145
- }, g.maximum = g.max = function() {
146
- return De(arguments, -1);
147
- }, g.minimum = g.min = function() {
148
- return De(arguments, 1);
149
- }, g.random = (function() {
145
+ }, D.maximum = D.max = function() {
146
+ return ge(arguments, -1);
147
+ }, D.minimum = D.min = function() {
148
+ return ge(arguments, 1);
149
+ }, D.random = (function() {
150
150
  var r = 9007199254740992, s = Math.random() * r & 2097151 ? function() {
151
151
  return ne(Math.random() * r);
152
152
  } : function() {
153
153
  return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
154
154
  };
155
155
  return function(o) {
156
- var A, u, f, E, c, l = 0, y = [], p = new g(d);
157
- if (o == null ? o = b : L(o, 0, q), E = Ne(o / k), h)
156
+ var A, u, f, E, c, l = 0, y = [], p = new D(d);
157
+ if (o == null ? o = b : L(o, 0, q), E = Me(o / k), g)
158
158
  if (crypto.getRandomValues) {
159
159
  for (A = crypto.getRandomValues(new Uint32Array(E *= 2)); l < E; )
160
160
  c = A[l] * 131072 + (A[l + 1] >>> 11), c >= 9e15 ? (u = crypto.getRandomValues(new Uint32Array(2)), A[l] = u[0], A[l + 1] = u[1]) : (y.push(c % 1e14), l += 2);
@@ -164,11 +164,11 @@ function ut(e) {
164
164
  c = (A[l] & 31) * 281474976710656 + A[l + 1] * 1099511627776 + A[l + 2] * 4294967296 + A[l + 3] * 16777216 + (A[l + 4] << 16) + (A[l + 5] << 8) + A[l + 6], c >= 9e15 ? crypto.randomBytes(7).copy(A, l) : (y.push(c % 1e14), l += 7);
165
165
  l = E / 7;
166
166
  } else
167
- throw h = !1, Error(Z + "crypto unavailable");
168
- if (!h)
167
+ throw g = !1, Error(Z + "crypto unavailable");
168
+ if (!g)
169
169
  for (; l < E; )
170
170
  c = s(), c < 9e15 && (y[l++] = c % 1e14);
171
- for (E = y[--l], o %= k, E && o && (c = Ue[k - o], y[l] = ne(E / c) * c); y[l] === 0; y.pop(), l--) ;
171
+ for (E = y[--l], o %= k, E && o && (c = Le[k - o], y[l] = ne(E / c) * c); y[l] === 0; y.pop(), l--) ;
172
172
  if (l < 0)
173
173
  y = [f = 0];
174
174
  else {
@@ -178,8 +178,8 @@ function ut(e) {
178
178
  }
179
179
  return p.e = f, p.c = y, p;
180
180
  };
181
- })(), g.sum = function() {
182
- for (var r = 1, s = arguments, o = new g(s[0]); r < s.length; ) o = o.plus(s[r++]);
181
+ })(), D.sum = function() {
182
+ for (var r = 1, s = arguments, o = new D(s[0]); r < s.length; ) o = o.plus(s[r++]);
183
183
  return o;
184
184
  }, n = /* @__PURE__ */ (function() {
185
185
  var r = "0123456789";
@@ -192,31 +192,31 @@ function ut(e) {
192
192
  return c.reverse();
193
193
  }
194
194
  return function(o, A, u, f, E) {
195
- var c, l, y, p, x, S, P, R, U = o.indexOf("."), G = b, I = m;
196
- for (U >= 0 && (p = B, B = 0, o = o.replace(".", ""), R = new g(A), S = R.pow(o.length - U), B = p, R.c = s(
197
- le(te(S.c), S.e, "0"),
195
+ var c, l, y, p, h, w, S, R, $ = o.indexOf("."), G = b, I = m;
196
+ for ($ >= 0 && (p = P, P = 0, o = o.replace(".", ""), R = new D(A), w = R.pow(o.length - $), P = p, R.c = s(
197
+ le(te(w.c), w.e, "0"),
198
198
  10,
199
199
  u,
200
200
  r
201
- ), R.e = R.c.length), P = s(o, A, u, E ? (c = K, r) : (c = r, K)), y = p = P.length; P[--p] == 0; P.pop()) ;
202
- if (!P[0]) return c.charAt(0);
203
- if (U < 0 ? --y : (S.c = P, S.e = y, S.s = f, S = t(S, R, G, I, u), P = S.c, x = S.r, y = S.e), l = y + G + 1, U = P[l], p = u / 2, x = x || l < 0 || P[l + 1] != null, x = I < 4 ? (U != null || x) && (I == 0 || I == (S.s < 0 ? 3 : 2)) : U > p || U == p && (I == 4 || x || I == 6 && P[l - 1] & 1 || I == (S.s < 0 ? 8 : 7)), l < 1 || !P[0])
204
- o = x ? le(c.charAt(1), -G, c.charAt(0)) : c.charAt(0);
201
+ ), R.e = R.c.length), S = s(o, A, u, E ? (c = U, r) : (c = r, U)), y = p = S.length; S[--p] == 0; S.pop()) ;
202
+ if (!S[0]) return c.charAt(0);
203
+ if ($ < 0 ? --y : (w.c = S, w.e = y, w.s = f, w = t(w, R, G, I, u), S = w.c, h = w.r, y = w.e), l = y + G + 1, $ = S[l], p = u / 2, h = h || l < 0 || S[l + 1] != null, h = I < 4 ? ($ != null || h) && (I == 0 || I == (w.s < 0 ? 3 : 2)) : $ > p || $ == p && (I == 4 || h || I == 6 && S[l - 1] & 1 || I == (w.s < 0 ? 8 : 7)), l < 1 || !S[0])
204
+ o = h ? le(c.charAt(1), -G, c.charAt(0)) : c.charAt(0);
205
205
  else {
206
- if (P.length = l, x)
207
- for (--u; ++P[--l] > u; )
208
- P[l] = 0, l || (++y, P = [1].concat(P));
209
- for (p = P.length; !P[--p]; ) ;
210
- for (U = 0, o = ""; U <= p; o += c.charAt(P[U++])) ;
206
+ if (S.length = l, h)
207
+ for (--u; ++S[--l] > u; )
208
+ S[l] = 0, l || (++y, S = [1].concat(S));
209
+ for (p = S.length; !S[--p]; ) ;
210
+ for ($ = 0, o = ""; $ <= p; o += c.charAt(S[$++])) ;
211
211
  o = le(o, y, c.charAt(0));
212
212
  }
213
213
  return o;
214
214
  };
215
215
  })(), t = /* @__PURE__ */ (function() {
216
216
  function r(A, u, f) {
217
- var E, c, l, y, p = 0, x = A.length, S = u % pe, P = u / pe | 0;
218
- for (A = A.slice(); x--; )
219
- l = A[x] % pe, y = A[x] / pe | 0, E = P * l + y * S, c = S * l + E % pe * pe + p, p = (c / f | 0) + (E / pe | 0) + P * y, A[x] = c % f;
217
+ var E, c, l, y, p = 0, h = A.length, w = u % pe, S = u / pe | 0;
218
+ for (A = A.slice(); h--; )
219
+ l = A[h] % pe, y = A[h] / pe | 0, E = S * l + y * w, c = w * l + E % pe * pe + p, p = (c / f | 0) + (E / pe | 0) + S * y, A[h] = c % f;
220
220
  return p && (A = [p].concat(A)), A;
221
221
  }
222
222
  function s(A, u, f, E) {
@@ -237,67 +237,67 @@ function ut(e) {
237
237
  for (; !A[0] && A.length > 1; A.splice(0, 1)) ;
238
238
  }
239
239
  return function(A, u, f, E, c) {
240
- var l, y, p, x, S, P, R, U, G, I, M, j, Fe, Re, Me, oe, ge, ee = A.s == u.s ? 1 : -1, X = A.c, $ = u.c;
241
- if (!X || !X[0] || !$ || !$[0])
242
- return new g(
240
+ var l, y, p, h, w, S, R, $, G, I, M, z, De, Ie, Re, oe, Te, ee = A.s == u.s ? 1 : -1, X = A.c, K = u.c;
241
+ if (!X || !X[0] || !K || !K[0])
242
+ return new D(
243
243
  // Return NaN if either NaN, or both Infinity or 0.
244
- !A.s || !u.s || (X ? $ && X[0] == $[0] : !$) ? NaN : (
244
+ !A.s || !u.s || (X ? K && X[0] == K[0] : !K) ? NaN : (
245
245
  // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
246
- X && X[0] == 0 || !$ ? ee * 0 : ee / 0
246
+ X && X[0] == 0 || !K ? ee * 0 : ee / 0
247
247
  )
248
248
  );
249
- for (U = new g(ee), G = U.c = [], y = A.e - u.e, ee = f + y + 1, c || (c = ae, y = re(A.e / k) - re(u.e / k), ee = ee / k | 0), p = 0; $[p] == (X[p] || 0); p++) ;
250
- if ($[p] > (X[p] || 0) && y--, ee < 0)
251
- G.push(1), x = !0;
249
+ for ($ = new D(ee), G = $.c = [], y = A.e - u.e, ee = f + y + 1, c || (c = ae, y = re(A.e / k) - re(u.e / k), ee = ee / k | 0), p = 0; K[p] == (X[p] || 0); p++) ;
250
+ if (K[p] > (X[p] || 0) && y--, ee < 0)
251
+ G.push(1), h = !0;
252
252
  else {
253
- for (Re = X.length, oe = $.length, p = 0, ee += 2, S = ne(c / ($[0] + 1)), S > 1 && ($ = r($, S, c), X = r(X, S, c), oe = $.length, Re = X.length), Fe = oe, I = X.slice(0, oe), M = I.length; M < oe; I[M++] = 0) ;
254
- ge = $.slice(), ge = [0].concat(ge), Me = $[0], $[1] >= c / 2 && Me++;
253
+ for (Ie = X.length, oe = K.length, p = 0, ee += 2, w = ne(c / (K[0] + 1)), w > 1 && (K = r(K, w, c), X = r(X, w, c), oe = K.length, Ie = X.length), De = oe, I = X.slice(0, oe), M = I.length; M < oe; I[M++] = 0) ;
254
+ Te = K.slice(), Te = [0].concat(Te), Re = K[0], K[1] >= c / 2 && Re++;
255
255
  do {
256
- if (S = 0, l = s($, I, oe, M), l < 0) {
257
- if (j = I[0], oe != M && (j = j * c + (I[1] || 0)), S = ne(j / Me), S > 1)
258
- for (S >= c && (S = c - 1), P = r($, S, c), R = P.length, M = I.length; s(P, I, R, M) == 1; )
259
- S--, o(P, oe < R ? ge : $, R, c), R = P.length, l = 1;
256
+ if (w = 0, l = s(K, I, oe, M), l < 0) {
257
+ if (z = I[0], oe != M && (z = z * c + (I[1] || 0)), w = ne(z / Re), w > 1)
258
+ for (w >= c && (w = c - 1), S = r(K, w, c), R = S.length, M = I.length; s(S, I, R, M) == 1; )
259
+ w--, o(S, oe < R ? Te : K, R, c), R = S.length, l = 1;
260
260
  else
261
- S == 0 && (l = S = 1), P = $.slice(), R = P.length;
262
- if (R < M && (P = [0].concat(P)), o(I, P, M, c), M = I.length, l == -1)
263
- for (; s($, I, oe, M) < 1; )
264
- S++, o(I, oe < M ? ge : $, M, c), M = I.length;
265
- } else l === 0 && (S++, I = [0]);
266
- G[p++] = S, I[0] ? I[M++] = X[Fe] || 0 : (I = [X[Fe]], M = 1);
267
- } while ((Fe++ < Re || I[0] != null) && ee--);
268
- x = I[0] != null, G[0] || G.splice(0, 1);
261
+ w == 0 && (l = w = 1), S = K.slice(), R = S.length;
262
+ if (R < M && (S = [0].concat(S)), o(I, S, M, c), M = I.length, l == -1)
263
+ for (; s(K, I, oe, M) < 1; )
264
+ w++, o(I, oe < M ? Te : K, M, c), M = I.length;
265
+ } else l === 0 && (w++, I = [0]);
266
+ G[p++] = w, I[0] ? I[M++] = X[De] || 0 : (I = [X[De]], M = 1);
267
+ } while ((De++ < Ie || I[0] != null) && ee--);
268
+ h = I[0] != null, G[0] || G.splice(0, 1);
269
269
  }
270
270
  if (c == ae) {
271
271
  for (p = 1, ee = G[0]; ee >= 10; ee /= 10, p++) ;
272
- Y(U, f + (U.e = p + y * k - 1) + 1, E, x);
272
+ Y($, f + ($.e = p + y * k - 1) + 1, E, h);
273
273
  } else
274
- U.e = y, U.r = +x;
275
- return U;
274
+ $.e = y, $.r = +h;
275
+ return $;
276
276
  };
277
277
  })();
278
- function xe(r, s, o, A) {
278
+ function he(r, s, o, A) {
279
279
  var u, f, E, c, l;
280
280
  if (o == null ? o = m : L(o, 0, 8), !r.c) return r.toString();
281
281
  if (u = r.c[0], E = r.e, s == null)
282
- l = te(r.c), l = A == 1 || A == 2 && (E <= D || E >= C) ? Be(l, E) : le(l, E, "0");
283
- else if (r = Y(new g(r), s, o), f = r.e, l = te(r.c), c = l.length, A == 1 || A == 2 && (s <= f || f <= D)) {
282
+ l = te(r.c), l = A == 1 || A == 2 && (E <= F || E >= C) ? Ce(l, E) : le(l, E, "0");
283
+ else if (r = Y(new D(r), s, o), f = r.e, l = te(r.c), c = l.length, A == 1 || A == 2 && (s <= f || f <= F)) {
284
284
  for (; c < s; l += "0", c++) ;
285
- l = Be(l, f);
285
+ l = Ce(l, f);
286
286
  } else if (s -= E + (A === 2 && f > E), l = le(l, f, "0"), f + 1 > c) {
287
287
  if (--s > 0) for (l += "."; s--; l += "0") ;
288
288
  } else if (s += f - c, s > 0)
289
289
  for (f + 1 == c && (l += "."); s--; l += "0") ;
290
290
  return r.s < 0 && u ? "-" + l : l;
291
291
  }
292
- function De(r, s) {
293
- for (var o, A, u = 1, f = new g(r[0]); u < r.length; u++)
294
- A = new g(r[u]), (!A.s || (o = ye(f, A)) === s || o === 0 && f.s === s) && (f = A);
292
+ function ge(r, s) {
293
+ for (var o, A, u = 1, f = new D(r[0]); u < r.length; u++)
294
+ A = new D(r[u]), (!A.s || (o = ye(f, A)) === s || o === 0 && f.s === s) && (f = A);
295
295
  return f;
296
296
  }
297
- function Te(r, s, o) {
297
+ function xe(r, s, o) {
298
298
  for (var A = 1, u = s.length; !s[--u]; s.pop()) ;
299
299
  for (u = s[0]; u >= 10; u /= 10, A++) ;
300
- return (o = A + o * k - 1) > F ? r.c = r.e = null : o < O ? r.c = [r.e = 0] : (r.e = o, r.c = s), r;
300
+ return (o = A + o * k - 1) > T ? r.c = r.e = null : o < O ? r.c = [r.e = 0] : (r.e = o, r.c = s), r;
301
301
  }
302
302
  i = /* @__PURE__ */ (function() {
303
303
  var r = /^(-?)0([xbo])(?=\w[\w.]*$)/i, s = /^([^.]+)\.$/, o = /^\.([^.]+)$/, A = /^-?(Infinity|NaN)$/, u = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
@@ -306,11 +306,11 @@ function ut(e) {
306
306
  if (A.test(p))
307
307
  f.s = isNaN(p) ? null : p < 0 ? -1 : 1;
308
308
  else {
309
- if (!c && (p = p.replace(r, function(x, S, P) {
310
- return y = (P = P.toLowerCase()) == "x" ? 16 : P == "b" ? 2 : 8, !l || l == y ? S : x;
309
+ if (!c && (p = p.replace(r, function(h, w, S) {
310
+ return y = (S = S.toLowerCase()) == "x" ? 16 : S == "b" ? 2 : 8, !l || l == y ? w : h;
311
311
  }), l && (y = l, p = p.replace(s, "$1").replace(o, "0.$1")), E != p))
312
- return new g(p, y);
313
- if (g.DEBUG)
312
+ return new D(p, y);
313
+ if (D.DEBUG)
314
314
  throw Error(Z + "Not a" + (l ? " base " + l : "") + " number: " + E);
315
315
  f.s = null;
316
316
  }
@@ -318,113 +318,113 @@ function ut(e) {
318
318
  };
319
319
  })();
320
320
  function Y(r, s, o, A) {
321
- var u, f, E, c, l, y, p, x = r.c, S = Ue;
322
- if (x) {
321
+ var u, f, E, c, l, y, p, h = r.c, w = Le;
322
+ if (h) {
323
323
  e: {
324
- for (u = 1, c = x[0]; c >= 10; c /= 10, u++) ;
324
+ for (u = 1, c = h[0]; c >= 10; c /= 10, u++) ;
325
325
  if (f = s - u, f < 0)
326
- f += k, E = s, l = x[y = 0], p = ne(l / S[u - E - 1] % 10);
327
- else if (y = Ne((f + 1) / k), y >= x.length)
326
+ f += k, E = s, l = h[y = 0], p = ne(l / w[u - E - 1] % 10);
327
+ else if (y = Me((f + 1) / k), y >= h.length)
328
328
  if (A) {
329
- for (; x.length <= y; x.push(0)) ;
329
+ for (; h.length <= y; h.push(0)) ;
330
330
  l = p = 0, u = 1, f %= k, E = f - k + 1;
331
331
  } else
332
332
  break e;
333
333
  else {
334
- for (l = c = x[y], u = 1; c >= 10; c /= 10, u++) ;
335
- f %= k, E = f - k + u, p = E < 0 ? 0 : ne(l / S[u - E - 1] % 10);
334
+ for (l = c = h[y], u = 1; c >= 10; c /= 10, u++) ;
335
+ f %= k, E = f - k + u, p = E < 0 ? 0 : ne(l / w[u - E - 1] % 10);
336
336
  }
337
337
  if (A = A || s < 0 || // Are there any non-zero digits after the rounding digit?
338
338
  // The expression n % pows10[d - j - 1] returns all digits of n to the right
339
339
  // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
340
- x[y + 1] != null || (E < 0 ? l : l % S[u - E - 1]), A = o < 4 ? (p || A) && (o == 0 || o == (r.s < 0 ? 3 : 2)) : p > 5 || p == 5 && (o == 4 || A || o == 6 && // Check whether the digit to the left of the rounding digit is odd.
341
- (f > 0 ? E > 0 ? l / S[u - E] : 0 : x[y - 1]) % 10 & 1 || o == (r.s < 0 ? 8 : 7)), s < 1 || !x[0])
342
- return x.length = 0, A ? (s -= r.e + 1, x[0] = S[(k - s % k) % k], r.e = -s || 0) : x[0] = r.e = 0, r;
343
- if (f == 0 ? (x.length = y, c = 1, y--) : (x.length = y + 1, c = S[k - f], x[y] = E > 0 ? ne(l / S[u - E] % S[E]) * c : 0), A)
340
+ h[y + 1] != null || (E < 0 ? l : l % w[u - E - 1]), A = o < 4 ? (p || A) && (o == 0 || o == (r.s < 0 ? 3 : 2)) : p > 5 || p == 5 && (o == 4 || A || o == 6 && // Check whether the digit to the left of the rounding digit is odd.
341
+ (f > 0 ? E > 0 ? l / w[u - E] : 0 : h[y - 1]) % 10 & 1 || o == (r.s < 0 ? 8 : 7)), s < 1 || !h[0])
342
+ return h.length = 0, A ? (s -= r.e + 1, h[0] = w[(k - s % k) % k], r.e = -s || 0) : h[0] = r.e = 0, r;
343
+ if (f == 0 ? (h.length = y, c = 1, y--) : (h.length = y + 1, c = w[k - f], h[y] = E > 0 ? ne(l / w[u - E] % w[E]) * c : 0), A)
344
344
  for (; ; )
345
345
  if (y == 0) {
346
- for (f = 1, E = x[0]; E >= 10; E /= 10, f++) ;
347
- for (E = x[0] += c, c = 1; E >= 10; E /= 10, c++) ;
348
- f != c && (r.e++, x[0] == ae && (x[0] = 1));
346
+ for (f = 1, E = h[0]; E >= 10; E /= 10, f++) ;
347
+ for (E = h[0] += c, c = 1; E >= 10; E /= 10, c++) ;
348
+ f != c && (r.e++, h[0] == ae && (h[0] = 1));
349
349
  break;
350
350
  } else {
351
- if (x[y] += c, x[y] != ae) break;
352
- x[y--] = 0, c = 1;
351
+ if (h[y] += c, h[y] != ae) break;
352
+ h[y--] = 0, c = 1;
353
353
  }
354
- for (f = x.length; x[--f] === 0; x.pop()) ;
354
+ for (f = h.length; h[--f] === 0; h.pop()) ;
355
355
  }
356
- r.e > F ? r.c = r.e = null : r.e < O && (r.c = [r.e = 0]);
356
+ r.e > T ? r.c = r.e = null : r.e < O && (r.c = [r.e = 0]);
357
357
  }
358
358
  return r;
359
359
  }
360
360
  function ue(r) {
361
361
  var s, o = r.e;
362
- return o === null ? r.toString() : (s = te(r.c), s = o <= D || o >= C ? Be(s, o) : le(s, o, "0"), r.s < 0 ? "-" + s : s);
362
+ return o === null ? r.toString() : (s = te(r.c), s = o <= F || o >= C ? Ce(s, o) : le(s, o, "0"), r.s < 0 ? "-" + s : s);
363
363
  }
364
364
  return a.absoluteValue = a.abs = function() {
365
- var r = new g(this);
365
+ var r = new D(this);
366
366
  return r.s < 0 && (r.s = 1), r;
367
367
  }, a.comparedTo = function(r, s) {
368
- return ye(this, new g(r, s));
368
+ return ye(this, new D(r, s));
369
369
  }, a.decimalPlaces = a.dp = function(r, s) {
370
370
  var o, A, u, f = this;
371
371
  if (r != null)
372
- return L(r, 0, q), s == null ? s = m : L(s, 0, 8), Y(new g(f), r + f.e + 1, s);
372
+ return L(r, 0, q), s == null ? s = m : L(s, 0, 8), Y(new D(f), r + f.e + 1, s);
373
373
  if (!(o = f.c)) return null;
374
374
  if (A = ((u = o.length - 1) - re(this.e / k)) * k, u = o[u]) for (; u % 10 == 0; u /= 10, A--) ;
375
375
  return A < 0 && (A = 0), A;
376
376
  }, a.dividedBy = a.div = function(r, s) {
377
- return t(this, new g(r, s), b, m);
377
+ return t(this, new D(r, s), b, m);
378
378
  }, a.dividedToIntegerBy = a.idiv = function(r, s) {
379
- return t(this, new g(r, s), 0, 1);
379
+ return t(this, new D(r, s), 0, 1);
380
380
  }, a.exponentiatedBy = a.pow = function(r, s) {
381
- var o, A, u, f, E, c, l, y, p, x = this;
382
- if (r = new g(r), r.c && !r.isInteger())
381
+ var o, A, u, f, E, c, l, y, p, h = this;
382
+ if (r = new D(r), r.c && !r.isInteger())
383
383
  throw Error(Z + "Exponent not an integer: " + ue(r));
384
- if (s != null && (s = new g(s)), c = r.e > 14, !x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !r.c || !r.c[0])
385
- return p = new g(Math.pow(+ue(x), c ? r.s * (2 - Ce(r)) : +ue(r))), s ? p.mod(s) : p;
384
+ if (s != null && (s = new D(s)), c = r.e > 14, !h.c || !h.c[0] || h.c[0] == 1 && !h.e && h.c.length == 1 || !r.c || !r.c[0])
385
+ return p = new D(Math.pow(+ue(h), c ? r.s * (2 - Fe(r)) : +ue(r))), s ? p.mod(s) : p;
386
386
  if (l = r.s < 0, s) {
387
- if (s.c ? !s.c[0] : !s.s) return new g(NaN);
388
- A = !l && x.isInteger() && s.isInteger(), A && (x = x.mod(s));
387
+ if (s.c ? !s.c[0] : !s.s) return new D(NaN);
388
+ A = !l && h.isInteger() && s.isInteger(), A && (h = h.mod(s));
389
389
  } else {
390
- if (r.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 ? x.c[0] > 1 || c && x.c[1] >= 24e7 : x.c[0] < 8e13 || c && x.c[0] <= 9999975e7)))
391
- return f = x.s < 0 && Ce(r) ? -0 : 0, x.e > -1 && (f = 1 / f), new g(l ? 1 / f : f);
392
- B && (f = Ne(B / k + 2));
390
+ if (r.e > 9 && (h.e > 0 || h.e < -1 || (h.e == 0 ? h.c[0] > 1 || c && h.c[1] >= 24e7 : h.c[0] < 8e13 || c && h.c[0] <= 9999975e7)))
391
+ return f = h.s < 0 && Fe(r) ? -0 : 0, h.e > -1 && (f = 1 / f), new D(l ? 1 / f : f);
392
+ P && (f = Me(P / k + 2));
393
393
  }
394
- for (c ? (o = new g(0.5), l && (r.s = 1), y = Ce(r)) : (u = Math.abs(+ue(r)), y = u % 2), p = new g(d); ; ) {
394
+ for (c ? (o = new D(0.5), l && (r.s = 1), y = Fe(r)) : (u = Math.abs(+ue(r)), y = u % 2), p = new D(d); ; ) {
395
395
  if (y) {
396
- if (p = p.times(x), !p.c) break;
396
+ if (p = p.times(h), !p.c) break;
397
397
  f ? p.c.length > f && (p.c.length = f) : A && (p = p.mod(s));
398
398
  }
399
399
  if (u) {
400
400
  if (u = ne(u / 2), u === 0) break;
401
401
  y = u % 2;
402
402
  } else if (r = r.times(o), Y(r, r.e + 1, 1), r.e > 14)
403
- y = Ce(r);
403
+ y = Fe(r);
404
404
  else {
405
405
  if (u = +ue(r), u === 0) break;
406
406
  y = u % 2;
407
407
  }
408
- x = x.times(x), f ? x.c && x.c.length > f && (x.c.length = f) : A && (x = x.mod(s));
408
+ h = h.times(h), f ? h.c && h.c.length > f && (h.c.length = f) : A && (h = h.mod(s));
409
409
  }
410
- return A ? p : (l && (p = d.div(p)), s ? p.mod(s) : f ? Y(p, B, m, E) : p);
410
+ return A ? p : (l && (p = d.div(p)), s ? p.mod(s) : f ? Y(p, P, m, E) : p);
411
411
  }, a.integerValue = function(r) {
412
- var s = new g(this);
412
+ var s = new D(this);
413
413
  return r == null ? r = m : L(r, 0, 8), Y(s, s.e + 1, r);
414
414
  }, a.isEqualTo = a.eq = function(r, s) {
415
- return ye(this, new g(r, s)) === 0;
415
+ return ye(this, new D(r, s)) === 0;
416
416
  }, a.isFinite = function() {
417
417
  return !!this.c;
418
418
  }, a.isGreaterThan = a.gt = function(r, s) {
419
- return ye(this, new g(r, s)) > 0;
419
+ return ye(this, new D(r, s)) > 0;
420
420
  }, a.isGreaterThanOrEqualTo = a.gte = function(r, s) {
421
- return (s = ye(this, new g(r, s))) === 1 || s === 0;
421
+ return (s = ye(this, new D(r, s))) === 1 || s === 0;
422
422
  }, a.isInteger = function() {
423
423
  return !!this.c && re(this.e / k) > this.c.length - 2;
424
424
  }, a.isLessThan = a.lt = function(r, s) {
425
- return ye(this, new g(r, s)) < 0;
425
+ return ye(this, new D(r, s)) < 0;
426
426
  }, a.isLessThanOrEqualTo = a.lte = function(r, s) {
427
- return (s = ye(this, new g(r, s))) === -1 || s === 0;
427
+ return (s = ye(this, new D(r, s))) === -1 || s === 0;
428
428
  }, a.isNaN = function() {
429
429
  return !this.s;
430
430
  }, a.isNegative = function() {
@@ -435,63 +435,63 @@ function ut(e) {
435
435
  return !!this.c && this.c[0] == 0;
436
436
  }, a.minus = function(r, s) {
437
437
  var o, A, u, f, E = this, c = E.s;
438
- if (r = new g(r, s), s = r.s, !c || !s) return new g(NaN);
438
+ if (r = new D(r, s), s = r.s, !c || !s) return new D(NaN);
439
439
  if (c != s)
440
440
  return r.s = -s, E.plus(r);
441
- var l = E.e / k, y = r.e / k, p = E.c, x = r.c;
441
+ var l = E.e / k, y = r.e / k, p = E.c, h = r.c;
442
442
  if (!l || !y) {
443
- if (!p || !x) return p ? (r.s = -s, r) : new g(x ? E : NaN);
444
- if (!p[0] || !x[0])
445
- return x[0] ? (r.s = -s, r) : new g(p[0] ? E : (
443
+ if (!p || !h) return p ? (r.s = -s, r) : new D(h ? E : NaN);
444
+ if (!p[0] || !h[0])
445
+ return h[0] ? (r.s = -s, r) : new D(p[0] ? E : (
446
446
  // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
447
447
  m == 3 ? -0 : 0
448
448
  ));
449
449
  }
450
450
  if (l = re(l), y = re(y), p = p.slice(), c = l - y) {
451
- for ((f = c < 0) ? (c = -c, u = p) : (y = l, u = x), u.reverse(), s = c; s--; u.push(0)) ;
451
+ for ((f = c < 0) ? (c = -c, u = p) : (y = l, u = h), u.reverse(), s = c; s--; u.push(0)) ;
452
452
  u.reverse();
453
453
  } else
454
- for (A = (f = (c = p.length) < (s = x.length)) ? c : s, c = s = 0; s < A; s++)
455
- if (p[s] != x[s]) {
456
- f = p[s] < x[s];
454
+ for (A = (f = (c = p.length) < (s = h.length)) ? c : s, c = s = 0; s < A; s++)
455
+ if (p[s] != h[s]) {
456
+ f = p[s] < h[s];
457
457
  break;
458
458
  }
459
- if (f && (u = p, p = x, x = u, r.s = -r.s), s = (A = x.length) - (o = p.length), s > 0) for (; s--; p[o++] = 0) ;
459
+ if (f && (u = p, p = h, h = u, r.s = -r.s), s = (A = h.length) - (o = p.length), s > 0) for (; s--; p[o++] = 0) ;
460
460
  for (s = ae - 1; A > c; ) {
461
- if (p[--A] < x[A]) {
461
+ if (p[--A] < h[A]) {
462
462
  for (o = A; o && !p[--o]; p[o] = s) ;
463
463
  --p[o], p[A] += ae;
464
464
  }
465
- p[A] -= x[A];
465
+ p[A] -= h[A];
466
466
  }
467
467
  for (; p[0] == 0; p.splice(0, 1), --y) ;
468
- return p[0] ? Te(r, p, y) : (r.s = m == 3 ? -1 : 1, r.c = [r.e = 0], r);
468
+ return p[0] ? xe(r, p, y) : (r.s = m == 3 ? -1 : 1, r.c = [r.e = 0], r);
469
469
  }, a.modulo = a.mod = function(r, s) {
470
470
  var o, A, u = this;
471
- return r = new g(r, s), !u.c || !r.s || r.c && !r.c[0] ? new g(NaN) : !r.c || u.c && !u.c[0] ? new g(u) : (w == 9 ? (A = r.s, r.s = 1, o = t(u, r, 0, 3), r.s = A, o.s *= A) : o = t(u, r, 0, w), r = u.minus(o.times(r)), !r.c[0] && w == 1 && (r.s = u.s), r);
471
+ return r = new D(r, s), !u.c || !r.s || r.c && !r.c[0] ? new D(NaN) : !r.c || u.c && !u.c[0] ? new D(u) : (B == 9 ? (A = r.s, r.s = 1, o = t(u, r, 0, 3), r.s = A, o.s *= A) : o = t(u, r, 0, B), r = u.minus(o.times(r)), !r.c[0] && B == 1 && (r.s = u.s), r);
472
472
  }, a.multipliedBy = a.times = function(r, s) {
473
- var o, A, u, f, E, c, l, y, p, x, S, P, R, U, G, I = this, M = I.c, j = (r = new g(r, s)).c;
474
- if (!M || !j || !M[0] || !j[0])
475
- return !I.s || !r.s || M && !M[0] && !j || j && !j[0] && !M ? r.c = r.e = r.s = null : (r.s *= I.s, !M || !j ? r.c = r.e = null : (r.c = [0], r.e = 0)), r;
476
- for (A = re(I.e / k) + re(r.e / k), r.s *= I.s, l = M.length, x = j.length, l < x && (R = M, M = j, j = R, u = l, l = x, x = u), u = l + x, R = []; u--; R.push(0)) ;
477
- for (U = ae, G = pe, u = x; --u >= 0; ) {
478
- for (o = 0, S = j[u] % G, P = j[u] / G | 0, E = l, f = u + E; f > u; )
479
- y = M[--E] % G, p = M[E] / G | 0, c = P * y + p * S, y = S * y + c % G * G + R[f] + o, o = (y / U | 0) + (c / G | 0) + P * p, R[f--] = y % U;
473
+ var o, A, u, f, E, c, l, y, p, h, w, S, R, $, G, I = this, M = I.c, z = (r = new D(r, s)).c;
474
+ if (!M || !z || !M[0] || !z[0])
475
+ return !I.s || !r.s || M && !M[0] && !z || z && !z[0] && !M ? r.c = r.e = r.s = null : (r.s *= I.s, !M || !z ? r.c = r.e = null : (r.c = [0], r.e = 0)), r;
476
+ for (A = re(I.e / k) + re(r.e / k), r.s *= I.s, l = M.length, h = z.length, l < h && (R = M, M = z, z = R, u = l, l = h, h = u), u = l + h, R = []; u--; R.push(0)) ;
477
+ for ($ = ae, G = pe, u = h; --u >= 0; ) {
478
+ for (o = 0, w = z[u] % G, S = z[u] / G | 0, E = l, f = u + E; f > u; )
479
+ y = M[--E] % G, p = M[E] / G | 0, c = S * y + p * w, y = w * y + c % G * G + R[f] + o, o = (y / $ | 0) + (c / G | 0) + S * p, R[f--] = y % $;
480
480
  R[f] = o;
481
481
  }
482
- return o ? ++A : R.splice(0, 1), Te(r, R, A);
482
+ return o ? ++A : R.splice(0, 1), xe(r, R, A);
483
483
  }, a.negated = function() {
484
- var r = new g(this);
484
+ var r = new D(this);
485
485
  return r.s = -r.s || null, r;
486
486
  }, a.plus = function(r, s) {
487
487
  var o, A = this, u = A.s;
488
- if (r = new g(r, s), s = r.s, !u || !s) return new g(NaN);
488
+ if (r = new D(r, s), s = r.s, !u || !s) return new D(NaN);
489
489
  if (u != s)
490
490
  return r.s = -s, A.minus(r);
491
491
  var f = A.e / k, E = r.e / k, c = A.c, l = r.c;
492
492
  if (!f || !E) {
493
- if (!c || !l) return new g(u / 0);
494
- if (!c[0] || !l[0]) return l[0] ? r : new g(c[0] ? A : u * 0);
493
+ if (!c || !l) return new D(u / 0);
494
+ if (!c[0] || !l[0]) return l[0] ? r : new D(c[0] ? A : u * 0);
495
495
  }
496
496
  if (f = re(f), E = re(E), c = c.slice(), u = f - E) {
497
497
  for (u > 0 ? (E = f, o = l) : (u = -u, o = c), o.reverse(); u--; o.push(0)) ;
@@ -499,11 +499,11 @@ function ut(e) {
499
499
  }
500
500
  for (u = c.length, s = l.length, u - s < 0 && (o = l, l = c, c = o, s = u), u = 0; s; )
501
501
  u = (c[--s] = c[s] + l[s] + u) / ae | 0, c[s] = ae === c[s] ? 0 : c[s] % ae;
502
- return u && (c = [u].concat(c), ++E), Te(r, c, E);
502
+ return u && (c = [u].concat(c), ++E), xe(r, c, E);
503
503
  }, a.precision = a.sd = function(r, s) {
504
504
  var o, A, u, f = this;
505
505
  if (r != null && r !== !!r)
506
- return L(r, 1, q), s == null ? s = m : L(s, 0, 8), Y(new g(f), r, s);
506
+ return L(r, 1, q), s == null ? s = m : L(s, 0, 8), Y(new D(f), r, s);
507
507
  if (!(o = f.c)) return null;
508
508
  if (u = o.length - 1, A = u * k + 1, u = o[u]) {
509
509
  for (; u % 10 == 0; u /= 10, A--) ;
@@ -511,12 +511,12 @@ function ut(e) {
511
511
  }
512
512
  return r && f.e + 1 > A && (A = f.e + 1), A;
513
513
  }, a.shiftedBy = function(r) {
514
- return L(r, -Le, Le), this.times("1e" + r);
514
+ return L(r, -Ne, Ne), this.times("1e" + r);
515
515
  }, a.squareRoot = a.sqrt = function() {
516
- var r, s, o, A, u, f = this, E = f.c, c = f.s, l = f.e, y = b + 4, p = new g("0.5");
516
+ var r, s, o, A, u, f = this, E = f.c, c = f.s, l = f.e, y = b + 4, p = new D("0.5");
517
517
  if (c !== 1 || !E || !E[0])
518
- return new g(!c || c < 0 && (!E || E[0]) ? NaN : E ? f : 1 / 0);
519
- if (c = Math.sqrt(+ue(f)), c == 0 || c == 1 / 0 ? (s = te(E), (s.length + l) % 2 == 0 && (s += "0"), c = Math.sqrt(+s), l = re((l + 1) / 2) - (l < 0 || l % 2), c == 1 / 0 ? s = "5e" + l : (s = c.toExponential(), s = s.slice(0, s.indexOf("e") + 1) + l), o = new g(s)) : o = new g(c + ""), o.c[0]) {
518
+ return new D(!c || c < 0 && (!E || E[0]) ? NaN : E ? f : 1 / 0);
519
+ if (c = Math.sqrt(+ue(f)), c == 0 || c == 1 / 0 ? (s = te(E), (s.length + l) % 2 == 0 && (s += "0"), c = Math.sqrt(+s), l = re((l + 1) / 2) - (l < 0 || l % 2), c == 1 / 0 ? s = "5e" + l : (s = c.toExponential(), s = s.slice(0, s.indexOf("e") + 1) + l), o = new D(s)) : o = new D(c + ""), o.c[0]) {
520
520
  for (l = o.e, c = l + y, c < 3 && (c = 0); ; )
521
521
  if (u = o, o = p.times(u.plus(t(f, u, y, 1))), te(u.c).slice(0, c) === (s = te(o.c)).slice(0, c))
522
522
  if (o.e < l && --c, s = s.slice(c - 3, c + 1), s == "9999" || !A && s == "4999") {
@@ -532,9 +532,9 @@ function ut(e) {
532
532
  }
533
533
  return Y(o, o.e + b + 1, m, r);
534
534
  }, a.toExponential = function(r, s) {
535
- return r != null && (L(r, 0, q), r++), xe(this, r, s, 1);
535
+ return r != null && (L(r, 0, q), r++), he(this, r, s, 1);
536
536
  }, a.toFixed = function(r, s) {
537
- return r != null && (L(r, 0, q), r = r + this.e + 1), xe(this, r, s);
537
+ return r != null && (L(r, 0, q), r = r + this.e + 1), he(this, r, s);
538
538
  }, a.toFormat = function(r, s, o) {
539
539
  var A, u = this;
540
540
  if (o == null)
@@ -542,37 +542,37 @@ function ut(e) {
542
542
  else if (typeof o != "object")
543
543
  throw Error(Z + "Argument not an object: " + o);
544
544
  if (A = u.toFixed(r, s), u.c) {
545
- var f, E = A.split("."), c = +o.groupSize, l = +o.secondaryGroupSize, y = o.groupSeparator || "", p = E[0], x = E[1], S = u.s < 0, P = S ? p.slice(1) : p, R = P.length;
545
+ var f, E = A.split("."), c = +o.groupSize, l = +o.secondaryGroupSize, y = o.groupSeparator || "", p = E[0], h = E[1], w = u.s < 0, S = w ? p.slice(1) : p, R = S.length;
546
546
  if (l && (f = c, c = l, l = f, R -= f), c > 0 && R > 0) {
547
- for (f = R % c || c, p = P.substr(0, f); f < R; f += c) p += y + P.substr(f, c);
548
- l > 0 && (p += y + P.slice(f)), S && (p = "-" + p);
547
+ for (f = R % c || c, p = S.substr(0, f); f < R; f += c) p += y + S.substr(f, c);
548
+ l > 0 && (p += y + S.slice(f)), w && (p = "-" + p);
549
549
  }
550
- A = x ? p + (o.decimalSeparator || "") + ((l = +o.fractionGroupSize) ? x.replace(
550
+ A = h ? p + (o.decimalSeparator || "") + ((l = +o.fractionGroupSize) ? h.replace(
551
551
  new RegExp("\\d{" + l + "}\\B", "g"),
552
552
  "$&" + (o.fractionGroupSeparator || "")
553
- ) : x) : p;
553
+ ) : h) : p;
554
554
  }
555
555
  return (o.prefix || "") + A + (o.suffix || "");
556
556
  }, a.toFraction = function(r) {
557
- var s, o, A, u, f, E, c, l, y, p, x, S, P = this, R = P.c;
558
- if (r != null && (c = new g(r), !c.isInteger() && (c.c || c.s !== 1) || c.lt(d)))
557
+ var s, o, A, u, f, E, c, l, y, p, h, w, S = this, R = S.c;
558
+ if (r != null && (c = new D(r), !c.isInteger() && (c.c || c.s !== 1) || c.lt(d)))
559
559
  throw Error(Z + "Argument " + (c.isInteger() ? "out of range: " : "not an integer: ") + ue(c));
560
- if (!R) return new g(P);
561
- for (s = new g(d), y = o = new g(d), A = l = new g(d), S = te(R), f = s.e = S.length - P.e - 1, s.c[0] = Ue[(E = f % k) < 0 ? k + E : E], r = !r || c.comparedTo(s) > 0 ? f > 0 ? s : y : c, E = F, F = 1 / 0, c = new g(S), l.c[0] = 0; p = t(c, s, 0, 1), u = o.plus(p.times(A)), u.comparedTo(r) != 1; )
560
+ if (!R) return new D(S);
561
+ for (s = new D(d), y = o = new D(d), A = l = new D(d), w = te(R), f = s.e = w.length - S.e - 1, s.c[0] = Le[(E = f % k) < 0 ? k + E : E], r = !r || c.comparedTo(s) > 0 ? f > 0 ? s : y : c, E = T, T = 1 / 0, c = new D(w), l.c[0] = 0; p = t(c, s, 0, 1), u = o.plus(p.times(A)), u.comparedTo(r) != 1; )
562
562
  o = A, A = u, y = l.plus(p.times(u = y)), l = u, s = c.minus(p.times(u = s)), c = u;
563
- return u = t(r.minus(o), A, 0, 1), l = l.plus(u.times(y)), o = o.plus(u.times(A)), l.s = y.s = P.s, f = f * 2, x = t(y, A, f, m).minus(P).abs().comparedTo(
564
- t(l, o, f, m).minus(P).abs()
565
- ) < 1 ? [y, A] : [l, o], F = E, x;
563
+ return u = t(r.minus(o), A, 0, 1), l = l.plus(u.times(y)), o = o.plus(u.times(A)), l.s = y.s = S.s, f = f * 2, h = t(y, A, f, m).minus(S).abs().comparedTo(
564
+ t(l, o, f, m).minus(S).abs()
565
+ ) < 1 ? [y, A] : [l, o], T = E, h;
566
566
  }, a.toNumber = function() {
567
567
  return +ue(this);
568
568
  }, a.toPrecision = function(r, s) {
569
- return r != null && L(r, 1, q), xe(this, r, s, 2);
569
+ return r != null && L(r, 1, q), he(this, r, s, 2);
570
570
  }, a.toString = function(r) {
571
571
  var s, o = this, A = o.s, u = o.e;
572
- return u === null ? A ? (s = "Infinity", A < 0 && (s = "-" + s)) : s = "NaN" : (r == null ? s = u <= D || u >= C ? Be(te(o.c), u) : le(te(o.c), u, "0") : r === 10 && z ? (o = Y(new g(o), b + u + 1, m), s = le(te(o.c), o.e, "0")) : (L(r, 2, K.length, "Base"), s = n(le(te(o.c), u, "0"), 10, r, A, !0)), A < 0 && o.c[0] && (s = "-" + s)), s;
572
+ return u === null ? A ? (s = "Infinity", A < 0 && (s = "-" + s)) : s = "NaN" : (r == null ? s = u <= F || u >= C ? Ce(te(o.c), u) : le(te(o.c), u, "0") : r === 10 && j ? (o = Y(new D(o), b + u + 1, m), s = le(te(o.c), o.e, "0")) : (L(r, 2, U.length, "Base"), s = n(le(te(o.c), u, "0"), 10, r, A, !0)), A < 0 && o.c[0] && (s = "-" + s)), s;
573
573
  }, a.valueOf = a.toJSON = function() {
574
574
  return ue(this);
575
- }, a._isBigNumber = !0, a[Symbol.toStringTag] = "BigNumber", a[Symbol.for("nodejs.util.inspect.custom")] = a.valueOf, e != null && g.set(e), g;
575
+ }, a._isBigNumber = !0, a[Symbol.toStringTag] = "BigNumber", a[Symbol.for("nodejs.util.inspect.custom")] = a.valueOf, e != null && D.set(e), D;
576
576
  }
577
577
  function re(e) {
578
578
  var t = e | 0;
@@ -587,24 +587,24 @@ function te(e) {
587
587
  return d.slice(0, a + 1 || 1);
588
588
  }
589
589
  function ye(e, t) {
590
- var n, i, a = e.c, d = t.c, b = e.s, m = t.s, D = e.e, C = t.e;
590
+ var n, i, a = e.c, d = t.c, b = e.s, m = t.s, F = e.e, C = t.e;
591
591
  if (!b || !m) return null;
592
592
  if (n = a && !a[0], i = d && !d[0], n || i) return n ? i ? 0 : -m : b;
593
593
  if (b != m) return b;
594
- if (n = b < 0, i = D == C, !a || !d) return i ? 0 : !a ^ n ? 1 : -1;
595
- if (!i) return D > C ^ n ? 1 : -1;
596
- for (m = (D = a.length) < (C = d.length) ? D : C, b = 0; b < m; b++) if (a[b] != d[b]) return a[b] > d[b] ^ n ? 1 : -1;
597
- return D == C ? 0 : D > C ^ n ? 1 : -1;
594
+ if (n = b < 0, i = F == C, !a || !d) return i ? 0 : !a ^ n ? 1 : -1;
595
+ if (!i) return F > C ^ n ? 1 : -1;
596
+ for (m = (F = a.length) < (C = d.length) ? F : C, b = 0; b < m; b++) if (a[b] != d[b]) return a[b] > d[b] ^ n ? 1 : -1;
597
+ return F == C ? 0 : F > C ^ n ? 1 : -1;
598
598
  }
599
599
  function L(e, t, n, i) {
600
600
  if (e < t || e > n || e !== ne(e))
601
601
  throw Error(Z + (i || "Argument") + (typeof e == "number" ? e < t || e > n ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(e));
602
602
  }
603
- function Ce(e) {
603
+ function Fe(e) {
604
604
  var t = e.c.length - 1;
605
605
  return re(e.e / k) == t && e.c[t] % 2 != 0;
606
606
  }
607
- function Be(e, t) {
607
+ function Ce(e, t) {
608
608
  return (e.length > 1 ? e.charAt(0) + "." + e.slice(1) : e) + (t < 0 ? "e" : "e+") + t;
609
609
  }
610
610
  function le(e, t, n) {
@@ -618,22 +618,22 @@ function le(e, t, n) {
618
618
  } else t < i && (e = e.slice(0, t) + "." + e.slice(t));
619
619
  return e;
620
620
  }
621
- var T = ut();
621
+ var x = ut();
622
622
  const H = (e) => {
623
623
  if (!e) return "";
624
- const t = T(e);
624
+ const t = x(e);
625
625
  return t.isFinite() && !t.isNaN() ? e : "";
626
626
  }, We = (e, t) => {
627
627
  if (t == null || !e) return "";
628
- const n = T(e);
629
- return !n.isFinite() || n.isNaN() ? "" : n.multipliedBy(T(10).pow(t)).toFixed(0);
628
+ const n = x(e);
629
+ return !n.isFinite() || n.isNaN() ? "" : n.multipliedBy(x(10).pow(t)).toFixed(0);
630
630
  }, ze = (e, t) => {
631
631
  if (t == null || !e) return "";
632
- const n = T(e);
633
- return !n.isFinite() || n.isNaN() ? "" : n.dividedBy(T(10).pow(t)).toFixed();
632
+ const n = x(e);
633
+ return !n.isFinite() || n.isNaN() ? "" : n.dividedBy(x(10).pow(t)).toFixed();
634
634
  }, je = (e, t) => {
635
635
  if (!e || !t) return "";
636
- const n = T(e), i = T(t);
636
+ const n = x(e), i = x(t);
637
637
  return !n.isFinite() || n.isNaN() || n.isZero() || !i.isFinite() || i.isNaN() || i.isZero() ? "" : n.multipliedBy(i).toFixed();
638
638
  }, Ae = (e, t, n) => {
639
639
  const i = H(e), a = ze(i, t);
@@ -648,33 +648,33 @@ const H = (e) => {
648
648
  outputTokenDecimals: n,
649
649
  outputUsdPrice: i
650
650
  }) => {
651
- const a = H(e), d = H(t), b = a && d && T(d).gt(0) ? T(a).dividedBy(d).toFixed() : "", m = ze(b, n);
651
+ const a = H(e), d = H(t), b = a && d && x(d).gt(0) ? x(a).dividedBy(d).toFixed() : "", m = ze(b, n);
652
652
  return {
653
653
  raw: b,
654
654
  ui: m,
655
655
  usd: je(m, i)
656
656
  };
657
- }, Ke = 300 * 1e3, Oe = 1440 * 60 * 60 * 1e3, Je = 300 * 1e3, Ve = {
657
+ }, Ke = 300 * 1e3, Pe = 1440 * 60 * 60 * 1e3, Je = 300 * 1e3, Ve = {
658
658
  unit: se.Minutes,
659
659
  value: Ke / 6e4
660
660
  }, Ft = "-5", Ct = "10", Bt = "-10", wt = "5", lt = (e) => {
661
661
  const t = H(e.initialPrice);
662
662
  let n = "";
663
663
  if (e.typedValue !== void 0) {
664
- const d = T(e.typedValue), b = e.isInverted ? d.isZero() ? T(0) : T(1).dividedBy(d) : d;
664
+ const d = x(e.typedValue), b = e.isInverted ? d.isZero() ? x(0) : x(1).dividedBy(d) : d;
665
665
  n = We(b.toFixed(), e.tokenDecimals);
666
- } else if (e.percentage !== void 0 && t && T(t).gt(0)) {
667
- const d = T(e.percentage || 0).dividedBy(100);
668
- n = T(t).plus(T(t).multipliedBy(d)).decimalPlaces(0).toFixed();
669
- } else t && T(t).gt(0) && (n = T(t).decimalPlaces(0).toFixed());
666
+ } else if (e.percentage !== void 0 && t && x(t).gt(0)) {
667
+ const d = x(e.percentage || 0).dividedBy(100);
668
+ n = x(t).plus(x(t).multipliedBy(d)).decimalPlaces(0).toFixed();
669
+ } else t && x(t).gt(0) && (n = x(t).decimalPlaces(0).toFixed());
670
670
  const i = H(n);
671
671
  let a = "";
672
- if (t && !T(t).isZero()) {
672
+ if (t && !x(t).isZero()) {
673
673
  if (e.percentage !== void 0 && e.percentage !== null)
674
674
  a = e.percentage;
675
675
  else if (i) {
676
- const d = T(i).minus(t).dividedBy(t).multipliedBy(100).decimalPlaces(2).toString();
677
- a = T(d).isZero() ? "" : d;
676
+ const d = x(i).minus(t).dividedBy(t).multipliedBy(100).decimalPlaces(2).toString();
677
+ a = x(d).isZero() ? "" : d;
678
678
  }
679
679
  }
680
680
  return {
@@ -686,7 +686,7 @@ const H = (e) => {
686
686
  }, ft = (e) => {
687
687
  const t = (d) => {
688
688
  if (!d) return "";
689
- const b = T(d);
689
+ const b = x(d);
690
690
  return b.isFinite() && !b.isNaN() ? d : "";
691
691
  };
692
692
  let n = "";
@@ -694,7 +694,7 @@ const H = (e) => {
694
694
  n = t(e.typedValue);
695
695
  else {
696
696
  const d = ze(e.raw, e.amountDecimals ?? 18);
697
- d && !T(d).isZero() && (n = e.isInverted ? T(1).dividedBy(d).toFixed() : d);
697
+ d && !x(d).isZero() && (n = e.isInverted ? x(1).dividedBy(d).toFixed() : d);
698
698
  }
699
699
  const i = n ? e.isInverted ? t(We(n, e.invertedAmountDecimals ?? 18)) : t(e.raw) : "", a = e.isInverted ? e.invertedAmountUsdPrice : e.amountUsdPrice;
700
700
  return {
@@ -704,8 +704,8 @@ const H = (e) => {
704
704
  };
705
705
  }, $r = (e) => {
706
706
  if (e === void 0 || e === "") return e;
707
- const t = T(e);
708
- return !t.isFinite() || t.isNaN() || t.isZero() ? "0" : T(1).dividedBy(t).toFixed();
707
+ const t = x(e);
708
+ return !t.isFinite() || t.isNaN() || t.isZero() ? "0" : x(1).dividedBy(t).toFixed();
709
709
  }, St = (e) => {
710
710
  if (e === v.STOP_LOSS) return Ft;
711
711
  if (e === v.TAKE_PROFIT) return Ct;
@@ -717,18 +717,18 @@ const H = (e) => {
717
717
  return wt;
718
718
  }
719
719
  }, Ot = (e, t, n, i) => {
720
- if (!(T(t || "0").isZero() || !n || e !== v.STOP_LOSS && e !== v.TAKE_PROFIT)) {
721
- if (e === v.STOP_LOSS && T(i || 0).gte(n))
720
+ if (!(x(t || "0").isZero() || !n || e !== v.STOP_LOSS && e !== v.TAKE_PROFIT)) {
721
+ if (e === v.STOP_LOSS && x(i || 0).gte(n))
722
722
  return {
723
723
  type: J.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE,
724
724
  value: n
725
725
  };
726
- if (e === v.TAKE_PROFIT && T(i || 0).lte(n))
726
+ if (e === v.TAKE_PROFIT && x(i || 0).lte(n))
727
727
  return {
728
728
  type: J.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE,
729
729
  value: n
730
730
  };
731
- if (!i || T(i).isZero())
731
+ if (!i || x(i).isZero())
732
732
  return {
733
733
  type: J.EMPTY_TRIGGER_PRICE,
734
734
  value: i
@@ -762,13 +762,13 @@ const H = (e) => {
762
762
  )
763
763
  };
764
764
  }, _t = (e, t, n) => {
765
- if (!(T(e.inputAmountRaw || "0").isZero() || !t || e.isMarketOrder)) {
766
- if ((e.module === v.STOP_LOSS || e.module === v.TAKE_PROFIT) && e.triggerPrice && T(n || 0).gte(e.triggerPrice))
765
+ if (!(x(e.inputAmountRaw || "0").isZero() || !t || e.isMarketOrder)) {
766
+ if ((e.module === v.STOP_LOSS || e.module === v.TAKE_PROFIT) && e.triggerPrice && x(n || 0).gte(e.triggerPrice))
767
767
  return {
768
768
  type: J.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,
769
769
  value: e.triggerPrice
770
770
  };
771
- if (!n || T(n).isZero())
771
+ if (!n || x(n).isZero())
772
772
  return {
773
773
  type: J.MISSING_LIMIT_PRICE,
774
774
  value: n
@@ -855,9 +855,9 @@ const Nt = {
855
855
  747474: { adapter: { Nordstern: "0xd16A1849E86431872a87f476fa0DfB30eEb96cb3", Sushi: "0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c" }, dex: { katana: { type: "universal", adapter: "0xe7505d43AdF7d44AB11d7eEAF353a85F8169bE6a", fee: "0x7a76704765D366ac2A559e1A1fc1273b834B2cA8" }, sushiswap: { type: "default", solver: "Sushi", router: "0xAC4c6e212A361c968F1725b4d055b47E63F80b75", adapter: "0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df", fee: "0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc" } } },
856
856
  "*": { wm: "0x0005d5cE0dB57e5BE3b2b8b6FeB75f0ccd015000", repermit: "0x00002a9C4D9497df5Bd31768eC5d30eEf5405000", cosigner: "0x000ECFa392ecDEfEE6e2a5C095d39B7A32f1E000", reactor: "0x000000b33fE4fB9d999Dd684F79b110731c3d000", executor: "0x000642A0966d9bd49870D9519f76b5cf823f3000", refinery: "0x000E474c0D7084EAA35A501035E73269f4b009A5", salt: { wm: "0xc9b46eae42dfeba3222a0315bf682f33cd5cc9d60c9625642e88406f8415f152", repermit: "0x4871dc9008e605821ea9677b65ea2a60ffb774afb31e0dcaea2e192880096be7", cosigner: "0x1117fe6f4e25c9380d10b2b3314a1e9b33e5f65ba0e55e0c63d0640db0dd60a2", reactor: "0xec73677f3a465a9755d4c9eab9509b59a24613fdb8b78719682930373e9876f5", executor: "0x9abc67d936f79e493f1f14050c2f6adb87ec208ff7aaae2e7ae788a7cb4796d7", refinery: "0x9746de29f1dd31b2c8460d71e92a7aefa34911130e61f274f37776e598c48bec", agentAdapter: "0xf6d54cf6a0619f1fb8e1ded91d4c23e7bb9f498c56735fb0c7669423c766219f", agentFee: "0x151234279af18acc113f70463977058efa2e598b5bfc0c106c75fd638d344c0a", unknownAdapter: "0x1aa43154c4be61f2790f139ef440a68806cfbbb86d0dc5e2704937cd93cbafc4", unknownFee: "0x429599ae7495b3e6a93b88d653ac97772fb130b0b74e755d9d215912a252cb7e", utilaAdapter: "0x7671291910b559d7a05ab73ee31dd714d9c6e7b065c9496338bf427182ae5145", utilaFee: "0x46f797cddb221ecf6279b56f52e2f6360cd721ef95bd5a17dd0ffceffaaf7fd6", efAdapter: "0xa5425e0f84a7cf12c4213f57396810d808d88e43a65210786bd0d9a98a314728", efFee: "0x14387b821c54f18e2a9351887a92cc79164a5ea0b88cfc3f36741eae6d4fd815", htAdapter: "0x2ec50a8a136049da76c16f3dd12a8ed1b23f2bc91aca73c6a20cc8344e34f998", htFee: "0x2f902a86a7f6abeedc073e76cd33d4737f25189e18c8f450f16d2ffe14405242" }, dex: { agent: { type: "universal", adapter: "0x0002BeFB46587d460AcEA9B2792c4A4c67B9cADa", fee: "0x0006d9557Ac9Af4f31962896299ba4FaBDaB9fEE" }, unknown: { type: "universal", adapter: "0xada00982E8a888a6aa9BFb270591cb54cE7190d0", fee: "0xfEe00C84894160d582860D76cd7e896d96DBD3d5" }, utila: { type: "universal", adapter: "0x000ADa14B2ECF45Da6Cf1B33dE34e05231E9C76f", fee: "0x000FEee351263c82501a4dF5f699a8b630ac7f36" }, ef: { type: "universal", adapter: "0xeF1B796D708BD776F6b377E93eAd8Ca5fA0C3117", fee: "0xeF1D677d7aE1a066beb26cC1C74E31C082B75FEf" }, ht: { type: "universal", adapter: "0xA560a960C3b7784f5c335C33028D31596b91650b", fee: "0xE7a926C0cb01aCCE74e5d4FCeB7CA1699e200608" }, ginco: { type: "universal", adapter: "0x96604C3E846BBa75c43B5518bd076851e5484197", fee: "0xCf2eB80A89A69aB17e295aeF033Ffe9564736155" } } }
857
857
  };
858
- var $e, et;
858
+ var Ue, et;
859
859
  function Lt() {
860
- if (et) return $e;
860
+ if (et) return Ue;
861
861
  et = 1;
862
862
  const e = Nt, t = (d) => Mt(`./out/${d}.sol/${d}.abi.json`), n = () => ({
863
863
  wm: t("WM"),
@@ -877,15 +877,15 @@ function Lt() {
877
877
  }
878
878
  function a(d, b) {
879
879
  if (!d) return;
880
- const { dex: m, salt: D, ...C } = e["*"] ?? {}, O = e[d];
880
+ const { dex: m, salt: F, ...C } = e["*"] ?? {}, O = e[d];
881
881
  if (!O) return;
882
- const { dex: F, salt: h, ...w } = O, B = { ...C, ...w }, V = b == null ? void 0 : b.trim();
883
- if (!V) return B;
884
- const K = m == null ? void 0 : m[V], z = F == null ? void 0 : F[V];
885
- if (!(!K && !z))
886
- return { ...B, ...K, ...z };
882
+ const { dex: T, salt: g, ...B } = O, P = { ...C, ...B }, V = b == null ? void 0 : b.trim();
883
+ if (!V) return P;
884
+ const U = m == null ? void 0 : m[V], j = T == null ? void 0 : T[V];
885
+ if (!(!U && !j))
886
+ return { ...P, ...U, ...j };
887
887
  }
888
- return $e = { config: a, adapters: i, abis: n, raw: e }, $e;
888
+ return Ue = { config: a, adapters: i, abis: n, raw: e }, Ue;
889
889
  }
890
890
  var Ge = Lt();
891
891
  const Ut = new Set(Object.values(Q)), $t = (e) => Ut.has(e), At = () => {
@@ -1019,16 +1019,16 @@ const Ut = new Set(Object.values(Q)), $t = (e) => Ut.has(e), At = () => {
1019
1019
  }, ln = (e, t) => {
1020
1020
  var n;
1021
1021
  return (n = un[e]) == null ? void 0 : n.get(t);
1022
- }, fn = (e) => e.bidDelaySeconds * 1e3 * 2, me = (e, t) => {
1022
+ }, fn = (e) => e.bidDelaySeconds * 1e3 * 2, be = (e, t) => {
1023
1023
  if (e == null || !t) return "";
1024
- const n = T(10).pow(e);
1025
- return T(t).times(n).idiv(n).div(n).toFixed();
1024
+ const n = x(10).pow(e);
1025
+ return x(t).times(n).idiv(n).div(n).toFixed();
1026
1026
  };
1027
- function ke(e, t) {
1027
+ function Oe(e, t) {
1028
1028
  return e == t || e.toLowerCase() == t.toLowerCase();
1029
1029
  }
1030
1030
  const pn = (e) => Rt.some(
1031
- (t) => ke(t, e || "")
1031
+ (t) => Oe(t, e || "")
1032
1032
  );
1033
1033
  function An(e) {
1034
1034
  return [
@@ -1040,7 +1040,7 @@ function An(e) {
1040
1040
  se.Minutes
1041
1041
  ].find((n) => n <= e) || se.Minutes;
1042
1042
  }
1043
- const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0" : T(e).decimalPlaces(0).toFixed(), Kr = (e) => {
1043
+ const me = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0" : x(e).decimalPlaces(0).toFixed(), Kr = (e) => {
1044
1044
  const t = [e];
1045
1045
  return typeof e == "object" && e !== null && t.push(Reflect.get(e, "error"), Reflect.get(e, "cause")), t.some((n) => {
1046
1046
  if (typeof n != "object" || n === null)
@@ -1064,47 +1064,47 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1064
1064
  );
1065
1065
  return Array.from(i);
1066
1066
  }, Vr = (e, t) => e.version === 1 ? (e.fillDelay || 0) * 1e3 + (t ? fn(t) : 0) : e.fillDelay || 0, Gr = (e) => At().filter((t) => t.name === e).map((t) => t.chainId), qr = (e = "", t = "", n = 18, i = 18) => {
1067
- if (!T(e || 0).gt(0) || !T(t || 0).gt(0))
1067
+ if (!x(e || 0).gt(0) || !x(t || 0).gt(0))
1068
1068
  return "";
1069
- const a = me(n, e), d = me(i, t);
1070
- return T(d).div(a).toFixed();
1069
+ const a = be(n, e), d = be(i, t);
1070
+ return x(d).div(a).toFixed();
1071
1071
  }, Wr = (e, t, n) => {
1072
1072
  if (e.type === N.TWAP_MARKET) return "";
1073
- const i = me(t, e.srcAmountPerTrade), a = me(n, e.dstMinAmountPerTrade);
1074
- return T(a).div(i).toFixed();
1073
+ const i = be(t, e.srcAmountPerTrade), a = be(n, e.dstMinAmountPerTrade);
1074
+ return x(a).div(i).toFixed();
1075
1075
  }, zr = (e, t, n) => {
1076
1076
  if (e.type === N.TWAP_MARKET) return "";
1077
- const i = me(t, e.srcAmountPerTrade), a = me(n, e.triggerPricePerTrade);
1078
- return T(a).div(i).toFixed();
1077
+ const i = be(t, e.srcAmountPerTrade), a = be(n, e.triggerPricePerTrade);
1078
+ return x(a).div(i).toFixed();
1079
1079
  }, bn = (e, t, n, i) => {
1080
- const a = he(n) * 2 * t;
1080
+ const a = me(n) * 2 * t;
1081
1081
  if (i) return i;
1082
1082
  if (e === v.LIMIT) return { unit: se.Days, value: 7 };
1083
1083
  if (e === v.STOP_LOSS || e === v.TAKE_PROFIT)
1084
1084
  return { unit: se.Days, value: 1 };
1085
1085
  const d = An(a);
1086
- return { unit: d, value: Number(T(a / d).toFixed(2)) };
1086
+ return { unit: d, value: Number(x(a / d).toFixed(2)) };
1087
1087
  }, mn = (e, t, n) => t !== v.TWAP ? 1 : n !== void 0 ? n : Math.max(1, Math.ceil(e / 2)), hn = (e, t, n) => {
1088
1088
  if (!e || !t || !n) return 1;
1089
- const a = T(t).times(e).div(n).integerValue(T.ROUND_FLOOR).toNumber();
1089
+ const a = x(t).times(e).div(n).integerValue(x.ROUND_FLOOR).toNumber();
1090
1090
  return Math.max(1, a);
1091
1091
  }, xn = (e, t) => ({
1092
- isError: !(e.unit === Ve.unit && e.value === Ve.value) && he(e) * t > Oe,
1093
- value: Math.floor(Oe / t)
1092
+ isError: !(e.unit === Ve.unit && e.value === Ve.value) && me(e) * t > Pe,
1093
+ value: Math.floor(Pe / t)
1094
1094
  }), Tn = (e, t) => e === v.STOP_LOSS || e === v.TAKE_PROFIT ? {
1095
- isError: he(t) > 5184e6,
1095
+ isError: me(t) > 5184e6,
1096
1096
  value: 5184e6
1097
1097
  } : {
1098
- isError: he(t) > Oe,
1099
- value: Oe
1098
+ isError: me(t) > Pe,
1099
+ value: Pe
1100
1100
  }, gn = (e) => ({
1101
- isError: he(e) < Je,
1101
+ isError: me(e) < Je,
1102
1102
  value: Je
1103
1103
  }), Dn = (e) => ({
1104
- isError: he(e) < Ke,
1104
+ isError: me(e) < Ke,
1105
1105
  value: Ke
1106
1106
  }), Fn = (e, t, n) => ({
1107
- isError: n === v.TWAP && T(e).isGreaterThan(t),
1107
+ isError: n === v.TWAP && x(e).isGreaterThan(t),
1108
1108
  value: t
1109
1109
  }), Cn = (e, t) => {
1110
1110
  const n = Number.isFinite(t) ? Math.floor(t) : 1;
@@ -1133,7 +1133,7 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1133
1133
  const i = t / 60;
1134
1134
  return i >= 1 ? `${i.toFixed(i % 1 ? 1 : 0)} ${i === 1 ? "hour" : "hours"}` : `${t.toFixed(t % 1 ? 1 : 0)} ${t === 1 ? "minute" : "minutes"}`;
1135
1135
  }, wn = (e, t, n, i, a) => {
1136
- if (T(n.raw || "0").isZero() || !t || T(e.inputTokenUsdPrice || "0").isZero())
1136
+ if (x(n.raw || "0").isZero() || !t || x(e.inputTokenUsdPrice || "0").isZero())
1137
1137
  return;
1138
1138
  if (!i)
1139
1139
  return {
@@ -1152,7 +1152,7 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1152
1152
  args: { maxTrades: `${a}` }
1153
1153
  };
1154
1154
  }, Sn = (e, t, n) => {
1155
- if (T(e || "0").isZero() || !t) return;
1155
+ if (x(e || "0").isZero() || !t) return;
1156
1156
  const i = Dn(n.fillDelay);
1157
1157
  if (i.isError)
1158
1158
  return {
@@ -1171,7 +1171,7 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1171
1171
  args: { fillDelay: at(a.value) }
1172
1172
  };
1173
1173
  }, Pn = (e, t, n, i) => {
1174
- if (T(t || "0").isZero() || !n) return;
1174
+ if (x(t || "0").isZero() || !n) return;
1175
1175
  const a = Tn(e, i.duration);
1176
1176
  if (a.isError)
1177
1177
  return {
@@ -1191,7 +1191,7 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1191
1191
  }
1192
1192
  };
1193
1193
  }, On = (e, t) => {
1194
- if (!(!T(e.raw || 0).gt(0) || !e.usd) && T(t).gt(e.usd))
1194
+ if (!(!x(e.raw || 0).gt(0) || !e.usd) && x(t).gt(e.usd))
1195
1195
  return {
1196
1196
  type: J.MIN_TRADE_SIZE,
1197
1197
  value: t,
@@ -1201,10 +1201,10 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1201
1201
  const b = On(
1202
1202
  t,
1203
1203
  e.minTradeSizeUsd
1204
- ), m = e.inputBalanceRaw && T(t.raw).gt(e.inputBalanceRaw) ? {
1204
+ ), m = e.inputBalanceRaw && x(t.raw).gt(e.inputBalanceRaw) ? {
1205
1205
  type: J.INSUFFICIENT_BALANCE,
1206
1206
  value: e.inputBalanceRaw
1207
- } : void 0, D = [
1207
+ } : void 0, F = [
1208
1208
  b,
1209
1209
  d.triggerPrice.error,
1210
1210
  d.limitPrice.error,
@@ -1212,11 +1212,11 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1212
1212
  a.fillDelayError,
1213
1213
  a.durationError,
1214
1214
  m
1215
- ].filter((F) => !!F), C = T(n || 0).gt(0) && T(t.raw || 0).gt(0) && T(e.inputTokenUsdPrice || 0).gt(0), O = C ? D[0] : void 0;
1215
+ ].filter((T) => !!T), C = x(n || 0).gt(0) && x(t.raw || 0).gt(0) && x(e.inputTokenUsdPrice || 0).gt(0), O = C ? F[0] : void 0;
1216
1216
  return {
1217
1217
  errors: {
1218
1218
  primary: O,
1219
- all: D,
1219
+ all: F,
1220
1220
  minTradeSize: b,
1221
1221
  triggerPrice: d.triggerPrice.error,
1222
1222
  limitPrice: d.limitPrice.error,
@@ -1230,26 +1230,26 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1230
1230
  };
1231
1231
  }, _n = (e, t, n) => {
1232
1232
  if (!(!e || !t || n == null))
1233
- return T(e).times(t).div(T(10).pow(n)).toFixed(0);
1233
+ return x(e).times(t).div(x(10).pow(n)).toFixed(0);
1234
1234
  }, vn = (e, t, n, i) => {
1235
1235
  if (n || i == null || !e || !t)
1236
1236
  return "0";
1237
- const a = T(e).times(t).div(T(10).pow(i));
1238
- return T.max(1, a).integerValue(T.ROUND_FLOOR).toFixed(0);
1237
+ const a = x(e).times(t).div(x(10).pow(i));
1238
+ return x.max(1, a).integerValue(x.ROUND_FLOOR).toFixed(0);
1239
1239
  }, In = (e, t, n, i) => {
1240
1240
  if (e === v.TWAP || e === v.LIMIT) return "0";
1241
1241
  if (i == null || !t || !n)
1242
1242
  return;
1243
- const a = T(t).times(n).div(T(10).pow(i));
1244
- return T.max(1, a).integerValue(T.ROUND_FLOOR).toFixed(0);
1245
- }, Rn = (e = "", t = 0) => !e || !t ? "0" : T(e).div(t).integerValue(T.ROUND_FLOOR).toFixed(0), Mn = (e, t) => e === v.LIMIT ? N.LIMIT : e === v.STOP_LOSS ? t ? N.STOP_LOSS_MARKET : N.STOP_LOSS_LIMIT : e === v.TAKE_PROFIT ? t ? N.TAKE_PROFIT_MARKET : N.TAKE_PROFIT_LIMIT : t ? N.TWAP_MARKET : N.TWAP_LIMIT, Nn = ({
1243
+ const a = x(t).times(n).div(x(10).pow(i));
1244
+ return x.max(1, a).integerValue(x.ROUND_FLOOR).toFixed(0);
1245
+ }, Rn = (e = "", t = 0) => !e || !t ? "0" : x(e).div(t).integerValue(x.ROUND_FLOOR).toFixed(0), Mn = (e, t) => e === v.LIMIT ? N.LIMIT : e === v.STOP_LOSS ? t ? N.STOP_LOSS_MARKET : N.STOP_LOSS_LIMIT : e === v.TAKE_PROFIT ? t ? N.TAKE_PROFIT_MARKET : N.TAKE_PROFIT_LIMIT : t ? N.TWAP_MARKET : N.TWAP_LIMIT, Nn = ({
1246
1246
  module: e,
1247
1247
  isMarketOrder: t,
1248
1248
  marketPrice: n,
1249
1249
  limitPrice: i,
1250
1250
  triggerPrice: a
1251
- }) => e === v.LIMIT || !t ? H(i) : e === v.STOP_LOSS || e === v.TAKE_PROFIT ? H(a) : H(n), Ln = (e, t) => !e || !t ? "" : T(e).multipliedBy(t).decimalPlaces(0).toFixed(), Un = (e) => {
1252
- const t = Bn(e), n = Number.isFinite(e.priceProtectionPercent) ? e.priceProtectionPercent * 100 : 0, i = typeof e.displayFeePercent == "number" && Number.isFinite(e.displayFeePercent) ? e.displayFeePercent : 0, a = H(e.totalInputAmount), d = H(e.marketPrice), b = H(e.limitPrice), m = H(e.triggerPrice), D = Nn({
1251
+ }) => e === v.LIMIT || !t ? H(i) : e === v.STOP_LOSS || e === v.TAKE_PROFIT ? H(a) : H(n), Ln = (e, t) => !e || !t ? "" : x(e).multipliedBy(t).decimalPlaces(0).toFixed(), Un = (e) => {
1252
+ const t = Bn(e), n = Number.isFinite(e.priceProtectionPercent) ? e.priceProtectionPercent * 100 : 0, i = typeof e.displayFeePercent == "number" && Number.isFinite(e.displayFeePercent) ? e.displayFeePercent : 0, a = H(e.totalInputAmount), d = H(e.marketPrice), b = H(e.limitPrice), m = H(e.triggerPrice), F = Nn({
1253
1253
  module: e.module,
1254
1254
  isMarketOrder: e.isMarketOrder,
1255
1255
  marketPrice: d,
@@ -1259,21 +1259,21 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1259
1259
  a,
1260
1260
  t.totalTrades
1261
1261
  ), O = H(
1262
- _n(a, D, e.inputTokenDecimals)
1263
- ), F = vn(
1262
+ _n(a, F, e.inputTokenDecimals)
1263
+ ), T = vn(
1264
1264
  C,
1265
1265
  b,
1266
1266
  e.isMarketOrder,
1267
1267
  e.inputTokenDecimals
1268
- ), h = Ln(
1269
- F,
1268
+ ), g = Ln(
1269
+ T,
1270
1270
  t.totalTrades
1271
- ), w = In(
1271
+ ), B = In(
1272
1272
  e.module,
1273
1273
  C,
1274
1274
  m,
1275
1275
  e.inputTokenDecimals
1276
- ) || "0", B = i && O ? T(O).multipliedBy(i).dividedBy(100).toFixed(0) : "";
1276
+ ) || "0", P = i && O ? x(O).multipliedBy(i).dividedBy(100).toFixed(0) : "";
1277
1277
  return {
1278
1278
  ...t,
1279
1279
  orderType: Mn(e.module, e.isMarketOrder),
@@ -1283,14 +1283,14 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1283
1283
  inputAmount: a,
1284
1284
  outputAmount: O,
1285
1285
  inputAmountPerTrade: C,
1286
- minOutputAmountPerTrade: F,
1287
- minOutputAmountTotal: h,
1288
- triggerOutputAmountPerTrade: w,
1289
- tradePrice: D,
1286
+ minOutputAmountPerTrade: T,
1287
+ minOutputAmountTotal: g,
1288
+ triggerOutputAmountPerTrade: B,
1289
+ tradePrice: F,
1290
1290
  marketPrice: d,
1291
1291
  limitPrice: b,
1292
1292
  triggerPrice: m,
1293
- displayFeeAmount: B,
1293
+ displayFeeAmount: P,
1294
1294
  displayFeePercent: i
1295
1295
  };
1296
1296
  }, $n = (e) => {
@@ -1304,7 +1304,7 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1304
1304
  );
1305
1305
  return {
1306
1306
  ...n,
1307
- isEmpty: !T(n.raw || 0).gt(0)
1307
+ isEmpty: !x(n.raw || 0).gt(0)
1308
1308
  };
1309
1309
  }, Kn = (e, t, n) => {
1310
1310
  const i = hn(
@@ -1386,7 +1386,7 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1386
1386
  limitPrice: b.limitPrice.raw,
1387
1387
  triggerPrice: b.triggerPrice.raw,
1388
1388
  displayFeePercent: e.displayFeePercent
1389
- }), D = Gn(
1389
+ }), F = Gn(
1390
1390
  e,
1391
1391
  n,
1392
1392
  a,
@@ -1396,7 +1396,7 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1396
1396
  t,
1397
1397
  a,
1398
1398
  d,
1399
- D,
1399
+ F,
1400
1400
  b
1401
1401
  );
1402
1402
  return {
@@ -1410,7 +1410,7 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1410
1410
  ),
1411
1411
  marketPrice: i,
1412
1412
  trades: C,
1413
- schedule: D,
1413
+ schedule: F,
1414
1414
  triggerPrice: b.triggerPrice,
1415
1415
  limitPrice: b.limitPrice,
1416
1416
  minOutputAmountTotal: Ae(
@@ -1746,308 +1746,29 @@ const he = (e) => e ? e.value * e.unit : 0, yn = (e) => !e || e === "NaN" ? "0"
1746
1746
  }
1747
1747
  ]
1748
1748
  }
1749
- ], zn = Wn, jn = qn, Xn = "2.9.0", ve = {
1749
+ ], zn = Wn, jn = qn, Xn = "2.9.0", _e = {
1750
1750
  version: Xn
1751
- }, Hn = 0.7, Yn = `https://bi.orbs.network/putes/twap-ui-${Hn}`;
1752
- let Pe = "unknown";
1753
- function Xr(e) {
1754
- Pe = e;
1755
- }
1756
- function we() {
1757
- const e = Math.random().toString(36).substring(2, 16), t = Math.random().toString(36).substring(2, 16), n = Date.now().toString(36);
1758
- return `id_${e + t + n}`;
1759
- }
1760
- const Zn = (e, t, n) => ({
1761
- spotVersion: ve.version,
1762
- partner: e,
1763
- chainId: n || 0,
1764
- minChunkSizeUsd: t
1765
- }), Qn = (e, t, n, i) => {
1766
- const { witness: a } = e.order, d = Ge.config(
1767
- e.domain.chainId,
1768
- t
1769
- );
1770
- return {
1771
- spotVersion: ve.version,
1772
- partner: t,
1773
- cosigner: d == null ? void 0 : d.cosigner,
1774
- fee: d == null ? void 0 : d.fee,
1775
- refinery: d == null ? void 0 : d.refinery,
1776
- router: d == null ? void 0 : d.router,
1777
- type: d == null ? void 0 : d.type,
1778
- wm: d == null ? void 0 : d.wm,
1779
- adapter: a.exchange.adapter,
1780
- executor: a.executor,
1781
- reactor: a.reactor,
1782
- repermit: e.domain.verifyingContract,
1783
- chainId: e.domain.chainId,
1784
- chainName: (n == null ? void 0 : n.chainName) || "",
1785
- twapVersion: (n == null ? void 0 : n.twapVersion) || 0,
1786
- twapAddress: (n == null ? void 0 : n.twapAddress) || "",
1787
- lensAddress: (n == null ? void 0 : n.lensAddress) || "",
1788
- bidDelaySeconds: (n == null ? void 0 : n.bidDelaySeconds) || 0,
1789
- minChunkSizeUsd: i || 0,
1790
- name: (n == null ? void 0 : n.name) || "",
1791
- exchangeAddress: (n == null ? void 0 : n.exchangeAddress) || "",
1792
- exchangeType: (n == null ? void 0 : n.exchangeType) || "",
1793
- pathfinderKey: (n == null ? void 0 : n.pathfinderKey) || ""
1794
- };
1795
- }, Se = async (e) => {
1796
- try {
1797
- await fetch(Yn, {
1798
- method: "POST",
1799
- headers: {
1800
- Accept: "application/json",
1801
- "Content-Type": "application/json"
1802
- },
1803
- body: JSON.stringify(e)
1804
- }).then();
1805
- } catch (t) {
1806
- console.error("Failed to send BI", t);
1807
- }
1808
- }, it = (e) => {
1809
- try {
1810
- if (typeof e == "string" && e.trim())
1811
- return e.toLowerCase();
1812
- if (typeof e == "object" && e !== null) {
1813
- const t = Reflect.get(e, "message");
1814
- if (typeof t == "string" && t.trim())
1815
- return t.toLowerCase();
1816
- const n = Reflect.get(e, "code");
1817
- if (typeof n == "string" || typeof n == "number")
1818
- return String(n).toLowerCase();
1819
- }
1820
- } catch {
1821
- }
1822
- return "unknown error";
1823
- };
1824
- class Jn {
1825
- constructor() {
1826
- Ee(this, "timeout");
1827
- Ee(this, "configDetails", {});
1828
- Ee(this, "configUpdateKey", "");
1829
- Ee(this, "moduleImportKey", "");
1830
- Ee(this, "data", {
1831
- _id: we()
1832
- });
1833
- }
1834
- async updateAndSend(t = {}, n = !1, i) {
1835
- try {
1836
- this.data = {
1837
- ...this.data,
1838
- ...t
1839
- }, n ? (await Se(this.data), i == null || i()) : (clearTimeout(this.timeout), this.timeout = setTimeout(() => {
1840
- Se(this.data), i == null || i();
1841
- }, 1e3));
1842
- } catch (a) {
1843
- console.error("Failed to update and send BI", a);
1844
- }
1845
- }
1846
- onCancelOrderRequest(t, n) {
1847
- this.updateAndSend({
1848
- cancelOrderIdsV1: n === 1 ? t : void 0,
1849
- cancelOrderIdsV2: n === 2 ? t : void 0,
1850
- action: "cancel order",
1851
- cancelOrderSuccess: !1,
1852
- cancelOrderTxHash: void 0,
1853
- actionError: void 0
1854
- });
1855
- }
1856
- onCancelOrderSuccess(t) {
1857
- this.updateAndSend({
1858
- cancelOrderTxHash: t,
1859
- cancelOrderSuccess: !0
1860
- });
1861
- }
1862
- onCancelOrderError(t) {
1863
- this.onTxError(t);
1864
- }
1865
- onWrapSuccess(t) {
1866
- this.updateAndSend({
1867
- wrapTxHash: t
1868
- });
1869
- }
1870
- onWrapRequest() {
1871
- this.updateAndSend({
1872
- action: "wrap"
1873
- });
1874
- }
1875
- onWrapError(t) {
1876
- this.onTxError(t);
1877
- }
1878
- onApproveRequest() {
1879
- this.updateAndSend({
1880
- action: "approve"
1881
- });
1882
- }
1883
- onApproveSuccess(t) {
1884
- this.updateAndSend({
1885
- approvalTxHash: t
1886
- });
1887
- }
1888
- onApproveError(t) {
1889
- this.onTxError(t);
1890
- }
1891
- onCrash(t) {
1892
- this.updateAndSend({
1893
- action: "crash",
1894
- actionError: it(t)
1895
- });
1896
- }
1897
- onTxError(t) {
1898
- this.updateAndSend({ actionError: it(t) });
1899
- }
1900
- onRequestOrder({
1901
- account: t,
1902
- chainId: n,
1903
- module: i,
1904
- srcToken: a,
1905
- dstToken: d,
1906
- fromTokenAmount: b,
1907
- srcChunkAmount: m,
1908
- minDstAmountOutPerTrade: D = "",
1909
- triggerPricePerTrade: C = "",
1910
- deadline: O,
1911
- fillDelay: F,
1912
- slippage: h,
1913
- isMarketOrder: w,
1914
- chunksAmount: B
1915
- }) {
1916
- this.updateAndSend({
1917
- toTokenAddress: d.address,
1918
- toTokenSymbol: d.symbol,
1919
- fromTokenAddress: a.address,
1920
- fromTokenSymbol: a.symbol,
1921
- fromTokenAmount: b,
1922
- chunksAmount: B,
1923
- srcChunkAmount: m,
1924
- minDstAmountOutPerTrade: D,
1925
- triggerPricePerTrade: C,
1926
- deadline: O,
1927
- fillDelay: F,
1928
- slippage: h,
1929
- chainId: n,
1930
- walletAddress: t,
1931
- module: i,
1932
- orderType: w ? "market" : "limit",
1933
- actionError: void 0
1934
- });
1935
- }
1936
- onSignOrderRequest(t) {
1937
- this.updateAndSend({
1938
- action: "sign order"
1939
- });
1940
- }
1941
- onSignOrderError(t) {
1942
- this.onTxError(t);
1943
- }
1944
- onSignOrderSuccess(t) {
1945
- this.updateAndSend({
1946
- action: "sign order"
1947
- });
1948
- }
1949
- init(t, n, i, a) {
1950
- const d = `${t}:${i || 0}:${a || ""}`;
1951
- if (d !== this.moduleImportKey) {
1952
- this.moduleImportKey = d;
1953
- const b = {
1954
- _id: we(),
1955
- action: "module-import",
1956
- uiVersion: Pe,
1957
- appId: a,
1958
- ...Zn(t, n, i),
1959
- origin: window.location.origin
1960
- };
1961
- this.configDetails.partner === t && this.configDetails.chainId === (i || 0) || (this.configDetails = {}), this.data = { ...b, ...this.configDetails }, Se(b);
1962
- }
1963
- }
1964
- onFetchedConfig(t, n, i, a) {
1965
- const d = Qn(
1966
- t,
1967
- n,
1968
- i,
1969
- a
1970
- ), b = `${n}:${d.chainId}:${d.repermit}:${d.adapter}:${d.executor}:${d.reactor}`;
1971
- b !== this.configUpdateKey && (this.configUpdateKey = b, this.configDetails = d, this.data = { ...this.data, ...d }, Se({
1972
- _id: we(),
1973
- action: "config-update",
1974
- uiVersion: Pe,
1975
- appId: this.data.appId,
1976
- origin: typeof window > "u" ? void 0 : window.location.origin,
1977
- ...d
1978
- }));
1979
- }
1980
- onCreateOrderError(t) {
1981
- this.onTxError(t);
1982
- }
1983
- onCreateOrderRequest() {
1984
- this.updateAndSend({
1985
- action: "create order"
1986
- });
1987
- }
1988
- async onCreateOrderSuccess(t) {
1989
- this.updateAndSend(
1990
- {
1991
- orderHash: t,
1992
- orderSuccess: !0
1993
- },
1994
- void 0,
1995
- () => {
1996
- this.data = {
1997
- _id: we(),
1998
- action: "reset",
1999
- uiVersion: Pe,
2000
- appId: this.data.appId,
2001
- origin: this.data.origin,
2002
- spotVersion: ve.version,
2003
- partner: this.data.partner,
2004
- adapter: this.data.adapter,
2005
- cosigner: this.data.cosigner,
2006
- executor: this.data.executor,
2007
- fee: this.data.fee,
2008
- reactor: this.data.reactor,
2009
- refinery: this.data.refinery,
2010
- repermit: this.data.repermit,
2011
- router: this.data.router,
2012
- type: this.data.type,
2013
- wm: this.data.wm,
2014
- chainName: this.data.chainName || "",
2015
- chainId: this.data.chainId || 0,
2016
- twapVersion: this.data.twapVersion || 0,
2017
- twapAddress: this.data.twapAddress || "",
2018
- lensAddress: this.data.lensAddress || "",
2019
- bidDelaySeconds: this.data.bidDelaySeconds || 0,
2020
- minChunkSizeUsd: this.data.minChunkSizeUsd || 0,
2021
- name: this.data.name || "",
2022
- exchangeAddress: this.data.exchangeAddress || "",
2023
- exchangeType: this.data.exchangeType || "",
2024
- pathfinderKey: this.data.pathfinderKey || ""
2025
- };
2026
- }
2027
- );
2028
- }
2029
- }
2030
- const be = new Jn(), _e = "https://order-sink.orbs.network", Ie = "https://order-sink-v2.orbs.network", Xe = ve.version.split(".")[0], er = () => Number(Xe) >= 2 ? Ie : _e, tr = () => `${Ie}/config`, nr = () => Number(Xe) >= 2 ? [Ie, _e] : [_e], rr = {
1751
+ }, ke = "https://order-sink.orbs.network", ve = "https://order-sink-v2.orbs.network", Xe = _e.version.split(".")[0], Hn = () => Number(Xe) >= 2 ? ve : ke, Yn = () => `${ve}/config`, Zn = () => Number(Xe) >= 2 ? [ve, ke] : [ke], Qn = {
2031
1752
  [Q.Thena]: ["0xB75218ba5A99bF57Fd02556B70F05A4A0f1Dbe67"],
2032
1753
  [Q.Katana]: ["0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df"]
2033
- }, ar = ({
1754
+ }, Jn = ({
2034
1755
  endpoint: e,
2035
1756
  exchange: t,
2036
1757
  partner: n
2037
1758
  }) => {
2038
- const a = [_e, Ie].includes(
1759
+ const a = [ke, ve].includes(
2039
1760
  e
2040
- ) && n ? rr[n] || [] : [], d = t ? [t, ...a] : a;
1761
+ ) && n ? Qn[n] || [] : [], d = t ? [t, ...a] : a;
2041
1762
  return d.filter(
2042
1763
  (b, m) => d.findIndex(
2043
- (D) => D.toLowerCase() === b.toLowerCase()
1764
+ (F) => F.toLowerCase() === b.toLowerCase()
2044
1765
  ) === m
2045
1766
  );
2046
- }, ir = async (e, t) => {
1767
+ }, er = async (e, t) => {
2047
1768
  const n = new URLSearchParams({
2048
1769
  partner: e,
2049
1770
  chain: t.toString()
2050
- }), i = await fetch(`${tr()}?${n}`);
1771
+ }), i = await fetch(`${Yn()}?${n}`);
2051
1772
  if (!i.ok) {
2052
1773
  const a = await i.text();
2053
1774
  throw new Error(
@@ -2055,7 +1776,7 @@ const be = new Jn(), _e = "https://order-sink.orbs.network", Ie = "https://order
2055
1776
  );
2056
1777
  }
2057
1778
  return i.json();
2058
- }, sr = ({
1779
+ }, tr = ({
2059
1780
  inputTokenAddress: e,
2060
1781
  outputTokenAddress: t,
2061
1782
  totalInputAmount: n,
@@ -2064,57 +1785,57 @@ const be = new Jn(), _e = "https://order-sink.orbs.network", Ie = "https://order
2064
1785
  deadlineMillis: d,
2065
1786
  fillDelayMillis: b,
2066
1787
  totalTrades: m,
2067
- slippageBps: D,
1788
+ slippageBps: F,
2068
1789
  swapperAddress: C,
2069
1790
  inputAmountPerTrade: O,
2070
- minOutputAmountPerTrade: F = "0",
2071
- triggerOutputAmountPerTrade: h = "0",
2072
- permitData: w,
2073
- module: B
1791
+ minOutputAmountPerTrade: T = "0",
1792
+ triggerOutputAmountPerTrade: g = "0",
1793
+ permitData: B,
1794
+ module: P
2074
1795
  }) => {
2075
- const V = !m || m === 1 ? 0 : parseInt((b / 1e3).toFixed(0)), K = yn(d / 1e3), z = 60, g = Math.floor(a / 1e3).toString(), xe = T(F || 0).toFixed(), De = T(
2076
- B === v.STOP_LOSS && h || 0
2077
- ).toFixed(), Te = T(
2078
- B === v.TAKE_PROFIT && h || 0
1796
+ const V = !m || m === 1 ? 0 : parseInt((b / 1e3).toFixed(0)), U = yn(d / 1e3), j = 60, D = Math.floor(a / 1e3).toString(), he = x(T || 0).toFixed(), ge = x(
1797
+ P === v.STOP_LOSS && g || 0
1798
+ ).toFixed(), xe = x(
1799
+ P === v.TAKE_PROFIT && g || 0
2079
1800
  ).toFixed(), Y = {
2080
- ...w.order,
1801
+ ...B.order,
2081
1802
  permitted: {
2082
- ...w.order.permitted,
1803
+ ...B.order.permitted,
2083
1804
  token: e,
2084
1805
  amount: n
2085
1806
  },
2086
1807
  nonce: i,
2087
- deadline: K,
1808
+ deadline: U,
2088
1809
  witness: {
2089
- ...w.order.witness,
1810
+ ...B.order.witness,
2090
1811
  swapper: C,
2091
1812
  nonce: i,
2092
- start: g,
2093
- deadline: K,
1813
+ start: D,
1814
+ deadline: U,
2094
1815
  epoch: V,
2095
- slippage: D,
2096
- freshness: z,
1816
+ slippage: F,
1817
+ freshness: j,
2097
1818
  input: {
2098
- ...w.order.witness.input,
1819
+ ...B.order.witness.input,
2099
1820
  token: e,
2100
1821
  amount: O,
2101
1822
  maxAmount: n
2102
1823
  },
2103
1824
  output: {
2104
- ...w.order.witness.output,
1825
+ ...B.order.witness.output,
2105
1826
  token: t,
2106
- limit: xe,
2107
- triggerLower: De,
2108
- triggerUpper: Te,
1827
+ limit: he,
1828
+ triggerLower: ge,
1829
+ triggerUpper: xe,
2109
1830
  recipient: C
2110
1831
  }
2111
1832
  }
2112
1833
  };
2113
1834
  return {
2114
- ...w,
1835
+ ...B,
2115
1836
  order: Y
2116
1837
  };
2117
- }, fe = (e, t) => e && e.length ? e.map(t || ((n) => `${n}`)) : void 0, or = (e) => {
1838
+ }, fe = (e, t) => e && e.length ? e.map(t || ((n) => `${n}`)) : void 0, nr = (e) => {
2118
1839
  if (e)
2119
1840
  return on[e];
2120
1841
  }, He = (e, t) => {
@@ -2136,42 +1857,42 @@ const be = new Jn(), _e = "https://order-sink.orbs.network", Ie = "https://order
2136
1857
  limit: d = 1e3,
2137
1858
  page: b
2138
1859
  }) => {
2139
- const m = or(e);
1860
+ const m = nr(e);
2140
1861
  if (!m) throw new Et();
2141
- const D = async (F) => {
2142
- let h = 0;
2143
- for (; h <= a; )
1862
+ const F = async (T) => {
1863
+ let g = 0;
1864
+ for (; g <= a; )
2144
1865
  try {
2145
- const w = await fetch(m, {
1866
+ const B = await fetch(m, {
2146
1867
  method: "POST",
2147
- body: JSON.stringify({ query: F }),
1868
+ body: JSON.stringify({ query: T }),
2148
1869
  signal: i,
2149
1870
  headers: { "Content-Type": "application/json" }
2150
1871
  });
2151
- if (!w.ok) throw new Error(`HTTP error: ${w.status}`);
2152
- const B = await w.json(), V = B && typeof B == "object" ? B.errors : void 0;
1872
+ if (!B.ok) throw new Error(`HTTP error: ${B.status}`);
1873
+ const P = await B.json(), V = P && typeof P == "object" ? P.errors : void 0;
2153
1874
  if (Array.isArray(V) && V.length) {
2154
- const K = V[0], z = K && typeof K == "object" ? K.message : void 0;
1875
+ const U = V[0], j = U && typeof U == "object" ? U.message : void 0;
2155
1876
  throw new Error(
2156
- typeof z == "string" ? z : "Subgraph request failed"
1877
+ typeof j == "string" ? j : "Subgraph request failed"
2157
1878
  );
2158
1879
  }
2159
- return n(B);
2160
- } catch (w) {
2161
- if (i != null && i.aborted || w instanceof Error && w.name === "AbortError" || h === a) throw w;
2162
- await new Promise((B) => setTimeout(B, 500 * 2 ** h)), h++;
1880
+ return n(P);
1881
+ } catch (B) {
1882
+ if (i != null && i.aborted || B instanceof Error && B.name === "AbortError" || g === a) throw B;
1883
+ await new Promise((P) => setTimeout(P, 500 * 2 ** g)), g++;
2163
1884
  }
2164
1885
  return [];
2165
1886
  };
2166
1887
  let C = 0;
2167
1888
  const O = [];
2168
1889
  if (b !== void 0) {
2169
- const F = t(b, d);
2170
- return D(F);
1890
+ const T = t(b, d);
1891
+ return F(T);
2171
1892
  }
2172
1893
  for (; ; ) {
2173
- const F = t(C, d), h = await D(F);
2174
- if (O.push(...h), h.length < d) break;
1894
+ const T = t(C, d), g = await F(T);
1895
+ if (O.push(...g), g.length < d) break;
2175
1896
  C++;
2176
1897
  }
2177
1898
  return O;
@@ -2180,17 +1901,17 @@ const be = new Jn(), _e = "https://order-sink.orbs.network", Ie = "https://order
2180
1901
  outAmount: t.dstAmountOut,
2181
1902
  timestamp: t.timestamp,
2182
1903
  txHash: t.transactionHash
2183
- })), st = (e, t) => {
2184
- const n = T(e || 0).gt(1);
1904
+ })), it = (e, t) => {
1905
+ const n = x(e || 0).gt(1);
2185
1906
  return !n && t === 1 ? N.TWAP_MARKET : t > 1 && n ? N.TWAP_LIMIT : n ? N.LIMIT : N.TWAP_MARKET;
2186
- }, dr = (e, t, n, i) => {
2187
- const a = yt(n || []), d = new T(e.ask_srcBidAmount || 0), b = d.gt(0) ? Math.max(
1907
+ }, rr = (e, t, n, i) => {
1908
+ const a = yt(n || []), d = new x(e.ask_srcBidAmount || 0), b = d.gt(0) ? Math.max(
2188
1909
  1,
2189
- new T(e.ask_srcAmount || 0).div(d).integerValue(T.ROUND_CEIL).toNumber()
2190
- ) : 1, D = (n == null ? void 0 : n.length) >= b ? a.reduce(
2191
- (w, B) => Math.max(w, B.timestamp),
1910
+ new x(e.ask_srcAmount || 0).div(d).integerValue(x.ROUND_CEIL).toNumber()
1911
+ ) : 1, F = (n == null ? void 0 : n.length) >= b ? a.reduce(
1912
+ (B, P) => Math.max(B, P.timestamp),
2192
1913
  0
2193
- ) : void 0, C = a.reduce((w, B) => w.plus(B.inAmount), new T(0)).toFixed(), O = a.reduce((w, B) => w.plus(B.outAmount), new T(0)).toFixed(), F = bt(e.ask_srcAmount, C), h = st(e.ask_dstMinAmount, b);
1914
+ ) : void 0, C = a.reduce((B, P) => B.plus(P.inAmount), new x(0)).toFixed(), O = a.reduce((B, P) => B.plus(P.outAmount), new x(0)).toFixed(), T = bt(e.ask_srcAmount, C), g = it(e.ask_dstMinAmount, b);
2194
1915
  return {
2195
1916
  repermitDigest: "",
2196
1917
  version: 1,
@@ -2198,67 +1919,67 @@ const be = new Jn(), _e = "https://order-sink.orbs.network", Ie = "https://order
2198
1919
  isTriggerPrice: !1,
2199
1920
  id: e.Contract_id.toString(),
2200
1921
  hash: "",
2201
- type: st(e.ask_dstMinAmount, b),
1922
+ type: it(e.ask_dstMinAmount, b),
2202
1923
  srcTokenAddress: e.ask_srcToken,
2203
1924
  dstTokenAddress: e.ask_dstToken,
2204
1925
  exchangeAddress: e.exchange,
2205
1926
  twapAddress: e.twapAddress,
2206
1927
  maker: e.maker,
2207
- progress: F,
1928
+ progress: T,
2208
1929
  dstAmountFilled: O,
2209
1930
  srcAmountFilled: C,
2210
- orderDollarValueIn: T(e.dollarValueIn || 0).toFixed(6),
1931
+ orderDollarValueIn: x(e.dollarValueIn || 0).toFixed(6),
2211
1932
  srcAmount: e.ask_srcAmount,
2212
- dstMinAmountTotal: T(e.ask_dstMinAmount).multipliedBy(b).toString(),
1933
+ dstMinAmountTotal: x(e.ask_dstMinAmount).multipliedBy(b).toString(),
2213
1934
  fills: a,
2214
1935
  fillDelay: e.ask_fillDelay,
2215
1936
  deadline: e.ask_deadline * 1e3,
2216
1937
  createdAt: new Date(e.timestamp).getTime(),
2217
- dstMinAmountPerTrade: T(e.ask_dstMinAmount).eq(1) ? "" : e.ask_dstMinAmount,
1938
+ dstMinAmountPerTrade: x(e.ask_dstMinAmount).eq(1) ? "" : e.ask_dstMinAmount,
2218
1939
  triggerPricePerTrade: "",
2219
1940
  srcAmountPerTrade: e.ask_srcBidAmount,
2220
1941
  txHash: e.transactionHash,
2221
1942
  totalTradesAmount: b,
2222
- isMarketPrice: [N.TWAP_MARKET].includes(h),
1943
+ isMarketPrice: [N.TWAP_MARKET].includes(g),
2223
1944
  chainId: t,
2224
- filledOrderTimestamp: D || 0,
1945
+ filledOrderTimestamp: F || 0,
2225
1946
  status: i,
2226
1947
  rawOrder: e
2227
1948
  };
2228
- }, cr = (e) => {
2229
- var F;
1949
+ }, ar = (e) => {
1950
+ var T;
2230
1951
  if (!e) return "";
2231
1952
  const t = fe(
2232
1953
  e.accounts,
2233
- (h) => `"${h.toLowerCase()}"`
1954
+ (g) => `"${g.toLowerCase()}"`
2234
1955
  ), n = fe(
2235
1956
  En(e.configs),
2236
- (h) => `"${h.toLowerCase()}"`
1957
+ (g) => `"${g.toLowerCase()}"`
2237
1958
  ), i = fe(
2238
1959
  e.inTokenSymbols,
2239
- (h) => `"${h.toUpperCase()}"`
1960
+ (g) => `"${g.toUpperCase()}"`
2240
1961
  ), a = fe(
2241
1962
  e.outTokenSymbols,
2242
- (h) => `"${h.toUpperCase()}"`
1963
+ (g) => `"${g.toUpperCase()}"`
2243
1964
  ), d = fe(
2244
1965
  e.inTokenAddresses,
2245
- (h) => `"${h.toLowerCase()}"`
1966
+ (g) => `"${g.toLowerCase()}"`
2246
1967
  ), b = fe(
2247
1968
  e.outTokenAddresses,
2248
- (h) => `"${h.toLowerCase()}"`
1969
+ (g) => `"${g.toLowerCase()}"`
2249
1970
  ), m = fe(
2250
1971
  e.transactionHashes,
2251
- (h) => `"${h.toLowerCase()}"`
2252
- ), D = fe(e.orderIds, (h) => `"${h}"`), C = n != null && n.length ? "" : fe(
2253
- (F = e.configs) == null ? void 0 : F.map((h) => h.twapAddress),
2254
- (h) => `"${h.toLowerCase()}"`
1972
+ (g) => `"${g.toLowerCase()}"`
1973
+ ), F = fe(e.orderIds, (g) => `"${g}"`), C = n != null && n.length ? "" : fe(
1974
+ (T = e.configs) == null ? void 0 : T.map((g) => g.twapAddress),
1975
+ (g) => `"${g.toLowerCase()}"`
2255
1976
  ), O = e.minDollarValueIn;
2256
1977
  return [
2257
1978
  n ? `exchange_in: [${n.join(", ")}]` : "",
2258
1979
  C ? `twapAddress_in: [${C.join(", ")}]` : "",
2259
1980
  t ? `maker_in: [${t.join(", ")}]` : "",
2260
1981
  m ? `transactionHash_in: [${m.join(", ")}]` : "",
2261
- D ? `Contract_id_in: [${D.join(", ")}]` : "",
1982
+ F ? `Contract_id_in: [${F.join(", ")}]` : "",
2262
1983
  O ? `dollarValueIn_gte: ${O}` : "",
2263
1984
  i ? `srcTokenSymbol_in: [${i.join(", ")}]` : "",
2264
1985
  a ? `dstTokenSymbol_in: [${a.join(", ")}]` : "",
@@ -2270,25 +1991,25 @@ const be = new Jn(), _e = "https://order-sink.orbs.network", Ie = "https://order
2270
1991
  (e == null ? void 0 : e.orderType) === "market" ? "ask_dstMinAmount_lte: 1" : ""
2271
1992
  ].filter(Boolean).join(", ");
2272
1993
  };
2273
- async function ur({
1994
+ async function ir({
2274
1995
  chainId: e,
2275
1996
  signal: t,
2276
1997
  page: n,
2277
1998
  limit: i,
2278
1999
  filters: a
2279
2000
  }) {
2280
- const d = i || 1e3, b = cr(a);
2001
+ const d = i || 1e3, b = ar(a);
2281
2002
  return await Ye({
2282
2003
  chainId: e,
2283
2004
  signal: t,
2284
2005
  limit: d,
2285
2006
  page: n,
2286
- buildQuery: (D, C) => `
2007
+ buildQuery: (F, C) => `
2287
2008
  {
2288
2009
  orderCreateds(
2289
2010
  ${b ? `where: { ${b} },` : ""}
2290
2011
  first: ${C},
2291
- skip: ${D * C},
2012
+ skip: ${F * C},
2292
2013
  orderBy: timestamp,
2293
2014
  orderDirection: desc,
2294
2015
  ) {
@@ -2318,10 +2039,10 @@ async function ur({
2318
2039
  }
2319
2040
  }
2320
2041
  `,
2321
- extractResults: (D) => He(D, "orderCreateds")
2042
+ extractResults: (F) => He(F, "orderCreateds")
2322
2043
  });
2323
2044
  }
2324
- const lr = async ({
2045
+ const sr = async ({
2325
2046
  chainId: e,
2326
2047
  orders: t,
2327
2048
  signal: n
@@ -2334,11 +2055,11 @@ const lr = async ({
2334
2055
  chainId: e,
2335
2056
  signal: n,
2336
2057
  limit: 1e3,
2337
- buildQuery: (m, D) => `
2058
+ buildQuery: (m, F) => `
2338
2059
  {
2339
2060
  statusNews(
2340
- first: ${D},
2341
- skip: ${m * D},
2061
+ first: ${F},
2062
+ skip: ${m * F},
2342
2063
  ${d}
2343
2064
  ) {
2344
2065
  twapId
@@ -2353,14 +2074,14 @@ const lr = async ({
2353
2074
  function qe(e) {
2354
2075
  return Array.from(new Set(e));
2355
2076
  }
2356
- const fr = async ({
2077
+ const or = async ({
2357
2078
  chainId: e,
2358
2079
  orders: t,
2359
2080
  signal: n
2360
2081
  }) => {
2361
- const i = qe(t.map((F) => F.Contract_id)), a = qe(t.map((F) => F.twapAddress)).filter(Boolean);
2082
+ const i = qe(t.map((T) => T.Contract_id)), a = qe(t.map((T) => T.twapAddress)).filter(Boolean);
2362
2083
  if (i.length === 0) return [];
2363
- const d = i.join(", "), b = a.map((F) => `"${F}"`).join(", "), m = a.length ? `twapAddress_in: [${b}]` : "", C = `where: { ${[
2084
+ const d = i.join(", "), b = a.map((T) => `"${T}"`).join(", "), m = a.length ? `twapAddress_in: [${b}]` : "", C = `where: { ${[
2364
2085
  `TWAP_id_in: [${d}]`,
2365
2086
  m
2366
2087
  ].filter(Boolean).join(", ")} }`;
@@ -2368,9 +2089,9 @@ const fr = async ({
2368
2089
  chainId: e,
2369
2090
  signal: n,
2370
2091
  limit: 1e3,
2371
- buildQuery: (F, h) => `
2092
+ buildQuery: (T, g) => `
2372
2093
  {
2373
- orderFilleds(first: ${h}, orderBy: timestamp, skip: ${F * h}, ${C}) {
2094
+ orderFilleds(first: ${g}, orderBy: timestamp, skip: ${T * g}, ${C}) {
2374
2095
  id
2375
2096
  dstAmountOut
2376
2097
  dstFee
@@ -2386,9 +2107,9 @@ const fr = async ({
2386
2107
  }
2387
2108
  }
2388
2109
  `,
2389
- extractResults: (F) => He(F, "orderFilleds").map((h) => ({
2390
- ...h,
2391
- timestamp: new Date(h.timestamp).getTime()
2110
+ extractResults: (T) => He(T, "orderFilleds").map((g) => ({
2111
+ ...g,
2112
+ timestamp: new Date(g.timestamp).getTime()
2392
2113
  }))
2393
2114
  });
2394
2115
  };
@@ -2397,7 +2118,7 @@ class Et extends Error {
2397
2118
  super("No graph endpoint found"), this.name = "NoGraphEndpointError";
2398
2119
  }
2399
2120
  }
2400
- const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "number" && Number.isFinite(e.Contract_id)) && typeof e.twapAddress == "string" && e.twapAddress.length > 0 && typeof e.exchange == "string", Ar = async ({
2121
+ const dr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "number" && Number.isFinite(e.Contract_id)) && typeof e.twapAddress == "string" && e.twapAddress.length > 0 && typeof e.exchange == "string", cr = async ({
2401
2122
  chainId: e,
2402
2123
  signal: t,
2403
2124
  page: n,
@@ -2405,7 +2126,7 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2405
2126
  filters: a
2406
2127
  }) => {
2407
2128
  try {
2408
- const d = await ur({
2129
+ const d = await ir({
2409
2130
  chainId: e,
2410
2131
  signal: t,
2411
2132
  page: n,
@@ -2413,63 +2134,63 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2413
2134
  filters: a
2414
2135
  });
2415
2136
  let b = 0;
2416
- const m = d.filter((h) => {
2417
- const w = pr(h);
2418
- return w || b++, w;
2419
- }), [D, C] = await Promise.all([
2420
- fr({ chainId: e, orders: m, signal: t }),
2421
- lr({ chainId: e, orders: m, signal: t })
2422
- ]), O = m.flatMap((h) => {
2423
- const w = D == null ? void 0 : D.filter(
2424
- (B) => String(B.TWAP_id) === String(h.Contract_id) && ke(B.exchange, h.exchange) && ke(B.twapAddress, h.twapAddress)
2137
+ const m = d.filter((g) => {
2138
+ const B = dr(g);
2139
+ return B || b++, B;
2140
+ }), [F, C] = await Promise.all([
2141
+ or({ chainId: e, orders: m, signal: t }),
2142
+ sr({ chainId: e, orders: m, signal: t })
2143
+ ]), O = m.flatMap((g) => {
2144
+ const B = F == null ? void 0 : F.filter(
2145
+ (P) => String(P.TWAP_id) === String(g.Contract_id) && Oe(P.exchange, g.exchange) && Oe(P.twapAddress, g.twapAddress)
2425
2146
  );
2426
2147
  try {
2427
2148
  return [
2428
- dr(
2429
- h,
2149
+ rr(
2150
+ g,
2430
2151
  e,
2431
- w,
2432
- yr(h, w || [], C)
2152
+ B,
2153
+ ur(g, B || [], C)
2433
2154
  )
2434
2155
  ];
2435
2156
  } catch {
2436
2157
  return b++, [];
2437
2158
  }
2438
- }).sort((h, w) => w.createdAt - h.createdAt);
2159
+ }).sort((g, B) => B.createdAt - g.createdAt);
2439
2160
  b > 0 && console.warn(
2440
2161
  `Skipped ${b} invalid legacy order history ${b === 1 ? "item" : "items"} on chain ${e}`
2441
2162
  );
2442
- const F = /* @__PURE__ */ new Set();
2443
- return O.filter((h) => F.has(h.historyKey) ? !1 : (F.add(h.historyKey), !0));
2163
+ const T = /* @__PURE__ */ new Set();
2164
+ return O.filter((g) => T.has(g.historyKey) ? !1 : (T.add(g.historyKey), !0));
2444
2165
  } catch (d) {
2445
2166
  if (d instanceof Et) return [];
2446
2167
  throw d;
2447
2168
  }
2448
- }, yr = (e, t, n) => {
2169
+ }, ur = (e, t, n) => {
2449
2170
  var m;
2450
2171
  const i = (m = n == null ? void 0 : n.find(
2451
- (D) => D.twapId === e.Contract_id.toString() && ke(D.twapAddress, e.twapAddress)
2452
- )) == null ? void 0 : m.status, d = yt(t).reduce((D, C) => D.plus(C.inAmount), new T(0)).toFixed(), b = bt(e.ask_srcAmount, d);
2453
- return Er(b, e.ask_deadline * 1e3, i);
2172
+ (F) => F.twapId === e.Contract_id.toString() && Oe(F.twapAddress, e.twapAddress)
2173
+ )) == null ? void 0 : m.status, d = yt(t).reduce((F, C) => F.plus(C.inAmount), new x(0)).toFixed(), b = bt(e.ask_srcAmount, d);
2174
+ return lr(b, e.ask_deadline * 1e3, i);
2454
2175
  }, bt = (e, t) => {
2455
- const n = T(e || 0), i = T(t || 0);
2176
+ const n = x(e || 0), i = x(t || 0);
2456
2177
  if (!n.isFinite() || !i.isFinite() || n.lte(0)) return 0;
2457
2178
  const a = i.dividedBy(n).toNumber();
2458
2179
  return a >= 1 ? 100 : a <= 0 ? 0 : Number((a * 100).toFixed(2));
2459
- }, Er = (e, t, n) => e === 100 ? ce.Completed : n === "CANCELLED" ? ce.Cancelled : n === "COMPLETED" ? ce.Completed : t > Date.now() ? ce.Open : ce.Expired, br = (e) => {
2460
- const t = T(e.order.witness.output.limit || 0).gt(1), { stop: n, triggerLower: i, triggerUpper: a } = e.order.witness.output, d = T(n || 0).eq(pt), b = d || T(a || 0).gt(0), m = !d && T(n || 0).gt(0) || T(i || 0).gt(0), D = T(e.order.witness.input.amount), C = e.metadata.expectedChunks || (D.gt(0) ? T(e.order.witness.input.maxAmount).div(D).toNumber() : 1);
2180
+ }, lr = (e, t, n) => e === 100 ? ce.Completed : n === "CANCELLED" ? ce.Cancelled : n === "COMPLETED" ? ce.Completed : t > Date.now() ? ce.Open : ce.Expired, fr = (e) => {
2181
+ const t = x(e.order.witness.output.limit || 0).gt(1), { stop: n, triggerLower: i, triggerUpper: a } = e.order.witness.output, d = x(n || 0).eq(pt), b = d || x(a || 0).gt(0), m = !d && x(n || 0).gt(0) || x(i || 0).gt(0), F = x(e.order.witness.input.amount), C = e.metadata.expectedChunks || (F.gt(0) ? x(e.order.witness.input.maxAmount).div(F).toNumber() : 1);
2461
2182
  return b ? t ? N.TAKE_PROFIT_LIMIT : N.TAKE_PROFIT_MARKET : m ? t ? N.STOP_LOSS_LIMIT : N.STOP_LOSS_MARKET : t ? C > 1 && t ? N.TWAP_LIMIT : t ? N.LIMIT : N.TWAP_MARKET : N.TWAP_MARKET;
2462
- }, mr = (e) => {
2183
+ }, pr = (e) => {
2463
2184
  var a;
2464
2185
  const t = ((a = e.metadata.chunks) == null ? void 0 : a.filter((d) => d.status === "success").length) || 0, n = e.metadata.expectedChunks || 0;
2465
2186
  if (!n) return 0;
2466
- const i = T(t).dividedBy(n).toNumber();
2187
+ const i = x(t).dividedBy(n).toNumber();
2467
2188
  return t >= n ? 100 : i <= 0 ? 0 : Number((i * 100).toFixed(2));
2468
- }, hr = (e, t) => {
2189
+ }, Ar = (e, t) => {
2469
2190
  var a;
2470
2191
  const n = (e.metadata.status || "").toLowerCase(), i = (a = e.metadata.description) == null ? void 0 : a.toLowerCase();
2471
2192
  return n === "completed" || t === 100 ? ce.Completed : ["pending", "eligible"].includes(n) ? ce.Open : ["cancelled", "canceled"].includes(n) || i === "cancelled by contract" || i === "canceled by contract" ? ce.Cancelled : ce.Expired;
2472
- }, xr = (e) => {
2193
+ }, yr = (e) => {
2473
2194
  var n;
2474
2195
  return (((n = e.metadata.chunks) == null ? void 0 : n.filter((i) => i.status === "success")) || []).map((i) => ({
2475
2196
  inAmount: i.inAmount,
@@ -2477,28 +2198,28 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2477
2198
  timestamp: new Date(i.timestamp).getTime(),
2478
2199
  txHash: i.txHash
2479
2200
  })).sort((i, a) => i.timestamp - a.timestamp);
2480
- }, Tr = (e, t) => e.length >= t ? e.reduce(
2201
+ }, Er = (e, t) => e.length >= t ? e.reduce(
2481
2202
  (i, a) => Math.max(i, a.timestamp),
2482
2203
  0
2483
- ) : 0, gr = (e) => {
2484
- const t = T(e.metadata.displayOnlyInputTokenPriceUSD || 0);
2204
+ ) : 0, br = (e) => {
2205
+ const t = x(e.metadata.displayOnlyInputTokenPriceUSD || 0);
2485
2206
  return t.isFinite() ? t.dividedBy(1e18).toFixed() : "0";
2486
- }, Ze = (e) => T(e.order.witness.output.limit || 0).eq(1) ? "" : e.order.witness.output.limit, Dr = (e) => {
2487
- const { triggerLower: t = "0", triggerUpper: n = "0" } = e.order.witness.output, i = Ze(e), a = e.metadata.expectedChunks || 1, d = T(n || 0).gt(0);
2207
+ }, Ze = (e) => x(e.order.witness.output.limit || 0).eq(1) ? "" : e.order.witness.output.limit, mr = (e) => {
2208
+ const { triggerLower: t = "0", triggerUpper: n = "0" } = e.order.witness.output, i = Ze(e), a = e.metadata.expectedChunks || 1, d = x(n || 0).gt(0);
2488
2209
  return {
2489
2210
  dstMinAmountPerTrade: i,
2490
2211
  triggerPricePerTrade: d ? n : t,
2491
- dstMinAmountTotal: i ? T(i).multipliedBy(a).toFixed() : ""
2212
+ dstMinAmountTotal: i ? x(i).multipliedBy(a).toFixed() : ""
2492
2213
  };
2493
- }, Fr = (e) => {
2494
- const t = Ze(e), n = T(e.order.witness.output.stop || 0).eq(pt), i = e.metadata.expectedChunks || 1;
2214
+ }, hr = (e) => {
2215
+ const t = Ze(e), n = x(e.order.witness.output.stop || 0).eq(pt), i = e.metadata.expectedChunks || 1;
2495
2216
  return {
2496
2217
  dstMinAmountPerTrade: n ? "" : t,
2497
- triggerPricePerTrade: n ? t : T(e.order.witness.output.stop || 0).toFixed(),
2498
- dstMinAmountTotal: n || !t ? "" : T(t).multipliedBy(i).toFixed()
2218
+ triggerPricePerTrade: n ? t : x(e.order.witness.output.stop || 0).toFixed(),
2219
+ dstMinAmountTotal: n || !t ? "" : x(t).multipliedBy(i).toFixed()
2499
2220
  };
2500
- }, Cr = (e) => Number(Xe) >= 2 ? Dr(e) : Fr(e), mt = (e) => {
2501
- const t = mr(e), n = Ze(e), i = e.metadata.expectedChunks || 1, a = xr(e), d = br(e);
2221
+ }, xr = (e) => Number(Xe) >= 2 ? mr(e) : hr(e), mt = (e) => {
2222
+ const t = pr(e), n = Ze(e), i = e.metadata.expectedChunks || 1, a = yr(e), d = fr(e);
2502
2223
  return {
2503
2224
  id: e.hash,
2504
2225
  hash: e.hash,
@@ -2507,32 +2228,32 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2507
2228
  type: d,
2508
2229
  maker: e.order.witness.swapper,
2509
2230
  progress: t,
2510
- srcAmountFilled: a.reduce((b, m) => b.plus(m.inAmount), new T(0)).toFixed() || "",
2511
- dstAmountFilled: a.reduce((b, m) => b.plus(m.outAmount), new T(0)).toFixed() || "",
2231
+ srcAmountFilled: a.reduce((b, m) => b.plus(m.inAmount), new x(0)).toFixed() || "",
2232
+ dstAmountFilled: a.reduce((b, m) => b.plus(m.outAmount), new x(0)).toFixed() || "",
2512
2233
  fills: a,
2513
2234
  srcTokenAddress: e.order.witness.input.token,
2514
2235
  dstTokenAddress: e.order.witness.output.token,
2515
- orderDollarValueIn: gr(e),
2236
+ orderDollarValueIn: br(e),
2516
2237
  fillDelay: e.order.witness.epoch * 1e3,
2517
2238
  deadline: Number(e.order.deadline) * 1e3,
2518
2239
  createdAt: new Date(e.timestamp).getTime(),
2519
2240
  srcAmount: e.order.witness.input.maxAmount,
2520
2241
  srcAmountPerTrade: e.order.witness.input.amount,
2521
2242
  totalTradesAmount: i,
2522
- isMarketPrice: T(n || 0).lte(1),
2243
+ isMarketPrice: x(n || 0).lte(1),
2523
2244
  chainId: e.order.witness.chainid,
2524
- filledOrderTimestamp: Tr(a, i),
2525
- status: hr(e, t),
2245
+ filledOrderTimestamp: Er(a, i),
2246
+ status: Ar(e, t),
2526
2247
  repermitDigest: e.metadata.repermitDigest,
2527
2248
  isTriggerPrice: d === N.TAKE_PROFIT_MARKET || d === N.TAKE_PROFIT_LIMIT || d === N.STOP_LOSS_LIMIT || d === N.STOP_LOSS_MARKET,
2528
2249
  rawOrder: e,
2529
- ...Cr(e)
2250
+ ...xr(e)
2530
2251
  };
2531
- }, Br = (e, t) => {
2252
+ }, Tr = (e, t) => {
2532
2253
  e !== 0 && console.warn(
2533
2254
  `Skipped ${e} invalid order history ${e === 1 ? "item" : "items"} from ${t}`
2534
2255
  );
2535
- }, wr = (e, t) => {
2256
+ }, gr = (e, t) => {
2536
2257
  if (!e || typeof e != "object" || !Array.isArray(e.orders))
2537
2258
  throw new Error("Invalid order history response: missing orders array");
2538
2259
  const n = Number(
@@ -2542,7 +2263,7 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2542
2263
  orders: e.orders,
2543
2264
  totalPages: i
2544
2265
  };
2545
- }, ot = async ({
2266
+ }, st = async ({
2546
2267
  endpoint: e,
2547
2268
  chainId: t,
2548
2269
  signal: n,
@@ -2557,22 +2278,22 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2557
2278
  page: d.toString()
2558
2279
  });
2559
2280
  a && m.set("exchange", a), b !== void 0 && m.set("limit", b.toString());
2560
- const D = await fetch(`${e}/orders?${m}`, { signal: n });
2561
- if (!D.ok)
2281
+ const F = await fetch(`${e}/orders?${m}`, { signal: n });
2282
+ if (!F.ok)
2562
2283
  throw new Error(
2563
- `Failed to fetch order history from ${e}: ${D.status}`
2284
+ `Failed to fetch order history from ${e}: ${F.status}`
2564
2285
  );
2565
- const C = wr(await D.json(), d);
2286
+ const C = gr(await F.json(), d);
2566
2287
  let O = 0;
2567
- const F = C.orders.flatMap((h) => {
2288
+ const T = C.orders.flatMap((g) => {
2568
2289
  try {
2569
- return [mt(h)];
2290
+ return [mt(g)];
2570
2291
  } catch {
2571
2292
  return O++, [];
2572
2293
  }
2573
2294
  });
2574
- return Br(O, e), { orders: F, totalPages: C.totalPages ?? d };
2575
- }, Sr = async ({
2295
+ return Tr(O, e), { orders: T, totalPages: C.totalPages ?? d };
2296
+ }, Dr = async ({
2576
2297
  endpoint: e,
2577
2298
  chainId: t,
2578
2299
  signal: n,
@@ -2581,7 +2302,7 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2581
2302
  page: d,
2582
2303
  limit: b
2583
2304
  }) => {
2584
- const m = d === void 0 ? 1 : d + 1, D = await ot({
2305
+ const m = d === void 0 ? 1 : d + 1, F = await st({
2585
2306
  endpoint: e,
2586
2307
  chainId: t,
2587
2308
  signal: n,
@@ -2590,45 +2311,45 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2590
2311
  page: m,
2591
2312
  limit: b
2592
2313
  });
2593
- if (d !== void 0 || m >= D.totalPages)
2594
- return D.orders;
2314
+ if (d !== void 0 || m >= F.totalPages)
2315
+ return F.orders;
2595
2316
  const C = Array.from(
2596
- { length: D.totalPages - m },
2597
- (F, h) => m + h + 1
2317
+ { length: F.totalPages - m },
2318
+ (T, g) => m + g + 1
2598
2319
  ), O = await Promise.all(
2599
2320
  C.map(
2600
- (F) => ot({
2321
+ (T) => st({
2601
2322
  endpoint: e,
2602
2323
  chainId: t,
2603
2324
  signal: n,
2604
2325
  account: i,
2605
2326
  exchange: a,
2606
- page: F,
2327
+ page: T,
2607
2328
  limit: b
2608
2329
  })
2609
2330
  )
2610
2331
  );
2611
2332
  return [
2612
- ...D.orders,
2613
- ...O.flatMap((F) => F.orders)
2333
+ ...F.orders,
2334
+ ...O.flatMap((T) => T.orders)
2614
2335
  ];
2615
- }, Pr = (e, t, n) => {
2336
+ }, Fr = (e, t, n) => {
2616
2337
  const i = /* @__PURE__ */ new Map();
2617
2338
  for (const a of e) {
2618
- const d = ar({ endpoint: a, exchange: t, partner: n }), b = d.length ? d : [void 0];
2339
+ const d = Jn({ endpoint: a, exchange: t, partner: n }), b = d.length ? d : [void 0];
2619
2340
  for (const m of b) {
2620
- const D = (m == null ? void 0 : m.toLowerCase()) ?? "all", C = i.get(D) ?? {
2341
+ const F = (m == null ? void 0 : m.toLowerCase()) ?? "all", C = i.get(F) ?? {
2621
2342
  exchange: m,
2622
2343
  endpoints: []
2623
2344
  };
2624
- C.endpoints.push(a), i.set(D, C);
2345
+ C.endpoints.push(a), i.set(F, C);
2625
2346
  }
2626
2347
  }
2627
2348
  return Array.from(i.values());
2628
- }, dt = () => {
2349
+ }, ot = () => {
2629
2350
  const e = new Error("Order history request aborted");
2630
2351
  throw e.name = "AbortError", e;
2631
- }, Or = async ({
2352
+ }, Cr = async ({
2632
2353
  chainId: e,
2633
2354
  signal: t,
2634
2355
  account: n,
@@ -2638,58 +2359,58 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2638
2359
  limit: b
2639
2360
  }) => {
2640
2361
  if (!n) return [];
2641
- const m = Pr(
2642
- nr(),
2362
+ const m = Fr(
2363
+ Zn(),
2643
2364
  i,
2644
2365
  a
2645
- ), D = await Promise.allSettled(
2646
- m.map(async (F) => {
2647
- const h = await Promise.allSettled(
2648
- F.endpoints.map(
2649
- (B) => Sr({
2650
- endpoint: B,
2366
+ ), F = await Promise.allSettled(
2367
+ m.map(async (T) => {
2368
+ const g = await Promise.allSettled(
2369
+ T.endpoints.map(
2370
+ (P) => Dr({
2371
+ endpoint: P,
2651
2372
  chainId: e,
2652
2373
  signal: t,
2653
2374
  account: n,
2654
- exchange: F.exchange,
2375
+ exchange: T.exchange,
2655
2376
  page: d,
2656
2377
  limit: b
2657
2378
  })
2658
2379
  )
2659
2380
  );
2660
- t != null && t.aborted && dt();
2661
- const w = h.filter(
2662
- (B) => B.status === "fulfilled"
2381
+ t != null && t.aborted && ot();
2382
+ const B = g.filter(
2383
+ (P) => P.status === "fulfilled"
2663
2384
  );
2664
- if (!w.length) {
2665
- const B = h.find(
2385
+ if (!B.length) {
2386
+ const P = g.find(
2666
2387
  (V) => V.status === "rejected"
2667
2388
  );
2668
- throw (B == null ? void 0 : B.reason) instanceof Error ? B.reason : new Error("Failed to fetch order history");
2389
+ throw (P == null ? void 0 : P.reason) instanceof Error ? P.reason : new Error("Failed to fetch order history");
2669
2390
  }
2670
- return w.flatMap((B) => B.value);
2391
+ return B.flatMap((P) => P.value);
2671
2392
  })
2672
2393
  );
2673
- t != null && t.aborted && dt();
2674
- const C = D.filter(
2675
- (F) => F.status === "fulfilled"
2394
+ t != null && t.aborted && ot();
2395
+ const C = F.filter(
2396
+ (T) => T.status === "fulfilled"
2676
2397
  );
2677
2398
  if (!C.length) {
2678
- const F = D.find(
2679
- (h) => h.status === "rejected"
2399
+ const T = F.find(
2400
+ (g) => g.status === "rejected"
2680
2401
  );
2681
- throw (F == null ? void 0 : F.reason) instanceof Error ? F.reason : new Error("Failed to fetch order history");
2402
+ throw (T == null ? void 0 : T.reason) instanceof Error ? T.reason : new Error("Failed to fetch order history");
2682
2403
  }
2683
2404
  const O = /* @__PURE__ */ new Map();
2684
- for (const F of C.flatMap((h) => h.value))
2685
- O.has(F.historyKey) || O.set(F.historyKey, F);
2405
+ for (const T of C.flatMap((g) => g.value))
2406
+ O.has(T.historyKey) || O.set(T.historyKey, T);
2686
2407
  return Array.from(O.values());
2687
- }, kr = (e, t) => {
2408
+ }, Br = (e, t) => {
2688
2409
  if (e !== void 0 && (!Number.isInteger(e) || e < 0))
2689
2410
  throw new Error("Order history page must be a non-negative integer");
2690
2411
  if (t !== void 0 && (!Number.isInteger(t) || t <= 0))
2691
2412
  throw new Error("Order history limit must be a positive integer");
2692
- }, _r = async ({
2413
+ }, wr = async ({
2693
2414
  signal: e,
2694
2415
  page: t,
2695
2416
  chainId: n,
@@ -2699,20 +2420,20 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2699
2420
  account: b,
2700
2421
  legacyOrders: m = !0
2701
2422
  }) => {
2702
- kr(t, i);
2703
- const D = ln(d, n);
2423
+ Br(t, i);
2424
+ const F = ln(d, n);
2704
2425
  return (await Promise.all([
2705
- !D || !m ? Promise.resolve([]) : Ar({
2426
+ !F || !m ? Promise.resolve([]) : cr({
2706
2427
  chainId: n,
2707
2428
  signal: e,
2708
2429
  page: t,
2709
2430
  limit: i,
2710
2431
  filters: {
2711
2432
  accounts: [b],
2712
- configs: [D]
2433
+ configs: [F]
2713
2434
  }
2714
2435
  }),
2715
- Or({
2436
+ Cr({
2716
2437
  chainId: n,
2717
2438
  signal: e,
2718
2439
  account: b,
@@ -2721,16 +2442,295 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2721
2442
  page: t,
2722
2443
  limit: i
2723
2444
  })
2724
- ]).then(([F, h]) => [...F, ...h])).sort((F, h) => h.createdAt - F.createdAt);
2725
- }, vr = async (e, t) => {
2445
+ ]).then(([T, g]) => [...T, ...g])).sort((T, g) => g.createdAt - T.createdAt);
2446
+ }, Sr = 0.7, Pr = `https://bi.orbs.network/putes/twap-ui-${Sr}`;
2447
+ let Se = "unknown";
2448
+ function Xr(e) {
2449
+ Se = e;
2450
+ }
2451
+ function Be() {
2452
+ const e = Math.random().toString(36).substring(2, 16), t = Math.random().toString(36).substring(2, 16), n = Date.now().toString(36);
2453
+ return `id_${e + t + n}`;
2454
+ }
2455
+ const Or = (e, t, n) => ({
2456
+ spotVersion: _e.version,
2457
+ partner: e,
2458
+ chainId: n || 0,
2459
+ minChunkSizeUsd: t
2460
+ }), kr = (e, t, n, i) => {
2461
+ const { witness: a } = e.order, d = Ge.config(
2462
+ e.domain.chainId,
2463
+ t
2464
+ );
2465
+ return {
2466
+ spotVersion: _e.version,
2467
+ partner: t,
2468
+ cosigner: d == null ? void 0 : d.cosigner,
2469
+ fee: d == null ? void 0 : d.fee,
2470
+ refinery: d == null ? void 0 : d.refinery,
2471
+ router: d == null ? void 0 : d.router,
2472
+ type: d == null ? void 0 : d.type,
2473
+ wm: d == null ? void 0 : d.wm,
2474
+ adapter: a.exchange.adapter,
2475
+ executor: a.executor,
2476
+ reactor: a.reactor,
2477
+ repermit: e.domain.verifyingContract,
2478
+ chainId: e.domain.chainId,
2479
+ chainName: (n == null ? void 0 : n.chainName) || "",
2480
+ twapVersion: (n == null ? void 0 : n.twapVersion) || 0,
2481
+ twapAddress: (n == null ? void 0 : n.twapAddress) || "",
2482
+ lensAddress: (n == null ? void 0 : n.lensAddress) || "",
2483
+ bidDelaySeconds: (n == null ? void 0 : n.bidDelaySeconds) || 0,
2484
+ minChunkSizeUsd: i || 0,
2485
+ name: (n == null ? void 0 : n.name) || "",
2486
+ exchangeAddress: (n == null ? void 0 : n.exchangeAddress) || "",
2487
+ exchangeType: (n == null ? void 0 : n.exchangeType) || "",
2488
+ pathfinderKey: (n == null ? void 0 : n.pathfinderKey) || ""
2489
+ };
2490
+ }, we = async (e) => {
2491
+ try {
2492
+ await fetch(Pr, {
2493
+ method: "POST",
2494
+ headers: {
2495
+ Accept: "application/json",
2496
+ "Content-Type": "application/json"
2497
+ },
2498
+ body: JSON.stringify(e)
2499
+ }).then();
2500
+ } catch (t) {
2501
+ console.error("Failed to send BI", t);
2502
+ }
2503
+ }, dt = (e) => {
2504
+ try {
2505
+ if (typeof e == "string" && e.trim())
2506
+ return e.toLowerCase();
2507
+ if (typeof e == "object" && e !== null) {
2508
+ const t = Reflect.get(e, "message");
2509
+ if (typeof t == "string" && t.trim())
2510
+ return t.toLowerCase();
2511
+ const n = Reflect.get(e, "code");
2512
+ if (typeof n == "string" || typeof n == "number")
2513
+ return String(n).toLowerCase();
2514
+ }
2515
+ } catch {
2516
+ }
2517
+ return "unknown error";
2518
+ };
2519
+ class _r {
2520
+ constructor() {
2521
+ Ee(this, "timeout");
2522
+ Ee(this, "configDetails", {});
2523
+ Ee(this, "configUpdateKey", "");
2524
+ Ee(this, "moduleImportKey", "");
2525
+ Ee(this, "data", {
2526
+ _id: Be()
2527
+ });
2528
+ }
2529
+ async updateAndSend(t = {}, n = !1, i) {
2530
+ try {
2531
+ this.data = {
2532
+ ...this.data,
2533
+ ...t
2534
+ }, n ? (await we(this.data), i == null || i()) : (clearTimeout(this.timeout), this.timeout = setTimeout(() => {
2535
+ we(this.data), i == null || i();
2536
+ }, 1e3));
2537
+ } catch (a) {
2538
+ console.error("Failed to update and send BI", a);
2539
+ }
2540
+ }
2541
+ onCancelOrderRequest(t, n) {
2542
+ this.updateAndSend({
2543
+ cancelOrderIdsV1: n === 1 ? t : void 0,
2544
+ cancelOrderIdsV2: n === 2 ? t : void 0,
2545
+ action: "cancel order",
2546
+ cancelOrderSuccess: !1,
2547
+ cancelOrderTxHash: void 0,
2548
+ actionError: void 0
2549
+ });
2550
+ }
2551
+ onCancelOrderSuccess(t) {
2552
+ this.updateAndSend({
2553
+ cancelOrderTxHash: t,
2554
+ cancelOrderSuccess: !0
2555
+ });
2556
+ }
2557
+ onCancelOrderError(t) {
2558
+ this.onTxError(t);
2559
+ }
2560
+ onWrapSuccess(t) {
2561
+ this.updateAndSend({
2562
+ wrapTxHash: t
2563
+ });
2564
+ }
2565
+ onWrapRequest() {
2566
+ this.updateAndSend({
2567
+ action: "wrap"
2568
+ });
2569
+ }
2570
+ onWrapError(t) {
2571
+ this.onTxError(t);
2572
+ }
2573
+ onApproveRequest() {
2574
+ this.updateAndSend({
2575
+ action: "approve"
2576
+ });
2577
+ }
2578
+ onApproveSuccess(t) {
2579
+ this.updateAndSend({
2580
+ approvalTxHash: t
2581
+ });
2582
+ }
2583
+ onApproveError(t) {
2584
+ this.onTxError(t);
2585
+ }
2586
+ onCrash(t) {
2587
+ this.updateAndSend({
2588
+ action: "crash",
2589
+ actionError: dt(t)
2590
+ });
2591
+ }
2592
+ onTxError(t) {
2593
+ this.updateAndSend({ actionError: dt(t) });
2594
+ }
2595
+ onRequestOrder({
2596
+ account: t,
2597
+ chainId: n,
2598
+ module: i,
2599
+ srcToken: a,
2600
+ dstToken: d,
2601
+ fromTokenAmount: b,
2602
+ srcChunkAmount: m,
2603
+ minDstAmountOutPerTrade: F = "",
2604
+ triggerPricePerTrade: C = "",
2605
+ deadline: O,
2606
+ fillDelay: T,
2607
+ slippage: g,
2608
+ isMarketOrder: B,
2609
+ chunksAmount: P
2610
+ }) {
2611
+ this.updateAndSend({
2612
+ toTokenAddress: d.address,
2613
+ toTokenSymbol: d.symbol,
2614
+ fromTokenAddress: a.address,
2615
+ fromTokenSymbol: a.symbol,
2616
+ fromTokenAmount: b,
2617
+ chunksAmount: P,
2618
+ srcChunkAmount: m,
2619
+ minDstAmountOutPerTrade: F,
2620
+ triggerPricePerTrade: C,
2621
+ deadline: O,
2622
+ fillDelay: T,
2623
+ slippage: g,
2624
+ chainId: n,
2625
+ walletAddress: t,
2626
+ module: i,
2627
+ orderType: B ? "market" : "limit",
2628
+ actionError: void 0
2629
+ });
2630
+ }
2631
+ onSignOrderRequest(t) {
2632
+ this.updateAndSend({
2633
+ action: "sign order"
2634
+ });
2635
+ }
2636
+ onSignOrderError(t) {
2637
+ this.onTxError(t);
2638
+ }
2639
+ onSignOrderSuccess(t) {
2640
+ this.updateAndSend({
2641
+ action: "sign order"
2642
+ });
2643
+ }
2644
+ init(t, n, i, a) {
2645
+ const d = `${t}:${i || 0}:${a || ""}`;
2646
+ if (d !== this.moduleImportKey) {
2647
+ this.moduleImportKey = d;
2648
+ const b = {
2649
+ _id: Be(),
2650
+ action: "module-import",
2651
+ uiVersion: Se,
2652
+ appId: a,
2653
+ ...Or(t, n, i),
2654
+ origin: window.location.origin
2655
+ };
2656
+ this.configDetails.partner === t && this.configDetails.chainId === (i || 0) || (this.configDetails = {}), this.data = { ...b, ...this.configDetails }, we(b);
2657
+ }
2658
+ }
2659
+ onFetchedConfig(t, n, i, a) {
2660
+ const d = kr(
2661
+ t,
2662
+ n,
2663
+ i,
2664
+ a
2665
+ ), b = `${n}:${d.chainId}:${d.repermit}:${d.adapter}:${d.executor}:${d.reactor}`;
2666
+ b !== this.configUpdateKey && (this.configUpdateKey = b, this.configDetails = d, this.data = { ...this.data, ...d }, we({
2667
+ _id: Be(),
2668
+ action: "config-update",
2669
+ uiVersion: Se,
2670
+ appId: this.data.appId,
2671
+ origin: typeof window > "u" ? void 0 : window.location.origin,
2672
+ ...d
2673
+ }));
2674
+ }
2675
+ onCreateOrderError(t) {
2676
+ this.onTxError(t);
2677
+ }
2678
+ onCreateOrderRequest() {
2679
+ this.updateAndSend({
2680
+ action: "create order"
2681
+ });
2682
+ }
2683
+ async onCreateOrderSuccess(t) {
2684
+ this.updateAndSend(
2685
+ {
2686
+ orderHash: t,
2687
+ orderSuccess: !0
2688
+ },
2689
+ void 0,
2690
+ () => {
2691
+ this.data = {
2692
+ _id: Be(),
2693
+ action: "reset",
2694
+ uiVersion: Se,
2695
+ appId: this.data.appId,
2696
+ origin: this.data.origin,
2697
+ spotVersion: _e.version,
2698
+ partner: this.data.partner,
2699
+ adapter: this.data.adapter,
2700
+ cosigner: this.data.cosigner,
2701
+ executor: this.data.executor,
2702
+ fee: this.data.fee,
2703
+ reactor: this.data.reactor,
2704
+ refinery: this.data.refinery,
2705
+ repermit: this.data.repermit,
2706
+ router: this.data.router,
2707
+ type: this.data.type,
2708
+ wm: this.data.wm,
2709
+ chainName: this.data.chainName || "",
2710
+ chainId: this.data.chainId || 0,
2711
+ twapVersion: this.data.twapVersion || 0,
2712
+ twapAddress: this.data.twapAddress || "",
2713
+ lensAddress: this.data.lensAddress || "",
2714
+ bidDelaySeconds: this.data.bidDelaySeconds || 0,
2715
+ minChunkSizeUsd: this.data.minChunkSizeUsd || 0,
2716
+ name: this.data.name || "",
2717
+ exchangeAddress: this.data.exchangeAddress || "",
2718
+ exchangeType: this.data.exchangeType || "",
2719
+ pathfinderKey: this.data.pathfinderKey || ""
2720
+ };
2721
+ }
2722
+ );
2723
+ }
2724
+ }
2725
+ const $e = new _r(), vr = async (e, t) => {
2726
2726
  try {
2727
2727
  const n = {
2728
2728
  signature: t,
2729
2729
  order: e,
2730
2730
  status: "pending"
2731
2731
  };
2732
- be.onCreateOrderRequest();
2733
- const i = await fetch(`${er()}/orders/new`, {
2732
+ $e.onCreateOrderRequest();
2733
+ const i = await fetch(`${Hn()}/orders/new`, {
2734
2734
  method: "POST",
2735
2735
  headers: {
2736
2736
  "Content-Type": "application/json",
@@ -2745,9 +2745,9 @@ const pr = (e) => (typeof e.Contract_id == "string" || typeof e.Contract_id == "
2745
2745
  if (!a.signedOrder || typeof a.signedOrder != "object")
2746
2746
  throw new Error("Invalid API response: missing signedOrder");
2747
2747
  const d = mt(a.signedOrder);
2748
- return be.onCreateOrderSuccess(d.id), d;
2748
+ return $e.onCreateOrderSuccess(d.id), d;
2749
2749
  } catch (n) {
2750
- throw be.onCreateOrderError(n), console.error(n), n;
2750
+ throw $e.onCreateOrderError(n), console.error(n), n;
2751
2751
  }
2752
2752
  }, Ir = (e, t) => e + t.unit * t.value + 6e4, Rr = (e, t) => {
2753
2753
  if (!At().some(
@@ -2781,89 +2781,80 @@ const Lr = (e, t) => {
2781
2781
  );
2782
2782
  }, Hr = async (e, t) => {
2783
2783
  Rr(e, t);
2784
- const n = await ir(e, t);
2784
+ const n = await er(e, t);
2785
2785
  Lr(n, t);
2786
2786
  const i = n.domain.verifyingContract, a = n.order.witness.exchange.adapter;
2787
2787
  let d = 0;
2788
- const b = (h) => (d = Math.max(h, d + 1), d.toString());
2788
+ const b = (T) => (d = Math.max(T, d + 1), d.toString());
2789
2789
  return Object.freeze({
2790
2790
  partner: e,
2791
2791
  chainId: t,
2792
2792
  rePermitData: n,
2793
2793
  spenderAddress: i,
2794
2794
  exchangeAddress: a,
2795
- prepareOrder: (h) => {
2796
- const { form: w } = h;
2797
- if (!w.canSubmit)
2795
+ prepareOrder: (T) => {
2796
+ const { form: g } = T;
2797
+ if (!g.canSubmit)
2798
2798
  throw new Error("Order form is not submittable");
2799
- if (pn(h.inputTokenAddress))
2799
+ if (pn(T.inputTokenAddress))
2800
2800
  throw new Error(
2801
2801
  "prepareOrder inputTokenAddress must be an ERC-20 address; pass the host-provided wrapped native token for native input"
2802
2802
  );
2803
- const B = w.values, V = Date.now(), K = {
2803
+ const B = g.values, P = Date.now(), V = {
2804
2804
  ...B,
2805
- currentTimeMillis: V,
2806
- deadlineMillis: Ir(V, B.duration)
2807
- }, z = sr({
2808
- inputTokenAddress: h.inputTokenAddress,
2809
- outputTokenAddress: h.outputTokenAddress,
2805
+ currentTimeMillis: P,
2806
+ deadlineMillis: Ir(P, B.duration)
2807
+ }, U = tr({
2808
+ inputTokenAddress: T.inputTokenAddress,
2809
+ outputTokenAddress: T.outputTokenAddress,
2810
2810
  totalInputAmount: B.inputAmount,
2811
- nonce: b(V),
2812
- currentTimeMillis: K.currentTimeMillis,
2813
- deadlineMillis: K.deadlineMillis,
2811
+ nonce: b(P),
2812
+ currentTimeMillis: V.currentTimeMillis,
2813
+ deadlineMillis: V.deadlineMillis,
2814
2814
  fillDelayMillis: B.fillDelayMillis,
2815
2815
  totalTrades: B.totalTrades,
2816
2816
  slippageBps: B.slippageBps,
2817
- swapperAddress: h.swapperAddress,
2817
+ swapperAddress: T.swapperAddress,
2818
2818
  inputAmountPerTrade: B.inputAmountPerTrade,
2819
2819
  minOutputAmountPerTrade: B.minOutputAmountPerTrade,
2820
2820
  triggerOutputAmountPerTrade: B.triggerOutputAmountPerTrade,
2821
2821
  permitData: n,
2822
- module: w.module
2823
- }), g = z.order;
2822
+ module: g.module
2823
+ }), j = U.order;
2824
2824
  return {
2825
- order: g,
2825
+ order: j,
2826
2826
  signingRequest: {
2827
- signerAddress: h.swapperAddress,
2827
+ signerAddress: T.swapperAddress,
2828
2828
  typedData: {
2829
- domain: z.domain,
2830
- types: z.types,
2831
- primaryType: z.primaryType,
2832
- message: g
2829
+ domain: U.domain,
2830
+ types: U.types,
2831
+ primaryType: U.primaryType,
2832
+ message: j
2833
2833
  }
2834
2834
  },
2835
2835
  approvalRequest: {
2836
- tokenAddress: g.permitted.token,
2836
+ tokenAddress: j.permitted.token,
2837
2837
  amount: B.inputAmount,
2838
2838
  spenderAddress: i
2839
2839
  },
2840
- form: w,
2841
- values: K
2840
+ form: g,
2841
+ values: V
2842
2842
  };
2843
2843
  },
2844
- signOrder: async (h, w) => {
2845
- be.onSignOrderRequest(h.order);
2846
- try {
2847
- const B = await w(h.signingRequest);
2848
- return be.onSignOrderSuccess(B), B;
2849
- } catch (B) {
2850
- throw be.onSignOrderError(B), B;
2851
- }
2852
- },
2853
- submitOrder: (h, w) => vr(h.order, w),
2854
- getCancelOrderRequest: (h) => {
2855
- const w = h.version === 1 ? h.twapAddress : i;
2856
- if (!w)
2844
+ submitOrder: (T, g) => vr(T.order, g),
2845
+ getCancelOrderRequest: (T) => {
2846
+ const g = T.version === 1 ? T.twapAddress : i;
2847
+ if (!g)
2857
2848
  throw new Error("Cancellation contract address is unavailable");
2858
2849
  return {
2859
- order: h,
2860
- contractAddress: w,
2861
- args: h.version === 1 ? [h.id] : [[h.repermitDigest]],
2862
- abi: h.version === 1 ? jn : zn
2850
+ order: T,
2851
+ contractAddress: g,
2852
+ args: T.version === 1 ? [T.id] : [[T.repermitDigest]],
2853
+ abi: T.version === 1 ? jn : zn
2863
2854
  };
2864
2855
  },
2865
- getAccountOrders: (h) => _r({
2866
- ...h,
2856
+ getAccountOrders: (T) => wr({
2857
+ ...T,
2867
2858
  chainId: t,
2868
2859
  exchange: a,
2869
2860
  partner: e
@@ -2884,10 +2875,10 @@ export {
2884
2875
  Q as Partners,
2885
2876
  Xe as SPOT_VERSION,
2886
2877
  se as TimeUnit,
2887
- be as analytics,
2878
+ $e as analytics,
2888
2879
  jr as calculateOrderForm,
2889
2880
  Hr as createClient,
2890
- ke as eqIgnoreCase,
2881
+ Oe as eqIgnoreCase,
2891
2882
  qr as getOrderExecutionRate,
2892
2883
  Vr as getOrderFillDelayMillis,
2893
2884
  Wr as getOrderLimitPriceRate,