@sundaeswap/math 0.0.0-dev-20251113093518 → 0.0.0-dev-20251113094713

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.
@@ -3,13 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getFirstLp = exports.feePrecision = exports.calculateLiquidity = exports.aPrecision = void 0;
6
+ exports.getFirstLp = exports.calculateLiquidity = exports.RESERVE_PRECISION = exports.FEE_PRECISION = exports.A_PRECISION = void 0;
7
7
  exports.getNewY = getNewY;
8
8
  exports.getPrice = getPrice;
9
9
  exports.getSumInvariant = getSumInvariant;
10
10
  exports.getTokensForLp = exports.getSwapOutput = exports.getSwapInput = void 0;
11
11
  exports.liquidityInvariant = liquidityInvariant;
12
- exports.reservePrecision = void 0;
13
12
  var _index = require("./index.js");
14
13
  var _fraction = require("@sundaeswap/fraction");
15
14
  function liquidityInvariant(assetA, assetB, linearAmplification, newSumInvariant) {
@@ -28,16 +27,16 @@ function liquidityInvariant(assetA, assetB, linearAmplification, newSumInvariant
28
27
  var f2 = sixteen_a_x_y * d_plus_one + d_plus_one_cubed - (sixteen_a_x_y_x_plus_y + four_x_y * d_plus_one);
29
28
  return f1 <= 0n && f2 > 0n;
30
29
  }
31
- var aPrecision = exports.aPrecision = 200n;
32
- var reservePrecision = exports.reservePrecision = 1000000000000n;
33
- var feePrecision = exports.feePrecision = 10000n;
30
+ var A_PRECISION = exports.A_PRECISION = 200n;
31
+ var RESERVE_PRECISION = exports.RESERVE_PRECISION = 1000000000000n;
32
+ var FEE_PRECISION = exports.FEE_PRECISION = 10000n;
34
33
  function getSumInvariant(a, x, y) {
35
34
  if (a <= 0n) {
36
35
  throw new Error("Amplification coefficient must be positive.");
37
36
  }
38
- x = x * reservePrecision;
39
- y = y * reservePrecision;
40
- a = a * aPrecision;
37
+ x = x * RESERVE_PRECISION;
38
+ y = y * RESERVE_PRECISION;
39
+ a = a * A_PRECISION;
41
40
  var sum = x + y;
42
41
  if (sum === 0n) {
43
42
  return 0n;
@@ -50,7 +49,7 @@ function getSumInvariant(a, x, y) {
50
49
  d = (ann * sum / 100n + d_p * 2n) * d / ((ann - 100n) * d / 100n + 3n * d_p);
51
50
  if (d > d_prev) {
52
51
  if (d - d_prev <= 1) {
53
- if (liquidityInvariant(x, y, a / aPrecision, d)) {
52
+ if (liquidityInvariant(x, y, a / A_PRECISION, d)) {
54
53
  return d;
55
54
  } else {
56
55
  return d - 1n;
@@ -58,7 +57,7 @@ function getSumInvariant(a, x, y) {
58
57
  }
59
58
  } else {
60
59
  if (d_prev - d <= 1) {
61
- if (liquidityInvariant(x, y, a / aPrecision, d)) {
60
+ if (liquidityInvariant(x, y, a / A_PRECISION, d)) {
62
61
  return d;
63
62
  } else {
64
63
  return d - 1n;
@@ -69,15 +68,15 @@ function getSumInvariant(a, x, y) {
69
68
  throw new Error("Failed to converge on D value after 255 iterations.");
70
69
  }
71
70
  function getNewY(newX, aRaw, sumInvariant) {
72
- newX = newX * reservePrecision;
71
+ newX = newX * RESERVE_PRECISION;
73
72
  var sum = newX;
74
73
  var yPrev;
75
74
  var c = sumInvariant;
76
- var ann = aRaw * aPrecision * 2n;
75
+ var ann = aRaw * A_PRECISION * 2n;
77
76
  c = c * sumInvariant / (newX * 2n);
78
- c = c * sumInvariant * aPrecision / 2n;
77
+ c = c * sumInvariant * A_PRECISION / 2n;
79
78
  c = c / (ann * 2n);
80
- var b = sum + sumInvariant * aPrecision / 2n / ann;
79
+ var b = sum + sumInvariant * A_PRECISION / 2n / ann;
81
80
  var y = sumInvariant;
82
81
  for (var i = 0; i < 255; i++) {
83
82
  yPrev = y;
@@ -110,7 +109,7 @@ function getNewY(newX, aRaw, sumInvariant) {
110
109
  * @returns the minted lp token amount
111
110
  */
112
111
  var getFirstLp = exports.getFirstLp = function getFirstLp(a, b, laf) {
113
- return getSumInvariant(laf, a, b) / reservePrecision;
112
+ return getSumInvariant(laf, a, b) / RESERVE_PRECISION;
114
113
  };
115
114
 
116
115
  /**
@@ -194,9 +193,9 @@ var getSwapOutput = exports.getSwapOutput = function getSwapOutput(input, inputR
194
193
  var sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);
195
194
  var nextInputReserve = inputReserve + input;
196
195
  var newY = getNewY(nextInputReserve, laf, sumInvariant);
197
- var deltaYPrec = outputReserve * reservePrecision - newY;
198
- var deltaY = new _fraction.Fraction(deltaYPrec, reservePrecision);
199
- var totalFee = combinedFee.multiply(feePrecision).multiply(deltaY.quotient).add(_fraction.Fraction.asFraction(feePrecision - 1n)).divide(feePrecision).quotient;
196
+ var deltaYPrec = outputReserve * RESERVE_PRECISION - newY;
197
+ var deltaY = new _fraction.Fraction(deltaYPrec, RESERVE_PRECISION);
198
+ var totalFee = combinedFee.multiply(FEE_PRECISION).multiply(deltaY.quotient).add(_fraction.Fraction.asFraction(FEE_PRECISION - 1n)).divide(FEE_PRECISION).quotient;
200
199
  var totalProtocolFee = protocolFee.multiply(totalFee).divide(combinedFee).quotient;
201
200
  var totalLpFee = totalFee - totalProtocolFee;
202
201
  var output = deltaY.subtract(totalFee);
@@ -225,13 +224,13 @@ var getSwapOutput = exports.getSwapOutput = function getSwapOutput(input, inputR
225
224
  };
226
225
  function getPrice(aReserve, bReserve, laf) {
227
226
  // dx_0 / dx_1 only, however can have any number of coins in pool
228
- var ann = laf * 2n * aPrecision;
229
- var sumInvariant = getSumInvariant(laf, aReserve, bReserve) / reservePrecision;
227
+ var ann = laf * 2n * A_PRECISION;
228
+ var sumInvariant = getSumInvariant(laf, aReserve, bReserve) / RESERVE_PRECISION;
230
229
  // D / n^n with n = 2
231
230
  var dR = sumInvariant / 4n;
232
231
  dR = dR * sumInvariant / aReserve;
233
232
  dR = dR * sumInvariant / bReserve;
234
- var xpA = ann * aReserve / aPrecision;
233
+ var xpA = ann * aReserve / A_PRECISION;
235
234
  var p = new _fraction.Fraction(xpA + dR * aReserve / bReserve, xpA + dR);
236
235
  return p;
237
236
  }
@@ -267,8 +266,8 @@ var getSwapInput = exports.getSwapInput = function getSwapInput(output, inputRes
267
266
  var rawOutput = (rawOutputF.numerator + rawOutputF.denominator - 1n) / rawOutputF.denominator;
268
267
  var sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);
269
268
  var newX = getNewY(outputReserve - rawOutput, laf, sumInvariant);
270
- var input = (newX - inputReserve * reservePrecision + reservePrecision - 1n) / reservePrecision;
271
- var totalFee = (combinedFee.multiply(feePrecision).quotient * rawOutput + feePrecision - 1n) / feePrecision;
269
+ var input = (newX - inputReserve * RESERVE_PRECISION + RESERVE_PRECISION - 1n) / RESERVE_PRECISION;
270
+ var totalFee = (combinedFee.multiply(FEE_PRECISION).quotient * rawOutput + FEE_PRECISION - 1n) / FEE_PRECISION;
272
271
  var totalProtocolFee = protocolFee.multiply(totalFee).divide(combinedFee).quotient;
273
272
  var totalLpFee = totalFee - totalProtocolFee;
274
273
  var nextInputReserve = inputReserve + input;
@@ -1 +1 @@
1
- {"version":3,"file":"StableSwapsPool.js","names":["_index","require","_fraction","liquidityInvariant","assetA","assetB","linearAmplification","newSumInvariant","four_a","four_x_y","d_plus_one","d_cubed","d_plus_one_cubed","x_plus_y","sixteen_a_x_y","sixteen_a_x_y_x_plus_y","f1","f2","aPrecision","exports","reservePrecision","feePrecision","getSumInvariant","a","x","y","Error","sum","d","ann","i","d_p","d_prev","getNewY","newX","aRaw","sumInvariant","yPrev","c","b","getFirstLp","laf","calculateLiquidity","aReserve","bReserve","totalLp","oldSumInvariant","newLpTokens","newTotalLpTokens","nextTotalLp","generatedLp","shareAfterDeposit","SharedPoolMath","getShare","aChange","bChange","actualDepositedA","actualDepositedB","getTokensForLp","lp","Fraction","quotient","getSwapOutput","input","inputReserve","outputReserve","fee","protocolFee","roundOutputUp","asFraction","lt","ZERO","gte","ONE","combinedFee","add","nextInputReserve","newY","deltaYPrec","deltaY","totalFee","multiply","divide","totalProtocolFee","totalLpFee","output","subtract","safeOutput","numerator","denominator","nextOutputReserve","idealPrice","getPrice","actualPrice","priceImpact","outputLpFee","outputProtocolFee","nextSumInvariant","dR","xpA","p","getSwapInput","rawOutputF","sub","rawOutput"],"sources":["../../../src/PoolMath/StableSwapsPool.ts"],"sourcesContent":["import { SharedPoolMath } from \"./index.js\";\nimport { Fraction, type TFractionLike } from \"@sundaeswap/fraction\";\n\nexport function liquidityInvariant(\n assetA: bigint,\n assetB: bigint,\n linearAmplification: bigint,\n newSumInvariant: bigint,\n) {\n // 4 * A * 4 * (x*y) * D + D^3 - (4(x*y) * (4A(x + y) + D))\n // 4A * 4xy * D + D^3 - (4xy * 4a * (x + y) + 4xy * D)\n // 16Axy * D + D^3 - (16Axy * (x + y) + 4xy * D)\n const four_a = 4n * linearAmplification;\n const four_x_y = 4n * assetA * assetB;\n const d_plus_one = newSumInvariant + 1n;\n const d_cubed = newSumInvariant * newSumInvariant * newSumInvariant;\n const d_plus_one_cubed = d_plus_one * d_plus_one * d_plus_one;\n const x_plus_y = assetA + assetB;\n const sixteen_a_x_y = four_a * four_x_y;\n const sixteen_a_x_y_x_plus_y = sixteen_a_x_y * x_plus_y;\n const f1 =\n sixteen_a_x_y * newSumInvariant +\n d_cubed -\n (sixteen_a_x_y_x_plus_y + four_x_y * newSumInvariant);\n const f2 =\n sixteen_a_x_y * d_plus_one +\n d_plus_one_cubed -\n (sixteen_a_x_y_x_plus_y + four_x_y * d_plus_one);\n return f1 <= 0n && f2 > 0n;\n}\n\nexport const aPrecision = 200n;\nexport const reservePrecision = 1_000_000_000_000n;\nexport const feePrecision = 10_000n;\n\nexport function getSumInvariant(a: bigint, x: bigint, y: bigint): bigint {\n if (a <= 0n) {\n throw new Error(\"Amplification coefficient must be positive.\");\n }\n x = x * reservePrecision;\n y = y * reservePrecision;\n a = a * aPrecision;\n const sum: bigint = x + y;\n if (sum === 0n) {\n return 0n;\n }\n\n let d = sum;\n const ann = a * 2n;\n for (let i = 0; i < 255; i++) {\n const d_p = (d * d * d) / (4n * x * y);\n const d_prev = d;\n\n d =\n (((ann * sum) / 100n + d_p * 2n) * d) /\n (((ann - 100n) * d) / 100n + 3n * d_p);\n\n if (d > d_prev) {\n if (d - d_prev <= 1) {\n if (liquidityInvariant(x, y, a / aPrecision, d)) {\n return d;\n } else {\n return d - 1n;\n }\n }\n } else {\n if (d_prev - d <= 1) {\n if (liquidityInvariant(x, y, a / aPrecision, d)) {\n return d;\n } else {\n return d - 1n;\n }\n }\n }\n }\n throw new Error(\"Failed to converge on D value after 255 iterations.\");\n}\n\nexport function getNewY(\n newX: bigint,\n aRaw: bigint,\n sumInvariant: bigint,\n): bigint {\n newX = newX * reservePrecision;\n const sum = newX;\n let yPrev: bigint;\n let c = sumInvariant;\n const ann = aRaw * aPrecision * 2n;\n\n c = (c * sumInvariant) / (newX * 2n);\n c = (c * sumInvariant * aPrecision) / 2n;\n c = c / (ann * 2n);\n const b = sum + (sumInvariant * aPrecision) / 2n / ann;\n let y = sumInvariant;\n for (let i = 0; i < 255; i++) {\n yPrev = y;\n y = (y * y + c) / (y * 2n + b - sumInvariant);\n if (y > yPrev) {\n if (y - yPrev <= 1n) {\n if (liquidityInvariant(newX, y, aRaw, sumInvariant)) {\n return y;\n } else {\n return y + 1n;\n }\n }\n } else {\n if (yPrev - y <= 1n) {\n if (liquidityInvariant(newX, y, aRaw, sumInvariant)) {\n return y;\n } else {\n return y + 1n;\n }\n }\n }\n }\n throw new Error(\"failed to converge on y value after 255 iterations.\");\n}\n\n/**\n * Get the lp token amount for a, b\n * @param a tokenA amount\n * @param b tokenB amount\n * @returns the minted lp token amount\n */\nexport const getFirstLp = (a: bigint, b: bigint, laf: bigint) =>\n getSumInvariant(laf, a, b) / reservePrecision;\n\n/**\n * Calculate the Add (Mixed-Deposit) Liquidity parameters\n *\n * TODO: Investigate way to optimize actualdeposited amounts\n *\n * @param {bigint} a - The amount of token A to deposit.\n * @param {bigint} b - The amount of token B to deposit.\n * @param {bigint} aReserve - The current reserve of token A in the pool.\n * @param {bigint} bReserve - The current reserve of token B in the pool.\n * @param {bigint} totalLp - The total lp tokens for the pool before the deposit.\n * @param {bigint} laf - The linear amplifciation factor of the pool.\n * @throws {Error} If the pool doesn't have enough liquidity.\n * @throws {Error} If either of the deposit amounts is zero.\n * @returns {Object} An object containing:\n * - nextTotalLp: The total lp tokens for the pool after the deposit.\n * - generatedLp: The amount of lp tokens generated by the deposit.\n * - shareAfterDeposit: The depositor's share of the pool after the deposit.\n */\nexport const calculateLiquidity = (\n a: bigint,\n b: bigint,\n aReserve: bigint,\n bReserve: bigint,\n totalLp: bigint,\n laf: bigint,\n) => {\n if (aReserve === 0n && bReserve === 0n) {\n throw new Error(\"Not enough pool liquidity\");\n }\n\n if (a === 0n && b === 0n) {\n throw new Error(\"Cannot use a deposit asset amount of 0\");\n }\n\n const oldSumInvariant = getSumInvariant(laf, aReserve, bReserve);\n\n const newSumInvariant = getSumInvariant(laf, aReserve + a, bReserve + b);\n\n const newLpTokens =\n ((newSumInvariant - oldSumInvariant) * totalLp) / oldSumInvariant;\n\n const newTotalLpTokens = totalLp + newLpTokens;\n\n return {\n nextTotalLp: newTotalLpTokens,\n generatedLp: newLpTokens,\n shareAfterDeposit: SharedPoolMath.getShare(newLpTokens, newTotalLpTokens),\n aChange: 0n,\n bChange: 0n,\n actualDepositedA: a,\n actualDepositedB: b,\n };\n};\n\n/**\n * Get the token amounts the given lp represents\n * @param lp the lp amount\n * @param aReserve the pool's reserveA amount\n * @param bReserve the pool's reserveB amount\n * @param totalLp the pool's total minted lp currently\n * @returns [a, b] token amounts\n */\nexport const getTokensForLp = (\n lp: bigint,\n aReserve: bigint,\n bReserve: bigint,\n totalLp: bigint,\n): SharedPoolMath.TPair => [\n new Fraction(lp * aReserve, totalLp).quotient,\n new Fraction(lp * bReserve, totalLp).quotient,\n];\n\n/**\n * Holds the calculated outcome of a swap\n */\nexport type TSwapOutcome = {\n input: bigint;\n output: bigint;\n outputLpFee: bigint;\n outputProtocolFee: bigint;\n nextInputReserve: bigint;\n nextOutputReserve: bigint;\n nextSumInvariant: bigint;\n priceImpact: Fraction;\n};\n\n/**\n * Calculate swap outcome for a given input and pool parameters (input tokens, output tokens, fee).\n * Throws if\n * - any of the arguments are negative\n * - fee is greater than or equal 1\n *\n * @param input The given amount of tokens to be swapped\n * @param inputReserve The amount of tokens in the input reserve\n * @param outputReserve The amount of tokens in the output reserve\n * @param fee The liquidity provider fee\n * @param protocolFee The protocol fee\n * @param laf The linear amplification factor\n * @returns The swap details\n */\nexport const getSwapOutput = (\n input: bigint,\n inputReserve: bigint,\n outputReserve: bigint,\n fee: TFractionLike,\n protocolFee: TFractionLike,\n laf: bigint,\n roundOutputUp?: boolean,\n): TSwapOutcome => {\n if (input <= 0 || inputReserve <= 0 || outputReserve <= 0)\n throw new Error(\"Input and reserves must be positive\");\n\n fee = Fraction.asFraction(fee);\n if (fee.lt(Fraction.ZERO) || fee.gte(Fraction.ONE))\n throw new Error(\"fee must be between 0 and 1\");\n\n protocolFee = Fraction.asFraction(protocolFee);\n if (protocolFee.lt(Fraction.ZERO) || protocolFee.gte(Fraction.ONE))\n throw new Error(\"protocolFee must be between 0 and 1\");\n\n const combinedFee = fee.add(protocolFee);\n if (combinedFee.gte(Fraction.ONE))\n throw new Error(\"Combined fee must be less than 1\");\n const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);\n const nextInputReserve = inputReserve + input;\n const newY = getNewY(nextInputReserve, laf, sumInvariant);\n\n const deltaYPrec = outputReserve * reservePrecision - newY;\n const deltaY = new Fraction(deltaYPrec, reservePrecision);\n const totalFee = combinedFee\n .multiply(feePrecision)\n .multiply(deltaY.quotient)\n .add(Fraction.asFraction(feePrecision - 1n))\n .divide(feePrecision).quotient;\n const totalProtocolFee = protocolFee\n .multiply(totalFee)\n .divide(combinedFee).quotient;\n const totalLpFee = totalFee - totalProtocolFee;\n const output = deltaY.subtract(totalFee);\n const safeOutput = roundOutputUp\n ? (output.numerator + output.denominator - 1n) / output.denominator\n : output.quotient;\n const nextOutputReserve = outputReserve - safeOutput - totalProtocolFee;\n\n // PRICEIMPACT: \"priceImpact\" is slightly misleadingly named in the industry as a whole\n // just by it's name, it would imply that it's the percentage difference between\n // the current price and the price after the swap, but it's actually the percentage\n // difference between the real price of your swap, and the price implied by the current\n // reserves; We got this wrong in v1, but this aligns it with the industry standard\n // Source: https://dailydefi.org/articles/price-impact-and-how-to-calculate/\n const idealPrice = getPrice(inputReserve, outputReserve, laf);\n const actualPrice = new Fraction(input, safeOutput);\n const priceImpact = Fraction.ONE.subtract(idealPrice.divide(actualPrice));\n return {\n input,\n output: safeOutput,\n outputLpFee: totalLpFee,\n outputProtocolFee: totalProtocolFee,\n nextInputReserve,\n nextOutputReserve,\n nextSumInvariant: getSumInvariant(laf, nextInputReserve, nextOutputReserve),\n priceImpact,\n };\n};\n\nexport function getPrice(\n aReserve: bigint,\n bReserve: bigint,\n laf: bigint,\n): Fraction {\n // dx_0 / dx_1 only, however can have any number of coins in pool\n const ann = laf * 2n * aPrecision;\n const sumInvariant =\n getSumInvariant(laf, aReserve, bReserve) / reservePrecision;\n // D / n^n with n = 2\n let dR = sumInvariant / 4n;\n dR = (dR * sumInvariant) / aReserve;\n dR = (dR * sumInvariant) / bReserve;\n const xpA = (ann * aReserve) / aPrecision;\n const p = new Fraction(xpA + (dR * aReserve) / bReserve, xpA + dR);\n return p;\n}\n\n/**\n * Calculate input required for a swap outcome for a given output and pool parameters (input tokens, output tokens, fee).\n * Throws if\n * - any of the arguments are negative\n * - fee is greater than or equal 1\n * - output is greater than or equal to output reserve\n *\n * @param output\n * @param inputReserve\n * @param outputReserve\n * @param fee\n * @param protocolFee The protocol fee\n * @param laf The linear amplification factor\n * @returns The swap details\n */\nexport const getSwapInput = (\n output: bigint,\n inputReserve: bigint,\n outputReserve: bigint,\n fee: TFractionLike,\n protocolFee: TFractionLike,\n laf: bigint,\n): TSwapOutcome => {\n if (output <= 0 || inputReserve <= 0 || outputReserve <= 0)\n throw new Error(\"Output and reserves must be positive\");\n\n if (output >= outputReserve)\n throw new Error(\"Output must be less than output reserve\");\n\n fee = Fraction.asFraction(fee);\n if (fee.lt(Fraction.ZERO) || fee.gte(Fraction.ONE))\n throw new Error(\"fee must be [0,1)\");\n\n protocolFee = Fraction.asFraction(protocolFee);\n if (protocolFee.lt(Fraction.ZERO) || protocolFee.gte(Fraction.ONE))\n throw new Error(\"protocolFee must be between 0 and 1\");\n\n const combinedFee = fee.add(protocolFee);\n if (combinedFee.gte(Fraction.ONE))\n throw new Error(\"Combined fee must be less than 1\");\n\n // output = rawOutput * (1-fee)\n // rawOutput = output / (1-fee)\n const rawOutputF = Fraction.asFraction(output).divide(\n Fraction.ONE.sub(combinedFee),\n );\n const rawOutput =\n (rawOutputF.numerator + rawOutputF.denominator - 1n) /\n rawOutputF.denominator;\n const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);\n const newX = getNewY(outputReserve - rawOutput, laf, sumInvariant);\n const input =\n (newX - inputReserve * reservePrecision + reservePrecision - 1n) /\n reservePrecision;\n\n const totalFee =\n (combinedFee.multiply(feePrecision).quotient * rawOutput +\n feePrecision -\n 1n) /\n feePrecision;\n const totalProtocolFee = protocolFee\n .multiply(totalFee)\n .divide(combinedFee).quotient;\n\n const totalLpFee = totalFee - totalProtocolFee;\n\n const nextInputReserve = inputReserve + input;\n const nextOutputReserve = outputReserve - output - totalProtocolFee;\n\n // See PRICEIMPACT\n const idealPrice = getPrice(inputReserve, outputReserve, laf);\n const actualPrice = new Fraction(input, output);\n const priceImpact = Fraction.ONE.subtract(idealPrice.divide(actualPrice));\n\n const nextSumInvariant = getSumInvariant(\n laf,\n nextInputReserve,\n nextOutputReserve,\n );\n\n return {\n input,\n output,\n outputLpFee: totalLpFee,\n outputProtocolFee: totalProtocolFee,\n nextInputReserve,\n nextOutputReserve,\n priceImpact,\n nextSumInvariant,\n };\n};\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEO,S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AEzE,IAAMI,gBAAgB,GAAG3E,eAAe,CACtCmB,GAAG,EACHmC,gBAAgB,EAChBc,iBACF,CAAC;EAED,OAAO;IACL3B,KAAK,EAALA,KAAK;IACLsB,MAAM,EAANA,MAAM;IACNU,WAAW,EAAEX,UAAU;IACvBY,iBAAiB,EAAEb,gBAAgB;IACnCP,gBAAgB,EAAhBA,gBAAgB;IAChBc,iBAAiB,EAAjBA,iBAAiB;IACjBI,WAAW,EAAXA,WAAW;IACXG,gBAAgB,EAAhBA;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"StableSwapsPool.js","names":["_index","require","_fraction","liquidityInvariant","assetA","assetB","linearAmplification","newSumInvariant","four_a","four_x_y","d_plus_one","d_cubed","d_plus_one_cubed","x_plus_y","sixteen_a_x_y","sixteen_a_x_y_x_plus_y","f1","f2","A_PRECISION","exports","RESERVE_PRECISION","FEE_PRECISION","getSumInvariant","a","x","y","Error","sum","d","ann","i","d_p","d_prev","getNewY","newX","aRaw","sumInvariant","yPrev","c","b","getFirstLp","laf","calculateLiquidity","aReserve","bReserve","totalLp","oldSumInvariant","newLpTokens","newTotalLpTokens","nextTotalLp","generatedLp","shareAfterDeposit","SharedPoolMath","getShare","aChange","bChange","actualDepositedA","actualDepositedB","getTokensForLp","lp","Fraction","quotient","getSwapOutput","input","inputReserve","outputReserve","fee","protocolFee","roundOutputUp","asFraction","lt","ZERO","gte","ONE","combinedFee","add","nextInputReserve","newY","deltaYPrec","deltaY","totalFee","multiply","divide","totalProtocolFee","totalLpFee","output","subtract","safeOutput","numerator","denominator","nextOutputReserve","idealPrice","getPrice","actualPrice","priceImpact","outputLpFee","outputProtocolFee","nextSumInvariant","dR","xpA","p","getSwapInput","rawOutputF","sub","rawOutput"],"sources":["../../../src/PoolMath/StableSwapsPool.ts"],"sourcesContent":["import { SharedPoolMath } from \"./index.js\";\nimport { Fraction, type TFractionLike } from \"@sundaeswap/fraction\";\n\nexport function liquidityInvariant(\n assetA: bigint,\n assetB: bigint,\n linearAmplification: bigint,\n newSumInvariant: bigint,\n) {\n // 4 * A * 4 * (x*y) * D + D^3 - (4(x*y) * (4A(x + y) + D))\n // 4A * 4xy * D + D^3 - (4xy * 4a * (x + y) + 4xy * D)\n // 16Axy * D + D^3 - (16Axy * (x + y) + 4xy * D)\n const four_a = 4n * linearAmplification;\n const four_x_y = 4n * assetA * assetB;\n const d_plus_one = newSumInvariant + 1n;\n const d_cubed = newSumInvariant * newSumInvariant * newSumInvariant;\n const d_plus_one_cubed = d_plus_one * d_plus_one * d_plus_one;\n const x_plus_y = assetA + assetB;\n const sixteen_a_x_y = four_a * four_x_y;\n const sixteen_a_x_y_x_plus_y = sixteen_a_x_y * x_plus_y;\n const f1 =\n sixteen_a_x_y * newSumInvariant +\n d_cubed -\n (sixteen_a_x_y_x_plus_y + four_x_y * newSumInvariant);\n const f2 =\n sixteen_a_x_y * d_plus_one +\n d_plus_one_cubed -\n (sixteen_a_x_y_x_plus_y + four_x_y * d_plus_one);\n return f1 <= 0n && f2 > 0n;\n}\n\nexport const A_PRECISION: bigint = 200n;\nexport const RESERVE_PRECISION: bigint = 1_000_000_000_000n;\nexport const FEE_PRECISION: bigint = 10_000n;\n\nexport function getSumInvariant(a: bigint, x: bigint, y: bigint): bigint {\n if (a <= 0n) {\n throw new Error(\"Amplification coefficient must be positive.\");\n }\n x = x * RESERVE_PRECISION;\n y = y * RESERVE_PRECISION;\n a = a * A_PRECISION;\n const sum: bigint = x + y;\n if (sum === 0n) {\n return 0n;\n }\n\n let d = sum;\n const ann = a * 2n;\n for (let i = 0; i < 255; i++) {\n const d_p = (d * d * d) / (4n * x * y);\n const d_prev = d;\n\n d =\n (((ann * sum) / 100n + d_p * 2n) * d) /\n (((ann - 100n) * d) / 100n + 3n * d_p);\n\n if (d > d_prev) {\n if (d - d_prev <= 1) {\n if (liquidityInvariant(x, y, a / A_PRECISION, d)) {\n return d;\n } else {\n return d - 1n;\n }\n }\n } else {\n if (d_prev - d <= 1) {\n if (liquidityInvariant(x, y, a / A_PRECISION, d)) {\n return d;\n } else {\n return d - 1n;\n }\n }\n }\n }\n throw new Error(\"Failed to converge on D value after 255 iterations.\");\n}\n\nexport function getNewY(\n newX: bigint,\n aRaw: bigint,\n sumInvariant: bigint,\n): bigint {\n newX = newX * RESERVE_PRECISION;\n const sum = newX;\n let yPrev: bigint;\n let c = sumInvariant;\n const ann = aRaw * A_PRECISION * 2n;\n\n c = (c * sumInvariant) / (newX * 2n);\n c = (c * sumInvariant * A_PRECISION) / 2n;\n c = c / (ann * 2n);\n const b = sum + (sumInvariant * A_PRECISION) / 2n / ann;\n let y = sumInvariant;\n for (let i = 0; i < 255; i++) {\n yPrev = y;\n y = (y * y + c) / (y * 2n + b - sumInvariant);\n if (y > yPrev) {\n if (y - yPrev <= 1n) {\n if (liquidityInvariant(newX, y, aRaw, sumInvariant)) {\n return y;\n } else {\n return y + 1n;\n }\n }\n } else {\n if (yPrev - y <= 1n) {\n if (liquidityInvariant(newX, y, aRaw, sumInvariant)) {\n return y;\n } else {\n return y + 1n;\n }\n }\n }\n }\n throw new Error(\"failed to converge on y value after 255 iterations.\");\n}\n\n/**\n * Get the lp token amount for a, b\n * @param a tokenA amount\n * @param b tokenB amount\n * @returns the minted lp token amount\n */\nexport const getFirstLp = (a: bigint, b: bigint, laf: bigint) =>\n getSumInvariant(laf, a, b) / RESERVE_PRECISION;\n\n/**\n * Calculate the Add (Mixed-Deposit) Liquidity parameters\n *\n * TODO: Investigate way to optimize actualdeposited amounts\n *\n * @param {bigint} a - The amount of token A to deposit.\n * @param {bigint} b - The amount of token B to deposit.\n * @param {bigint} aReserve - The current reserve of token A in the pool.\n * @param {bigint} bReserve - The current reserve of token B in the pool.\n * @param {bigint} totalLp - The total lp tokens for the pool before the deposit.\n * @param {bigint} laf - The linear amplifciation factor of the pool.\n * @throws {Error} If the pool doesn't have enough liquidity.\n * @throws {Error} If either of the deposit amounts is zero.\n * @returns {Object} An object containing:\n * - nextTotalLp: The total lp tokens for the pool after the deposit.\n * - generatedLp: The amount of lp tokens generated by the deposit.\n * - shareAfterDeposit: The depositor's share of the pool after the deposit.\n */\nexport const calculateLiquidity = (\n a: bigint,\n b: bigint,\n aReserve: bigint,\n bReserve: bigint,\n totalLp: bigint,\n laf: bigint,\n) => {\n if (aReserve === 0n && bReserve === 0n) {\n throw new Error(\"Not enough pool liquidity\");\n }\n\n if (a === 0n && b === 0n) {\n throw new Error(\"Cannot use a deposit asset amount of 0\");\n }\n\n const oldSumInvariant = getSumInvariant(laf, aReserve, bReserve);\n\n const newSumInvariant = getSumInvariant(laf, aReserve + a, bReserve + b);\n\n const newLpTokens =\n ((newSumInvariant - oldSumInvariant) * totalLp) / oldSumInvariant;\n\n const newTotalLpTokens = totalLp + newLpTokens;\n\n return {\n nextTotalLp: newTotalLpTokens,\n generatedLp: newLpTokens,\n shareAfterDeposit: SharedPoolMath.getShare(newLpTokens, newTotalLpTokens),\n aChange: 0n,\n bChange: 0n,\n actualDepositedA: a,\n actualDepositedB: b,\n };\n};\n\n/**\n * Get the token amounts the given lp represents\n * @param lp the lp amount\n * @param aReserve the pool's reserveA amount\n * @param bReserve the pool's reserveB amount\n * @param totalLp the pool's total minted lp currently\n * @returns [a, b] token amounts\n */\nexport const getTokensForLp = (\n lp: bigint,\n aReserve: bigint,\n bReserve: bigint,\n totalLp: bigint,\n): SharedPoolMath.TPair => [\n new Fraction(lp * aReserve, totalLp).quotient,\n new Fraction(lp * bReserve, totalLp).quotient,\n];\n\n/**\n * Holds the calculated outcome of a swap\n */\nexport type TSwapOutcome = {\n input: bigint;\n output: bigint;\n outputLpFee: bigint;\n outputProtocolFee: bigint;\n nextInputReserve: bigint;\n nextOutputReserve: bigint;\n nextSumInvariant: bigint;\n priceImpact: Fraction;\n};\n\n/**\n * Calculate swap outcome for a given input and pool parameters (input tokens, output tokens, fee).\n * Throws if\n * - any of the arguments are negative\n * - fee is greater than or equal 1\n *\n * @param input The given amount of tokens to be swapped\n * @param inputReserve The amount of tokens in the input reserve\n * @param outputReserve The amount of tokens in the output reserve\n * @param fee The liquidity provider fee\n * @param protocolFee The protocol fee\n * @param laf The linear amplification factor\n * @returns The swap details\n */\nexport const getSwapOutput = (\n input: bigint,\n inputReserve: bigint,\n outputReserve: bigint,\n fee: TFractionLike,\n protocolFee: TFractionLike,\n laf: bigint,\n roundOutputUp?: boolean,\n): TSwapOutcome => {\n if (input <= 0 || inputReserve <= 0 || outputReserve <= 0)\n throw new Error(\"Input and reserves must be positive\");\n\n fee = Fraction.asFraction(fee);\n if (fee.lt(Fraction.ZERO) || fee.gte(Fraction.ONE))\n throw new Error(\"fee must be between 0 and 1\");\n\n protocolFee = Fraction.asFraction(protocolFee);\n if (protocolFee.lt(Fraction.ZERO) || protocolFee.gte(Fraction.ONE))\n throw new Error(\"protocolFee must be between 0 and 1\");\n\n const combinedFee = fee.add(protocolFee);\n if (combinedFee.gte(Fraction.ONE))\n throw new Error(\"Combined fee must be less than 1\");\n const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);\n const nextInputReserve = inputReserve + input;\n const newY = getNewY(nextInputReserve, laf, sumInvariant);\n\n const deltaYPrec = outputReserve * RESERVE_PRECISION - newY;\n const deltaY = new Fraction(deltaYPrec, RESERVE_PRECISION);\n const totalFee = combinedFee\n .multiply(FEE_PRECISION)\n .multiply(deltaY.quotient)\n .add(Fraction.asFraction(FEE_PRECISION - 1n))\n .divide(FEE_PRECISION).quotient;\n const totalProtocolFee = protocolFee\n .multiply(totalFee)\n .divide(combinedFee).quotient;\n const totalLpFee = totalFee - totalProtocolFee;\n const output = deltaY.subtract(totalFee);\n const safeOutput = roundOutputUp\n ? (output.numerator + output.denominator - 1n) / output.denominator\n : output.quotient;\n const nextOutputReserve = outputReserve - safeOutput - totalProtocolFee;\n\n // PRICEIMPACT: \"priceImpact\" is slightly misleadingly named in the industry as a whole\n // just by it's name, it would imply that it's the percentage difference between\n // the current price and the price after the swap, but it's actually the percentage\n // difference between the real price of your swap, and the price implied by the current\n // reserves; We got this wrong in v1, but this aligns it with the industry standard\n // Source: https://dailydefi.org/articles/price-impact-and-how-to-calculate/\n const idealPrice = getPrice(inputReserve, outputReserve, laf);\n const actualPrice = new Fraction(input, safeOutput);\n const priceImpact = Fraction.ONE.subtract(idealPrice.divide(actualPrice));\n return {\n input,\n output: safeOutput,\n outputLpFee: totalLpFee,\n outputProtocolFee: totalProtocolFee,\n nextInputReserve,\n nextOutputReserve,\n nextSumInvariant: getSumInvariant(laf, nextInputReserve, nextOutputReserve),\n priceImpact,\n };\n};\n\nexport function getPrice(\n aReserve: bigint,\n bReserve: bigint,\n laf: bigint,\n): Fraction {\n // dx_0 / dx_1 only, however can have any number of coins in pool\n const ann = laf * 2n * A_PRECISION;\n const sumInvariant =\n getSumInvariant(laf, aReserve, bReserve) / RESERVE_PRECISION;\n // D / n^n with n = 2\n let dR = sumInvariant / 4n;\n dR = (dR * sumInvariant) / aReserve;\n dR = (dR * sumInvariant) / bReserve;\n const xpA = (ann * aReserve) / A_PRECISION;\n const p = new Fraction(xpA + (dR * aReserve) / bReserve, xpA + dR);\n return p;\n}\n\n/**\n * Calculate input required for a swap outcome for a given output and pool parameters (input tokens, output tokens, fee).\n * Throws if\n * - any of the arguments are negative\n * - fee is greater than or equal 1\n * - output is greater than or equal to output reserve\n *\n * @param output\n * @param inputReserve\n * @param outputReserve\n * @param fee\n * @param protocolFee The protocol fee\n * @param laf The linear amplification factor\n * @returns The swap details\n */\nexport const getSwapInput = (\n output: bigint,\n inputReserve: bigint,\n outputReserve: bigint,\n fee: TFractionLike,\n protocolFee: TFractionLike,\n laf: bigint,\n): TSwapOutcome => {\n if (output <= 0 || inputReserve <= 0 || outputReserve <= 0)\n throw new Error(\"Output and reserves must be positive\");\n\n if (output >= outputReserve)\n throw new Error(\"Output must be less than output reserve\");\n\n fee = Fraction.asFraction(fee);\n if (fee.lt(Fraction.ZERO) || fee.gte(Fraction.ONE))\n throw new Error(\"fee must be [0,1)\");\n\n protocolFee = Fraction.asFraction(protocolFee);\n if (protocolFee.lt(Fraction.ZERO) || protocolFee.gte(Fraction.ONE))\n throw new Error(\"protocolFee must be between 0 and 1\");\n\n const combinedFee = fee.add(protocolFee);\n if (combinedFee.gte(Fraction.ONE))\n throw new Error(\"Combined fee must be less than 1\");\n\n // output = rawOutput * (1-fee)\n // rawOutput = output / (1-fee)\n const rawOutputF = Fraction.asFraction(output).divide(\n Fraction.ONE.sub(combinedFee),\n );\n const rawOutput =\n (rawOutputF.numerator + rawOutputF.denominator - 1n) /\n rawOutputF.denominator;\n const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);\n const newX = getNewY(outputReserve - rawOutput, laf, sumInvariant);\n const input =\n (newX - inputReserve * RESERVE_PRECISION + RESERVE_PRECISION - 1n) /\n RESERVE_PRECISION;\n\n const totalFee =\n (combinedFee.multiply(FEE_PRECISION).quotient * rawOutput +\n FEE_PRECISION -\n 1n) /\n FEE_PRECISION;\n const totalProtocolFee = protocolFee\n .multiply(totalFee)\n .divide(combinedFee).quotient;\n\n const totalLpFee = totalFee - totalProtocolFee;\n\n const nextInputReserve = inputReserve + input;\n const nextOutputReserve = outputReserve - output - totalProtocolFee;\n\n // See PRICEIMPACT\n const idealPrice = getPrice(inputReserve, outputReserve, laf);\n const actualPrice = new Fraction(input, output);\n const priceImpact = Fraction.ONE.subtract(idealPrice.divide(actualPrice));\n\n const nextSumInvariant = getSumInvariant(\n laf,\n nextInputReserve,\n nextOutputReserve,\n );\n\n return {\n input,\n output,\n outputLpFee: totalLpFee,\n outputProtocolFee: totalProtocolFee,\n nextInputReserve,\n nextOutputReserve,\n priceImpact,\n nextSumInvariant,\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEO,SAASE,kBAAkBA,CAChCC,MAAc,EACdC,MAAc,EACdC,mBAA2B,EAC3BC,eAAuB,EACvB;EACA;EACA;EACA;EACA,IAAMC,MAAM,GAA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ALA,KAAK;IACLsB,MAAM,EAANA,MAAM;IACNU,WAAW,EAAEX,UAAU;IACvBY,iBAAiB,EAAEb,gBAAgB;IACnCP,gBAAgB,EAAhBA,gBAAgB;IAChBc,iBAAiB,EAAjBA,iBAAiB;IACjBI,WAAW,EAAXA,WAAW;IACXG,gBAAgB,EAAhBA;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -16,16 +16,16 @@ export function liquidityInvariant(assetA, assetB, linearAmplification, newSumIn
16
16
  const f2 = sixteen_a_x_y * d_plus_one + d_plus_one_cubed - (sixteen_a_x_y_x_plus_y + four_x_y * d_plus_one);
17
17
  return f1 <= 0n && f2 > 0n;
18
18
  }
19
- export const aPrecision = 200n;
20
- export const reservePrecision = 1_000_000_000_000n;
21
- export const feePrecision = 10_000n;
19
+ export const A_PRECISION = 200n;
20
+ export const RESERVE_PRECISION = 1_000_000_000_000n;
21
+ export const FEE_PRECISION = 10_000n;
22
22
  export function getSumInvariant(a, x, y) {
23
23
  if (a <= 0n) {
24
24
  throw new Error("Amplification coefficient must be positive.");
25
25
  }
26
- x = x * reservePrecision;
27
- y = y * reservePrecision;
28
- a = a * aPrecision;
26
+ x = x * RESERVE_PRECISION;
27
+ y = y * RESERVE_PRECISION;
28
+ a = a * A_PRECISION;
29
29
  const sum = x + y;
30
30
  if (sum === 0n) {
31
31
  return 0n;
@@ -38,7 +38,7 @@ export function getSumInvariant(a, x, y) {
38
38
  d = (ann * sum / 100n + d_p * 2n) * d / ((ann - 100n) * d / 100n + 3n * d_p);
39
39
  if (d > d_prev) {
40
40
  if (d - d_prev <= 1) {
41
- if (liquidityInvariant(x, y, a / aPrecision, d)) {
41
+ if (liquidityInvariant(x, y, a / A_PRECISION, d)) {
42
42
  return d;
43
43
  } else {
44
44
  return d - 1n;
@@ -46,7 +46,7 @@ export function getSumInvariant(a, x, y) {
46
46
  }
47
47
  } else {
48
48
  if (d_prev - d <= 1) {
49
- if (liquidityInvariant(x, y, a / aPrecision, d)) {
49
+ if (liquidityInvariant(x, y, a / A_PRECISION, d)) {
50
50
  return d;
51
51
  } else {
52
52
  return d - 1n;
@@ -57,15 +57,15 @@ export function getSumInvariant(a, x, y) {
57
57
  throw new Error("Failed to converge on D value after 255 iterations.");
58
58
  }
59
59
  export function getNewY(newX, aRaw, sumInvariant) {
60
- newX = newX * reservePrecision;
60
+ newX = newX * RESERVE_PRECISION;
61
61
  const sum = newX;
62
62
  let yPrev;
63
63
  let c = sumInvariant;
64
- const ann = aRaw * aPrecision * 2n;
64
+ const ann = aRaw * A_PRECISION * 2n;
65
65
  c = c * sumInvariant / (newX * 2n);
66
- c = c * sumInvariant * aPrecision / 2n;
66
+ c = c * sumInvariant * A_PRECISION / 2n;
67
67
  c = c / (ann * 2n);
68
- const b = sum + sumInvariant * aPrecision / 2n / ann;
68
+ const b = sum + sumInvariant * A_PRECISION / 2n / ann;
69
69
  let y = sumInvariant;
70
70
  for (let i = 0; i < 255; i++) {
71
71
  yPrev = y;
@@ -97,7 +97,7 @@ export function getNewY(newX, aRaw, sumInvariant) {
97
97
  * @param b tokenB amount
98
98
  * @returns the minted lp token amount
99
99
  */
100
- export const getFirstLp = (a, b, laf) => getSumInvariant(laf, a, b) / reservePrecision;
100
+ export const getFirstLp = (a, b, laf) => getSumInvariant(laf, a, b) / RESERVE_PRECISION;
101
101
 
102
102
  /**
103
103
  * Calculate the Add (Mixed-Deposit) Liquidity parameters
@@ -178,9 +178,9 @@ export const getSwapOutput = (input, inputReserve, outputReserve, fee, protocolF
178
178
  const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);
179
179
  const nextInputReserve = inputReserve + input;
180
180
  const newY = getNewY(nextInputReserve, laf, sumInvariant);
181
- const deltaYPrec = outputReserve * reservePrecision - newY;
182
- const deltaY = new Fraction(deltaYPrec, reservePrecision);
183
- const totalFee = combinedFee.multiply(feePrecision).multiply(deltaY.quotient).add(Fraction.asFraction(feePrecision - 1n)).divide(feePrecision).quotient;
181
+ const deltaYPrec = outputReserve * RESERVE_PRECISION - newY;
182
+ const deltaY = new Fraction(deltaYPrec, RESERVE_PRECISION);
183
+ const totalFee = combinedFee.multiply(FEE_PRECISION).multiply(deltaY.quotient).add(Fraction.asFraction(FEE_PRECISION - 1n)).divide(FEE_PRECISION).quotient;
184
184
  const totalProtocolFee = protocolFee.multiply(totalFee).divide(combinedFee).quotient;
185
185
  const totalLpFee = totalFee - totalProtocolFee;
186
186
  const output = deltaY.subtract(totalFee);
@@ -209,13 +209,13 @@ export const getSwapOutput = (input, inputReserve, outputReserve, fee, protocolF
209
209
  };
210
210
  export function getPrice(aReserve, bReserve, laf) {
211
211
  // dx_0 / dx_1 only, however can have any number of coins in pool
212
- const ann = laf * 2n * aPrecision;
213
- const sumInvariant = getSumInvariant(laf, aReserve, bReserve) / reservePrecision;
212
+ const ann = laf * 2n * A_PRECISION;
213
+ const sumInvariant = getSumInvariant(laf, aReserve, bReserve) / RESERVE_PRECISION;
214
214
  // D / n^n with n = 2
215
215
  let dR = sumInvariant / 4n;
216
216
  dR = dR * sumInvariant / aReserve;
217
217
  dR = dR * sumInvariant / bReserve;
218
- const xpA = ann * aReserve / aPrecision;
218
+ const xpA = ann * aReserve / A_PRECISION;
219
219
  const p = new Fraction(xpA + dR * aReserve / bReserve, xpA + dR);
220
220
  return p;
221
221
  }
@@ -251,8 +251,8 @@ export const getSwapInput = (output, inputReserve, outputReserve, fee, protocolF
251
251
  const rawOutput = (rawOutputF.numerator + rawOutputF.denominator - 1n) / rawOutputF.denominator;
252
252
  const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);
253
253
  const newX = getNewY(outputReserve - rawOutput, laf, sumInvariant);
254
- const input = (newX - inputReserve * reservePrecision + reservePrecision - 1n) / reservePrecision;
255
- const totalFee = (combinedFee.multiply(feePrecision).quotient * rawOutput + feePrecision - 1n) / feePrecision;
254
+ const input = (newX - inputReserve * RESERVE_PRECISION + RESERVE_PRECISION - 1n) / RESERVE_PRECISION;
255
+ const totalFee = (combinedFee.multiply(FEE_PRECISION).quotient * rawOutput + FEE_PRECISION - 1n) / FEE_PRECISION;
256
256
  const totalProtocolFee = protocolFee.multiply(totalFee).divide(combinedFee).quotient;
257
257
  const totalLpFee = totalFee - totalProtocolFee;
258
258
  const nextInputReserve = inputReserve + input;
@@ -1 +1 @@
1
- {"version":3,"file":"StableSwapsPool.js","names":["SharedPoolMath","Fraction","liquidityInvariant","assetA","assetB","linearAmplification","newSumInvariant","four_a","four_x_y","d_plus_one","d_cubed","d_plus_one_cubed","x_plus_y","sixteen_a_x_y","sixteen_a_x_y_x_plus_y","f1","f2","aPrecision","reservePrecision","feePrecision","getSumInvariant","a","x","y","Error","sum","d","ann","i","d_p","d_prev","getNewY","newX","aRaw","sumInvariant","yPrev","c","b","getFirstLp","laf","calculateLiquidity","aReserve","bReserve","totalLp","oldSumInvariant","newLpTokens","newTotalLpTokens","nextTotalLp","generatedLp","shareAfterDeposit","getShare","aChange","bChange","actualDepositedA","actualDepositedB","getTokensForLp","lp","quotient","getSwapOutput","input","inputReserve","outputReserve","fee","protocolFee","roundOutputUp","asFraction","lt","ZERO","gte","ONE","combinedFee","add","nextInputReserve","newY","deltaYPrec","deltaY","totalFee","multiply","divide","totalProtocolFee","totalLpFee","output","subtract","safeOutput","numerator","denominator","nextOutputReserve","idealPrice","getPrice","actualPrice","priceImpact","outputLpFee","outputProtocolFee","nextSumInvariant","dR","xpA","p","getSwapInput","rawOutputF","sub","rawOutput"],"sources":["../../../src/PoolMath/StableSwapsPool.ts"],"sourcesContent":["import { SharedPoolMath } from \"./index.js\";\nimport { Fraction, type TFractionLike } from \"@sundaeswap/fraction\";\n\nexport function liquidityInvariant(\n assetA: bigint,\n assetB: bigint,\n linearAmplification: bigint,\n newSumInvariant: bigint,\n) {\n // 4 * A * 4 * (x*y) * D + D^3 - (4(x*y) * (4A(x + y) + D))\n // 4A * 4xy * D + D^3 - (4xy * 4a * (x + y) + 4xy * D)\n // 16Axy * D + D^3 - (16Axy * (x + y) + 4xy * D)\n const four_a = 4n * linearAmplification;\n const four_x_y = 4n * assetA * assetB;\n const d_plus_one = newSumInvariant + 1n;\n const d_cubed = newSumInvariant * newSumInvariant * newSumInvariant;\n const d_plus_one_cubed = d_plus_one * d_plus_one * d_plus_one;\n const x_plus_y = assetA + assetB;\n const sixteen_a_x_y = four_a * four_x_y;\n const sixteen_a_x_y_x_plus_y = sixteen_a_x_y * x_plus_y;\n const f1 =\n sixteen_a_x_y * newSumInvariant +\n d_cubed -\n (sixteen_a_x_y_x_plus_y + four_x_y * newSumInvariant);\n const f2 =\n sixteen_a_x_y * d_plus_one +\n d_plus_one_cubed -\n (sixteen_a_x_y_x_plus_y + four_x_y * d_plus_one);\n return f1 <= 0n && f2 > 0n;\n}\n\nexport const aPrecision = 200n;\nexport const reservePrecision = 1_000_000_000_000n;\nexport const feePrecision = 10_000n;\n\nexport function getSumInvariant(a: bigint, x: bigint, y: bigint): bigint {\n if (a <= 0n) {\n throw new Error(\"Amplification coefficient must be positive.\");\n }\n x = x * reservePrecision;\n y = y * reservePrecision;\n a = a * aPrecision;\n const sum: bigint = x + y;\n if (sum === 0n) {\n return 0n;\n }\n\n let d = sum;\n const ann = a * 2n;\n for (let i = 0; i < 255; i++) {\n const d_p = (d * d * d) / (4n * x * y);\n const d_prev = d;\n\n d =\n (((ann * sum) / 100n + d_p * 2n) * d) /\n (((ann - 100n) * d) / 100n + 3n * d_p);\n\n if (d > d_prev) {\n if (d - d_prev <= 1) {\n if (liquidityInvariant(x, y, a / aPrecision, d)) {\n return d;\n } else {\n return d - 1n;\n }\n }\n } else {\n if (d_prev - d <= 1) {\n if (liquidityInvariant(x, y, a / aPrecision, d)) {\n return d;\n } else {\n return d - 1n;\n }\n }\n }\n }\n throw new Error(\"Failed to converge on D value after 255 iterations.\");\n}\n\nexport function getNewY(\n newX: bigint,\n aRaw: bigint,\n sumInvariant: bigint,\n): bigint {\n newX = newX * reservePrecision;\n const sum = newX;\n let yPrev: bigint;\n let c = sumInvariant;\n const ann = aRaw * aPrecision * 2n;\n\n c = (c * sumInvariant) / (newX * 2n);\n c = (c * sumInvariant * aPrecision) / 2n;\n c = c / (ann * 2n);\n const b = sum + (sumInvariant * aPrecision) / 2n / ann;\n let y = sumInvariant;\n for (let i = 0; i < 255; i++) {\n yPrev = y;\n y = (y * y + c) / (y * 2n + b - sumInvariant);\n if (y > yPrev) {\n if (y - yPrev <= 1n) {\n if (liquidityInvariant(newX, y, aRaw, sumInvariant)) {\n return y;\n } else {\n return y + 1n;\n }\n }\n } else {\n if (yPrev - y <= 1n) {\n if (liquidityInvariant(newX, y, aRaw, sumInvariant)) {\n return y;\n } else {\n return y + 1n;\n }\n }\n }\n }\n throw new Error(\"failed to converge on y value after 255 iterations.\");\n}\n\n/**\n * Get the lp token amount for a, b\n * @param a tokenA amount\n * @param b tokenB amount\n * @returns the minted lp token amount\n */\nexport const getFirstLp = (a: bigint, b: bigint, laf: bigint) =>\n getSumInvariant(laf, a, b) / reservePrecision;\n\n/**\n * Calculate the Add (Mixed-Deposit) Liquidity parameters\n *\n * TODO: Investigate way to optimize actualdeposited amounts\n *\n * @param {bigint} a - The amount of token A to deposit.\n * @param {bigint} b - The amount of token B to deposit.\n * @param {bigint} aReserve - The current reserve of token A in the pool.\n * @param {bigint} bReserve - The current reserve of token B in the pool.\n * @param {bigint} totalLp - The total lp tokens for the pool before the deposit.\n * @param {bigint} laf - The linear amplifciation factor of the pool.\n * @throws {Error} If the pool doesn't have enough liquidity.\n * @throws {Error} If either of the deposit amounts is zero.\n * @returns {Object} An object containing:\n * - nextTotalLp: The total lp tokens for the pool after the deposit.\n * - generatedLp: The amount of lp tokens generated by the deposit.\n * - shareAfterDeposit: The depositor's share of the pool after the deposit.\n */\nexport const calculateLiquidity = (\n a: bigint,\n b: bigint,\n aReserve: bigint,\n bReserve: bigint,\n totalLp: bigint,\n laf: bigint,\n) => {\n if (aReserve === 0n && bReserve === 0n) {\n throw new Error(\"Not enough pool liquidity\");\n }\n\n if (a === 0n && b === 0n) {\n throw new Error(\"Cannot use a deposit asset amount of 0\");\n }\n\n const oldSumInvariant = getSumInvariant(laf, aReserve, bReserve);\n\n const newSumInvariant = getSumInvariant(laf, aReserve + a, bReserve + b);\n\n const newLpTokens =\n ((newSumInvariant - oldSumInvariant) * totalLp) / oldSumInvariant;\n\n const newTotalLpTokens = totalLp + newLpTokens;\n\n return {\n nextTotalLp: newTotalLpTokens,\n generatedLp: newLpTokens,\n shareAfterDeposit: SharedPoolMath.getShare(newLpTokens, newTotalLpTokens),\n aChange: 0n,\n bChange: 0n,\n actualDepositedA: a,\n actualDepositedB: b,\n };\n};\n\n/**\n * Get the token amounts the given lp represents\n * @param lp the lp amount\n * @param aReserve the pool's reserveA amount\n * @param bReserve the pool's reserveB amount\n * @param totalLp the pool's total minted lp currently\n * @returns [a, b] token amounts\n */\nexport const getTokensForLp = (\n lp: bigint,\n aReserve: bigint,\n bReserve: bigint,\n totalLp: bigint,\n): SharedPoolMath.TPair => [\n new Fraction(lp * aReserve, totalLp).quotient,\n new Fraction(lp * bReserve, totalLp).quotient,\n];\n\n/**\n * Holds the calculated outcome of a swap\n */\nexport type TSwapOutcome = {\n input: bigint;\n output: bigint;\n outputLpFee: bigint;\n outputProtocolFee: bigint;\n nextInputReserve: bigint;\n nextOutputReserve: bigint;\n nextSumInvariant: bigint;\n priceImpact: Fraction;\n};\n\n/**\n * Calculate swap outcome for a given input and pool parameters (input tokens, output tokens, fee).\n * Throws if\n * - any of the arguments are negative\n * - fee is greater than or equal 1\n *\n * @param input The given amount of tokens to be swapped\n * @param inputReserve The amount of tokens in the input reserve\n * @param outputReserve The amount of tokens in the output reserve\n * @param fee The liquidity provider fee\n * @param protocolFee The protocol fee\n * @param laf The linear amplification factor\n * @returns The swap details\n */\nexport const getSwapOutput = (\n input: bigint,\n inputReserve: bigint,\n outputReserve: bigint,\n fee: TFractionLike,\n protocolFee: TFractionLike,\n laf: bigint,\n roundOutputUp?: boolean,\n): TSwapOutcome => {\n if (input <= 0 || inputReserve <= 0 || outputReserve <= 0)\n throw new Error(\"Input and reserves must be positive\");\n\n fee = Fraction.asFraction(fee);\n if (fee.lt(Fraction.ZERO) || fee.gte(Fraction.ONE))\n throw new Error(\"fee must be between 0 and 1\");\n\n protocolFee = Fraction.asFraction(protocolFee);\n if (protocolFee.lt(Fraction.ZERO) || protocolFee.gte(Fraction.ONE))\n throw new Error(\"protocolFee must be between 0 and 1\");\n\n const combinedFee = fee.add(protocolFee);\n if (combinedFee.gte(Fraction.ONE))\n throw new Error(\"Combined fee must be less than 1\");\n const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);\n const nextInputReserve = inputReserve + input;\n const newY = getNewY(nextInputReserve, laf, sumInvariant);\n\n const deltaYPrec = outputReserve * reservePrecision - newY;\n const deltaY = new Fraction(deltaYPrec, reservePrecision);\n const totalFee = combinedFee\n .multiply(feePrecision)\n .multiply(deltaY.quotient)\n .add(Fraction.asFraction(feePrecision - 1n))\n .divide(feePrecision).quotient;\n const totalProtocolFee = protocolFee\n .multiply(totalFee)\n .divide(combinedFee).quotient;\n const totalLpFee = totalFee - totalProtocolFee;\n const output = deltaY.subtract(totalFee);\n const safeOutput = roundOutputUp\n ? (output.numerator + output.denominator - 1n) / output.denominator\n : output.quotient;\n const nextOutputReserve = outputReserve - safeOutput - totalProtocolFee;\n\n // PRICEIMPACT: \"priceImpact\" is slightly misleadingly named in the industry as a whole\n // just by it's name, it would imply that it's the percentage difference between\n // the current price and the price after the swap, but it's actually the percentage\n // difference between the real price of your swap, and the price implied by the current\n // reserves; We got this wrong in v1, but this aligns it with the industry standard\n // Source: https://dailydefi.org/articles/price-impact-and-how-to-calculate/\n const idealPrice = getPrice(inputReserve, outputReserve, laf);\n const actualPrice = new Fraction(input, safeOutput);\n const priceImpact = Fraction.ONE.subtract(idealPrice.divide(actualPrice));\n return {\n input,\n output: safeOutput,\n outputLpFee: totalLpFee,\n outputProtocolFee: totalProtocolFee,\n nextInputReserve,\n nextOutputReserve,\n nextSumInvariant: getSumInvariant(laf, nextInputReserve, nextOutputReserve),\n priceImpact,\n };\n};\n\nexport function getPrice(\n aReserve: bigint,\n bReserve: bigint,\n laf: bigint,\n): Fraction {\n // dx_0 / dx_1 only, however can have any number of coins in pool\n const ann = laf * 2n * aPrecision;\n const sumInvariant =\n getSumInvariant(laf, aReserve, bReserve) / reservePrecision;\n // D / n^n with n = 2\n let dR = sumInvariant / 4n;\n dR = (dR * sumInvariant) / aReserve;\n dR = (dR * sumInvariant) / bReserve;\n const xpA = (ann * aReserve) / aPrecision;\n const p = new Fraction(xpA + (dR * aReserve) / bReserve, xpA + dR);\n return p;\n}\n\n/**\n * Calculate input required for a swap outcome for a given output and pool parameters (input tokens, output tokens, fee).\n * Throws if\n * - any of the arguments are negative\n * - fee is greater than or equal 1\n * - output is greater than or equal to output reserve\n *\n * @param output\n * @param inputReserve\n * @param outputReserve\n * @param fee\n * @param protocolFee The protocol fee\n * @param laf The linear amplification factor\n * @returns The swap details\n */\nexport const getSwapInput = (\n output: bigint,\n inputReserve: bigint,\n outputReserve: bigint,\n fee: TFractionLike,\n protocolFee: TFractionLike,\n laf: bigint,\n): TSwapOutcome => {\n if (output <= 0 || inputReserve <= 0 || outputReserve <= 0)\n throw new Error(\"Output and reserves must be positive\");\n\n if (output >= outputReserve)\n throw new Error(\"Output must be less than output reserve\");\n\n fee = Fraction.asFraction(fee);\n if (fee.lt(Fraction.ZERO) || fee.gte(Fraction.ONE))\n throw new Error(\"fee must be [0,1)\");\n\n protocolFee = Fraction.asFraction(protocolFee);\n if (protocolFee.lt(Fraction.ZERO) || protocolFee.gte(Fraction.ONE))\n throw new Error(\"protocolFee must be between 0 and 1\");\n\n const combinedFee = fee.add(protocolFee);\n if (combinedFee.gte(Fraction.ONE))\n throw new Error(\"Combined fee must be less than 1\");\n\n // output = rawOutput * (1-fee)\n // rawOutput = output / (1-fee)\n const rawOutputF = Fraction.asFraction(output).divide(\n Fraction.ONE.sub(combinedFee),\n );\n const rawOutput =\n (rawOutputF.numerator + rawOutputF.denominator - 1n) /\n rawOutputF.denominator;\n const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);\n const newX = getNewY(outputReserve - rawOutput, laf, sumInvariant);\n const input =\n (newX - inputReserve * reservePrecision + reservePrecision - 1n) /\n reservePrecision;\n\n const totalFee =\n (combinedFee.multiply(feePrecision).quotient * rawOutput +\n feePrecision -\n 1n) /\n feePrecision;\n const totalProtocolFee = protocolFee\n .multiply(totalFee)\n .divide(combinedFee).quotient;\n\n const totalLpFee = totalFee - totalProtocolFee;\n\n const nextInputReserve = inputReserve + input;\n const nextOutputReserve = outputReserve - output - totalProtocolFee;\n\n // See PRICEIMPACT\n const idealPrice = getPrice(inputReserve, outputReserve, laf);\n const actualPrice = new Fraction(input, output);\n const priceImpact = Fraction.ONE.subtract(idealPrice.divide(actualPrice));\n\n const nextSumInvariant = getSumInvariant(\n laf,\n nextInputReserve,\n nextOutputReserve,\n );\n\n return {\n input,\n output,\n outputLpFee: totalLpFee,\n outputProtocolFee: totalProtocolFee,\n nextInputReserve,\n nextOutputReserve,\n priceImpact,\n nextSumInvariant,\n };\n};\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,YAAY;AAC3C,SAASC,QAAQ,QAA4B,sBAAsB;AAEnE,OAAO,SAASC,kBAAkBA,CAChCC,MAAc,EACdC,MAAc,EACdC,mBAA2B,EAC3BC,eAAuB,EACvB;EACA;EACA;EACA;EACA,MAAMC,MAAM,GAAG,EAAE,GAAGF,mBAAmB;EACvC,MAAMG,QAAQ,GAAG,EAAE,GAAGL,MAAM,GAAGC,MAAM;EACrC,MAAMK,UAAU,GAAGH,eAAe,GAAG,EAAE;EACvC,MAAMI,OAAO,GAAGJ,eAAe,GAAGA,eAAe,GAAGA,eAAe;EACnE,MAAMK,gBAAgB,GAAGF,UAAU,GAAGA,UAAU,GAAGA,UAAU;EAC7D,MAAMG,QAAQ,GAAGT,MAAM,GAAGC,MAAM;EAChC,MAAMS,aAAa,GAAGN,MAAM,GAAGC,Q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BE,MAAM,CAACR,WAAW,CAAC,CAACb,QAAQ;EAE/B,MAAMuB,UAAU,GAAGJ,QAAQ,GAAGG,gBAAgB;EAE9C,MAAMP,gBAAgB,GAAGZ,YAAY,GAAGD,KAAK;EAC7C,MAAM2B,iBAAiB,GAAGzB,aAAa,GAAGoB,MAAM,GAAGF,gBAAgB;;EAEnE;EACA,MAAMQ,UAAU,GAAGC,QAAQ,CAAC5B,YAAY,EAAEC,aAAa,EAAEtB,GAAG,CAAC;EAC7D,MAAMkD,WAAW,GAAG,IAAIxF,QAAQ,CAAC0D,KAAK,EAAEsB,MAAM,CAAC;EAC/C,MAAMS,WAAW,GAAGzF,QAAQ,CAACoE,GAAG,CAACa,QAAQ,CAACK,UAAU,CAACT,MAAM,CAACW,WAAW,CAAC,CAAC;EAEzE,MAAMI,gBAAgB,GAAGzE,eAAe,CACtCmB,GAAG,EACHiC,gBAAgB,EAChBc,iBACF,CAAC;EAED,OAAO;IACL3B,KAAK;IACLsB,MAAM;IACNU,WAAW,EAAEX,UAAU;IACvBY,iBAAiB,EAAEb,gBAAgB;IACnCP,gBAAgB;IAChBc,iBAAiB;IACjBI,WAAW;IACXG;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"StableSwapsPool.js","names":["SharedPoolMath","Fraction","liquidityInvariant","assetA","assetB","linearAmplification","newSumInvariant","four_a","four_x_y","d_plus_one","d_cubed","d_plus_one_cubed","x_plus_y","sixteen_a_x_y","sixteen_a_x_y_x_plus_y","f1","f2","A_PRECISION","RESERVE_PRECISION","FEE_PRECISION","getSumInvariant","a","x","y","Error","sum","d","ann","i","d_p","d_prev","getNewY","newX","aRaw","sumInvariant","yPrev","c","b","getFirstLp","laf","calculateLiquidity","aReserve","bReserve","totalLp","oldSumInvariant","newLpTokens","newTotalLpTokens","nextTotalLp","generatedLp","shareAfterDeposit","getShare","aChange","bChange","actualDepositedA","actualDepositedB","getTokensForLp","lp","quotient","getSwapOutput","input","inputReserve","outputReserve","fee","protocolFee","roundOutputUp","asFraction","lt","ZERO","gte","ONE","combinedFee","add","nextInputReserve","newY","deltaYPrec","deltaY","totalFee","multiply","divide","totalProtocolFee","totalLpFee","output","subtract","safeOutput","numerator","denominator","nextOutputReserve","idealPrice","getPrice","actualPrice","priceImpact","outputLpFee","outputProtocolFee","nextSumInvariant","dR","xpA","p","getSwapInput","rawOutputF","sub","rawOutput"],"sources":["../../../src/PoolMath/StableSwapsPool.ts"],"sourcesContent":["import { SharedPoolMath } from \"./index.js\";\nimport { Fraction, type TFractionLike } from \"@sundaeswap/fraction\";\n\nexport function liquidityInvariant(\n assetA: bigint,\n assetB: bigint,\n linearAmplification: bigint,\n newSumInvariant: bigint,\n) {\n // 4 * A * 4 * (x*y) * D + D^3 - (4(x*y) * (4A(x + y) + D))\n // 4A * 4xy * D + D^3 - (4xy * 4a * (x + y) + 4xy * D)\n // 16Axy * D + D^3 - (16Axy * (x + y) + 4xy * D)\n const four_a = 4n * linearAmplification;\n const four_x_y = 4n * assetA * assetB;\n const d_plus_one = newSumInvariant + 1n;\n const d_cubed = newSumInvariant * newSumInvariant * newSumInvariant;\n const d_plus_one_cubed = d_plus_one * d_plus_one * d_plus_one;\n const x_plus_y = assetA + assetB;\n const sixteen_a_x_y = four_a * four_x_y;\n const sixteen_a_x_y_x_plus_y = sixteen_a_x_y * x_plus_y;\n const f1 =\n sixteen_a_x_y * newSumInvariant +\n d_cubed -\n (sixteen_a_x_y_x_plus_y + four_x_y * newSumInvariant);\n const f2 =\n sixteen_a_x_y * d_plus_one +\n d_plus_one_cubed -\n (sixteen_a_x_y_x_plus_y + four_x_y * d_plus_one);\n return f1 <= 0n && f2 > 0n;\n}\n\nexport const A_PRECISION: bigint = 200n;\nexport const RESERVE_PRECISION: bigint = 1_000_000_000_000n;\nexport const FEE_PRECISION: bigint = 10_000n;\n\nexport function getSumInvariant(a: bigint, x: bigint, y: bigint): bigint {\n if (a <= 0n) {\n throw new Error(\"Amplification coefficient must be positive.\");\n }\n x = x * RESERVE_PRECISION;\n y = y * RESERVE_PRECISION;\n a = a * A_PRECISION;\n const sum: bigint = x + y;\n if (sum === 0n) {\n return 0n;\n }\n\n let d = sum;\n const ann = a * 2n;\n for (let i = 0; i < 255; i++) {\n const d_p = (d * d * d) / (4n * x * y);\n const d_prev = d;\n\n d =\n (((ann * sum) / 100n + d_p * 2n) * d) /\n (((ann - 100n) * d) / 100n + 3n * d_p);\n\n if (d > d_prev) {\n if (d - d_prev <= 1) {\n if (liquidityInvariant(x, y, a / A_PRECISION, d)) {\n return d;\n } else {\n return d - 1n;\n }\n }\n } else {\n if (d_prev - d <= 1) {\n if (liquidityInvariant(x, y, a / A_PRECISION, d)) {\n return d;\n } else {\n return d - 1n;\n }\n }\n }\n }\n throw new Error(\"Failed to converge on D value after 255 iterations.\");\n}\n\nexport function getNewY(\n newX: bigint,\n aRaw: bigint,\n sumInvariant: bigint,\n): bigint {\n newX = newX * RESERVE_PRECISION;\n const sum = newX;\n let yPrev: bigint;\n let c = sumInvariant;\n const ann = aRaw * A_PRECISION * 2n;\n\n c = (c * sumInvariant) / (newX * 2n);\n c = (c * sumInvariant * A_PRECISION) / 2n;\n c = c / (ann * 2n);\n const b = sum + (sumInvariant * A_PRECISION) / 2n / ann;\n let y = sumInvariant;\n for (let i = 0; i < 255; i++) {\n yPrev = y;\n y = (y * y + c) / (y * 2n + b - sumInvariant);\n if (y > yPrev) {\n if (y - yPrev <= 1n) {\n if (liquidityInvariant(newX, y, aRaw, sumInvariant)) {\n return y;\n } else {\n return y + 1n;\n }\n }\n } else {\n if (yPrev - y <= 1n) {\n if (liquidityInvariant(newX, y, aRaw, sumInvariant)) {\n return y;\n } else {\n return y + 1n;\n }\n }\n }\n }\n throw new Error(\"failed to converge on y value after 255 iterations.\");\n}\n\n/**\n * Get the lp token amount for a, b\n * @param a tokenA amount\n * @param b tokenB amount\n * @returns the minted lp token amount\n */\nexport const getFirstLp = (a: bigint, b: bigint, laf: bigint) =>\n getSumInvariant(laf, a, b) / RESERVE_PRECISION;\n\n/**\n * Calculate the Add (Mixed-Deposit) Liquidity parameters\n *\n * TODO: Investigate way to optimize actualdeposited amounts\n *\n * @param {bigint} a - The amount of token A to deposit.\n * @param {bigint} b - The amount of token B to deposit.\n * @param {bigint} aReserve - The current reserve of token A in the pool.\n * @param {bigint} bReserve - The current reserve of token B in the pool.\n * @param {bigint} totalLp - The total lp tokens for the pool before the deposit.\n * @param {bigint} laf - The linear amplifciation factor of the pool.\n * @throws {Error} If the pool doesn't have enough liquidity.\n * @throws {Error} If either of the deposit amounts is zero.\n * @returns {Object} An object containing:\n * - nextTotalLp: The total lp tokens for the pool after the deposit.\n * - generatedLp: The amount of lp tokens generated by the deposit.\n * - shareAfterDeposit: The depositor's share of the pool after the deposit.\n */\nexport const calculateLiquidity = (\n a: bigint,\n b: bigint,\n aReserve: bigint,\n bReserve: bigint,\n totalLp: bigint,\n laf: bigint,\n) => {\n if (aReserve === 0n && bReserve === 0n) {\n throw new Error(\"Not enough pool liquidity\");\n }\n\n if (a === 0n && b === 0n) {\n throw new Error(\"Cannot use a deposit asset amount of 0\");\n }\n\n const oldSumInvariant = getSumInvariant(laf, aReserve, bReserve);\n\n const newSumInvariant = getSumInvariant(laf, aReserve + a, bReserve + b);\n\n const newLpTokens =\n ((newSumInvariant - oldSumInvariant) * totalLp) / oldSumInvariant;\n\n const newTotalLpTokens = totalLp + newLpTokens;\n\n return {\n nextTotalLp: newTotalLpTokens,\n generatedLp: newLpTokens,\n shareAfterDeposit: SharedPoolMath.getShare(newLpTokens, newTotalLpTokens),\n aChange: 0n,\n bChange: 0n,\n actualDepositedA: a,\n actualDepositedB: b,\n };\n};\n\n/**\n * Get the token amounts the given lp represents\n * @param lp the lp amount\n * @param aReserve the pool's reserveA amount\n * @param bReserve the pool's reserveB amount\n * @param totalLp the pool's total minted lp currently\n * @returns [a, b] token amounts\n */\nexport const getTokensForLp = (\n lp: bigint,\n aReserve: bigint,\n bReserve: bigint,\n totalLp: bigint,\n): SharedPoolMath.TPair => [\n new Fraction(lp * aReserve, totalLp).quotient,\n new Fraction(lp * bReserve, totalLp).quotient,\n];\n\n/**\n * Holds the calculated outcome of a swap\n */\nexport type TSwapOutcome = {\n input: bigint;\n output: bigint;\n outputLpFee: bigint;\n outputProtocolFee: bigint;\n nextInputReserve: bigint;\n nextOutputReserve: bigint;\n nextSumInvariant: bigint;\n priceImpact: Fraction;\n};\n\n/**\n * Calculate swap outcome for a given input and pool parameters (input tokens, output tokens, fee).\n * Throws if\n * - any of the arguments are negative\n * - fee is greater than or equal 1\n *\n * @param input The given amount of tokens to be swapped\n * @param inputReserve The amount of tokens in the input reserve\n * @param outputReserve The amount of tokens in the output reserve\n * @param fee The liquidity provider fee\n * @param protocolFee The protocol fee\n * @param laf The linear amplification factor\n * @returns The swap details\n */\nexport const getSwapOutput = (\n input: bigint,\n inputReserve: bigint,\n outputReserve: bigint,\n fee: TFractionLike,\n protocolFee: TFractionLike,\n laf: bigint,\n roundOutputUp?: boolean,\n): TSwapOutcome => {\n if (input <= 0 || inputReserve <= 0 || outputReserve <= 0)\n throw new Error(\"Input and reserves must be positive\");\n\n fee = Fraction.asFraction(fee);\n if (fee.lt(Fraction.ZERO) || fee.gte(Fraction.ONE))\n throw new Error(\"fee must be between 0 and 1\");\n\n protocolFee = Fraction.asFraction(protocolFee);\n if (protocolFee.lt(Fraction.ZERO) || protocolFee.gte(Fraction.ONE))\n throw new Error(\"protocolFee must be between 0 and 1\");\n\n const combinedFee = fee.add(protocolFee);\n if (combinedFee.gte(Fraction.ONE))\n throw new Error(\"Combined fee must be less than 1\");\n const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);\n const nextInputReserve = inputReserve + input;\n const newY = getNewY(nextInputReserve, laf, sumInvariant);\n\n const deltaYPrec = outputReserve * RESERVE_PRECISION - newY;\n const deltaY = new Fraction(deltaYPrec, RESERVE_PRECISION);\n const totalFee = combinedFee\n .multiply(FEE_PRECISION)\n .multiply(deltaY.quotient)\n .add(Fraction.asFraction(FEE_PRECISION - 1n))\n .divide(FEE_PRECISION).quotient;\n const totalProtocolFee = protocolFee\n .multiply(totalFee)\n .divide(combinedFee).quotient;\n const totalLpFee = totalFee - totalProtocolFee;\n const output = deltaY.subtract(totalFee);\n const safeOutput = roundOutputUp\n ? (output.numerator + output.denominator - 1n) / output.denominator\n : output.quotient;\n const nextOutputReserve = outputReserve - safeOutput - totalProtocolFee;\n\n // PRICEIMPACT: \"priceImpact\" is slightly misleadingly named in the industry as a whole\n // just by it's name, it would imply that it's the percentage difference between\n // the current price and the price after the swap, but it's actually the percentage\n // difference between the real price of your swap, and the price implied by the current\n // reserves; We got this wrong in v1, but this aligns it with the industry standard\n // Source: https://dailydefi.org/articles/price-impact-and-how-to-calculate/\n const idealPrice = getPrice(inputReserve, outputReserve, laf);\n const actualPrice = new Fraction(input, safeOutput);\n const priceImpact = Fraction.ONE.subtract(idealPrice.divide(actualPrice));\n return {\n input,\n output: safeOutput,\n outputLpFee: totalLpFee,\n outputProtocolFee: totalProtocolFee,\n nextInputReserve,\n nextOutputReserve,\n nextSumInvariant: getSumInvariant(laf, nextInputReserve, nextOutputReserve),\n priceImpact,\n };\n};\n\nexport function getPrice(\n aReserve: bigint,\n bReserve: bigint,\n laf: bigint,\n): Fraction {\n // dx_0 / dx_1 only, however can have any number of coins in pool\n const ann = laf * 2n * A_PRECISION;\n const sumInvariant =\n getSumInvariant(laf, aReserve, bReserve) / RESERVE_PRECISION;\n // D / n^n with n = 2\n let dR = sumInvariant / 4n;\n dR = (dR * sumInvariant) / aReserve;\n dR = (dR * sumInvariant) / bReserve;\n const xpA = (ann * aReserve) / A_PRECISION;\n const p = new Fraction(xpA + (dR * aReserve) / bReserve, xpA + dR);\n return p;\n}\n\n/**\n * Calculate input required for a swap outcome for a given output and pool parameters (input tokens, output tokens, fee).\n * Throws if\n * - any of the arguments are negative\n * - fee is greater than or equal 1\n * - output is greater than or equal to output reserve\n *\n * @param output\n * @param inputReserve\n * @param outputReserve\n * @param fee\n * @param protocolFee The protocol fee\n * @param laf The linear amplification factor\n * @returns The swap details\n */\nexport const getSwapInput = (\n output: bigint,\n inputReserve: bigint,\n outputReserve: bigint,\n fee: TFractionLike,\n protocolFee: TFractionLike,\n laf: bigint,\n): TSwapOutcome => {\n if (output <= 0 || inputReserve <= 0 || outputReserve <= 0)\n throw new Error(\"Output and reserves must be positive\");\n\n if (output >= outputReserve)\n throw new Error(\"Output must be less than output reserve\");\n\n fee = Fraction.asFraction(fee);\n if (fee.lt(Fraction.ZERO) || fee.gte(Fraction.ONE))\n throw new Error(\"fee must be [0,1)\");\n\n protocolFee = Fraction.asFraction(protocolFee);\n if (protocolFee.lt(Fraction.ZERO) || protocolFee.gte(Fraction.ONE))\n throw new Error(\"protocolFee must be between 0 and 1\");\n\n const combinedFee = fee.add(protocolFee);\n if (combinedFee.gte(Fraction.ONE))\n throw new Error(\"Combined fee must be less than 1\");\n\n // output = rawOutput * (1-fee)\n // rawOutput = output / (1-fee)\n const rawOutputF = Fraction.asFraction(output).divide(\n Fraction.ONE.sub(combinedFee),\n );\n const rawOutput =\n (rawOutputF.numerator + rawOutputF.denominator - 1n) /\n rawOutputF.denominator;\n const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);\n const newX = getNewY(outputReserve - rawOutput, laf, sumInvariant);\n const input =\n (newX - inputReserve * RESERVE_PRECISION + RESERVE_PRECISION - 1n) /\n RESERVE_PRECISION;\n\n const totalFee =\n (combinedFee.multiply(FEE_PRECISION).quotient * rawOutput +\n FEE_PRECISION -\n 1n) /\n FEE_PRECISION;\n const totalProtocolFee = protocolFee\n .multiply(totalFee)\n .divide(combinedFee).quotient;\n\n const totalLpFee = totalFee - totalProtocolFee;\n\n const nextInputReserve = inputReserve + input;\n const nextOutputReserve = outputReserve - output - totalProtocolFee;\n\n // See PRICEIMPACT\n const idealPrice = getPrice(inputReserve, outputReserve, laf);\n const actualPrice = new Fraction(input, output);\n const priceImpact = Fraction.ONE.subtract(idealPrice.divide(actualPrice));\n\n const nextSumInvariant = getSumInvariant(\n laf,\n nextInputReserve,\n nextOutputReserve,\n );\n\n return {\n input,\n output,\n outputLpFee: totalLpFee,\n outputProtocolFee: totalProtocolFee,\n nextInputReserve,\n nextOutputReserve,\n priceImpact,\n nextSumInvariant,\n };\n};\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,YAAY;AAC3C,SAASC,QAAQ,QAA4B,sBAAsB;AAEnE,OAAO,SAASC,kBAAkBA,CAChCC,MAAc,EACdC,MAAc,EACdC,mBAA2B,EAC3BC,eAAuB,EACvB;EACA;EACA;EACA;EACA,MAAMC,MAAM,GAAG,EAAE,GAAGF,mBAAmB;EACvC,MAAMG,QAAQ,GAAG,EAAE,GAAGL,MAAM,GAAGC,MAAM;EACrC,MAAMK,UAAU,GAAGH,eAAe,GAAG,EAAE;EACvC,MAAMI,OAAO,GAAGJ,eAAe,GAAGA,eAAe,GAAGA,eAAe;EACnE,MAAMK,gBAAgB,GAAGF,UAAU,GAAGA,UAAU,GAAGA,UAAU;EAC7D,MAAMG,QAAQ,GAAGT,MAAM,GAAGC,MAAM;EAChC,MAAMS,aAAa,GAAGN,MAAM,GAAGC,QAAQ;EACvC,MAAMM,sBAAsB,GAAGD,aAAa,GAAGD,QAAQ;EACvD,MAAMG,EAAE,GACNF,aAAa,GAAGP,eAAe,GAC/BI,OAAO,IACNI,sBAAsB,GAAGN,QAAQ,GAAGF,eAAe,CAAC;EACvD,MAAMU,EAAE,GACNH,aAAa,GAAGJ,UAAU,GAC1BE,gBAAgB,IACfG,sBAAsB,GAAGN,QAAQ,GAAGC,UAAU,CAAC;EAClD,OAAOM,EAAE,IAAI,EAAE,IAAIC,EAAE,GAAG,EAAE;AAC5B;AAEA,OAAO,MAAMC,WAAmB,GAAG,IAAI;AACvC,OAAO,MAAMC,iBAAyB,GAAG,kBAAkB;AAC3D,OAAO,MAAMC,aAAqB,GAAG,OAAO;AAE5C,OAAO,SAASC,eAAeA,CAACC,CAAS,EAAEC,CA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MI,gBAAgB,GAAGzE,eAAe,CACtCmB,GAAG,EACHiC,gBAAgB,EAChBc,iBACF,CAAC;EAED,OAAO;IACL3B,KAAK;IACLsB,MAAM;IACNU,WAAW,EAAEX,UAAU;IACvBY,iBAAiB,EAAEb,gBAAgB;IACnCP,gBAAgB;IAChBc,iBAAiB;IACjBI,WAAW;IACXG;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,9 +1,9 @@
1
1
  import { SharedPoolMath } from "./index.js";
2
2
  import { Fraction, type TFractionLike } from "@sundaeswap/fraction";
3
3
  export declare function liquidityInvariant(assetA: bigint, assetB: bigint, linearAmplification: bigint, newSumInvariant: bigint): boolean;
4
- export declare const aPrecision = 200n;
5
- export declare const reservePrecision = 1000000000000n;
6
- export declare const feePrecision = 10000n;
4
+ export declare const A_PRECISION: bigint;
5
+ export declare const RESERVE_PRECISION: bigint;
6
+ export declare const FEE_PRECISION: bigint;
7
7
  export declare function getSumInvariant(a: bigint, x: bigint, y: bigint): bigint;
8
8
  export declare function getNewY(newX: bigint, aRaw: bigint, sumInvariant: bigint): bigint;
9
9
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"StableSwapsPool.d.ts","sourceRoot":"","sources":["../../../src/PoolMath/StableSwapsPool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEpE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,MAAM,EAC3B,eAAe,EAAE,MAAM,WAsBxB;AAED,eAAO,MAAM,UAAU,OAAO,CAAC;AAC/B,eAAO,MAAM,gBAAgB,iBAAqB,CAAC;AACnD,eAAO,MAAM,YAAY,SAAU,CAAC;AAEpC,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CA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AiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,QAAQ,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,UACjB,MAAM,gBACC,MAAM,iBACL,MAAM,OAChB,aAAa,eACL,aAAa,OACrB,MAAM,kBACK,OAAO,KACtB,YAuDF,CAAC;AAEF,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,QAAQ,CAYV;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,WACf,MAAM,gBACA,MAAM,iBACL,MAAM,OAChB,aAAa,eACL,aAAa,OACrB,MAAM,KACV,YAoEF,CAAC"}
@@ -1 +1 @@
1
- {"program":{"fileNames":["../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../node_modules/@sundaeswap/asset/dist/types/asset.d.ts","../../../../node_modules/@sundaeswap/fraction/dist/types/fraction.d.ts","../../../../node_modules/@sundaeswap/fraction/dist/types/index.d.ts","../../../../node_modules/@sundaeswap/asset/dist/types/assetratio.d.ts","../../../../node_modules/@sundaeswap/asset/dist/types/assetamount.d.ts","../../../../node_modules/@sundaeswap/asset/dist/types/tokenbundle.d.ts","../../../../node_modules/@sundaeswap/asset/dist/types/index.d.ts","../../../../node_modules/@sundaeswap/bigint-math/dist/types/bigintmath.d.ts","../../../../node_modules/@sundaeswap/bigint-math/dist/types/index.d.ts","../../src/poolmath/constantproductpool.ts","../../src/poolmath/stableswapspool.ts","../../src/poolmath/sharedpoolmath.ts","../../src/poolmath/index.ts","../../src/@types/index.ts","../../src/index.ts","../../../../node_modules/buffer/index.d.ts","../../../../node_modules/undici-types/header.d.ts","../../../../node_modules/undici-types/readable.d.ts","../../../../node_modules/@types/node/compatibility/disposable.d.ts","../../../../node_modules/@types/node/compatibility/indexable.d.ts","../../../../node_modules/@types/node/compatibility/iterators.d.ts","../../../../node_modules/@types/node/compatibility/index.d.ts","../../../../node_modules/@types/node/ts5.6/globals.typedarray.d.ts","../../../../node_modules/@types/node/ts5.6/buffer.buffer.d.ts","../../../../node_modules/@types/node/globals.d.ts","../../../../node_modules/@types/node/assert.d.ts","../../../../node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/@types/node/buffer.d.ts","../../../../node_modules/@types/node/child_process.d.ts","../../../../node_modules/@types/node/cluster.d.ts","../../../../node_modules/@types/node/console.d.ts","../../../../node_modules/@types/node/constants.d.ts","../../../../node_modules/@types/node/crypto.d.ts","../../../../node_modules/@types/node/dgram.d.ts","../../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../../node_modules/@types/node/dns.d.ts","../../../../node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/@types/node/domain.d.ts","../../../../node_modules/@types/node/dom-events.d.ts","../../../../node_modules/@types/node/events.d.ts","../../../../node_modules/@types/node/fs.d.ts","../../../../node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/@types/node/http.d.ts","../../../../node_modules/@types/node/http2.d.ts","../../../../node_modules/@types/node/https.d.ts","../../../../node_modules/@types/node/inspector.d.ts","../../../../node_modules/@types/node/module.d.ts","../../../../node_modules/@types/node/net.d.ts","../../../../node_modules/@types/node/os.d.ts","../../../../node_modules/@types/node/path.d.ts","../../../../node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/@types/node/process.d.ts","../../../../node_modules/@types/node/punycode.d.ts","../../../../node_modules/@types/node/querystring.d.ts","../../../../node_modules/@types/node/readline.d.ts","../../../../node_modules/@types/node/readline/promises.d.ts","../../../../node_modules/@types/node/repl.d.ts","../../../../node_modules/@types/node/stream.d.ts","../../../../node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/@types/node/stream/consumers.d.ts","../../../../node_modules/@types/node/stream/web.d.ts","../../../../node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/@types/node/test.d.ts","../../../../node_modules/@types/node/timers.d.ts","../../../../node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/@types/node/tls.d.ts","../../../../node_modules/@types/node/trace_events.d.ts","../../../../node_modules/@types/node/tty.d.ts","../../../../node_modules/@types/node/url.d.ts","../../../../node_modules/@types/node/util.d.ts","../../../../node_modules/@types/node/v8.d.ts","../../../../node_modules/@types/node/vm.d.ts","../../../../node_modules/@types/node/wasi.d.ts","../../../../node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/@types/node/zlib.d.ts","../../../../node_modules/@types/node/ts5.6/index.d.ts","../../../../node_modules/undici-types/file.d.ts","../../../../node_modules/undici-types/fetch.d.ts","../../../../node_modules/undici-types/formdata.d.ts","../../../../node_modules/undici-types/connector.d.ts","../../../../node_modules/undici-types/client.d.ts","../../../../node_modules/undici-types/errors.d.ts","../../../../node_modules/undici-types/dispatcher.d.ts","../../../../node_modules/undici-types/global-dispatcher.d.ts","../../../../node_modules/undici-types/global-origin.d.ts","../../../../node_modules/undici-types/pool-stats.d.ts","../../../../node_modules/undici-types/pool.d.ts","../../../../node_modules/undici-types/handlers.d.ts","../../../../node_modules/undici-types/balanced-pool.d.ts","../../../../node_modules/undici-types/agent.d.ts","../../../../node_modules/undici-types/mock-interceptor.d.ts","../../../../node_modules/undici-types/mock-agent.d.ts","../../../../node_modules/undici-types/mock-client.d.ts","../../../../node_modules/undici-types/mock-pool.d.ts","../../../../node_modules/undici-types/mock-errors.d.ts","../../../../node_modules/undici-types/proxy-agent.d.ts","../../../../node_modules/undici-types/api.d.ts","../../../../node_modules/undici-types/cookies.d.ts","../../../../node_modules/undici-types/patch.d.ts","../../../../node_modules/undici-types/filereader.d.ts","../../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../../node_modules/undici-types/websocket.d.ts","../../../../node_modules/undici-types/content-type.d.ts","../../../../node_modules/undici-types/cache.d.ts","../../../../node_modules/undici-types/interceptors.d.ts","../../../../node_modules/undici-types/index.d.ts","../../node_modules/@types/bun/node_modules/bun-types/globals.d.ts","../../node_modules/@types/bun/node_modules/bun-types/s3.d.ts","../../node_modules/@types/bun/node_modules/bun-types/fetch.d.ts","../../node_modules/@types/bun/node_modules/bun-types/bun.d.ts","../../node_modules/@types/bun/node_modules/bun-types/extensions.d.ts","../../node_modules/@types/bun/node_modules/bun-types/devserver.d.ts","../../node_modules/@types/bun/node_modules/bun-types/ffi.d.ts","../../node_modules/@types/bun/node_modules/bun-types/html-rewriter.d.ts","../../node_modules/@types/bun/node_modules/bun-types/jsc.d.ts","../../node_modules/@types/bun/node_modules/bun-types/sqlite.d.ts","../../node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/utils.d.ts","../../node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/overloads.d.ts","../../node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/branding.d.ts","../../node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/messages.d.ts","../../node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/index.d.ts","../../node_modules/@types/bun/node_modules/bun-types/test.d.ts","../../node_modules/@types/bun/node_modules/bun-types/wasm.d.ts","../../node_modules/@types/bun/node_modules/bun-types/overrides.d.ts","../../node_modules/@types/bun/node_modules/bun-types/deprecated.d.ts","../../node_modules/@types/bun/node_modules/bun-types/redis.d.ts","../../node_modules/@types/bun/node_modules/bun-types/shell.d.ts","../../../../node_modules/@types/react/global.d.ts","../../../../node_modules/csstype/index.d.ts","../../../../node_modules/@types/prop-types/index.d.ts","../../../../node_modules/@types/react/index.d.ts","../../node_modules/@types/bun/node_modules/bun-types/experimental.d.ts","../../node_modules/@types/bun/node_modules/bun-types/serve.d.ts","../../node_modules/@types/bun/node_modules/bun-types/sql.d.ts","../../node_modules/@types/bun/node_modules/bun-types/security.d.ts","../../node_modules/@types/bun/node_modules/bun-types/bun.ns.d.ts","../../node_modules/@types/bun/node_modules/bun-types/index.d.ts","../../node_modules/@types/bun/index.d.ts","../../../../node_modules/@types/aria-query/index.d.ts","../../../../node_modules/@babel/types/lib/index.d.ts","../../../../node_modules/@types/babel__generator/index.d.ts","../../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../../node_modules/@types/babel__template/index.d.ts","../../../../node_modules/@types/babel__traverse/index.d.ts","../../../../node_modules/@types/babel__core/index.d.ts","../../../../node_modules/@types/connect/index.d.ts","../../../../node_modules/@types/body-parser/index.d.ts","../../../../node_modules/@types/bonjour/index.d.ts","../../../../node_modules/@types/cli-progress/index.d.ts","../../../../node_modules/mime/dist/src/mime.d.ts","../../../../node_modules/mime/dist/src/index.d.ts","../../../../node_modules/@types/send/index.d.ts","../../../../node_modules/@types/qs/index.d.ts","../../../../node_modules/@types/range-parser/index.d.ts","../../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../../node_modules/@types/dns-packet/index.d.ts","../../../../node_modules/@types/estree/index.d.ts","../../../../node_modules/@types/json-schema/index.d.ts","../../../../node_modules/@types/eslint/use-at-your-own-risk.d.ts","../../../../node_modules/@types/eslint/index.d.ts","../../../../node_modules/@eslint/core/dist/esm/types.d.ts","../../../../node_modules/eslint/lib/types/use-at-your-own-risk.d.ts","../../../../node_modules/eslint/lib/types/index.d.ts","../../../../node_modules/@types/eslint-scope/index.d.ts","../../../../node_modules/@types/http-errors/index.d.ts","../../../../node_modules/@types/serve-static/index.d.ts","../../../../node_modules/@types/express/node_modules/@types/express-serve-static-core/index.d.ts","../../../../node_modules/@types/express/index.d.ts","../../../../node_modules/@types/minimatch/index.d.ts","../../../../node_modules/@types/glob/index.d.ts","../../../../node_modules/@types/graceful-fs/index.d.ts","../../../../node_modules/@types/unist/index.d.ts","../../../../node_modules/@types/hast/index.d.ts","../../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../../node_modules/@types/http-proxy/index.d.ts","../../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../../node_modules/@types/istanbul-reports/index.d.ts","../../../../node_modules/@jest/expect-utils/build/index.d.ts","../../../../node_modules/chalk/index.d.ts","../../../../node_modules/@jest/schemas/node_modules/@sinclair/typebox/typebox.d.ts","../../../../node_modules/@jest/schemas/build/index.d.ts","../../../../node_modules/pretty-format/build/index.d.ts","../../../../node_modules/jest-matcher-utils/node_modules/jest-diff/build/index.d.ts","../../../../node_modules/jest-matcher-utils/build/index.d.ts","../../../../node_modules/expect/build/index.d.ts","../../../../node_modules/@types/jest/index.d.ts","../../../../node_modules/parse5/dist/common/html.d.ts","../../../../node_modules/parse5/dist/common/token.d.ts","../../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../../node_modules/parse5/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts","../../../../node_modules/parse5/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts","../../../../node_modules/parse5/node_modules/entities/dist/commonjs/decode-codepoint.d.ts","../../../../node_modules/parse5/node_modules/entities/dist/commonjs/decode.d.ts","../../../../node_modules/parse5/node_modules/entities/decode.d.ts","../../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../../node_modules/parse5/dist/parser/index.d.ts","../../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../../node_modules/parse5/dist/serializer/index.d.ts","../../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../../node_modules/parse5/dist/index.d.ts","../../../../node_modules/@types/tough-cookie/index.d.ts","../../../../node_modules/@types/jsdom/base.d.ts","../../../../node_modules/@types/jsdom/index.d.ts","../../../../node_modules/@types/json-bigint/index.d.ts","../../../../node_modules/@types/json5/index.d.ts","../../../../node_modules/@types/mdast/index.d.ts","../../../../node_modules/@types/mime/index.d.ts","../../../../node_modules/@types/minimist/index.d.ts","../../../../node_modules/@types/node-forge/index.d.ts","../../../../node_modules/@types/normalize-package-data/index.d.ts","../../../../node_modules/@types/parse-json/index.d.ts","../../../../node_modules/@types/react-dom/index.d.ts","../../../../node_modules/@types/retry/index.d.ts","../../../../node_modules/@types/serve-index/index.d.ts","../../../../node_modules/@types/sockjs/index.d.ts","../../../../node_modules/@types/stack-utils/index.d.ts","../../../../node_modules/@types/testing-library__jest-dom/matchers.d.ts","../../../../node_modules/@types/testing-library__jest-dom/index.d.ts","../../../../node_modules/@types/ws/index.d.ts","../../../../node_modules/@types/yargs-parser/index.d.ts","../../../../node_modules/@types/yargs/index.d.ts"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4",{"version":"4af6b0c727b7a2896463d512fafd23634229adf69ac7c00e2ae15a09cb084fad","affectsGlobalScope":true},{"version":"9c00a480825408b6a24c63c1b71362232927247595d7c97659bc24dc68ae0757","affectsGlobalScope":true},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"51c956a7c738d7f4fd20eec47a375a8cb710ea54f82fb0ad03d787fb12657d92","68c52be545faa567bbb3568f7bdfe6cce70e2715c9c13a61849f86aea5a9ebbd","e9a73f3b07707e735d5a85fc8edd642c907efe342e9ce6f1e96102965dc3ba89","b34f125d24f666b3146a2aa7075fb5c75248fe05bb035be9c3acf408c084790e","de495af61b69bc716de329ae92128b85d1adb1a412ec2b18bdc09e1e2408c3d7","fe0d90c26b19d8f79ccc69c68f0facfd3dc808c3dc19fcd452cf30cb199a7a8e","6257871c4fc4701fb42d4136f5bc86529c97a9abb1d0fc7babbef91b6f1942f2","910f330ba93ef8eb90baabbc6ed0b12ad8d9b27dc841aa95dfb2799643c41045","874a1013a9dab7c69706b58b35e85658ab0b284b834b2dc3af8906f534ad79ae",{"version":"96ff6fd0ad67b4c9f3aa27c7d22b26563e765f90ed1395843665d1fa38e817ff","signature":"b1e0c8086bd5e87139ef16d93bb953d1303cd5f15588a07b4992496480f2a5ce"},{"version":"de44d64f881c3212b84096d1eb2f188c0c9afd85290f695e11c19ed41655ecb0","signature":"3d9a919381b9b03f6b2448f8b6a49acc44974233ac6e931fcbf3608292b2ba0d"},{"version":"66acaaa1d369f8beb3eeb99ecda57f318b28005caee5405fe8da1cbca2727e26","signature":"7b311aa1193ba30b6beb6bca85a137af8410bbab82bee6d78b58397e0a64f728"},"f7bbbe20be74e8eb7e2cd2fc58ca4197ce4a8f830da9d6ca6bdc3e5905d4b3a2","d505dd3248a004e125aedacd78ac294598ac676ff103c532d35de6355ebf2786","7fc64678c4e3e69edf0add713b86c4f2ae254ea12ded16a99366142b29dda7b3","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","7180c03fd3cb6e22f911ce9ba0f8a7008b1a6ddbe88ccf16a9c8140ef9ac1686",{"version":"6c7176368037af28cb72f2392010fa1cef295d6d6744bca8cfb54985f3a18c3e","affectsGlobalScope":true},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true},{"version":"437e20f2ba32abaeb7985e0afe0002de1917bc74e949ba585e49feba65da6ca1","affectsGlobalScope":true},"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a",{"version":"613b21ccdf3be6329d56e6caa13b258c842edf8377be7bc9f014ed14cdcfc308","affectsGlobalScope":true},{"version":"d2662405c15ec112ebc0c3ec787edb82d58d6acb1a9d109317d7bf9cff9d09a7","affectsGlobalScope":true},{"version":"1a2e588ce04b57f262959afb54933563431bf75304cfda6165703fe08f4018c5","affectsGlobalScope":true},"c775b106d611ae2c068ed8429a132608d10007918941311214892dcd4a571ad7","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","75eb536b960b85f75e21490beeab53ea616646a995ad203e1af532d67a774fb6",{"version":"36d0976d3dad74078f707af107b5082dbe42ffcadb3442ff140c36c8a33b4887","affectsGlobalScope":true},"51bb58ef3a22fdc49a2d338a852050855d1507f918d4d7fa77a68d72fee9f780","7646ad748a9ca15bf43d4c88f83cc851c67f8ec9c1186295605b59ba6bb36dcb",{"version":"cef8931bc129687165253f0642427c2a72705a4613b3ac461b9fa78c7cdaef32","affectsGlobalScope":true},"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","47b62c294beb69daa5879f052e416b02e6518f3e4541ae98adbfb27805dd6711","f8375506002c556ec412c7e2a5a9ece401079ee5d9eb2c1372e9f5377fac56c7","8edd6482bd72eca772f9df15d05c838dd688cdbd4d62690891fca6578cfda6fe","07ba29a1a495b710aea48a4cf19ae12b3cbda2a8e9ac62192af477027a99e8de","6dead64c944504250dd2fc9095231f36887cfc1534f1ff57737c19f92d165c91","b9a4824bb83f25d6d227394db2ed99985308cf2a3a35f0d6d39aa72b15473982",{"version":"6e57c0b7b3d2716fbc0ca28aa23f62bc997ad534d1369f3853dcb9d453d1fb91","affectsGlobalScope":true},{"version":"b84f34005e497dbc0c1948833818cdb38e8c01ff4f88d810b4d70aa2e6c52916","affectsGlobalScope":true},"8e8e284b3832911aeede987e4d74cf0a00f2b03896b2fd3bf924344cc0f96b3c","37d37474a969ab1b91fc332eb6a375885dfd25279624dfa84dea48c9aedf4472","957905d33a09ce85efd84a65819cdd22eefdd64959afacbdcfe5f36b0d7a7bbe","f1a79b6047d006548185e55478837dfbcdd234d6fe51532783f5dffd401cfb2b","565fda33feca88f4b5db23ba8e605da1fd28b6d63292d276bdbd2afe6cd4c490","e822320b448edce0c7ede9cbeada034c72e1f1c8c8281974817030564c63dcb1",{"version":"9d65568cba17c9db40251023406668695ad698ea4a34542364af3e78edd37811","affectsGlobalScope":true},"f23e3d484de54d235bf702072100b541553a1df2550bad691fe84995e15cf7be","821c79b046e40d54a447bebd9307e70b86399a89980a87bbc98114411169e274","17bc38afc78d40b2f54af216c0cc31a4bd0c6897a5945fa39945dfc43260be2c",{"version":"d201b44ff390c220a94fb0ff6a534fe9fa15b44f8a86d0470009cdde3a3e62ab","affectsGlobalScope":true},{"version":"d44445141f204d5672c502a39c1124bcf1df225eba05df0d2957f79122be87b5","affectsGlobalScope":true},"de905bc5f7e7a81cb420e212b95ab5e3ab840f93e0cfa8ce879f6e7fa465d4a2","bc2ff43214898bc6d53cab92fb41b5309efec9cbb59a0650525980aee994de2b","bede3143eeddca3b8ec3592b09d7eb02042f9e195251040c5146eac09b173236","64a40cf4ec8a7a29db2b4bc35f042e5be8537c4be316e5221f40f30ca8ed7051","294c082d609e6523520290db4f1d54114ebc83643fb42abd965be5bcc5d9416b","cf7d740e39bd8adbdc7840ee91bef0af489052f6467edfcefb7197921757ec3b","37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093",{"version":"b9f0681c4d2cb00a5cfe08a7be9662627b912de562926819ebddfe2ef6a9b5ee","affectsGlobalScope":true},"b85151402164ab7cb665e58df5c1a29aa25ea4ed3a367f84a15589e7d7a9c8ca","89eb8abe2b5c146fbb8f3bf72f4e91de3541f2fb559ad5fed4ad5bf223a3dedb",{"version":"bc6cb10764a82f3025c0f4822b8ad711c16d1a5c75789be2d188d553b69b2d48","affectsGlobalScope":true},"41d510caf7ed692923cb6ef5932dc9cf1ed0f57de8eb518c5bab8358a21af674","2751c5a6b9054b61c9b03b3770b2d39b1327564672b63e3485ac03ffeb28b4f6","dc058956a93388aab38307b7b3b9b6379e1021e73a244aab6ac9427dc3a252a7","f33302cf240672359992c356f2005d395b559e176196d03f31a28cc7b01e69bc",{"version":"3ce25041ff6ae06c08fcaccd5fcd9baf4ca6e80e6cb5a922773a1985672e74c2","affectsGlobalScope":true},{"version":"652c0de14329a834ff06af6ad44670fac35849654a464fd9ae36edb92a362c12","affectsGlobalScope":true},"3b1e178016d3fc554505ae087c249b205b1c50624d482c542be9d4682bab81fc","5db7c5bb02ef47aaaec6d262d50c4e9355c80937d649365c343fa5e84569621d","cf45d0510b661f1da461479851ff902f188edb111777c37055eff12fa986a23a",{"version":"ec9a5f06328f61e09f44d6781d1bd862475f9900c16cef82621a46305def3c4d","affectsGlobalScope":true},"37bef1064b7d015aeaa7c0716fe23a0b3844abe2c0a3df7144153ca8445fe0da","75bd411256302c183207051fd198b4e0dbab45d28a6daf04d3ad61f70a2c8e90","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","54cb85a47d760da1c13c00add10d26b5118280d44d58e6908d8e89abbd9d7725","3e4825171442666d31c845aeb47fcd34b62e14041bb353ae2b874285d78482aa","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","a967bfe3ad4e62243eb604bf956101e4c740f5921277c60debaf325c1320bf88","e9775e97ac4877aebf963a0289c81abe76d1ec9a2a7778dbe637e5151f25c5f3","471e1da5a78350bc55ef8cef24eb3aca6174143c281b8b214ca2beda51f5e04a","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","db3435f3525cd785bf21ec6769bf8da7e8a776be1a99e2e7efb5f244a2ef5fee","c3b170c45fc031db31f782e612adf7314b167e60439d304b49e704010e7bafe5","40383ebef22b943d503c6ce2cb2e060282936b952a01bea5f9f493d5fb487cc7","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","3a84b7cb891141824bd00ef8a50b6a44596aded4075da937f180c90e362fe5f6","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","33203609eba548914dc83ddf6cadbc0bcb6e8ef89f6d648ca0908ae887f9fcc5","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","9f0a92164925aa37d4a5d9dd3e0134cff8177208dba55fd2310cd74beea40ee2","8bfdb79bf1a9d435ec48d9372dc93291161f152c0865b81fc0b2694aedb4578d","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","d32275be3546f252e3ad33976caf8c5e842c09cb87d468cb40d5f4cf092d1acc","4a0c3504813a3289f7fb1115db13967c8e004aa8e4f8a9021b95285502221bd1",{"version":"eabae5daa40501125bc1f6da9ff442ecc0159e1b3bfe19b37552cc5a90aa23fc","affectsGlobalScope":true},"53e074a281b50dc3bbdddac7a1c2946100c80a7f5c3161452ab98b31db2e31ba","f3d3e999a323c85c8a63ce90c6e4624ff89fe137a0e2508fddc08e0556d08abf","300b7ea7b0801a4b5f1b203136185481b1f66cfe4517773ed65f982c69bdf34e","49ae37a1b5de16f762c8a151eeaec6b558ce3c27251052ef7a361144af42cad4",{"version":"fc9e630f9302d0414ccd6c8ed2706659cff5ae454a56560c6122fa4a3fac5bbd","affectsGlobalScope":true},"aa0a44af370a2d7c1aac988a17836f57910a6c52689f52f5b3ac1d4c6cadcb23",{"version":"0ac74c7586880e26b6a599c710b59284a284e084a2bbc82cd40fb3fbfdea71ae","affectsGlobalScope":true},"2ce12357dadbb8efc4e4ec4dab709c8071bf992722fc9adfea2fe0bd5b50923f","31bd1a31f935276adf90384a35edbd4614018ff008f57d62ffb57ac538e94e51","ffd344731abee98a0a85a735b19052817afd2156d97d1410819cd9bcd1bd575e","475e07c959f4766f90678425b45cf58ac9b95e50de78367759c1e5118e85d5c3","a524ae401b30a1b0814f1bbcdae459da97fa30ae6e22476e506bb3f82e3d9456","7375e803c033425e27cb33bae21917c106cb37b508fd242cccd978ef2ee244c7","eeb890c7e9218afdad2f30ad8a76b0b0b5161d11ce13b6723879de408e6bc47a","bb35ce2892f70447f1fd6e76dbbaa915309181414728bc22877bd99ddef4905d",{"version":"b05b9ef20d18697e468c3ae9cecfff3f47e8976f9522d067047e3f236db06a41","affectsGlobalScope":true},{"version":"efc6ad7bb4b317be15eede0218b94b836894cb372bbeabdcc3679d90cfca86fb","affectsGlobalScope":true},{"version":"6b386c7b6ce6f369d18246904fa5eac73566167c88fb6508feba74fa7501a384","affectsGlobalScope":true},"592a109e67b907ffd2078cd6f727d5c326e06eaada169eef8fb18546d96f6797","f2eb1e35cae499d57e34b4ac3650248776fe7dbd9a3ec34b23754cfd8c22fceb",{"version":"eb5b19b86227ace1d29ea4cf81387279d04bb34051e944bc53df69f58914b788","affectsGlobalScope":true},"8a8eb4ebffd85e589a1cc7c178e291626c359543403d58c9cd22b81fab5b1fb9","87d9d29dbc745f182683f63187bf3d53fd8673e5fca38ad5eaab69798ed29fbc",{"version":"472f5aab7edc498a0a761096e8e254c5bc3323d07a1e7f5f8b8ec0d6395b60a0","affectsGlobalScope":true},"83150b58197b25de8ba1334ec4732edf866a23fdd2b29f404b1af1da0614ce80","b557f8d0ae85258ba995e06f70957a8a20e4a63978c8d9fa20a1203ed7740377","9e98bd421e71f70c75dae7029e316745c89fa7b8bc8b43a91adf9b82c206099c","fc803e6b01f4365f71f51f9ce13f71396766848204d4f7a1b2b6154434b84b15",{"version":"c8109fe76467db6e801d0edfbc50e6826934686467c9418ce6b246232ce7f109","affectsGlobalScope":true},{"version":"1922ac4f92c7f8320b4584e3fe117776395ef5b4dc2bd426e5b0de39261669ec","affectsGlobalScope":true},"37be812b06e518320ba82e2aff3ac2ca37370a9df917db708f081b9043fa3315","ae77d81a5541a8abb938a0efedf9ac4bea36fb3a24cc28cfa11c598863aba571","a28ac3e717907284b3910b8e9b3f9844a4e0b0a861bea7b923e5adf90f620330","b6d03c9cfe2cf0ba4c673c209fcd7c46c815b2619fd2aad59fc4229aaef2ed43","82e5a50e17833a10eb091923b7e429dc846d42f1c6161eb6beeb964288d98a15","670a76db379b27c8ff42f1ba927828a22862e2ab0b0908e38b671f0e912cc5ed","13b77ab19ef7aadd86a1e54f2f08ea23a6d74e102909e3c00d31f231ed040f62","069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","104c67f0da1bdf0d94865419247e20eded83ce7f9911a1aa75fc675c077ca66e","cc0d0b339f31ce0ab3b7a5b714d8e578ce698f1e13d7f8c60bfb766baeb1d35c","f9e22729fa06ed20f8b1fe60670b7c74933fdfd44d869ddfb1919c15a5cf12fb","c0e5b4df115963b8a8dcd5b56ff9dc046ddec110de138dba29b00e2b02fa03a9","0ae65c3e977c81f6e46ae9028ae97fc75c78c70f4d6d5f961a8af60301145af6","b1a6683b821c624d63d887dbdd9f34aebb9de586acf87bbf50cb16f5ec2c36c7","b78cd10245a90e27e62d0558564f5d9a16576294eee724a59ae21b91f9269e4a","baac9896d29bcc55391d769e408ff400d61273d832dd500f21de766205255acb","2f5747b1508ccf83fad0c251ba1e5da2f5a30b78b09ffa1cfaf633045160afed",{"version":"a8932b7a5ef936687cc5b2492b525e2ad5e7ed321becfea4a17d5a6c80f49e92","affectsGlobalScope":true},"689be50b735f145624c6f391042155ae2ff6b90a93bac11ca5712bc866f6010c","bc222163edcb8df6ba9b506d053d6c5afcae50e85695151cf4636a3107deaba9","151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","a4a39b5714adfcadd3bbea6698ca2e942606d833bde62ad5fb6ec55f5e438ff8","bbc1d029093135d7d9bfa4b38cbf8761db505026cc458b5e9c8b74f4000e5e75","851fe8b694793c8e4c48c154847712e940694e960e33ac68b73e94557d6aff8d","8a190298d0ff502ad1c7294ba6b0abb3a290fc905b3a00603016a97c363a4c7a","ed1441df2b8bbbd907f603490cb207f44141fe191b20be2f270e8de69bfa194a","1f68ab0e055994eb337b67aa87d2a15e0200951e9664959b3866ee6f6b11a0fe","b71c603a539078a5e3a039b20f2b0a0d1708967530cf97dec8850a9ca45baa2b","0e13570a7e86c6d83dd92e81758a930f63747483e2cd34ef36fcdb47d1f9726a",{"version":"a45c25e77c911c1f2a04cade78f6f42b4d7d896a3882d4e226efd3a3fcd5f2c4","affectsGlobalScope":true},"5c45abf1e13e4463eacfd5dedda06855da8748a6a6cb3334f582b52e219acc04","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","fd326577c62145816fe1acc306c734c2396487f76719d3785d4e825b34540b33","afe73051ff6a03a9565cbd8ebb0e956ee3df5e913ad5c1ded64218aabfa3dcb5","89121c1bf2990f5219bfd802a3e7fc557de447c62058d6af68d6b6348d64499a","79b4369233a12c6fa4a07301ecb7085802c98f3a77cf9ab97eee27e1656f82e6","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","63786b6f821dee19eb898afb385bd58f1846e6cba593a35edcf9631ace09ba25","035a5df183489c2e22f3cf59fc1ed2b043d27f357eecc0eb8d8e840059d44245","a4809f4d92317535e6b22b01019437030077a76fec1d93b9881c9ed4738fcc54","5f53fa0bd22096d2a78533f94e02c899143b8f0f9891a46965294ee8b91a9434","763e521cf114b80e0dd0e21ca49b9f8ae62e8999555a5e7bade8ce36b33001c2","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","3054ef91b855e005b9c4681399e9d64d2a7b07a22d539314d794f09e53b876a7","ffcc5500e77223169833fc6eb59b3a507944a1f89574e0a1276b0ea7fc22c4a4","22f13de9e2fe5f0f4724797abd3d34a1cdd6e47ef81fc4933fea3b8bf4ad524b","e3ba509d3dce019b3190ceb2f3fc88e2610ab717122dabd91a9efaa37804040d","cda0cb09b995489b7f4c57f168cd31b83dcbaa7aad49612734fb3c9c73f6e4f2","f72f8428f3c1caa22e9c247d046603b85b442c0dae7b77a7a0bc092c18867cb7",{"version":"195f63105abc03e72b6a176e3e34dfb5ac932b55db378fdc7874b1617e24b465","affectsGlobalScope":true},"19990350fca066265b2c190c9b6cde1229f35002ea2d4df8c9e397e9942f6c89","8fb8fdda477cd7382477ffda92c2bb7d9f7ef583b1aa531eb6b2dc2f0a206c10","66995b0c991b5c5d42eff1d950733f85482c7419f7296ab8952e03718169e379","9863f888da357e35e013ca3465b794a490a198226bd8232c2f81fb44e16ff323","84bc2d80326a83ee4a6e7cba2fd480b86502660770c0e24da96535af597c9f1e","ea27768379b866ee3f5da2419650acdb01125479f7af73580a4bceb25b79e372","598931eeb4362542cae5845f95c5f0e45ac668925a40ce201e244d7fe808e965","da9ef88cde9f715756da642ad80c4cd87a987f465d325462d6bc2a0b11d202c8","9462ab013df86c16a2a69ca0a3b6f31d4fd86dd29a947e14b590eb20806f220b","b4c6184d78303b0816e779a48bef779b15aea4a66028eb819aac0abee8407dea","db085d2171d48938a99e851dafe0e486dce9859e5dfa73c21de5ed3d4d6fb0c5","62a3ad1ddd1f5974b3bf105680b3e09420f2230711d6520a521fab2be1a32838","a77be6fc44c876bc10c897107f84eaba10790913ebdcad40fcda7e47469b2160","06cf55b6da5cef54eaaf51cdc3d4e5ebf16adfdd9ebd20cec7fe719be9ced017","91f5dbcdb25d145a56cffe957ec665256827892d779ef108eb2f3864faff523b","052ba354bab8fb943e0bc05a0769f7b81d7c3b3c6cd0f5cfa53c7b2da2a525c5","927955a3de5857e0a1c575ced5a4245e74e6821d720ed213141347dd1870197f","fec804d54cd97dd77e956232fc37dc13f53e160d4bbeeb5489e86eeaa91f7ebd","03c258e060b7da220973f84b89615e4e9850e9b5d30b3a8e4840b3e3268ae8eb","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"7ea81b87bac163bb67849d6104f82c62a8625714c1a5b31bf7d337da279b4ef4","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","d4a22007b481fe2a2e6bfd3a42c00cd62d41edb36d30fc4697df2692e9891fc8","d3f2d715f57df3f04bf7b16dde01dec10366f64fce44503c92b8f78f614c1769","fbca5ffaebf282ec3cdac47b0d1d4a138a8b0bb32105251a38acb235087d3318","a39f2a304ccc39e70914e9db08f971d23b862b6f0e34753fad86b895fe566533","22293bd6fa12747929f8dfca3ec1684a3fe08638aa18023dd286ab337e88a592","916be7d770b0ae0406be9486ac12eb9825f21514961dd050594c4b250617d5a8","17ed71200119e86ccef2d96b73b02ce8854b76ad6bd21b5021d4269bec527b5f","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","ddef25f825320de051dcb0e62ffce621b41c67712b5b4105740c32fd83f4c449","1b3dffaa4ca8e38ac434856843505af767a614d187fb3a5ef4fcebb023c355aa","ab82804a14454734010dcdcd43f564ff7b0389bee4c5692eec76ff5b30d4cf66","3f36c0c7508302f3dca3dc5ab0a66d822b2222f70c24bb1796ddb5c9d1168a05",{"version":"b23d5b89c465872587e130f427b39458b8e3ad16385f98446e9e86151ba6eb15","affectsGlobalScope":true},"1ba59c8bbeed2cb75b239bb12041582fa3e8ef32f8d0bd0ec802e38442d3f317","bae8d023ef6b23df7da26f51cea44321f95817c190342a36882e93b80d07a960","26a770cec4bd2e7dbba95c6e536390fffe83c6268b78974a93727903b515c4e7"],"root":[60,61],"options":{"allowJs":false,"allowSyntheticDefaultImports":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":99,"outDir":"./","skipLibCheck":true,"strict":true,"target":7},"fileIdsList":[[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,187],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,206],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,229],[47,49,50,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[51,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[47,50,51,52,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[54,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[48,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,187,188,189,190,191],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,187,189],[70,75,90,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,193],[70,75,81,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,116,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,202],[70,75,90,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,205,211],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,205,206,207],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,208],[70,75,87,90,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,199,200,201],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,194,200,202,214,215],[70,75,87,88,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,217],[70,75,88,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,220],[70,75,87,90,92,95,105,116,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,224],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,225],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,231,234,271],[70,75,87,119,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,253,254,256],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,255],[70,72,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,74,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,80,108,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,76,87,88,95,105,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,76,77,87,95,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[65,66,67,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,78,117,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,79,80,88,96,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,80,105,113,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,81,83,87,95,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,74,75,82,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,83,84,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,85,87,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,74,75,87,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,88,89,105,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,88,89,102,105,108,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,153,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,83,87,90,95,105,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,88,90,91,95,105,113,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,90,92,105,113,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,93,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,94,116,121,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,83,87,95,105,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,96,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,97,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,74,75,98,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,99,115,121,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,100,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,101,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,102,103,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,102,104,117,119,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,105,106,108,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,107,108,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,106,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,108,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,109,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,110,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,111,112,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,111,112,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,80,95,105,113,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,114,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,95,115,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,90,101,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,80,117,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,118,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,94,119,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,120,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,89,98,105,108,116,119,121,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,122,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,178,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,175,176,177,179,180,181,182],[70,75,88,105,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,198],[70,75,88,154,155,156,157,159,170,171,172,173,174,179,180,181,182,216],[70,75,90,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,199,213],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,234,235,270],[70,75,87,90,92,95,105,113,116,122,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,273],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,205,206,209,210],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,211],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,227,233],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,228,232],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,231],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,197],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,237],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236,237],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236,237,238,245,246,249,250,251,252],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,237,246],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236,237,238,245,246,247,248],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236,246],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,246,250],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,237,238,239,244],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,238],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236,237,246],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,243],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,240,241,242],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,230],[70,75,116,130,134,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,116,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,125,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,113,116,127,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,95,113,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,123,125,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,95,116,127,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[63,64,70,75,87,105,116,126,129,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[63,70,75,128,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,108,116,123,126,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,123,146,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,123,124,125,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,124,125,126,127,128,129,130,131,132,134,135,136,137,138,139,140,141,142,143,144,145,147,148,149,150,151,152,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,130,137,138,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,128,130,138,139,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,129,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[63,70,75,125,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,130,134,138,139,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,134,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,116,128,130,133,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[63,70,75,127,128,130,134,137,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,121,123,125,130,146,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,184],[70,75,80,88,90,113,117,121,153,154,155,156,159,160,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,173,174,179,180,181,182],[70,75,154,155,156,157,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,178,180,181,182],[70,75,153,154,155,157,159,170,171,172,173,174,179,180,181,182],[70,75,80,98,105,108,113,117,121,153,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,123,154,155,156,157,158,159,160,161,162,163,169,170,171,172,173,174,179,180,181,182,183],[70,75,80,88,89,96,108,113,116,122,154,155,156,157,159,170,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,174,179,180,181,182],[70,75,88,154,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181],[70,75,154,155,156,157,159,170,171,172,173,174,179,181,182],[70,75,154,155,156,157,159,170,171,172,173,179,180,181,182],[70,75,154,155,156,157,159,163,170,171,172,173,174,179,180,182],[70,75,154,155,156,157,159,168,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,164,165,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,164,165,166,167,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,164,166,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,164,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,171,172,173,174,179,180,181,182],[59,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[60,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[49,53,55,59,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[56,57,58,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[49,53,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[49,59,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182]],"referencedMap":[[189,1],[187,2],[209,3],[227,2],[230,4],[229,2],[47,2],[51,5],[50,6],[53,7],[52,6],[54,2],[55,8],[48,2],[49,9],[186,2],[192,10],[188,1],[190,11],[191,1],[194,12],[195,13],[196,14],[203,15],[193,16],[204,17],[212,18],[208,19],[207,20],[205,2],[202,21],[216,22],[215,21],[218,23],[219,24],[221,25],[222,2],[213,2],[223,26],[224,2],[225,27],[226,28],[235,29],[255,30],[256,31],[257,2],[206,2],[258,2],[259,25],[260,2],[217,2],[261,2],[262,17],[72,32],[73,32],[74,33],[75,34],[76,35],[77,36],[65,2],[68,37],[66,2],[67,2],[78,38],[79,39],[80,40],[81,41],[82,42],[83,43],[84,43],[86,2],[85,44],[87,45],[88,46],[89,47],[71,48],[90,49],[91,50],[92,51],[93,52],[94,53],[95,54],[96,55],[97,56],[98,57],[99,58],[100,59],[101,60],[102,61],[103,61],[104,62],[105,63],[107,64],[106,65],[108,66],[109,67],[110,68],[111,69],[112,70],[113,71],[114,72],[70,73],[69,2],[123,74],[115,75],[116,76],[117,77],[118,78],[119,79],[120,80],[121,81],[122,82],[263,2],[264,2],[177,2],[200,2],[201,2],[265,83],[175,2],[178,84],[266,2],[199,85],[267,86],[214,87],[268,16],[269,2],[271,88],[270,2],[254,2],[220,2],[272,89],[273,2],[274,90],[62,2],[228,2],[176,2],[211,91],[210,92],[234,93],[233,94],[232,95],[198,96],[197,2],[238,97],[252,98],[236,2],[237,99],[253,100],[248,101],[249,102],[247,103],[251,104],[245,105],[239,106],[250,107],[246,98],[244,108],[242,2],[243,109],[240,2],[241,2],[231,110],[45,2],[46,2],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[20,2],[4,2],[21,2],[25,2],[22,2],[23,2],[24,2],[26,2],[27,2],[28,2],[5,2],[29,2],[30,2],[31,2],[32,2],[6,2],[36,2],[33,2],[34,2],[35,2],[37,2],[7,2],[38,2],[43,2],[44,2],[39,2],[40,2],[41,2],[42,2],[1,2],[137,111],[144,112],[136,111],[151,113],[128,114],[127,115],[150,17],[145,116],[148,117],[130,118],[129,119],[125,120],[124,17],[147,121],[126,122],[131,123],[132,2],[135,123],[63,2],[153,124],[152,123],[139,125],[140,126],[142,127],[138,128],[141,129],[146,17],[133,130],[134,131],[143,132],[64,133],[149,134],[185,135],[157,136],[183,2],[172,137],[159,138],[179,139],[158,2],[156,140],[160,2],[154,141],[161,2],[184,142],[162,2],[171,143],[173,144],[155,145],[182,146],[180,147],[174,148],[181,149],[163,2],[169,150],[166,151],[168,152],[167,153],[165,154],[164,2],[170,155],[60,156],[61,157],[56,158],[59,159],[58,160],[57,161]]},"version":"5.5.4"}
1
+ {"program":{"fileNames":["../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../node_modules/@sundaeswap/asset/dist/types/asset.d.ts","../../../../node_modules/@sundaeswap/fraction/dist/types/fraction.d.ts","../../../../node_modules/@sundaeswap/fraction/dist/types/index.d.ts","../../../../node_modules/@sundaeswap/asset/dist/types/assetratio.d.ts","../../../../node_modules/@sundaeswap/asset/dist/types/assetamount.d.ts","../../../../node_modules/@sundaeswap/asset/dist/types/tokenbundle.d.ts","../../../../node_modules/@sundaeswap/asset/dist/types/index.d.ts","../../../../node_modules/@sundaeswap/bigint-math/dist/types/bigintmath.d.ts","../../../../node_modules/@sundaeswap/bigint-math/dist/types/index.d.ts","../../src/poolmath/constantproductpool.ts","../../src/poolmath/stableswapspool.ts","../../src/poolmath/sharedpoolmath.ts","../../src/poolmath/index.ts","../../src/@types/index.ts","../../src/index.ts","../../../../node_modules/buffer/index.d.ts","../../../../node_modules/undici-types/header.d.ts","../../../../node_modules/undici-types/readable.d.ts","../../../../node_modules/@types/node/compatibility/disposable.d.ts","../../../../node_modules/@types/node/compatibility/indexable.d.ts","../../../../node_modules/@types/node/compatibility/iterators.d.ts","../../../../node_modules/@types/node/compatibility/index.d.ts","../../../../node_modules/@types/node/ts5.6/globals.typedarray.d.ts","../../../../node_modules/@types/node/ts5.6/buffer.buffer.d.ts","../../../../node_modules/@types/node/globals.d.ts","../../../../node_modules/@types/node/assert.d.ts","../../../../node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/@types/node/buffer.d.ts","../../../../node_modules/@types/node/child_process.d.ts","../../../../node_modules/@types/node/cluster.d.ts","../../../../node_modules/@types/node/console.d.ts","../../../../node_modules/@types/node/constants.d.ts","../../../../node_modules/@types/node/crypto.d.ts","../../../../node_modules/@types/node/dgram.d.ts","../../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../../node_modules/@types/node/dns.d.ts","../../../../node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/@types/node/domain.d.ts","../../../../node_modules/@types/node/dom-events.d.ts","../../../../node_modules/@types/node/events.d.ts","../../../../node_modules/@types/node/fs.d.ts","../../../../node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/@types/node/http.d.ts","../../../../node_modules/@types/node/http2.d.ts","../../../../node_modules/@types/node/https.d.ts","../../../../node_modules/@types/node/inspector.d.ts","../../../../node_modules/@types/node/module.d.ts","../../../../node_modules/@types/node/net.d.ts","../../../../node_modules/@types/node/os.d.ts","../../../../node_modules/@types/node/path.d.ts","../../../../node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/@types/node/process.d.ts","../../../../node_modules/@types/node/punycode.d.ts","../../../../node_modules/@types/node/querystring.d.ts","../../../../node_modules/@types/node/readline.d.ts","../../../../node_modules/@types/node/readline/promises.d.ts","../../../../node_modules/@types/node/repl.d.ts","../../../../node_modules/@types/node/stream.d.ts","../../../../node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/@types/node/stream/consumers.d.ts","../../../../node_modules/@types/node/stream/web.d.ts","../../../../node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/@types/node/test.d.ts","../../../../node_modules/@types/node/timers.d.ts","../../../../node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/@types/node/tls.d.ts","../../../../node_modules/@types/node/trace_events.d.ts","../../../../node_modules/@types/node/tty.d.ts","../../../../node_modules/@types/node/url.d.ts","../../../../node_modules/@types/node/util.d.ts","../../../../node_modules/@types/node/v8.d.ts","../../../../node_modules/@types/node/vm.d.ts","../../../../node_modules/@types/node/wasi.d.ts","../../../../node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/@types/node/zlib.d.ts","../../../../node_modules/@types/node/ts5.6/index.d.ts","../../../../node_modules/undici-types/file.d.ts","../../../../node_modules/undici-types/fetch.d.ts","../../../../node_modules/undici-types/formdata.d.ts","../../../../node_modules/undici-types/connector.d.ts","../../../../node_modules/undici-types/client.d.ts","../../../../node_modules/undici-types/errors.d.ts","../../../../node_modules/undici-types/dispatcher.d.ts","../../../../node_modules/undici-types/global-dispatcher.d.ts","../../../../node_modules/undici-types/global-origin.d.ts","../../../../node_modules/undici-types/pool-stats.d.ts","../../../../node_modules/undici-types/pool.d.ts","../../../../node_modules/undici-types/handlers.d.ts","../../../../node_modules/undici-types/balanced-pool.d.ts","../../../../node_modules/undici-types/agent.d.ts","../../../../node_modules/undici-types/mock-interceptor.d.ts","../../../../node_modules/undici-types/mock-agent.d.ts","../../../../node_modules/undici-types/mock-client.d.ts","../../../../node_modules/undici-types/mock-pool.d.ts","../../../../node_modules/undici-types/mock-errors.d.ts","../../../../node_modules/undici-types/proxy-agent.d.ts","../../../../node_modules/undici-types/api.d.ts","../../../../node_modules/undici-types/cookies.d.ts","../../../../node_modules/undici-types/patch.d.ts","../../../../node_modules/undici-types/filereader.d.ts","../../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../../node_modules/undici-types/websocket.d.ts","../../../../node_modules/undici-types/content-type.d.ts","../../../../node_modules/undici-types/cache.d.ts","../../../../node_modules/undici-types/interceptors.d.ts","../../../../node_modules/undici-types/index.d.ts","../../node_modules/@types/bun/node_modules/bun-types/globals.d.ts","../../node_modules/@types/bun/node_modules/bun-types/s3.d.ts","../../node_modules/@types/bun/node_modules/bun-types/fetch.d.ts","../../node_modules/@types/bun/node_modules/bun-types/bun.d.ts","../../node_modules/@types/bun/node_modules/bun-types/extensions.d.ts","../../node_modules/@types/bun/node_modules/bun-types/devserver.d.ts","../../node_modules/@types/bun/node_modules/bun-types/ffi.d.ts","../../node_modules/@types/bun/node_modules/bun-types/html-rewriter.d.ts","../../node_modules/@types/bun/node_modules/bun-types/jsc.d.ts","../../node_modules/@types/bun/node_modules/bun-types/sqlite.d.ts","../../node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/utils.d.ts","../../node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/overloads.d.ts","../../node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/branding.d.ts","../../node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/messages.d.ts","../../node_modules/@types/bun/node_modules/bun-types/vendor/expect-type/index.d.ts","../../node_modules/@types/bun/node_modules/bun-types/test.d.ts","../../node_modules/@types/bun/node_modules/bun-types/wasm.d.ts","../../node_modules/@types/bun/node_modules/bun-types/overrides.d.ts","../../node_modules/@types/bun/node_modules/bun-types/deprecated.d.ts","../../node_modules/@types/bun/node_modules/bun-types/redis.d.ts","../../node_modules/@types/bun/node_modules/bun-types/shell.d.ts","../../../../node_modules/@types/react/global.d.ts","../../../../node_modules/csstype/index.d.ts","../../../../node_modules/@types/prop-types/index.d.ts","../../../../node_modules/@types/react/index.d.ts","../../node_modules/@types/bun/node_modules/bun-types/experimental.d.ts","../../node_modules/@types/bun/node_modules/bun-types/serve.d.ts","../../node_modules/@types/bun/node_modules/bun-types/sql.d.ts","../../node_modules/@types/bun/node_modules/bun-types/security.d.ts","../../node_modules/@types/bun/node_modules/bun-types/bun.ns.d.ts","../../node_modules/@types/bun/node_modules/bun-types/index.d.ts","../../node_modules/@types/bun/index.d.ts","../../../../node_modules/@types/aria-query/index.d.ts","../../../../node_modules/@babel/types/lib/index.d.ts","../../../../node_modules/@types/babel__generator/index.d.ts","../../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../../node_modules/@types/babel__template/index.d.ts","../../../../node_modules/@types/babel__traverse/index.d.ts","../../../../node_modules/@types/babel__core/index.d.ts","../../../../node_modules/@types/connect/index.d.ts","../../../../node_modules/@types/body-parser/index.d.ts","../../../../node_modules/@types/bonjour/index.d.ts","../../../../node_modules/@types/cli-progress/index.d.ts","../../../../node_modules/mime/dist/src/mime.d.ts","../../../../node_modules/mime/dist/src/index.d.ts","../../../../node_modules/@types/send/index.d.ts","../../../../node_modules/@types/qs/index.d.ts","../../../../node_modules/@types/range-parser/index.d.ts","../../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../../node_modules/@types/dns-packet/index.d.ts","../../../../node_modules/@types/estree/index.d.ts","../../../../node_modules/@types/json-schema/index.d.ts","../../../../node_modules/@types/eslint/use-at-your-own-risk.d.ts","../../../../node_modules/@types/eslint/index.d.ts","../../../../node_modules/@eslint/core/dist/esm/types.d.ts","../../../../node_modules/eslint/lib/types/use-at-your-own-risk.d.ts","../../../../node_modules/eslint/lib/types/index.d.ts","../../../../node_modules/@types/eslint-scope/index.d.ts","../../../../node_modules/@types/http-errors/index.d.ts","../../../../node_modules/@types/serve-static/index.d.ts","../../../../node_modules/@types/express/node_modules/@types/express-serve-static-core/index.d.ts","../../../../node_modules/@types/express/index.d.ts","../../../../node_modules/@types/minimatch/index.d.ts","../../../../node_modules/@types/glob/index.d.ts","../../../../node_modules/@types/graceful-fs/index.d.ts","../../../../node_modules/@types/unist/index.d.ts","../../../../node_modules/@types/hast/index.d.ts","../../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../../node_modules/@types/http-proxy/index.d.ts","../../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../../node_modules/@types/istanbul-reports/index.d.ts","../../../../node_modules/@jest/expect-utils/build/index.d.ts","../../../../node_modules/chalk/index.d.ts","../../../../node_modules/@jest/schemas/node_modules/@sinclair/typebox/typebox.d.ts","../../../../node_modules/@jest/schemas/build/index.d.ts","../../../../node_modules/pretty-format/build/index.d.ts","../../../../node_modules/jest-matcher-utils/node_modules/jest-diff/build/index.d.ts","../../../../node_modules/jest-matcher-utils/build/index.d.ts","../../../../node_modules/expect/build/index.d.ts","../../../../node_modules/@types/jest/index.d.ts","../../../../node_modules/parse5/dist/common/html.d.ts","../../../../node_modules/parse5/dist/common/token.d.ts","../../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../../node_modules/parse5/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts","../../../../node_modules/parse5/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts","../../../../node_modules/parse5/node_modules/entities/dist/commonjs/decode-codepoint.d.ts","../../../../node_modules/parse5/node_modules/entities/dist/commonjs/decode.d.ts","../../../../node_modules/parse5/node_modules/entities/decode.d.ts","../../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../../node_modules/parse5/dist/parser/index.d.ts","../../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../../node_modules/parse5/dist/serializer/index.d.ts","../../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../../node_modules/parse5/dist/index.d.ts","../../../../node_modules/@types/tough-cookie/index.d.ts","../../../../node_modules/@types/jsdom/base.d.ts","../../../../node_modules/@types/jsdom/index.d.ts","../../../../node_modules/@types/json-bigint/index.d.ts","../../../../node_modules/@types/json5/index.d.ts","../../../../node_modules/@types/mdast/index.d.ts","../../../../node_modules/@types/mime/index.d.ts","../../../../node_modules/@types/minimist/index.d.ts","../../../../node_modules/@types/node-forge/index.d.ts","../../../../node_modules/@types/normalize-package-data/index.d.ts","../../../../node_modules/@types/parse-json/index.d.ts","../../../../node_modules/@types/react-dom/index.d.ts","../../../../node_modules/@types/retry/index.d.ts","../../../../node_modules/@types/serve-index/index.d.ts","../../../../node_modules/@types/sockjs/index.d.ts","../../../../node_modules/@types/stack-utils/index.d.ts","../../../../node_modules/@types/testing-library__jest-dom/matchers.d.ts","../../../../node_modules/@types/testing-library__jest-dom/index.d.ts","../../../../node_modules/@types/ws/index.d.ts","../../../../node_modules/@types/yargs-parser/index.d.ts","../../../../node_modules/@types/yargs/index.d.ts"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4",{"version":"4af6b0c727b7a2896463d512fafd23634229adf69ac7c00e2ae15a09cb084fad","affectsGlobalScope":true},{"version":"9c00a480825408b6a24c63c1b71362232927247595d7c97659bc24dc68ae0757","affectsGlobalScope":true},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"51c956a7c738d7f4fd20eec47a375a8cb710ea54f82fb0ad03d787fb12657d92","68c52be545faa567bbb3568f7bdfe6cce70e2715c9c13a61849f86aea5a9ebbd","e9a73f3b07707e735d5a85fc8edd642c907efe342e9ce6f1e96102965dc3ba89","b34f125d24f666b3146a2aa7075fb5c75248fe05bb035be9c3acf408c084790e","de495af61b69bc716de329ae92128b85d1adb1a412ec2b18bdc09e1e2408c3d7","fe0d90c26b19d8f79ccc69c68f0facfd3dc808c3dc19fcd452cf30cb199a7a8e","6257871c4fc4701fb42d4136f5bc86529c97a9abb1d0fc7babbef91b6f1942f2","910f330ba93ef8eb90baabbc6ed0b12ad8d9b27dc841aa95dfb2799643c41045","874a1013a9dab7c69706b58b35e85658ab0b284b834b2dc3af8906f534ad79ae",{"version":"96ff6fd0ad67b4c9f3aa27c7d22b26563e765f90ed1395843665d1fa38e817ff","signature":"b1e0c8086bd5e87139ef16d93bb953d1303cd5f15588a07b4992496480f2a5ce"},{"version":"6ed5c0a9b539a75719dd97f3834bd121b07f7cfa09065a8d21190cab0e987ac2","signature":"cf4bb5e7f9c9bfc6add29c2207aeb662efffbb115d2e944f121593cd4f05bd92"},{"version":"66acaaa1d369f8beb3eeb99ecda57f318b28005caee5405fe8da1cbca2727e26","signature":"7b311aa1193ba30b6beb6bca85a137af8410bbab82bee6d78b58397e0a64f728"},"f7bbbe20be74e8eb7e2cd2fc58ca4197ce4a8f830da9d6ca6bdc3e5905d4b3a2","d505dd3248a004e125aedacd78ac294598ac676ff103c532d35de6355ebf2786","7fc64678c4e3e69edf0add713b86c4f2ae254ea12ded16a99366142b29dda7b3","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","7180c03fd3cb6e22f911ce9ba0f8a7008b1a6ddbe88ccf16a9c8140ef9ac1686",{"version":"6c7176368037af28cb72f2392010fa1cef295d6d6744bca8cfb54985f3a18c3e","affectsGlobalScope":true},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true},{"version":"437e20f2ba32abaeb7985e0afe0002de1917bc74e949ba585e49feba65da6ca1","affectsGlobalScope":true},"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a",{"version":"613b21ccdf3be6329d56e6caa13b258c842edf8377be7bc9f014ed14cdcfc308","affectsGlobalScope":true},{"version":"d2662405c15ec112ebc0c3ec787edb82d58d6acb1a9d109317d7bf9cff9d09a7","affectsGlobalScope":true},{"version":"1a2e588ce04b57f262959afb54933563431bf75304cfda6165703fe08f4018c5","affectsGlobalScope":true},"c775b106d611ae2c068ed8429a132608d10007918941311214892dcd4a571ad7","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","75eb536b960b85f75e21490beeab53ea616646a995ad203e1af532d67a774fb6",{"version":"36d0976d3dad74078f707af107b5082dbe42ffcadb3442ff140c36c8a33b4887","affectsGlobalScope":true},"51bb58ef3a22fdc49a2d338a852050855d1507f918d4d7fa77a68d72fee9f780","7646ad748a9ca15bf43d4c88f83cc851c67f8ec9c1186295605b59ba6bb36dcb",{"version":"cef8931bc129687165253f0642427c2a72705a4613b3ac461b9fa78c7cdaef32","affectsGlobalScope":true},"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","47b62c294beb69daa5879f052e416b02e6518f3e4541ae98adbfb27805dd6711","f8375506002c556ec412c7e2a5a9ece401079ee5d9eb2c1372e9f5377fac56c7","8edd6482bd72eca772f9df15d05c838dd688cdbd4d62690891fca6578cfda6fe","07ba29a1a495b710aea48a4cf19ae12b3cbda2a8e9ac62192af477027a99e8de","6dead64c944504250dd2fc9095231f36887cfc1534f1ff57737c19f92d165c91","b9a4824bb83f25d6d227394db2ed99985308cf2a3a35f0d6d39aa72b15473982",{"version":"6e57c0b7b3d2716fbc0ca28aa23f62bc997ad534d1369f3853dcb9d453d1fb91","affectsGlobalScope":true},{"version":"b84f34005e497dbc0c1948833818cdb38e8c01ff4f88d810b4d70aa2e6c52916","affectsGlobalScope":true},"8e8e284b3832911aeede987e4d74cf0a00f2b03896b2fd3bf924344cc0f96b3c","37d37474a969ab1b91fc332eb6a375885dfd25279624dfa84dea48c9aedf4472","957905d33a09ce85efd84a65819cdd22eefdd64959afacbdcfe5f36b0d7a7bbe","f1a79b6047d006548185e55478837dfbcdd234d6fe51532783f5dffd401cfb2b","565fda33feca88f4b5db23ba8e605da1fd28b6d63292d276bdbd2afe6cd4c490","e822320b448edce0c7ede9cbeada034c72e1f1c8c8281974817030564c63dcb1",{"version":"9d65568cba17c9db40251023406668695ad698ea4a34542364af3e78edd37811","affectsGlobalScope":true},"f23e3d484de54d235bf702072100b541553a1df2550bad691fe84995e15cf7be","821c79b046e40d54a447bebd9307e70b86399a89980a87bbc98114411169e274","17bc38afc78d40b2f54af216c0cc31a4bd0c6897a5945fa39945dfc43260be2c",{"version":"d201b44ff390c220a94fb0ff6a534fe9fa15b44f8a86d0470009cdde3a3e62ab","affectsGlobalScope":true},{"version":"d44445141f204d5672c502a39c1124bcf1df225eba05df0d2957f79122be87b5","affectsGlobalScope":true},"de905bc5f7e7a81cb420e212b95ab5e3ab840f93e0cfa8ce879f6e7fa465d4a2","bc2ff43214898bc6d53cab92fb41b5309efec9cbb59a0650525980aee994de2b","bede3143eeddca3b8ec3592b09d7eb02042f9e195251040c5146eac09b173236","64a40cf4ec8a7a29db2b4bc35f042e5be8537c4be316e5221f40f30ca8ed7051","294c082d609e6523520290db4f1d54114ebc83643fb42abd965be5bcc5d9416b","cf7d740e39bd8adbdc7840ee91bef0af489052f6467edfcefb7197921757ec3b","37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093",{"version":"b9f0681c4d2cb00a5cfe08a7be9662627b912de562926819ebddfe2ef6a9b5ee","affectsGlobalScope":true},"b85151402164ab7cb665e58df5c1a29aa25ea4ed3a367f84a15589e7d7a9c8ca","89eb8abe2b5c146fbb8f3bf72f4e91de3541f2fb559ad5fed4ad5bf223a3dedb",{"version":"bc6cb10764a82f3025c0f4822b8ad711c16d1a5c75789be2d188d553b69b2d48","affectsGlobalScope":true},"41d510caf7ed692923cb6ef5932dc9cf1ed0f57de8eb518c5bab8358a21af674","2751c5a6b9054b61c9b03b3770b2d39b1327564672b63e3485ac03ffeb28b4f6","dc058956a93388aab38307b7b3b9b6379e1021e73a244aab6ac9427dc3a252a7","f33302cf240672359992c356f2005d395b559e176196d03f31a28cc7b01e69bc",{"version":"3ce25041ff6ae06c08fcaccd5fcd9baf4ca6e80e6cb5a922773a1985672e74c2","affectsGlobalScope":true},{"version":"652c0de14329a834ff06af6ad44670fac35849654a464fd9ae36edb92a362c12","affectsGlobalScope":true},"3b1e178016d3fc554505ae087c249b205b1c50624d482c542be9d4682bab81fc","5db7c5bb02ef47aaaec6d262d50c4e9355c80937d649365c343fa5e84569621d","cf45d0510b661f1da461479851ff902f188edb111777c37055eff12fa986a23a",{"version":"ec9a5f06328f61e09f44d6781d1bd862475f9900c16cef82621a46305def3c4d","affectsGlobalScope":true},"37bef1064b7d015aeaa7c0716fe23a0b3844abe2c0a3df7144153ca8445fe0da","75bd411256302c183207051fd198b4e0dbab45d28a6daf04d3ad61f70a2c8e90","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","54cb85a47d760da1c13c00add10d26b5118280d44d58e6908d8e89abbd9d7725","3e4825171442666d31c845aeb47fcd34b62e14041bb353ae2b874285d78482aa","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","a967bfe3ad4e62243eb604bf956101e4c740f5921277c60debaf325c1320bf88","e9775e97ac4877aebf963a0289c81abe76d1ec9a2a7778dbe637e5151f25c5f3","471e1da5a78350bc55ef8cef24eb3aca6174143c281b8b214ca2beda51f5e04a","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","db3435f3525cd785bf21ec6769bf8da7e8a776be1a99e2e7efb5f244a2ef5fee","c3b170c45fc031db31f782e612adf7314b167e60439d304b49e704010e7bafe5","40383ebef22b943d503c6ce2cb2e060282936b952a01bea5f9f493d5fb487cc7","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","3a84b7cb891141824bd00ef8a50b6a44596aded4075da937f180c90e362fe5f6","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","33203609eba548914dc83ddf6cadbc0bcb6e8ef89f6d648ca0908ae887f9fcc5","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","9f0a92164925aa37d4a5d9dd3e0134cff8177208dba55fd2310cd74beea40ee2","8bfdb79bf1a9d435ec48d9372dc93291161f152c0865b81fc0b2694aedb4578d","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","d32275be3546f252e3ad33976caf8c5e842c09cb87d468cb40d5f4cf092d1acc","4a0c3504813a3289f7fb1115db13967c8e004aa8e4f8a9021b95285502221bd1",{"version":"eabae5daa40501125bc1f6da9ff442ecc0159e1b3bfe19b37552cc5a90aa23fc","affectsGlobalScope":true},"53e074a281b50dc3bbdddac7a1c2946100c80a7f5c3161452ab98b31db2e31ba","f3d3e999a323c85c8a63ce90c6e4624ff89fe137a0e2508fddc08e0556d08abf","300b7ea7b0801a4b5f1b203136185481b1f66cfe4517773ed65f982c69bdf34e","49ae37a1b5de16f762c8a151eeaec6b558ce3c27251052ef7a361144af42cad4",{"version":"fc9e630f9302d0414ccd6c8ed2706659cff5ae454a56560c6122fa4a3fac5bbd","affectsGlobalScope":true},"aa0a44af370a2d7c1aac988a17836f57910a6c52689f52f5b3ac1d4c6cadcb23",{"version":"0ac74c7586880e26b6a599c710b59284a284e084a2bbc82cd40fb3fbfdea71ae","affectsGlobalScope":true},"2ce12357dadbb8efc4e4ec4dab709c8071bf992722fc9adfea2fe0bd5b50923f","31bd1a31f935276adf90384a35edbd4614018ff008f57d62ffb57ac538e94e51","ffd344731abee98a0a85a735b19052817afd2156d97d1410819cd9bcd1bd575e","475e07c959f4766f90678425b45cf58ac9b95e50de78367759c1e5118e85d5c3","a524ae401b30a1b0814f1bbcdae459da97fa30ae6e22476e506bb3f82e3d9456","7375e803c033425e27cb33bae21917c106cb37b508fd242cccd978ef2ee244c7","eeb890c7e9218afdad2f30ad8a76b0b0b5161d11ce13b6723879de408e6bc47a","bb35ce2892f70447f1fd6e76dbbaa915309181414728bc22877bd99ddef4905d",{"version":"b05b9ef20d18697e468c3ae9cecfff3f47e8976f9522d067047e3f236db06a41","affectsGlobalScope":true},{"version":"efc6ad7bb4b317be15eede0218b94b836894cb372bbeabdcc3679d90cfca86fb","affectsGlobalScope":true},{"version":"6b386c7b6ce6f369d18246904fa5eac73566167c88fb6508feba74fa7501a384","affectsGlobalScope":true},"592a109e67b907ffd2078cd6f727d5c326e06eaada169eef8fb18546d96f6797","f2eb1e35cae499d57e34b4ac3650248776fe7dbd9a3ec34b23754cfd8c22fceb",{"version":"eb5b19b86227ace1d29ea4cf81387279d04bb34051e944bc53df69f58914b788","affectsGlobalScope":true},"8a8eb4ebffd85e589a1cc7c178e291626c359543403d58c9cd22b81fab5b1fb9","87d9d29dbc745f182683f63187bf3d53fd8673e5fca38ad5eaab69798ed29fbc",{"version":"472f5aab7edc498a0a761096e8e254c5bc3323d07a1e7f5f8b8ec0d6395b60a0","affectsGlobalScope":true},"83150b58197b25de8ba1334ec4732edf866a23fdd2b29f404b1af1da0614ce80","b557f8d0ae85258ba995e06f70957a8a20e4a63978c8d9fa20a1203ed7740377","9e98bd421e71f70c75dae7029e316745c89fa7b8bc8b43a91adf9b82c206099c","fc803e6b01f4365f71f51f9ce13f71396766848204d4f7a1b2b6154434b84b15",{"version":"c8109fe76467db6e801d0edfbc50e6826934686467c9418ce6b246232ce7f109","affectsGlobalScope":true},{"version":"1922ac4f92c7f8320b4584e3fe117776395ef5b4dc2bd426e5b0de39261669ec","affectsGlobalScope":true},"37be812b06e518320ba82e2aff3ac2ca37370a9df917db708f081b9043fa3315","ae77d81a5541a8abb938a0efedf9ac4bea36fb3a24cc28cfa11c598863aba571","a28ac3e717907284b3910b8e9b3f9844a4e0b0a861bea7b923e5adf90f620330","b6d03c9cfe2cf0ba4c673c209fcd7c46c815b2619fd2aad59fc4229aaef2ed43","82e5a50e17833a10eb091923b7e429dc846d42f1c6161eb6beeb964288d98a15","670a76db379b27c8ff42f1ba927828a22862e2ab0b0908e38b671f0e912cc5ed","13b77ab19ef7aadd86a1e54f2f08ea23a6d74e102909e3c00d31f231ed040f62","069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","104c67f0da1bdf0d94865419247e20eded83ce7f9911a1aa75fc675c077ca66e","cc0d0b339f31ce0ab3b7a5b714d8e578ce698f1e13d7f8c60bfb766baeb1d35c","f9e22729fa06ed20f8b1fe60670b7c74933fdfd44d869ddfb1919c15a5cf12fb","c0e5b4df115963b8a8dcd5b56ff9dc046ddec110de138dba29b00e2b02fa03a9","0ae65c3e977c81f6e46ae9028ae97fc75c78c70f4d6d5f961a8af60301145af6","b1a6683b821c624d63d887dbdd9f34aebb9de586acf87bbf50cb16f5ec2c36c7","b78cd10245a90e27e62d0558564f5d9a16576294eee724a59ae21b91f9269e4a","baac9896d29bcc55391d769e408ff400d61273d832dd500f21de766205255acb","2f5747b1508ccf83fad0c251ba1e5da2f5a30b78b09ffa1cfaf633045160afed",{"version":"a8932b7a5ef936687cc5b2492b525e2ad5e7ed321becfea4a17d5a6c80f49e92","affectsGlobalScope":true},"689be50b735f145624c6f391042155ae2ff6b90a93bac11ca5712bc866f6010c","bc222163edcb8df6ba9b506d053d6c5afcae50e85695151cf4636a3107deaba9","151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","a4a39b5714adfcadd3bbea6698ca2e942606d833bde62ad5fb6ec55f5e438ff8","bbc1d029093135d7d9bfa4b38cbf8761db505026cc458b5e9c8b74f4000e5e75","851fe8b694793c8e4c48c154847712e940694e960e33ac68b73e94557d6aff8d","8a190298d0ff502ad1c7294ba6b0abb3a290fc905b3a00603016a97c363a4c7a","ed1441df2b8bbbd907f603490cb207f44141fe191b20be2f270e8de69bfa194a","1f68ab0e055994eb337b67aa87d2a15e0200951e9664959b3866ee6f6b11a0fe","b71c603a539078a5e3a039b20f2b0a0d1708967530cf97dec8850a9ca45baa2b","0e13570a7e86c6d83dd92e81758a930f63747483e2cd34ef36fcdb47d1f9726a",{"version":"a45c25e77c911c1f2a04cade78f6f42b4d7d896a3882d4e226efd3a3fcd5f2c4","affectsGlobalScope":true},"5c45abf1e13e4463eacfd5dedda06855da8748a6a6cb3334f582b52e219acc04","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","fd326577c62145816fe1acc306c734c2396487f76719d3785d4e825b34540b33","afe73051ff6a03a9565cbd8ebb0e956ee3df5e913ad5c1ded64218aabfa3dcb5","89121c1bf2990f5219bfd802a3e7fc557de447c62058d6af68d6b6348d64499a","79b4369233a12c6fa4a07301ecb7085802c98f3a77cf9ab97eee27e1656f82e6","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","63786b6f821dee19eb898afb385bd58f1846e6cba593a35edcf9631ace09ba25","035a5df183489c2e22f3cf59fc1ed2b043d27f357eecc0eb8d8e840059d44245","a4809f4d92317535e6b22b01019437030077a76fec1d93b9881c9ed4738fcc54","5f53fa0bd22096d2a78533f94e02c899143b8f0f9891a46965294ee8b91a9434","763e521cf114b80e0dd0e21ca49b9f8ae62e8999555a5e7bade8ce36b33001c2","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","3054ef91b855e005b9c4681399e9d64d2a7b07a22d539314d794f09e53b876a7","ffcc5500e77223169833fc6eb59b3a507944a1f89574e0a1276b0ea7fc22c4a4","22f13de9e2fe5f0f4724797abd3d34a1cdd6e47ef81fc4933fea3b8bf4ad524b","e3ba509d3dce019b3190ceb2f3fc88e2610ab717122dabd91a9efaa37804040d","cda0cb09b995489b7f4c57f168cd31b83dcbaa7aad49612734fb3c9c73f6e4f2","f72f8428f3c1caa22e9c247d046603b85b442c0dae7b77a7a0bc092c18867cb7",{"version":"195f63105abc03e72b6a176e3e34dfb5ac932b55db378fdc7874b1617e24b465","affectsGlobalScope":true},"19990350fca066265b2c190c9b6cde1229f35002ea2d4df8c9e397e9942f6c89","8fb8fdda477cd7382477ffda92c2bb7d9f7ef583b1aa531eb6b2dc2f0a206c10","66995b0c991b5c5d42eff1d950733f85482c7419f7296ab8952e03718169e379","9863f888da357e35e013ca3465b794a490a198226bd8232c2f81fb44e16ff323","84bc2d80326a83ee4a6e7cba2fd480b86502660770c0e24da96535af597c9f1e","ea27768379b866ee3f5da2419650acdb01125479f7af73580a4bceb25b79e372","598931eeb4362542cae5845f95c5f0e45ac668925a40ce201e244d7fe808e965","da9ef88cde9f715756da642ad80c4cd87a987f465d325462d6bc2a0b11d202c8","9462ab013df86c16a2a69ca0a3b6f31d4fd86dd29a947e14b590eb20806f220b","b4c6184d78303b0816e779a48bef779b15aea4a66028eb819aac0abee8407dea","db085d2171d48938a99e851dafe0e486dce9859e5dfa73c21de5ed3d4d6fb0c5","62a3ad1ddd1f5974b3bf105680b3e09420f2230711d6520a521fab2be1a32838","a77be6fc44c876bc10c897107f84eaba10790913ebdcad40fcda7e47469b2160","06cf55b6da5cef54eaaf51cdc3d4e5ebf16adfdd9ebd20cec7fe719be9ced017","91f5dbcdb25d145a56cffe957ec665256827892d779ef108eb2f3864faff523b","052ba354bab8fb943e0bc05a0769f7b81d7c3b3c6cd0f5cfa53c7b2da2a525c5","927955a3de5857e0a1c575ced5a4245e74e6821d720ed213141347dd1870197f","fec804d54cd97dd77e956232fc37dc13f53e160d4bbeeb5489e86eeaa91f7ebd","03c258e060b7da220973f84b89615e4e9850e9b5d30b3a8e4840b3e3268ae8eb","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"7ea81b87bac163bb67849d6104f82c62a8625714c1a5b31bf7d337da279b4ef4","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","d4a22007b481fe2a2e6bfd3a42c00cd62d41edb36d30fc4697df2692e9891fc8","d3f2d715f57df3f04bf7b16dde01dec10366f64fce44503c92b8f78f614c1769","fbca5ffaebf282ec3cdac47b0d1d4a138a8b0bb32105251a38acb235087d3318","a39f2a304ccc39e70914e9db08f971d23b862b6f0e34753fad86b895fe566533","22293bd6fa12747929f8dfca3ec1684a3fe08638aa18023dd286ab337e88a592","916be7d770b0ae0406be9486ac12eb9825f21514961dd050594c4b250617d5a8","17ed71200119e86ccef2d96b73b02ce8854b76ad6bd21b5021d4269bec527b5f","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","ddef25f825320de051dcb0e62ffce621b41c67712b5b4105740c32fd83f4c449","1b3dffaa4ca8e38ac434856843505af767a614d187fb3a5ef4fcebb023c355aa","ab82804a14454734010dcdcd43f564ff7b0389bee4c5692eec76ff5b30d4cf66","3f36c0c7508302f3dca3dc5ab0a66d822b2222f70c24bb1796ddb5c9d1168a05",{"version":"b23d5b89c465872587e130f427b39458b8e3ad16385f98446e9e86151ba6eb15","affectsGlobalScope":true},"1ba59c8bbeed2cb75b239bb12041582fa3e8ef32f8d0bd0ec802e38442d3f317","bae8d023ef6b23df7da26f51cea44321f95817c190342a36882e93b80d07a960","26a770cec4bd2e7dbba95c6e536390fffe83c6268b78974a93727903b515c4e7"],"root":[60,61],"options":{"allowJs":false,"allowSyntheticDefaultImports":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":99,"outDir":"./","skipLibCheck":true,"strict":true,"target":7},"fileIdsList":[[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,187],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,206],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,229],[47,49,50,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[51,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[47,50,51,52,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[54,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[48,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,187,188,189,190,191],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,187,189],[70,75,90,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,193],[70,75,81,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,116,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,202],[70,75,90,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,205,211],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,205,206,207],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,208],[70,75,87,90,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,199,200,201],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,194,200,202,214,215],[70,75,87,88,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,217],[70,75,88,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,220],[70,75,87,90,92,95,105,116,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,224],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,225],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,231,234,271],[70,75,87,119,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,253,254,256],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,255],[70,72,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,74,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,80,108,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,76,87,88,95,105,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,76,77,87,95,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[65,66,67,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,78,117,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,79,80,88,96,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,80,105,113,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,81,83,87,95,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,74,75,82,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,83,84,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,85,87,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,74,75,87,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,88,89,105,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,88,89,102,105,108,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,153,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,83,87,90,95,105,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,88,90,91,95,105,113,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,90,92,105,113,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,93,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,94,116,121,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,83,87,95,105,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,96,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,97,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,74,75,98,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,99,115,121,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,100,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,101,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,102,103,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,102,104,117,119,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,105,106,108,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,107,108,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,106,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,108,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,109,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,110,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,111,112,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,111,112,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,80,95,105,113,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,114,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,95,115,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,90,101,116,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,80,117,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,118,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,94,119,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,120,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,87,89,98,105,108,116,119,121,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,122,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,178,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,175,176,177,179,180,181,182],[70,75,88,105,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,198],[70,75,88,154,155,156,157,159,170,171,172,173,174,179,180,181,182,216],[70,75,90,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182,199,213],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,234,235,270],[70,75,87,90,92,95,105,113,116,122,123,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,273],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,205,206,209,210],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,211],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,227,233],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,228,232],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,231],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,197],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,237],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236,237],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236,237,238,245,246,249,250,251,252],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,237,246],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236,237,238,245,246,247,248],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236,246],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,246,250],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,237,238,239,244],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,238],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,236,237,246],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,243],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,240,241,242],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,230],[70,75,116,130,134,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,116,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,125,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,113,116,127,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,95,113,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,123,125,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,95,116,127,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[63,64,70,75,87,105,116,126,129,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[63,70,75,128,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,108,116,123,126,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,123,146,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,123,124,125,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,124,125,126,127,128,129,130,131,132,134,135,136,137,138,139,140,141,142,143,144,145,147,148,149,150,151,152,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,130,137,138,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,128,130,138,139,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,129,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[63,70,75,125,130,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,130,134,138,139,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,134,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,116,128,130,133,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[63,70,75,127,128,130,134,137,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,105,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,121,123,125,130,146,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182,184],[70,75,80,88,90,113,117,121,153,154,155,156,159,160,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,173,174,179,180,181,182],[70,75,154,155,156,157,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,178,180,181,182],[70,75,153,154,155,157,159,170,171,172,173,174,179,180,181,182],[70,75,80,98,105,108,113,117,121,153,155,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,123,154,155,156,157,158,159,160,161,162,163,169,170,171,172,173,174,179,180,181,182,183],[70,75,80,88,89,96,108,113,116,122,154,155,156,157,159,170,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,174,179,180,181,182],[70,75,88,154,156,157,159,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,170,171,172,173,174,179,180,181],[70,75,154,155,156,157,159,170,171,172,173,174,179,181,182],[70,75,154,155,156,157,159,170,171,172,173,179,180,181,182],[70,75,154,155,156,157,159,163,170,171,172,173,174,179,180,182],[70,75,154,155,156,157,159,168,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,164,165,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,164,165,166,167,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,164,166,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,164,170,171,172,173,174,179,180,181,182],[70,75,154,155,156,157,159,171,172,173,174,179,180,181,182],[59,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[60,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[49,53,55,59,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[56,57,58,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[49,53,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182],[49,59,70,75,154,155,156,157,159,170,171,172,173,174,179,180,181,182]],"referencedMap":[[189,1],[187,2],[209,3],[227,2],[230,4],[229,2],[47,2],[51,5],[50,6],[53,7],[52,6],[54,2],[55,8],[48,2],[49,9],[186,2],[192,10],[188,1],[190,11],[191,1],[194,12],[195,13],[196,14],[203,15],[193,16],[204,17],[212,18],[208,19],[207,20],[205,2],[202,21],[216,22],[215,21],[218,23],[219,24],[221,25],[222,2],[213,2],[223,26],[224,2],[225,27],[226,28],[235,29],[255,30],[256,31],[257,2],[206,2],[258,2],[259,25],[260,2],[217,2],[261,2],[262,17],[72,32],[73,32],[74,33],[75,34],[76,35],[77,36],[65,2],[68,37],[66,2],[67,2],[78,38],[79,39],[80,40],[81,41],[82,42],[83,43],[84,43],[86,2],[85,44],[87,45],[88,46],[89,47],[71,48],[90,49],[91,50],[92,51],[93,52],[94,53],[95,54],[96,55],[97,56],[98,57],[99,58],[100,59],[101,60],[102,61],[103,61],[104,62],[105,63],[107,64],[106,65],[108,66],[109,67],[110,68],[111,69],[112,70],[113,71],[114,72],[70,73],[69,2],[123,74],[115,75],[116,76],[117,77],[118,78],[119,79],[120,80],[121,81],[122,82],[263,2],[264,2],[177,2],[200,2],[201,2],[265,83],[175,2],[178,84],[266,2],[199,85],[267,86],[214,87],[268,16],[269,2],[271,88],[270,2],[254,2],[220,2],[272,89],[273,2],[274,90],[62,2],[228,2],[176,2],[211,91],[210,92],[234,93],[233,94],[232,95],[198,96],[197,2],[238,97],[252,98],[236,2],[237,99],[253,100],[248,101],[249,102],[247,103],[251,104],[245,105],[239,106],[250,107],[246,98],[244,108],[242,2],[243,109],[240,2],[241,2],[231,110],[45,2],[46,2],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[20,2],[4,2],[21,2],[25,2],[22,2],[23,2],[24,2],[26,2],[27,2],[28,2],[5,2],[29,2],[30,2],[31,2],[32,2],[6,2],[36,2],[33,2],[34,2],[35,2],[37,2],[7,2],[38,2],[43,2],[44,2],[39,2],[40,2],[41,2],[42,2],[1,2],[137,111],[144,112],[136,111],[151,113],[128,114],[127,115],[150,17],[145,116],[148,117],[130,118],[129,119],[125,120],[124,17],[147,121],[126,122],[131,123],[132,2],[135,123],[63,2],[153,124],[152,123],[139,125],[140,126],[142,127],[138,128],[141,129],[146,17],[133,130],[134,131],[143,132],[64,133],[149,134],[185,135],[157,136],[183,2],[172,137],[159,138],[179,139],[158,2],[156,140],[160,2],[154,141],[161,2],[184,142],[162,2],[171,143],[173,144],[155,145],[182,146],[180,147],[174,148],[181,149],[163,2],[169,150],[166,151],[168,152],[167,153],[165,154],[164,2],[170,155],[60,156],[61,157],[56,158],[59,159],[58,160],[57,161]]},"version":"5.5.4"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sundaeswap/math",
3
- "version": "0.0.0-dev-20251113093518",
3
+ "version": "0.0.0-dev-20251113094713",
4
4
  "description": "SundaeSwap SDK Math Utilities",
5
5
  "repository": "git@github.com:SundaeSwap-finance/sundae-sdk.git",
6
6
  "author": {
@@ -29,17 +29,17 @@ export function liquidityInvariant(
29
29
  return f1 <= 0n && f2 > 0n;
30
30
  }
31
31
 
32
- export const aPrecision = 200n;
33
- export const reservePrecision = 1_000_000_000_000n;
34
- export const feePrecision = 10_000n;
32
+ export const A_PRECISION: bigint = 200n;
33
+ export const RESERVE_PRECISION: bigint = 1_000_000_000_000n;
34
+ export const FEE_PRECISION: bigint = 10_000n;
35
35
 
36
36
  export function getSumInvariant(a: bigint, x: bigint, y: bigint): bigint {
37
37
  if (a <= 0n) {
38
38
  throw new Error("Amplification coefficient must be positive.");
39
39
  }
40
- x = x * reservePrecision;
41
- y = y * reservePrecision;
42
- a = a * aPrecision;
40
+ x = x * RESERVE_PRECISION;
41
+ y = y * RESERVE_PRECISION;
42
+ a = a * A_PRECISION;
43
43
  const sum: bigint = x + y;
44
44
  if (sum === 0n) {
45
45
  return 0n;
@@ -57,7 +57,7 @@ export function getSumInvariant(a: bigint, x: bigint, y: bigint): bigint {
57
57
 
58
58
  if (d > d_prev) {
59
59
  if (d - d_prev <= 1) {
60
- if (liquidityInvariant(x, y, a / aPrecision, d)) {
60
+ if (liquidityInvariant(x, y, a / A_PRECISION, d)) {
61
61
  return d;
62
62
  } else {
63
63
  return d - 1n;
@@ -65,7 +65,7 @@ export function getSumInvariant(a: bigint, x: bigint, y: bigint): bigint {
65
65
  }
66
66
  } else {
67
67
  if (d_prev - d <= 1) {
68
- if (liquidityInvariant(x, y, a / aPrecision, d)) {
68
+ if (liquidityInvariant(x, y, a / A_PRECISION, d)) {
69
69
  return d;
70
70
  } else {
71
71
  return d - 1n;
@@ -81,16 +81,16 @@ export function getNewY(
81
81
  aRaw: bigint,
82
82
  sumInvariant: bigint,
83
83
  ): bigint {
84
- newX = newX * reservePrecision;
84
+ newX = newX * RESERVE_PRECISION;
85
85
  const sum = newX;
86
86
  let yPrev: bigint;
87
87
  let c = sumInvariant;
88
- const ann = aRaw * aPrecision * 2n;
88
+ const ann = aRaw * A_PRECISION * 2n;
89
89
 
90
90
  c = (c * sumInvariant) / (newX * 2n);
91
- c = (c * sumInvariant * aPrecision) / 2n;
91
+ c = (c * sumInvariant * A_PRECISION) / 2n;
92
92
  c = c / (ann * 2n);
93
- const b = sum + (sumInvariant * aPrecision) / 2n / ann;
93
+ const b = sum + (sumInvariant * A_PRECISION) / 2n / ann;
94
94
  let y = sumInvariant;
95
95
  for (let i = 0; i < 255; i++) {
96
96
  yPrev = y;
@@ -123,7 +123,7 @@ export function getNewY(
123
123
  * @returns the minted lp token amount
124
124
  */
125
125
  export const getFirstLp = (a: bigint, b: bigint, laf: bigint) =>
126
- getSumInvariant(laf, a, b) / reservePrecision;
126
+ getSumInvariant(laf, a, b) / RESERVE_PRECISION;
127
127
 
128
128
  /**
129
129
  * Calculate the Add (Mixed-Deposit) Liquidity parameters
@@ -252,13 +252,13 @@ export const getSwapOutput = (
252
252
  const nextInputReserve = inputReserve + input;
253
253
  const newY = getNewY(nextInputReserve, laf, sumInvariant);
254
254
 
255
- const deltaYPrec = outputReserve * reservePrecision - newY;
256
- const deltaY = new Fraction(deltaYPrec, reservePrecision);
255
+ const deltaYPrec = outputReserve * RESERVE_PRECISION - newY;
256
+ const deltaY = new Fraction(deltaYPrec, RESERVE_PRECISION);
257
257
  const totalFee = combinedFee
258
- .multiply(feePrecision)
258
+ .multiply(FEE_PRECISION)
259
259
  .multiply(deltaY.quotient)
260
- .add(Fraction.asFraction(feePrecision - 1n))
261
- .divide(feePrecision).quotient;
260
+ .add(Fraction.asFraction(FEE_PRECISION - 1n))
261
+ .divide(FEE_PRECISION).quotient;
262
262
  const totalProtocolFee = protocolFee
263
263
  .multiply(totalFee)
264
264
  .divide(combinedFee).quotient;
@@ -296,14 +296,14 @@ export function getPrice(
296
296
  laf: bigint,
297
297
  ): Fraction {
298
298
  // dx_0 / dx_1 only, however can have any number of coins in pool
299
- const ann = laf * 2n * aPrecision;
299
+ const ann = laf * 2n * A_PRECISION;
300
300
  const sumInvariant =
301
- getSumInvariant(laf, aReserve, bReserve) / reservePrecision;
301
+ getSumInvariant(laf, aReserve, bReserve) / RESERVE_PRECISION;
302
302
  // D / n^n with n = 2
303
303
  let dR = sumInvariant / 4n;
304
304
  dR = (dR * sumInvariant) / aReserve;
305
305
  dR = (dR * sumInvariant) / bReserve;
306
- const xpA = (ann * aReserve) / aPrecision;
306
+ const xpA = (ann * aReserve) / A_PRECISION;
307
307
  const p = new Fraction(xpA + (dR * aReserve) / bReserve, xpA + dR);
308
308
  return p;
309
309
  }
@@ -360,14 +360,14 @@ export const getSwapInput = (
360
360
  const sumInvariant = getSumInvariant(laf, inputReserve, outputReserve);
361
361
  const newX = getNewY(outputReserve - rawOutput, laf, sumInvariant);
362
362
  const input =
363
- (newX - inputReserve * reservePrecision + reservePrecision - 1n) /
364
- reservePrecision;
363
+ (newX - inputReserve * RESERVE_PRECISION + RESERVE_PRECISION - 1n) /
364
+ RESERVE_PRECISION;
365
365
 
366
366
  const totalFee =
367
- (combinedFee.multiply(feePrecision).quotient * rawOutput +
368
- feePrecision -
367
+ (combinedFee.multiply(FEE_PRECISION).quotient * rawOutput +
368
+ FEE_PRECISION -
369
369
  1n) /
370
- feePrecision;
370
+ FEE_PRECISION;
371
371
  const totalProtocolFee = protocolFee
372
372
  .multiply(totalFee)
373
373
  .divide(combinedFee).quotient;
@@ -5,7 +5,7 @@ import {
5
5
  getSwapInput,
6
6
  getSwapOutput,
7
7
  liquidityInvariant,
8
- reservePrecision,
8
+ RESERVE_PRECISION,
9
9
  } from "../StableSwapsPool.js";
10
10
  import { TPair } from "../SharedPoolMath.js";
11
11
  import { Fraction, type TFractionLike } from "@sundaeswap/fraction";
@@ -14,8 +14,8 @@ describe("liquidityInvariant()", () => {
14
14
  test("Should be true for normal balanced case", () => {
15
15
  expect(
16
16
  liquidityInvariant(
17
- 20_000_000n * reservePrecision,
18
- 20_000_000n * reservePrecision,
17
+ 20_000_000n * RESERVE_PRECISION,
18
+ 20_000_000n * RESERVE_PRECISION,
19
19
  200n,
20
20
  40000000000000000000n,
21
21
  ),
@@ -27,8 +27,8 @@ describe("liquidityInvariant()", () => {
27
27
  test("Should be true after a swap", () => {
28
28
  expect(
29
29
  liquidityInvariant(
30
- 1010000000n * reservePrecision,
31
- 1000000000n * reservePrecision - rawSwap,
30
+ 1010000000n * RESERVE_PRECISION,
31
+ 1000000000n * RESERVE_PRECISION - rawSwap,
32
32
  200n,
33
33
  2000000000000000000000n,
34
34
  ),
@@ -38,8 +38,8 @@ describe("liquidityInvariant()", () => {
38
38
  test("Should be false after a swap minus 1", () => {
39
39
  expect(
40
40
  liquidityInvariant(
41
- 1010000000n * reservePrecision,
42
- 1000000000n * reservePrecision - rawSwap - 1n,
41
+ 1010000000n * RESERVE_PRECISION,
42
+ 1000000000n * RESERVE_PRECISION - rawSwap - 1n,
43
43
  200n,
44
44
  2000000000000000000000n,
45
45
  ),
@@ -49,8 +49,8 @@ describe("liquidityInvariant()", () => {
49
49
  test("Should be false after a swap plus 1", () => {
50
50
  expect(
51
51
  liquidityInvariant(
52
- 1010000000n * reservePrecision,
53
- 1000000000n * reservePrecision - rawSwap + 1n,
52
+ 1010000000n * RESERVE_PRECISION,
53
+ 1000000000n * RESERVE_PRECISION - rawSwap + 1n,
54
54
  200n,
55
55
  2000000000000000000000n,
56
56
  ),
@@ -78,7 +78,7 @@ describe("getNewY()", () => {
78
78
  const oldY = 1000000000n;
79
79
  test("Should find the correct swap amount", () => {
80
80
  const newY = getNewY(newX, 200n, sumInvariant);
81
- expect(newY).toEqual(oldY * reservePrecision - rawSwap);
81
+ expect(newY).toEqual(oldY * RESERVE_PRECISION - rawSwap);
82
82
  });
83
83
  });
84
84