From 2f1b45fa390c47f59b6dad0fcf5f2a6c4bba0fcd Mon Sep 17 00:00:00 2001 From: Cem KIRAY Date: Wed, 1 Feb 2023 12:02:34 +0100 Subject: [PATCH 01/14] fix(liquidity/initial): do not convert initial liquidity amount to base units --- src/add-liquidity/v2/initial.ts | 9 +++++---- src/add-liquidity/v2/util.ts | 17 ++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/add-liquidity/v2/initial.ts b/src/add-liquidity/v2/initial.ts index c02da07f..bcc05911 100644 --- a/src/add-liquidity/v2/initial.ts +++ b/src/add-liquidity/v2/initial.ts @@ -14,7 +14,7 @@ import {getValidatorAppID} from "../../validator"; import {ADD_LIQUIDITY_APP_CALL_ARGUMENTS} from "../constants"; import {V2AddLiquidityType} from "./constants"; import {V2InitialAddLiquidityQuote} from "./types"; -import {calculateInitialAddLiquidity, getV2AddLiquidityAppCallFee} from "./util"; +import {calculateV2InitialLiquidityAmount, getV2AddLiquidityAppCallFee} from "./util"; export * from "./common"; export function getQuote({ @@ -42,12 +42,13 @@ export function getQuote({ ); } - const poolTokenAssetAmount = calculateInitialAddLiquidity(asset1, asset2); - return { asset1In: {id: pool.asset1ID, amount: BigInt(asset1.amount)}, asset2In: {id: pool.asset2ID, amount: BigInt(asset2.amount)}, - poolTokenOut: {id: pool.poolTokenID!, amount: poolTokenAssetAmount}, + poolTokenOut: { + id: pool.poolTokenID!, + amount: calculateV2InitialLiquidityAmount(asset1, asset2) + }, slippage }; } diff --git a/src/add-liquidity/v2/util.ts b/src/add-liquidity/v2/util.ts index 70abf7cd..8ed92afd 100644 --- a/src/add-liquidity/v2/util.ts +++ b/src/add-liquidity/v2/util.ts @@ -2,7 +2,6 @@ import {ALGORAND_MIN_TX_FEE} from "algosdk"; import {calculatePriceImpact} from "../../swap/common/utils"; import {PoolReserves} from "../../util/pool/poolTypes"; -import {convertToBaseUnits} from "../../util/util"; import {V2_LOCKED_POOL_TOKENS} from "../../util/pool/poolConstants"; import { V2AddLiquidityType, @@ -99,21 +98,21 @@ export function calculateSubsequentAddLiquidity({ }; } -export function calculateInitialAddLiquidity( +/** + * @returns the amount of pool tokens that should be issued for the initial add liquidity operation + */ +export function calculateV2InitialLiquidityAmount( asset1: AssetWithAmountAndDecimals, asset2: AssetWithAmountAndDecimals -) { +): bigint { if (!asset1.amount || !asset2.amount) { throw new Error("Both assets are required for the initial add liquidity"); } return BigInt( - Math.abs( - Math.floor( - Math.sqrt( - convertToBaseUnits(asset1.decimals, Math.floor(Number(asset1.amount))) * - convertToBaseUnits(asset2.decimals, Math.floor(Number(asset2.amount))) - ) - V2_LOCKED_POOL_TOKENS + Math.floor( + Math.abs( + Math.sqrt(Number(asset1.amount) * Number(asset2.amount)) - V2_LOCKED_POOL_TOKENS ) ) ); From 5e819d37e5c356dbf2a2623b353e30e1b4671f27 Mon Sep 17 00:00:00 2001 From: edizcelik Date: Thu, 2 Feb 2023 14:58:21 -0800 Subject: [PATCH 02/14] Build lib --- dist/add-liquidity/v2/util.d.ts | 5 ++++- dist/index.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dist/add-liquidity/v2/util.d.ts b/dist/add-liquidity/v2/util.d.ts index 69e6d10e..38ced835 100644 --- a/dist/add-liquidity/v2/util.d.ts +++ b/dist/add-liquidity/v2/util.d.ts @@ -18,7 +18,10 @@ export declare function calculateSubsequentAddLiquidity({ reserves, totalFeeShar swapTotalFeeAmount: bigint; swapPriceImpact: number; }; -export declare function calculateInitialAddLiquidity(asset1: AssetWithAmountAndDecimals, asset2: AssetWithAmountAndDecimals): bigint; +/** + * @returns the amount of pool tokens that should be issued for the initial add liquidity operation + */ +export declare function calculateV2InitialLiquidityAmount(asset1: AssetWithAmountAndDecimals, asset2: AssetWithAmountAndDecimals): bigint; /** * @returns the fee that should be assigned to the app call transaction */ diff --git a/dist/index.js b/dist/index.js index 74f9ce71..d23f17c8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("algosdk"),e=require("base64-js");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=n(t),s=Uint8Array.from([1]);function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,T(Error));var e=y(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return W({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){return W({decimalPlaces:0},Math.pow(10,Number(t))*Number(e))}function W(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=v(J(e),2),a=s[0],o=s[1],i=v(J(Math.round(Number(z(a,o+r)))),2),u=i[0],c=i[1];return Number(z(u,c-r))}return Math.round(e)}function z(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function J(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function Y(t,e){return K.apply(this,arguments)}function K(){return(K=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function H(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function Z(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function $(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function tt(t){return(new TextEncoder).encode(t)}var et={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151"},nt={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function rt(){return(rt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function st(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function at(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function ot(t){return 0===Number(t)}var it,ut={V1_1:"v1_1",V2:"v2"},ct={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},pt={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},lt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return tt("tinyman/".concat(t===ut.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),dt=(f(it={},ut.V1_1,{testnet:62368684,mainnet:552635992}),f(it,ut.V2,{testnet:148607e3,mainnet:1002541853}),it);function ft(t,e){var n=dt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function gt(){return(gt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var It=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),At=new(function(n){m(s,It);var r=y(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=ft(n.network,ut.V1_1),s=v(at(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:wt(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function _t(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function wt(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var Dt,bt,Et=tt("e");function St(t){return Nt.apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:T=k({stateArray:x}),h=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset1ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset2ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.poolTokenID)])),_=T[h],w=T[y],D=T[v],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Ot(){return(Ot=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mLt)){n.next=48;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(Lt,"]): ").concat(B.issuedLiquidity));case 48:return n.abrupt("return",B);case 49:case"end":return n.stop()}}),n,null,[[8,31,34,37]])})))).apply(this,arguments)}function Mt(){return Mt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,vt(n,r);case 6:return o=t.sent,u=_t(o,ft(s,ut.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Pt[ut.V1_1].asset1],asset2ID:u[Pt[ut.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Mt.apply(this,arguments)}var Ct=Object.freeze({__proto__:null,getPoolInfo:Ft,getPoolReserves:function(t,e){return Rt.apply(this,arguments)},getPoolAssets:function(t){return Mt.apply(this,arguments)}});function Vt(t){return Xt.apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=yt(ut.V2),u=o.generateLogicSigAccountForPool(e),c=ft(r,ut.V2),p=u.address(),l=at(s,a),t.next=8,vt(n,p);case 8:return d=t.sent,f=_t(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:ut.V2},f&&(m.asset1ProtocolFees=BigInt(f[Pt.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Pt.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Pt.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Pt.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Pt.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Pt.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Pt.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Pt.v2.totalFeeShare]),m.poolTokenID=Number(f[Pt.v2.poolTokenID]),m.asset1ID=Number(f[Pt.v2.asset1]),m.asset2ID=Number(f[Pt.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,vt(e,n.account.address());case 2:return r=t.sent,s=_t(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Pt.v2.asset1Reserves]),a.asset2=BigInt(s[Pt.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Pt.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ut(){return(Ut=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,vt(n,r);case 3:return a=t.sent,o=_t(a,ft(s,ut.V2)),u=null,o&&(u={asset1ID:o[Pt[ut.V2].asset1],asset2ID:o[Pt[ut.V2].asset2],poolTokenID:o[Pt[ut.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Qt=Object.freeze({__proto__:null,getPoolInfo:Vt,getPoolReserves:function(t,e){return jt.apply(this,arguments)},getPoolAssets:function(t){return Ut.apply(this,arguments)}});function Gt(t){return Boolean(t&&!(t.asset1+t.asset2))}var qt,Wt,zt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Gt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Gt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Ft(t),Vt(t)])}}),Jt=o((f(qt={},ut.V1_1,o(o({},Ct),zt)),f(qt,ut.V2,o(o({},Qt),zt)),qt),zt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(Wt||(Wt={}));var Yt=96e4,Kt=859e3;function Ht(){return(Ht=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=st(a,o),l=v(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=ot(I),T=ft(s,ut.V1_1),h=At.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),y=h.address(),_=r.default.makeApplicationOptInTxnFromObject({from:y,appIndex:T,note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),appArgs:[tt("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:y,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:nt.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:y,amount:Zt(x),suggestedParams:c}),(E=[])[Wt.FUNDING_TXN]=b,E[Wt.VALIDATOR_APP_CALL]=_,E[Wt.POOL_TOKEN_CREATE]=w,E[Wt.ASSET1_OPT_IN]=D,x||(E[Wt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[Wt.FUNDING_TXN],signers:[u]},{txn:S[Wt.VALIDATOR_APP_CALL],signers:[y]},{txn:S[Wt.POOL_TOKEN_CREATE],signers:[y]},{txn:S[Wt.ASSET1_OPT_IN],signers:[y]}],S[Wt.ASSET2_OPT_IN]&&N.push({txn:S[Wt.ASSET2_OPT_IN],signers:[y]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zt(t){return t?Yt:Kt}function $t(){return($t=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=at(o,u),f=v(d,2),m=f[0],g=f[1],I=At.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===Wt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function te(t){return ee.apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[Wt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ne(){return(ne=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,te({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",Jt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var re,se={generateTxns:function(t){return Ht.apply(this,arguments)},signTxns:function(t){return $t.apply(this,arguments)},execute:function(t){return ne.apply(this,arguments)},getBootstrapFundingTxnAmount:Zt};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(re||(re={}));var ae=5,oe=6;function ie(t,e){return ue.apply(this,arguments)}function ue(){return(ue=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ce(t,e){return pe.apply(this,arguments)}function pe(){return(pe=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ie(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function le(){return(le=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=ft(a,ut.V2),d=t.getApplicationAddress(l),f=st(o,u),m=v(f,2),g=m[0].id,I=m[1].id,e.next=9,Jt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=ht.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),T=ot(I),(h=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[tt("bootstrap")],note:lt.getAppCallTxnNoteWithClientName(ut.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=fe(T),y=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:de(T),suggestedParams:p}),(_=[])[re.FUNDING_TXN]=y,_[re.VALIDATOR_APP_CALL]=h,w=r.default.assignGroupID(_),(D=[])[re.FUNDING_TXN]={txn:w[re.FUNDING_TXN],signers:[c]},D[re.VALIDATOR_APP_CALL]={txn:w[re.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function de(t){return function(t,e){var n=yt(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(ut.V2,t)+fe(t)+1e5}function fe(e){return((e?ae:oe)+1)*t.ALGORAND_MIN_TX_FEE}function me(){return(me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=at(o,u),f=v(d,2),m=f[0],g=f[1],I=ht.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===re.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ge(){return(ge=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,ie(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Pt.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",Jt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var Ie,Ae={generateTxns:function(t){return le.apply(this,arguments)},signTxns:function(t){return me.apply(this,arguments)},execute:function(t){return ge.apply(this,arguments)},getBootstrapFundingTxnAmount:de,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+de(e)}};var xe,Te=(f(Ie={},ut.V1_1,se),f(Ie,ut.V2,Ae),f(Ie,"generateTxns",(function(t){return t.contractVersion===ut.V1_1?se.generateTxns(t):Ae.generateTxns(t)})),f(Ie,"signTxns",(function(t){return t.contractVersion===ut.V1_1?se.signTxns(t):Ae.signTxns(t)})),f(Ie,"execute",(function(t){return t.contractVersion===ut.V1_1?se.execute(t):Ae.execute(t)})),f(Ie,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===ut.V1_1?se.getBootstrapFundingTxnAmount(n):Ae.getBootstrapFundingTxnAmount(n)})),Ie);exports.V1_1AddLiquidityTxnIndices=void 0,(xe=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[xe.FEE_TXN=0]="FEE_TXN",xe[xe.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",xe[xe.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",xe[xe.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",xe[xe.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var he,ye,ve,_e,we=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(_e=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",_e.FLEXIBLE="flexible",_e.INITIAL="initial";var De,be=(f(he={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(he,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(he,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),he),Ee=(f(ye={},exports.V2AddLiquidityType.INITIAL,1),f(ye,exports.V2AddLiquidityType.SINGLE,2),f(ye,exports.V2AddLiquidityType.FLEXIBLE,2),ye),Se=(f(ve={},exports.V2AddLiquidityType.INITIAL,3),f(ve,exports.V2AddLiquidityType.FLEXIBLE,3),f(ve,exports.V2AddLiquidityType.SINGLE,2),ve);function Ne(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function Oe(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Ne({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return W({decimalPlaces:5},Math.abs(a/o-1))}function Pe(t){var e,n,r,s,a=t.reserves,o=t.totalFeeShare,i=t.asset1Amount,u=t.asset2Amount,c=t.decimals,p=a.asset1*a.asset2,l=a.asset1+BigInt(i),d=a.asset2+BigInt(u),f=l*d,m=BigInt(parseInt(String(Math.sqrt(Number(f*a.issuedLiquidity*a.issuedLiquidity/p))))),g=m-a.issuedLiquidity,I=g*l/m,A=g*d/m,x=BigInt(i)-I,T=BigInt(u)-A;if(x>T){var h=x;r=BigInt(Math.abs(Math.min(Number(T),0))),e=!0,n=h+(s=ke(h,o)),g-=s*m/(l*BigInt(2))}else{var y=T;r=BigInt(Math.abs(Math.min(Number(x),0))),e=!1,n=y+(s=ke(y,o)),g-=s*m/(d*BigInt(2))}return{poolTokenAssetAmount:g,swapFromAsset1ToAsset2:e,swapInAmount:n,swapOutAmount:r,swapTotalFeeAmount:s,swapPriceImpact:Oe({inputSupply:e?a.asset1:a.asset2,outputSupply:e?a.asset2:a.asset1,assetIn:{amount:n,decimals:c.asset1},assetOut:{amount:r,decimals:c.asset2}})}}function ke(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Le(e){return(Ee[e]+1)*t.ALGORAND_MIN_TX_FEE}var Fe=tt("add_liquidity"),Be=(f(De={},ut.V1_1,[tt("mint")]),f(De,ut.V2,{INITIAL_LIQUIDITY:[tt("add_initial_liquidity")],SINGLE_ASSET_MODE:[Fe,tt("single")],FLEXIBLE_MODE:[Fe,tt("flexible")]}),De);function Re(){return(Re=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=Q("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:ft(a,ut.V1_1),appArgs:Be.v1_1,accounts:[d],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),T=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),h=r.default.assignGroupID([T,g,I,A,x]),t.abrupt("return",[{txn:h[0],signers:[d]},{txn:h[1],signers:[o]},{txn:h[2],signers:[d]},{txn:h[3],signers:[d]},{txn:h[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(){return(Me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=v(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ce(){return(Ce=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,St({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,Y(n,[a]);case 8:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=H(s),I=Z(s),t.next=17,St({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(T=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&T.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),T;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var Ve=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=os+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function vn(){return(vn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[en,r.default.encodeUint64(Q("negative",l,c)),r.default.encodeUint64(Q("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[$e.ASSET_TRANSFER_TXN]=g,A[$e.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[$e.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[$e.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _n(){return(_n=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,T=Q("negative",l,p),c!==f){e.next=17;break}A=T,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=T,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return h=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(y=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[en,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(v=[])[$e.ASSET_TRANSFER_TXN]=h,v[$e.APP_CALL_TXN]=y,_=r.default.assignGroupID(v),e.abrupt("return",[{txn:_[$e.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[$e.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wn(){return(wn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.client,s=e.txGroup,a=e.signedTxns,t.next=3,Y(r,[a]);case 3:return o=t.sent,u=v(o,1),c=u[0].txnID,t.next=8,ce(r,s);case 8:if(t.t1=n=t.sent,t.t0=null===t.t1,t.t0){t.next=12;break}t.t0=void 0===n;case 12:if(!t.t0){t.next=16;break}t.t2=void 0,t.next=17;break;case 16:t.t2=n.map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}}));case 17:return p=t.t2,t.abrupt("return",{outputAssets:p,txnID:c});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Dn,bn,En={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=yn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=yn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=hn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=hn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,T=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:T}}}return e},generateTxns:function(t){return vn.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return _n.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return wn.apply(this,arguments)}},Sn=(f(Dn={},ut.V1_1,pn),f(Dn,ut.V2,En),Dn),Nn=3n,On=1000n;function Pn(){return(Pn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=v(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===bn.FEE_TXN_INDEX?c:e===bn.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function kn(){return(kn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return d=t.sent,f=a.account.address(),m=[tt("swap"),o===exports.SwapType.FixedInput?tt("fi"):tt("fo")],g=r.default.makeApplicationNoOpTxnFromObject({from:f,appIndex:a.validatorAppID,appArgs:m,accounts:[l],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:d}),I=o===exports.SwapType.FixedOutput?Q("positive",p,u.amount):u.amount,A=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:I,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:f,assetIndex:u.id,amount:I,suggestedParams:d}),x=o===exports.SwapType.FixedInput?Q("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:f,to:l,amount:x,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:f,to:l,assetIndex:c.id,amount:x,suggestedParams:d}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:g.fee+T.fee,note:s,suggestedParams:d}),y=r.default.assignGroupID([h,g,A,T]),t.abrupt("return",[{txn:y[0],signers:[l]},{txn:y[1],signers:[f]},{txn:y[2],signers:[l]},{txn:y[3],signers:[f]}]);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ln(t){var e,n,r,s=t.pool,a=t.reserves,i=t.assetIn,u=t.decimals,c=BigInt(i.amount);i.id===s.asset1ID?(e=s.asset2ID,n=a.asset1,r=a.asset2):(e=s.asset1ID,n=a.asset2,r=a.asset1);var p=c*Nn/On,l=r-n*r/(n+(c-p));if(l>r)throw new Error("Output amount exceeds available liquidity.");var d={assetIn:{amount:c,decimals:u.assetIn},assetOut:{amount:l,decimals:u.assetOut}};return{round:a.round,assetInID:i.id,assetInAmount:c,assetOutID:e,assetOutAmount:l,swapFee:Number(p),rate:Ne(d),priceImpact:Oe(o({inputSupply:n,outputSupply:r},d))}}function Fn(t){return Bn.apply(this,arguments)}function Bn(){return(Bn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Rn(t){var e,n,r,s=t.pool,a=t.reserves,o=t.assetOut,i=t.decimals,u=BigInt(o.amount);if(o.id===s.asset1ID?(e=s.asset2ID,n=a.asset2,r=a.asset1):(e=s.asset1ID,n=a.asset1,r=a.asset2),u>r)throw new Error("Output amount exceeds available liquidity.");var c=n*r/(r-u)-n,p=c*On/(On-Nn),l=p-c,d=G(i.assetOut,Number(u))/G(i.assetIn,Number(p)),f=G(i.assetOut,Number(r))/G(i.assetIn,Number(n)),m=W({decimalPlaces:5},Math.abs(d/f-1));return{round:a.round,assetInID:e,assetInAmount:p,assetOutID:o.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Mn(t){return Cn.apply(this,arguments)}function Cn(){return(Cn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Vn(){return(Vn=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[bn.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[bn.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Fn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Mn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:Z(a),fees:H(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(bn||(bn={}));var Xn,jn={getQuote:function(t,e,n,r,s){if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,asset:r},"Trying to swap on a non-existent pool");return t===exports.SwapType.FixedInput?Ln({pool:e,reserves:n,assetIn:r,decimals:s}):Rn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Ln,getFixedOutputSwapQuote:Rn,generateTxns:function(t){return kn.apply(this,arguments)},signTxns:function(t){return Pn.apply(this,arguments)},execute:function(t){return Vn.apply(this,arguments)},executeFixedOutputSwap:Mn},Un=4*t.ALGORAND_MIN_TX_FEE;function Qn(t){return t.filter((function(t){return!Gt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Gn=(f(Xn={},ut.V1_1,jn),f(Xn,ut.V2,hn),f(Xn,"getQuote",(function(t){if(t.pools.every((function(t){return Gt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?(n=(e=t).pools,r=e.assetIn,s=e.assetOut,a=e.amount,Qn(n.map((function(t){var e={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===ut.V1_1?jn.getFixedInputSwapQuote(e):hn.getFixedInputSwapQuote(e)}})))):function(t){var e=t.pools,n=t.assetIn,r=t.assetOut,s=t.amount;return Qn(e.map((function(t){var e={pool:t.info,assetOut:{amount:s,id:Number(r.id)},decimals:{assetIn:n.decimals,assetOut:r.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===ut.V1_1?jn.getFixedOutputSwapQuote(e):hn.getFixedOutputSwapQuote(e)}})))}(t);var e,n,r,s,a})),f(Xn,"generateTxns",(function(t){return t.pool.contractVersion===ut.V1_1?jn.generateTxns(t):hn.generateTxns(t)})),f(Xn,"signTxns",(function(t){return t.pool.contractVersion===ut.V1_1?jn.signTxns(t):hn.signTxns(t)})),f(Xn,"execute",(function(t){return t.contractVersion===ut.V1_1?jn.execute(t):hn.execute(t)})),Xn);function qn(){return(qn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Wn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,Y(n,[o]);case 7:return u=t.sent,c=v(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:H(s),confirmedRound:d,txnID:l,groupID:Z(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Wn(t){return zn.apply(this,arguments)}function zn(){return(zn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=v(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Jn(){return Jn=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:H(e),groupID:Z(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,Y(n,[c]);case 4:p=s.sent,l=v(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),Jn.apply(this,arguments)}function Yn(){return(Yn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[tt("redeem")],note:lt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Kn(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[tt("commit"),u],note:L([tt("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function Hn(){return(Hn=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=Kn({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[tt("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=et,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=Ze,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=Te,exports.CONTRACT_VERSION=ut,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=nt,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Sn,exports.Swap=Gn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=tn,exports.V2AddLiquidityTxnIndices=be,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=Q,exports.calculateAccountMinimumRequiredBalance=wt,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=Jt,exports.prepareCommitTransactions=function(t){return Hn.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return Jn.apply(this,arguments)},exports.redeemExcessAsset=function(t){return qn.apply(this,arguments)},exports.sendAndWaitRawTransaction=Y,exports.sumUpTxnFees=H,exports.tinymanContract_v1_1=At,exports.tinymanContract_v2=ht,exports.tinymanJSSDKConfig=lt; +i=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new w(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(s,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===s)throw a;return b()}for(n.method=s,n.arg=a;;){var o=n.delegate;if(o){var i=y(o,n);if(i){if(i===l)continue;return i}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,o),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function d(){}function f(){}function m(){}var g={};u(g,s,(function(){return this}));var I=Object.getPrototypeOf,A=I&&I(I(D([])));A&&A!==e&&n.call(A,s)&&(g=A);var x=m.prototype=d.prototype=Object.create(g);function T(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function h(t,e){function r(s,a,o,i){var u=p(t[s],t,a);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,o,i)}),(function(t){r("throw",t,o,i)})):e.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return r("throw",t,o,i)}))}i(u.arg)}var s;this._invoke=function(t,n){function a(){return new e((function(e,s){r(t,n,e,s)}))}return s=s?s.then(a,a):a()}}function y(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,y(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=p(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var s=r.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function v(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(v,this),this.reset(!0)}function D(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,T(Error));var e=y(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return q({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=v(z(e),2),a=s[0],o=s[1],i=v(z(Math.round(Number(W(a,o+r)))),2),u=i[0],c=i[1];return Number(W(u,c-r))}return Math.round(e)}function W(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function z(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function J(t,e){return Y.apply(this,arguments)}function Y(){return(Y=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function K(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function H(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function Z(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function $(t){return(new TextEncoder).encode(t)}var tt={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151"},et={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function nt(){return(nt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function rt(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function st(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function at(t){return 0===Number(t)}var ot,it={V1_1:"v1_1",V2:"v2"},ut={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},ct={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},pt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return $("tinyman/".concat(t===it.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),lt=(f(ot={},it.V1_1,{testnet:62368684,mainnet:552635992}),f(ot,it.V2,{testnet:148607e3,mainnet:1002541853}),ot);function dt(t,e){var n=lt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function ft(){return(ft=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:dt(s,a),note:pt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:dt(s,a),note:pt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var gt=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),It=new(function(n){m(s,gt);var r=y(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=dt(n.network,it.V1_1),s=v(st(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:_t(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function vt(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function _t(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var wt,Dt,bt=$("e");function Et(t){return St.apply(this,arguments)}function St(){return(St=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:T=k({stateArray:x}),h=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.asset1ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.asset2ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.poolTokenID)])),_=T[h],w=T[y],D=T[v],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mkt)){n.next=48;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(kt,"]): ").concat(B.issuedLiquidity));case 48:return n.abrupt("return",B);case 49:case"end":return n.stop()}}),n,null,[[8,31,34,37]])})))).apply(this,arguments)}function Rt(){return Rt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,yt(n,r);case 6:return o=t.sent,u=vt(o,dt(s,it.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Ot[it.V1_1].asset1],asset2ID:u[Ot[it.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Rt.apply(this,arguments)}var Mt=Object.freeze({__proto__:null,getPoolInfo:Lt,getPoolReserves:function(t,e){return Bt.apply(this,arguments)},getPoolAssets:function(t){return Rt.apply(this,arguments)}});function Ct(t){return Vt.apply(this,arguments)}function Vt(){return(Vt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=ht(it.V2),u=o.generateLogicSigAccountForPool(e),c=dt(r,it.V2),p=u.address(),l=st(s,a),t.next=8,yt(n,p);case 8:return d=t.sent,f=vt(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:it.V2},f&&(m.asset1ProtocolFees=BigInt(f[Ot.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Ot.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Ot.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Ot.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Ot.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Ot.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Ot.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Ot.v2.totalFeeShare]),m.poolTokenID=Number(f[Ot.v2.poolTokenID]),m.asset1ID=Number(f[Ot.v2.asset1]),m.asset2ID=Number(f[Ot.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,yt(e,n.account.address());case 2:return r=t.sent,s=vt(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Ot.v2.asset1Reserves]),a.asset2=BigInt(s[Ot.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Ot.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,yt(n,r);case 3:return a=t.sent,o=vt(a,dt(s,it.V2)),u=null,o&&(u={asset1ID:o[Ot[it.V2].asset1],asset2ID:o[Ot[it.V2].asset2],poolTokenID:o[Ot[it.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ut=Object.freeze({__proto__:null,getPoolInfo:Ct,getPoolReserves:function(t,e){return Xt.apply(this,arguments)},getPoolAssets:function(t){return jt.apply(this,arguments)}});function Qt(t){return Boolean(t&&!(t.asset1+t.asset2))}var Gt,qt,Wt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Qt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Qt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Lt(t),Ct(t)])}}),zt=o((f(Gt={},it.V1_1,o(o({},Mt),Wt)),f(Gt,it.V2,o(o({},Ut),Wt)),Gt),Wt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(qt||(qt={}));var Jt=96e4,Yt=859e3;function Kt(){return(Kt=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=rt(a,o),l=v(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=at(I),T=dt(s,it.V1_1),h=It.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),y=h.address(),_=r.default.makeApplicationOptInTxnFromObject({from:y,appIndex:T,note:pt.getAppCallTxnNoteWithClientName(it.V1_1),appArgs:[$("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:y,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:et.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:y,amount:Ht(x),suggestedParams:c}),(E=[])[qt.FUNDING_TXN]=b,E[qt.VALIDATOR_APP_CALL]=_,E[qt.POOL_TOKEN_CREATE]=w,E[qt.ASSET1_OPT_IN]=D,x||(E[qt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[qt.FUNDING_TXN],signers:[u]},{txn:S[qt.VALIDATOR_APP_CALL],signers:[y]},{txn:S[qt.POOL_TOKEN_CREATE],signers:[y]},{txn:S[qt.ASSET1_OPT_IN],signers:[y]}],S[qt.ASSET2_OPT_IN]&&N.push({txn:S[qt.ASSET2_OPT_IN],signers:[y]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ht(t){return t?Jt:Yt}function Zt(){return(Zt=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=st(o,u),f=v(d,2),m=f[0],g=f[1],I=It.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===qt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function $t(t){return te.apply(this,arguments)}function te(){return(te=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[qt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,$t({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",zt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var ne,re={generateTxns:function(t){return Kt.apply(this,arguments)},signTxns:function(t){return Zt.apply(this,arguments)},execute:function(t){return ee.apply(this,arguments)},getBootstrapFundingTxnAmount:Ht};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(ne||(ne={}));var se=5,ae=6;function oe(t,e){return ie.apply(this,arguments)}function ie(){return(ie=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ue(t,e){return ce.apply(this,arguments)}function ce(){return(ce=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,oe(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function pe(){return(pe=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=dt(a,it.V2),d=t.getApplicationAddress(l),f=rt(o,u),m=v(f,2),g=m[0].id,I=m[1].id,e.next=9,zt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=Tt.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),T=at(I),(h=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[$("bootstrap")],note:pt.getAppCallTxnNoteWithClientName(it.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=de(T),y=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:le(T),suggestedParams:p}),(_=[])[ne.FUNDING_TXN]=y,_[ne.VALIDATOR_APP_CALL]=h,w=r.default.assignGroupID(_),(D=[])[ne.FUNDING_TXN]={txn:w[ne.FUNDING_TXN],signers:[c]},D[ne.VALIDATOR_APP_CALL]={txn:w[ne.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function le(t){return function(t,e){var n=ht(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(it.V2,t)+de(t)+1e5}function de(e){return((e?se:ae)+1)*t.ALGORAND_MIN_TX_FEE}function fe(){return(fe=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=st(o,u),f=v(d,2),m=f[0],g=f[1],I=Tt.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===ne.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function me(){return(me=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,oe(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Ot.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",zt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var ge,Ie={generateTxns:function(t){return pe.apply(this,arguments)},signTxns:function(t){return fe.apply(this,arguments)},execute:function(t){return me.apply(this,arguments)},getBootstrapFundingTxnAmount:le,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+le(e)}};var Ae,xe=(f(ge={},it.V1_1,re),f(ge,it.V2,Ie),f(ge,"generateTxns",(function(t){return t.contractVersion===it.V1_1?re.generateTxns(t):Ie.generateTxns(t)})),f(ge,"signTxns",(function(t){return t.contractVersion===it.V1_1?re.signTxns(t):Ie.signTxns(t)})),f(ge,"execute",(function(t){return t.contractVersion===it.V1_1?re.execute(t):Ie.execute(t)})),f(ge,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===it.V1_1?re.getBootstrapFundingTxnAmount(n):Ie.getBootstrapFundingTxnAmount(n)})),ge);exports.V1_1AddLiquidityTxnIndices=void 0,(Ae=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[Ae.FEE_TXN=0]="FEE_TXN",Ae[Ae.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",Ae[Ae.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",Ae[Ae.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",Ae[Ae.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var Te,he,ye,ve,_e=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(ve=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",ve.FLEXIBLE="flexible",ve.INITIAL="initial";var we,De=(f(Te={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(Te,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(Te,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),Te),be=(f(he={},exports.V2AddLiquidityType.INITIAL,1),f(he,exports.V2AddLiquidityType.SINGLE,2),f(he,exports.V2AddLiquidityType.FLEXIBLE,2),he),Ee=(f(ye={},exports.V2AddLiquidityType.INITIAL,3),f(ye,exports.V2AddLiquidityType.FLEXIBLE,3),f(ye,exports.V2AddLiquidityType.SINGLE,2),ye);function Se(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function Ne(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Se({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return q({decimalPlaces:5},Math.abs(a/o-1))}function Oe(t){var e,n,r,s,a=t.reserves,o=t.totalFeeShare,i=t.asset1Amount,u=t.asset2Amount,c=t.decimals,p=a.asset1*a.asset2,l=a.asset1+BigInt(i),d=a.asset2+BigInt(u),f=l*d,m=BigInt(parseInt(String(Math.sqrt(Number(f*a.issuedLiquidity*a.issuedLiquidity/p))))),g=m-a.issuedLiquidity,I=g*l/m,A=g*d/m,x=BigInt(i)-I,T=BigInt(u)-A;if(x>T){var h=x;r=BigInt(Math.abs(Math.min(Number(T),0))),e=!0,n=h+(s=ke(h,o)),g-=s*m/(l*BigInt(2))}else{var y=T;r=BigInt(Math.abs(Math.min(Number(x),0))),e=!1,n=y+(s=ke(y,o)),g-=s*m/(d*BigInt(2))}return{poolTokenAssetAmount:g,swapFromAsset1ToAsset2:e,swapInAmount:n,swapOutAmount:r,swapTotalFeeAmount:s,swapPriceImpact:Ne({inputSupply:e?a.asset1:a.asset2,outputSupply:e?a.asset2:a.asset1,assetIn:{amount:n,decimals:c.asset1},assetOut:{amount:r,decimals:c.asset2}})}}function Pe(t,e){if(!t.amount||!e.amount)throw new Error("Both assets are required for the initial add liquidity");return BigInt(Math.floor(Math.abs(Math.sqrt(Number(t.amount)*Number(e.amount))-1e3)))}function ke(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Le(e){return(be[e]+1)*t.ALGORAND_MIN_TX_FEE}var Fe=$("add_liquidity"),Be=(f(we={},it.V1_1,[$("mint")]),f(we,it.V2,{INITIAL_LIQUIDITY:[$("add_initial_liquidity")],SINGLE_ASSET_MODE:[Fe,$("single")],FLEXIBLE_MODE:[Fe,$("flexible")]}),we);function Re(){return(Re=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=Q("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:dt(a,it.V1_1),appArgs:Be.v1_1,accounts:[d],note:pt.getAppCallTxnNoteWithClientName(it.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),T=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),h=r.default.assignGroupID([T,g,I,A,x]),t.abrupt("return",[{txn:h[0],signers:[d]},{txn:h[1],signers:[o]},{txn:h[2],signers:[d]},{txn:h[3],signers:[d]},{txn:h[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(){return(Me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=v(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ce(){return(Ce=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,Et({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,J(n,[a]);case 8:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=K(s),I=H(s),t.next=17,Et({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(T=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&T.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),T;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var Ve=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=os+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function vn(){return(vn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:pt.getAppCallTxnNoteWithClientName(it.V2),appArgs:[en,r.default.encodeUint64(Q("negative",l,c)),r.default.encodeUint64(Q("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[$e.ASSET_TRANSFER_TXN]=g,A[$e.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[$e.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[$e.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _n(){return(_n=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,T=Q("negative",l,p),c!==f){e.next=17;break}A=T,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=T,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return h=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(y=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:pt.getAppCallTxnNoteWithClientName(it.V2),appArgs:[en,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(v=[])[$e.ASSET_TRANSFER_TXN]=h,v[$e.APP_CALL_TXN]=y,_=r.default.assignGroupID(v),e.abrupt("return",[{txn:_[$e.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[$e.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wn(){return(wn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.client,s=e.txGroup,a=e.signedTxns,t.next=3,J(r,[a]);case 3:return o=t.sent,u=v(o,1),c=u[0].txnID,t.next=8,ue(r,s);case 8:if(t.t1=n=t.sent,t.t0=null===t.t1,t.t0){t.next=12;break}t.t0=void 0===n;case 12:if(!t.t0){t.next=16;break}t.t2=void 0,t.next=17;break;case 16:t.t2=n.map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}}));case 17:return p=t.t2,t.abrupt("return",{outputAssets:p,txnID:c});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Dn,bn,En={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=yn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=yn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=hn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=hn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,T=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:T}}}return e},generateTxns:function(t){return vn.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return _n.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return wn.apply(this,arguments)}},Sn=(f(Dn={},it.V1_1,pn),f(Dn,it.V2,En),Dn),Nn=3n,On=1000n;function Pn(){return(Pn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=v(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===bn.FEE_TXN_INDEX?c:e===bn.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function kn(){return(kn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return d=t.sent,f=a.account.address(),m=[$("swap"),o===exports.SwapType.FixedInput?$("fi"):$("fo")],g=r.default.makeApplicationNoOpTxnFromObject({from:f,appIndex:a.validatorAppID,appArgs:m,accounts:[l],note:pt.getAppCallTxnNoteWithClientName(it.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:d}),I=o===exports.SwapType.FixedOutput?Q("positive",p,u.amount):u.amount,A=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:I,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:f,assetIndex:u.id,amount:I,suggestedParams:d}),x=o===exports.SwapType.FixedInput?Q("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:f,to:l,amount:x,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:f,to:l,assetIndex:c.id,amount:x,suggestedParams:d}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:g.fee+T.fee,note:s,suggestedParams:d}),y=r.default.assignGroupID([h,g,A,T]),t.abrupt("return",[{txn:y[0],signers:[l]},{txn:y[1],signers:[f]},{txn:y[2],signers:[l]},{txn:y[3],signers:[f]}]);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ln(t){var e,n,r,s=t.pool,a=t.reserves,i=t.assetIn,u=t.decimals,c=BigInt(i.amount);i.id===s.asset1ID?(e=s.asset2ID,n=a.asset1,r=a.asset2):(e=s.asset1ID,n=a.asset2,r=a.asset1);var p=c*Nn/On,l=r-n*r/(n+(c-p));if(l>r)throw new Error("Output amount exceeds available liquidity.");var d={assetIn:{amount:c,decimals:u.assetIn},assetOut:{amount:l,decimals:u.assetOut}};return{round:a.round,assetInID:i.id,assetInAmount:c,assetOutID:e,assetOutAmount:l,swapFee:Number(p),rate:Se(d),priceImpact:Ne(o({inputSupply:n,outputSupply:r},d))}}function Fn(t){return Bn.apply(this,arguments)}function Bn(){return(Bn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,Et({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,J(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,Et({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Rn(t){var e,n,r,s=t.pool,a=t.reserves,o=t.assetOut,i=t.decimals,u=BigInt(o.amount);if(o.id===s.asset1ID?(e=s.asset2ID,n=a.asset2,r=a.asset1):(e=s.asset1ID,n=a.asset1,r=a.asset2),u>r)throw new Error("Output amount exceeds available liquidity.");var c=n*r/(r-u)-n,p=c*On/(On-Nn),l=p-c,d=G(i.assetOut,Number(u))/G(i.assetIn,Number(p)),f=G(i.assetOut,Number(r))/G(i.assetIn,Number(n)),m=q({decimalPlaces:5},Math.abs(d/f-1));return{round:a.round,assetInID:e,assetInAmount:p,assetOutID:o.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Mn(t){return Cn.apply(this,arguments)}function Cn(){return(Cn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,Et({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,J(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,Et({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Vn(){return(Vn=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[bn.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[bn.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Fn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Mn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:H(a),fees:K(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(bn||(bn={}));var Xn,jn={getQuote:function(t,e,n,r,s){if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,asset:r},"Trying to swap on a non-existent pool");return t===exports.SwapType.FixedInput?Ln({pool:e,reserves:n,assetIn:r,decimals:s}):Rn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Ln,getFixedOutputSwapQuote:Rn,generateTxns:function(t){return kn.apply(this,arguments)},signTxns:function(t){return Pn.apply(this,arguments)},execute:function(t){return Vn.apply(this,arguments)},executeFixedOutputSwap:Mn},Un=4*t.ALGORAND_MIN_TX_FEE;function Qn(t){return t.filter((function(t){return!Qt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Gn=(f(Xn={},it.V1_1,jn),f(Xn,it.V2,hn),f(Xn,"getQuote",(function(t){if(t.pools.every((function(t){return Qt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?(n=(e=t).pools,r=e.assetIn,s=e.assetOut,a=e.amount,Qn(n.map((function(t){var e={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===it.V1_1?jn.getFixedInputSwapQuote(e):hn.getFixedInputSwapQuote(e)}})))):function(t){var e=t.pools,n=t.assetIn,r=t.assetOut,s=t.amount;return Qn(e.map((function(t){var e={pool:t.info,assetOut:{amount:s,id:Number(r.id)},decimals:{assetIn:n.decimals,assetOut:r.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===it.V1_1?jn.getFixedOutputSwapQuote(e):hn.getFixedOutputSwapQuote(e)}})))}(t);var e,n,r,s,a})),f(Xn,"generateTxns",(function(t){return t.pool.contractVersion===it.V1_1?jn.generateTxns(t):hn.generateTxns(t)})),f(Xn,"signTxns",(function(t){return t.pool.contractVersion===it.V1_1?jn.signTxns(t):hn.signTxns(t)})),f(Xn,"execute",(function(t){return t.contractVersion===it.V1_1?jn.execute(t):hn.execute(t)})),Xn);function qn(){return(qn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Wn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,J(n,[o]);case 7:return u=t.sent,c=v(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:K(s),confirmedRound:d,txnID:l,groupID:H(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Wn(t){return zn.apply(this,arguments)}function zn(){return(zn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=v(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Jn(){return Jn=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:K(e),groupID:H(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,J(n,[c]);case 4:p=s.sent,l=v(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),Jn.apply(this,arguments)}function Yn(){return(Yn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[$("redeem")],note:pt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Kn(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[$("commit"),u],note:L([$("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function Hn(){return(Hn=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=Kn({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[$("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=tt,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=Ze,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=xe,exports.CONTRACT_VERSION=it,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=et,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Sn,exports.Swap=Gn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=tn,exports.V2AddLiquidityTxnIndices=De,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=Q,exports.calculateAccountMinimumRequiredBalance=_t,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=zt,exports.prepareCommitTransactions=function(t){return Hn.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return Jn.apply(this,arguments)},exports.redeemExcessAsset=function(t){return qn.apply(this,arguments)},exports.sendAndWaitRawTransaction=J,exports.sumUpTxnFees=K,exports.tinymanContract_v1_1=It,exports.tinymanContract_v2=Tt,exports.tinymanJSSDKConfig=pt; From 0dbad868e9ab805397ac9d46af4ce6d19f8cd7ce Mon Sep 17 00:00:00 2001 From: edizcelik Date: Fri, 3 Feb 2023 11:48:42 -0800 Subject: [PATCH 03/14] fix(v1-pool/reserves): Make sure ALGO balance is not negative for not created pools --- dist/index.js | 2 +- src/util/pool/v1_1/index.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index d23f17c8..8a740ee2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("algosdk"),e=require("base64-js");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=n(t),s=Uint8Array.from([1]);function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,T(Error));var e=y(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return q({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=v(z(e),2),a=s[0],o=s[1],i=v(z(Math.round(Number(W(a,o+r)))),2),u=i[0],c=i[1];return Number(W(u,c-r))}return Math.round(e)}function W(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function z(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function J(t,e){return Y.apply(this,arguments)}function Y(){return(Y=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function K(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function H(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function Z(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function $(t){return(new TextEncoder).encode(t)}var tt={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151"},et={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function nt(){return(nt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function rt(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function st(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function at(t){return 0===Number(t)}var ot,it={V1_1:"v1_1",V2:"v2"},ut={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},ct={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},pt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return $("tinyman/".concat(t===it.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),lt=(f(ot={},it.V1_1,{testnet:62368684,mainnet:552635992}),f(ot,it.V2,{testnet:148607e3,mainnet:1002541853}),ot);function dt(t,e){var n=lt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function ft(){return(ft=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:dt(s,a),note:pt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:dt(s,a),note:pt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var gt=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),It=new(function(n){m(s,gt);var r=y(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=dt(n.network,it.V1_1),s=v(st(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:_t(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function vt(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function _t(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var wt,Dt,bt=$("e");function Et(t){return St.apply(this,arguments)}function St(){return(St=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:T=k({stateArray:x}),h=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.asset1ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.asset2ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.poolTokenID)])),_=T[h],w=T[y],D=T[v],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mkt)){n.next=48;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(kt,"]): ").concat(B.issuedLiquidity));case 48:return n.abrupt("return",B);case 49:case"end":return n.stop()}}),n,null,[[8,31,34,37]])})))).apply(this,arguments)}function Rt(){return Rt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,yt(n,r);case 6:return o=t.sent,u=vt(o,dt(s,it.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Ot[it.V1_1].asset1],asset2ID:u[Ot[it.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Rt.apply(this,arguments)}var Mt=Object.freeze({__proto__:null,getPoolInfo:Lt,getPoolReserves:function(t,e){return Bt.apply(this,arguments)},getPoolAssets:function(t){return Rt.apply(this,arguments)}});function Ct(t){return Vt.apply(this,arguments)}function Vt(){return(Vt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=ht(it.V2),u=o.generateLogicSigAccountForPool(e),c=dt(r,it.V2),p=u.address(),l=st(s,a),t.next=8,yt(n,p);case 8:return d=t.sent,f=vt(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:it.V2},f&&(m.asset1ProtocolFees=BigInt(f[Ot.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Ot.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Ot.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Ot.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Ot.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Ot.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Ot.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Ot.v2.totalFeeShare]),m.poolTokenID=Number(f[Ot.v2.poolTokenID]),m.asset1ID=Number(f[Ot.v2.asset1]),m.asset2ID=Number(f[Ot.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,yt(e,n.account.address());case 2:return r=t.sent,s=vt(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Ot.v2.asset1Reserves]),a.asset2=BigInt(s[Ot.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Ot.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,yt(n,r);case 3:return a=t.sent,o=vt(a,dt(s,it.V2)),u=null,o&&(u={asset1ID:o[Ot[it.V2].asset1],asset2ID:o[Ot[it.V2].asset2],poolTokenID:o[Ot[it.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ut=Object.freeze({__proto__:null,getPoolInfo:Ct,getPoolReserves:function(t,e){return Xt.apply(this,arguments)},getPoolAssets:function(t){return jt.apply(this,arguments)}});function Qt(t){return Boolean(t&&!(t.asset1+t.asset2))}var Gt,qt,Wt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Qt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Qt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Lt(t),Ct(t)])}}),zt=o((f(Gt={},it.V1_1,o(o({},Mt),Wt)),f(Gt,it.V2,o(o({},Ut),Wt)),Gt),Wt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(qt||(qt={}));var Jt=96e4,Yt=859e3;function Kt(){return(Kt=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=rt(a,o),l=v(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=at(I),T=dt(s,it.V1_1),h=It.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),y=h.address(),_=r.default.makeApplicationOptInTxnFromObject({from:y,appIndex:T,note:pt.getAppCallTxnNoteWithClientName(it.V1_1),appArgs:[$("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:y,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:et.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:y,amount:Ht(x),suggestedParams:c}),(E=[])[qt.FUNDING_TXN]=b,E[qt.VALIDATOR_APP_CALL]=_,E[qt.POOL_TOKEN_CREATE]=w,E[qt.ASSET1_OPT_IN]=D,x||(E[qt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[qt.FUNDING_TXN],signers:[u]},{txn:S[qt.VALIDATOR_APP_CALL],signers:[y]},{txn:S[qt.POOL_TOKEN_CREATE],signers:[y]},{txn:S[qt.ASSET1_OPT_IN],signers:[y]}],S[qt.ASSET2_OPT_IN]&&N.push({txn:S[qt.ASSET2_OPT_IN],signers:[y]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ht(t){return t?Jt:Yt}function Zt(){return(Zt=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=st(o,u),f=v(d,2),m=f[0],g=f[1],I=It.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===qt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function $t(t){return te.apply(this,arguments)}function te(){return(te=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[qt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,$t({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",zt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var ne,re={generateTxns:function(t){return Kt.apply(this,arguments)},signTxns:function(t){return Zt.apply(this,arguments)},execute:function(t){return ee.apply(this,arguments)},getBootstrapFundingTxnAmount:Ht};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(ne||(ne={}));var se=5,ae=6;function oe(t,e){return ie.apply(this,arguments)}function ie(){return(ie=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ue(t,e){return ce.apply(this,arguments)}function ce(){return(ce=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,oe(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function pe(){return(pe=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=dt(a,it.V2),d=t.getApplicationAddress(l),f=rt(o,u),m=v(f,2),g=m[0].id,I=m[1].id,e.next=9,zt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=Tt.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),T=at(I),(h=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[$("bootstrap")],note:pt.getAppCallTxnNoteWithClientName(it.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=de(T),y=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:le(T),suggestedParams:p}),(_=[])[ne.FUNDING_TXN]=y,_[ne.VALIDATOR_APP_CALL]=h,w=r.default.assignGroupID(_),(D=[])[ne.FUNDING_TXN]={txn:w[ne.FUNDING_TXN],signers:[c]},D[ne.VALIDATOR_APP_CALL]={txn:w[ne.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function le(t){return function(t,e){var n=ht(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(it.V2,t)+de(t)+1e5}function de(e){return((e?se:ae)+1)*t.ALGORAND_MIN_TX_FEE}function fe(){return(fe=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=st(o,u),f=v(d,2),m=f[0],g=f[1],I=Tt.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===ne.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function me(){return(me=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,oe(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Ot.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",zt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var ge,Ie={generateTxns:function(t){return pe.apply(this,arguments)},signTxns:function(t){return fe.apply(this,arguments)},execute:function(t){return me.apply(this,arguments)},getBootstrapFundingTxnAmount:le,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+le(e)}};var Ae,xe=(f(ge={},it.V1_1,re),f(ge,it.V2,Ie),f(ge,"generateTxns",(function(t){return t.contractVersion===it.V1_1?re.generateTxns(t):Ie.generateTxns(t)})),f(ge,"signTxns",(function(t){return t.contractVersion===it.V1_1?re.signTxns(t):Ie.signTxns(t)})),f(ge,"execute",(function(t){return t.contractVersion===it.V1_1?re.execute(t):Ie.execute(t)})),f(ge,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===it.V1_1?re.getBootstrapFundingTxnAmount(n):Ie.getBootstrapFundingTxnAmount(n)})),ge);exports.V1_1AddLiquidityTxnIndices=void 0,(Ae=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[Ae.FEE_TXN=0]="FEE_TXN",Ae[Ae.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",Ae[Ae.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",Ae[Ae.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",Ae[Ae.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var Te,he,ye,ve,_e=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(ve=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",ve.FLEXIBLE="flexible",ve.INITIAL="initial";var we,De=(f(Te={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(Te,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(Te,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),Te),be=(f(he={},exports.V2AddLiquidityType.INITIAL,1),f(he,exports.V2AddLiquidityType.SINGLE,2),f(he,exports.V2AddLiquidityType.FLEXIBLE,2),he),Ee=(f(ye={},exports.V2AddLiquidityType.INITIAL,3),f(ye,exports.V2AddLiquidityType.FLEXIBLE,3),f(ye,exports.V2AddLiquidityType.SINGLE,2),ye);function Se(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function Ne(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Se({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return q({decimalPlaces:5},Math.abs(a/o-1))}function Oe(t){var e,n,r,s,a=t.reserves,o=t.totalFeeShare,i=t.asset1Amount,u=t.asset2Amount,c=t.decimals,p=a.asset1*a.asset2,l=a.asset1+BigInt(i),d=a.asset2+BigInt(u),f=l*d,m=BigInt(parseInt(String(Math.sqrt(Number(f*a.issuedLiquidity*a.issuedLiquidity/p))))),g=m-a.issuedLiquidity,I=g*l/m,A=g*d/m,x=BigInt(i)-I,T=BigInt(u)-A;if(x>T){var h=x;r=BigInt(Math.abs(Math.min(Number(T),0))),e=!0,n=h+(s=ke(h,o)),g-=s*m/(l*BigInt(2))}else{var y=T;r=BigInt(Math.abs(Math.min(Number(x),0))),e=!1,n=y+(s=ke(y,o)),g-=s*m/(d*BigInt(2))}return{poolTokenAssetAmount:g,swapFromAsset1ToAsset2:e,swapInAmount:n,swapOutAmount:r,swapTotalFeeAmount:s,swapPriceImpact:Ne({inputSupply:e?a.asset1:a.asset2,outputSupply:e?a.asset2:a.asset1,assetIn:{amount:n,decimals:c.asset1},assetOut:{amount:r,decimals:c.asset2}})}}function Pe(t,e){if(!t.amount||!e.amount)throw new Error("Both assets are required for the initial add liquidity");return BigInt(Math.floor(Math.abs(Math.sqrt(Number(t.amount)*Number(e.amount))-1e3)))}function ke(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Le(e){return(be[e]+1)*t.ALGORAND_MIN_TX_FEE}var Fe=$("add_liquidity"),Be=(f(we={},it.V1_1,[$("mint")]),f(we,it.V2,{INITIAL_LIQUIDITY:[$("add_initial_liquidity")],SINGLE_ASSET_MODE:[Fe,$("single")],FLEXIBLE_MODE:[Fe,$("flexible")]}),we);function Re(){return(Re=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=Q("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:dt(a,it.V1_1),appArgs:Be.v1_1,accounts:[d],note:pt.getAppCallTxnNoteWithClientName(it.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),T=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),h=r.default.assignGroupID([T,g,I,A,x]),t.abrupt("return",[{txn:h[0],signers:[d]},{txn:h[1],signers:[o]},{txn:h[2],signers:[d]},{txn:h[3],signers:[d]},{txn:h[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(){return(Me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=v(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ce(){return(Ce=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,Et({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,J(n,[a]);case 8:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=K(s),I=H(s),t.next=17,Et({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(T=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&T.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),T;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var Ve=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=os+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function vn(){return(vn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:pt.getAppCallTxnNoteWithClientName(it.V2),appArgs:[en,r.default.encodeUint64(Q("negative",l,c)),r.default.encodeUint64(Q("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[$e.ASSET_TRANSFER_TXN]=g,A[$e.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[$e.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[$e.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _n(){return(_n=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,T=Q("negative",l,p),c!==f){e.next=17;break}A=T,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=T,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return h=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(y=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:pt.getAppCallTxnNoteWithClientName(it.V2),appArgs:[en,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(v=[])[$e.ASSET_TRANSFER_TXN]=h,v[$e.APP_CALL_TXN]=y,_=r.default.assignGroupID(v),e.abrupt("return",[{txn:_[$e.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[$e.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wn(){return(wn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.client,s=e.txGroup,a=e.signedTxns,t.next=3,J(r,[a]);case 3:return o=t.sent,u=v(o,1),c=u[0].txnID,t.next=8,ue(r,s);case 8:if(t.t1=n=t.sent,t.t0=null===t.t1,t.t0){t.next=12;break}t.t0=void 0===n;case 12:if(!t.t0){t.next=16;break}t.t2=void 0,t.next=17;break;case 16:t.t2=n.map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}}));case 17:return p=t.t2,t.abrupt("return",{outputAssets:p,txnID:c});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Dn,bn,En={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=yn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=yn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=hn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=hn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,T=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:T}}}return e},generateTxns:function(t){return vn.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return _n.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return wn.apply(this,arguments)}},Sn=(f(Dn={},it.V1_1,pn),f(Dn,it.V2,En),Dn),Nn=3n,On=1000n;function Pn(){return(Pn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=v(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===bn.FEE_TXN_INDEX?c:e===bn.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function kn(){return(kn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return d=t.sent,f=a.account.address(),m=[$("swap"),o===exports.SwapType.FixedInput?$("fi"):$("fo")],g=r.default.makeApplicationNoOpTxnFromObject({from:f,appIndex:a.validatorAppID,appArgs:m,accounts:[l],note:pt.getAppCallTxnNoteWithClientName(it.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:d}),I=o===exports.SwapType.FixedOutput?Q("positive",p,u.amount):u.amount,A=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:I,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:f,assetIndex:u.id,amount:I,suggestedParams:d}),x=o===exports.SwapType.FixedInput?Q("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:f,to:l,amount:x,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:f,to:l,assetIndex:c.id,amount:x,suggestedParams:d}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:g.fee+T.fee,note:s,suggestedParams:d}),y=r.default.assignGroupID([h,g,A,T]),t.abrupt("return",[{txn:y[0],signers:[l]},{txn:y[1],signers:[f]},{txn:y[2],signers:[l]},{txn:y[3],signers:[f]}]);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ln(t){var e,n,r,s=t.pool,a=t.reserves,i=t.assetIn,u=t.decimals,c=BigInt(i.amount);i.id===s.asset1ID?(e=s.asset2ID,n=a.asset1,r=a.asset2):(e=s.asset1ID,n=a.asset2,r=a.asset1);var p=c*Nn/On,l=r-n*r/(n+(c-p));if(l>r)throw new Error("Output amount exceeds available liquidity.");var d={assetIn:{amount:c,decimals:u.assetIn},assetOut:{amount:l,decimals:u.assetOut}};return{round:a.round,assetInID:i.id,assetInAmount:c,assetOutID:e,assetOutAmount:l,swapFee:Number(p),rate:Se(d),priceImpact:Ne(o({inputSupply:n,outputSupply:r},d))}}function Fn(t){return Bn.apply(this,arguments)}function Bn(){return(Bn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,Et({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,J(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,Et({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Rn(t){var e,n,r,s=t.pool,a=t.reserves,o=t.assetOut,i=t.decimals,u=BigInt(o.amount);if(o.id===s.asset1ID?(e=s.asset2ID,n=a.asset2,r=a.asset1):(e=s.asset1ID,n=a.asset1,r=a.asset2),u>r)throw new Error("Output amount exceeds available liquidity.");var c=n*r/(r-u)-n,p=c*On/(On-Nn),l=p-c,d=G(i.assetOut,Number(u))/G(i.assetIn,Number(p)),f=G(i.assetOut,Number(r))/G(i.assetIn,Number(n)),m=q({decimalPlaces:5},Math.abs(d/f-1));return{round:a.round,assetInID:e,assetInAmount:p,assetOutID:o.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Mn(t){return Cn.apply(this,arguments)}function Cn(){return(Cn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,Et({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,J(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,Et({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Vn(){return(Vn=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[bn.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[bn.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Fn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Mn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:H(a),fees:K(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(bn||(bn={}));var Xn,jn={getQuote:function(t,e,n,r,s){if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,asset:r},"Trying to swap on a non-existent pool");return t===exports.SwapType.FixedInput?Ln({pool:e,reserves:n,assetIn:r,decimals:s}):Rn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Ln,getFixedOutputSwapQuote:Rn,generateTxns:function(t){return kn.apply(this,arguments)},signTxns:function(t){return Pn.apply(this,arguments)},execute:function(t){return Vn.apply(this,arguments)},executeFixedOutputSwap:Mn},Un=4*t.ALGORAND_MIN_TX_FEE;function Qn(t){return t.filter((function(t){return!Qt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Gn=(f(Xn={},it.V1_1,jn),f(Xn,it.V2,hn),f(Xn,"getQuote",(function(t){if(t.pools.every((function(t){return Qt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?(n=(e=t).pools,r=e.assetIn,s=e.assetOut,a=e.amount,Qn(n.map((function(t){var e={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===it.V1_1?jn.getFixedInputSwapQuote(e):hn.getFixedInputSwapQuote(e)}})))):function(t){var e=t.pools,n=t.assetIn,r=t.assetOut,s=t.amount;return Qn(e.map((function(t){var e={pool:t.info,assetOut:{amount:s,id:Number(r.id)},decimals:{assetIn:n.decimals,assetOut:r.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===it.V1_1?jn.getFixedOutputSwapQuote(e):hn.getFixedOutputSwapQuote(e)}})))}(t);var e,n,r,s,a})),f(Xn,"generateTxns",(function(t){return t.pool.contractVersion===it.V1_1?jn.generateTxns(t):hn.generateTxns(t)})),f(Xn,"signTxns",(function(t){return t.pool.contractVersion===it.V1_1?jn.signTxns(t):hn.signTxns(t)})),f(Xn,"execute",(function(t){return t.contractVersion===it.V1_1?jn.execute(t):hn.execute(t)})),Xn);function qn(){return(qn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Wn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,J(n,[o]);case 7:return u=t.sent,c=v(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:K(s),confirmedRound:d,txnID:l,groupID:H(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Wn(t){return zn.apply(this,arguments)}function zn(){return(zn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=v(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Jn(){return Jn=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:K(e),groupID:H(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,J(n,[c]);case 4:p=s.sent,l=v(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),Jn.apply(this,arguments)}function Yn(){return(Yn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[$("redeem")],note:pt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Kn(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[$("commit"),u],note:L([$("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function Hn(){return(Hn=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=Kn({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[$("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=tt,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=Ze,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=xe,exports.CONTRACT_VERSION=it,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=et,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Sn,exports.Swap=Gn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=tn,exports.V2AddLiquidityTxnIndices=De,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=Q,exports.calculateAccountMinimumRequiredBalance=_t,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=zt,exports.prepareCommitTransactions=function(t){return Hn.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return Jn.apply(this,arguments)},exports.redeemExcessAsset=function(t){return qn.apply(this,arguments)},exports.sendAndWaitRawTransaction=J,exports.sumUpTxnFees=K,exports.tinymanContract_v1_1=It,exports.tinymanContract_v2=Tt,exports.tinymanJSSDKConfig=pt; +i=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new w(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(s,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===s)throw a;return b()}for(n.method=s,n.arg=a;;){var o=n.delegate;if(o){var i=y(o,n);if(i){if(i===l)continue;return i}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,o),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function d(){}function f(){}function m(){}var g={};u(g,s,(function(){return this}));var I=Object.getPrototypeOf,A=I&&I(I(D([])));A&&A!==e&&n.call(A,s)&&(g=A);var x=m.prototype=d.prototype=Object.create(g);function T(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function h(t,e){function r(s,a,o,i){var u=p(t[s],t,a);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,o,i)}),(function(t){r("throw",t,o,i)})):e.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return r("throw",t,o,i)}))}i(u.arg)}var s;this._invoke=function(t,n){function a(){return new e((function(e,s){r(t,n,e,s)}))}return s=s?s.then(a,a):a()}}function y(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,y(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=p(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var s=r.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function v(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(v,this),this.reset(!0)}function D(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,T(Error));var e=y(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return q({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=v(z(e),2),a=s[0],o=s[1],i=v(z(Math.round(Number(W(a,o+r)))),2),u=i[0],c=i[1];return Number(W(u,c-r))}return Math.round(e)}function W(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function z(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function J(t,e){return Y.apply(this,arguments)}function Y(){return(Y=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function K(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function H(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function Z(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function $(t){return(new TextEncoder).encode(t)}var tt={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151"},et={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function nt(){return(nt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function rt(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function st(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function at(t){return 0===Number(t)}var ot,it={V1_1:"v1_1",V2:"v2"},ut={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},ct={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},pt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return $("tinyman/".concat(t===it.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),lt=(f(ot={},it.V1_1,{testnet:62368684,mainnet:552635992}),f(ot,it.V2,{testnet:148607e3,mainnet:1002541853}),ot);function dt(t,e){var n=lt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function ft(){return(ft=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:dt(s,a),note:pt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:dt(s,a),note:pt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var gt=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),It=new(function(n){m(s,gt);var r=y(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=dt(n.network,it.V1_1),s=v(st(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:_t(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function vt(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function _t(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var wt,Dt,bt=$("e");function Et(t){return St.apply(this,arguments)}function St(){return(St=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:T=k({stateArray:x}),h=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.asset1ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.asset2ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.poolTokenID)])),_=T[h],w=T[y],D=T[v],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mkt)){n.next=49;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(kt,"]): ").concat(B.issuedLiquidity));case 49:return n.abrupt("return",B);case 50:case"end":return n.stop()}}),n,null,[[9,32,35,38]])})))).apply(this,arguments)}function Rt(){return Rt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,yt(n,r);case 6:return o=t.sent,u=vt(o,dt(s,it.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Ot[it.V1_1].asset1],asset2ID:u[Ot[it.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Rt.apply(this,arguments)}var Mt=Object.freeze({__proto__:null,getPoolInfo:Lt,getPoolReserves:function(t,e){return Bt.apply(this,arguments)},getPoolAssets:function(t){return Rt.apply(this,arguments)}});function Ct(t){return Vt.apply(this,arguments)}function Vt(){return(Vt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=ht(it.V2),u=o.generateLogicSigAccountForPool(e),c=dt(r,it.V2),p=u.address(),l=st(s,a),t.next=8,yt(n,p);case 8:return d=t.sent,f=vt(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:it.V2},f&&(m.asset1ProtocolFees=BigInt(f[Ot.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Ot.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Ot.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Ot.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Ot.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Ot.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Ot.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Ot.v2.totalFeeShare]),m.poolTokenID=Number(f[Ot.v2.poolTokenID]),m.asset1ID=Number(f[Ot.v2.asset1]),m.asset2ID=Number(f[Ot.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,yt(e,n.account.address());case 2:return r=t.sent,s=vt(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Ot.v2.asset1Reserves]),a.asset2=BigInt(s[Ot.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Ot.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,yt(n,r);case 3:return a=t.sent,o=vt(a,dt(s,it.V2)),u=null,o&&(u={asset1ID:o[Ot[it.V2].asset1],asset2ID:o[Ot[it.V2].asset2],poolTokenID:o[Ot[it.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ut=Object.freeze({__proto__:null,getPoolInfo:Ct,getPoolReserves:function(t,e){return Xt.apply(this,arguments)},getPoolAssets:function(t){return jt.apply(this,arguments)}});function Qt(t){return Boolean(t&&!(t.asset1+t.asset2))}var Gt,qt,Wt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Qt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Qt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Lt(t),Ct(t)])}}),zt=o((f(Gt={},it.V1_1,o(o({},Mt),Wt)),f(Gt,it.V2,o(o({},Ut),Wt)),Gt),Wt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(qt||(qt={}));var Jt=96e4,Yt=859e3;function Kt(){return(Kt=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=rt(a,o),l=v(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=at(I),T=dt(s,it.V1_1),h=It.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),y=h.address(),_=r.default.makeApplicationOptInTxnFromObject({from:y,appIndex:T,note:pt.getAppCallTxnNoteWithClientName(it.V1_1),appArgs:[$("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:y,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:et.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:y,amount:Ht(x),suggestedParams:c}),(E=[])[qt.FUNDING_TXN]=b,E[qt.VALIDATOR_APP_CALL]=_,E[qt.POOL_TOKEN_CREATE]=w,E[qt.ASSET1_OPT_IN]=D,x||(E[qt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[qt.FUNDING_TXN],signers:[u]},{txn:S[qt.VALIDATOR_APP_CALL],signers:[y]},{txn:S[qt.POOL_TOKEN_CREATE],signers:[y]},{txn:S[qt.ASSET1_OPT_IN],signers:[y]}],S[qt.ASSET2_OPT_IN]&&N.push({txn:S[qt.ASSET2_OPT_IN],signers:[y]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ht(t){return t?Jt:Yt}function Zt(){return(Zt=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=st(o,u),f=v(d,2),m=f[0],g=f[1],I=It.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===qt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function $t(t){return te.apply(this,arguments)}function te(){return(te=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[qt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,$t({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",zt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var ne,re={generateTxns:function(t){return Kt.apply(this,arguments)},signTxns:function(t){return Zt.apply(this,arguments)},execute:function(t){return ee.apply(this,arguments)},getBootstrapFundingTxnAmount:Ht};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(ne||(ne={}));var se=5,ae=6;function oe(t,e){return ie.apply(this,arguments)}function ie(){return(ie=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ue(t,e){return ce.apply(this,arguments)}function ce(){return(ce=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,oe(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function pe(){return(pe=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=dt(a,it.V2),d=t.getApplicationAddress(l),f=rt(o,u),m=v(f,2),g=m[0].id,I=m[1].id,e.next=9,zt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=Tt.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),T=at(I),(h=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[$("bootstrap")],note:pt.getAppCallTxnNoteWithClientName(it.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=de(T),y=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:le(T),suggestedParams:p}),(_=[])[ne.FUNDING_TXN]=y,_[ne.VALIDATOR_APP_CALL]=h,w=r.default.assignGroupID(_),(D=[])[ne.FUNDING_TXN]={txn:w[ne.FUNDING_TXN],signers:[c]},D[ne.VALIDATOR_APP_CALL]={txn:w[ne.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function le(t){return function(t,e){var n=ht(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(it.V2,t)+de(t)+1e5}function de(e){return((e?se:ae)+1)*t.ALGORAND_MIN_TX_FEE}function fe(){return(fe=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=st(o,u),f=v(d,2),m=f[0],g=f[1],I=Tt.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===ne.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function me(){return(me=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,oe(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Ot.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",zt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var ge,Ie={generateTxns:function(t){return pe.apply(this,arguments)},signTxns:function(t){return fe.apply(this,arguments)},execute:function(t){return me.apply(this,arguments)},getBootstrapFundingTxnAmount:le,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+le(e)}};var Ae,xe=(f(ge={},it.V1_1,re),f(ge,it.V2,Ie),f(ge,"generateTxns",(function(t){return t.contractVersion===it.V1_1?re.generateTxns(t):Ie.generateTxns(t)})),f(ge,"signTxns",(function(t){return t.contractVersion===it.V1_1?re.signTxns(t):Ie.signTxns(t)})),f(ge,"execute",(function(t){return t.contractVersion===it.V1_1?re.execute(t):Ie.execute(t)})),f(ge,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===it.V1_1?re.getBootstrapFundingTxnAmount(n):Ie.getBootstrapFundingTxnAmount(n)})),ge);exports.V1_1AddLiquidityTxnIndices=void 0,(Ae=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[Ae.FEE_TXN=0]="FEE_TXN",Ae[Ae.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",Ae[Ae.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",Ae[Ae.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",Ae[Ae.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var Te,he,ye,ve,_e=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(ve=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",ve.FLEXIBLE="flexible",ve.INITIAL="initial";var we,De=(f(Te={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(Te,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(Te,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),Te),be=(f(he={},exports.V2AddLiquidityType.INITIAL,1),f(he,exports.V2AddLiquidityType.SINGLE,2),f(he,exports.V2AddLiquidityType.FLEXIBLE,2),he),Ee=(f(ye={},exports.V2AddLiquidityType.INITIAL,3),f(ye,exports.V2AddLiquidityType.FLEXIBLE,3),f(ye,exports.V2AddLiquidityType.SINGLE,2),ye);function Se(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function Ne(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Se({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return q({decimalPlaces:5},Math.abs(a/o-1))}function Oe(t){var e,n,r,s,a=t.reserves,o=t.totalFeeShare,i=t.asset1Amount,u=t.asset2Amount,c=t.decimals,p=a.asset1*a.asset2,l=a.asset1+BigInt(i),d=a.asset2+BigInt(u),f=l*d,m=BigInt(parseInt(String(Math.sqrt(Number(f*a.issuedLiquidity*a.issuedLiquidity/p))))),g=m-a.issuedLiquidity,I=g*l/m,A=g*d/m,x=BigInt(i)-I,T=BigInt(u)-A;if(x>T){var h=x;r=BigInt(Math.abs(Math.min(Number(T),0))),e=!0,n=h+(s=ke(h,o)),g-=s*m/(l*BigInt(2))}else{var y=T;r=BigInt(Math.abs(Math.min(Number(x),0))),e=!1,n=y+(s=ke(y,o)),g-=s*m/(d*BigInt(2))}return{poolTokenAssetAmount:g,swapFromAsset1ToAsset2:e,swapInAmount:n,swapOutAmount:r,swapTotalFeeAmount:s,swapPriceImpact:Ne({inputSupply:e?a.asset1:a.asset2,outputSupply:e?a.asset2:a.asset1,assetIn:{amount:n,decimals:c.asset1},assetOut:{amount:r,decimals:c.asset2}})}}function Pe(t,e){if(!t.amount||!e.amount)throw new Error("Both assets are required for the initial add liquidity");return BigInt(Math.floor(Math.abs(Math.sqrt(Number(t.amount)*Number(e.amount))-1e3)))}function ke(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Le(e){return(be[e]+1)*t.ALGORAND_MIN_TX_FEE}var Fe=$("add_liquidity"),Be=(f(we={},it.V1_1,[$("mint")]),f(we,it.V2,{INITIAL_LIQUIDITY:[$("add_initial_liquidity")],SINGLE_ASSET_MODE:[Fe,$("single")],FLEXIBLE_MODE:[Fe,$("flexible")]}),we);function Re(){return(Re=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=Q("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:dt(a,it.V1_1),appArgs:Be.v1_1,accounts:[d],note:pt.getAppCallTxnNoteWithClientName(it.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),T=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),h=r.default.assignGroupID([T,g,I,A,x]),t.abrupt("return",[{txn:h[0],signers:[d]},{txn:h[1],signers:[o]},{txn:h[2],signers:[d]},{txn:h[3],signers:[d]},{txn:h[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(){return(Me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=v(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ce(){return(Ce=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,Et({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,J(n,[a]);case 8:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=K(s),I=H(s),t.next=17,Et({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(T=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&T.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),T;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var Ve=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=os+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function vn(){return(vn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:pt.getAppCallTxnNoteWithClientName(it.V2),appArgs:[en,r.default.encodeUint64(Q("negative",l,c)),r.default.encodeUint64(Q("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[$e.ASSET_TRANSFER_TXN]=g,A[$e.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[$e.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[$e.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _n(){return(_n=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,T=Q("negative",l,p),c!==f){e.next=17;break}A=T,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=T,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return h=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(y=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:pt.getAppCallTxnNoteWithClientName(it.V2),appArgs:[en,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(v=[])[$e.ASSET_TRANSFER_TXN]=h,v[$e.APP_CALL_TXN]=y,_=r.default.assignGroupID(v),e.abrupt("return",[{txn:_[$e.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[$e.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wn(){return(wn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.client,s=e.txGroup,a=e.signedTxns,t.next=3,J(r,[a]);case 3:return o=t.sent,u=v(o,1),c=u[0].txnID,t.next=8,ue(r,s);case 8:if(t.t1=n=t.sent,t.t0=null===t.t1,t.t0){t.next=12;break}t.t0=void 0===n;case 12:if(!t.t0){t.next=16;break}t.t2=void 0,t.next=17;break;case 16:t.t2=n.map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}}));case 17:return p=t.t2,t.abrupt("return",{outputAssets:p,txnID:c});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Dn,bn,En={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=yn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=yn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=hn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=hn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,T=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:T}}}return e},generateTxns:function(t){return vn.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return _n.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return wn.apply(this,arguments)}},Sn=(f(Dn={},it.V1_1,pn),f(Dn,it.V2,En),Dn),Nn=3n,On=1000n;function Pn(){return(Pn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=v(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===bn.FEE_TXN_INDEX?c:e===bn.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function kn(){return(kn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return d=t.sent,f=a.account.address(),m=[$("swap"),o===exports.SwapType.FixedInput?$("fi"):$("fo")],g=r.default.makeApplicationNoOpTxnFromObject({from:f,appIndex:a.validatorAppID,appArgs:m,accounts:[l],note:pt.getAppCallTxnNoteWithClientName(it.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:d}),I=o===exports.SwapType.FixedOutput?Q("positive",p,u.amount):u.amount,A=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:I,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:f,assetIndex:u.id,amount:I,suggestedParams:d}),x=o===exports.SwapType.FixedInput?Q("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:f,to:l,amount:x,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:f,to:l,assetIndex:c.id,amount:x,suggestedParams:d}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:g.fee+T.fee,note:s,suggestedParams:d}),y=r.default.assignGroupID([h,g,A,T]),t.abrupt("return",[{txn:y[0],signers:[l]},{txn:y[1],signers:[f]},{txn:y[2],signers:[l]},{txn:y[3],signers:[f]}]);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ln(t){var e,n,r,s=t.pool,a=t.reserves,i=t.assetIn,u=t.decimals,c=BigInt(i.amount);i.id===s.asset1ID?(e=s.asset2ID,n=a.asset1,r=a.asset2):(e=s.asset1ID,n=a.asset2,r=a.asset1);var p=c*Nn/On,l=r-n*r/(n+(c-p));if(l>r)throw new Error("Output amount exceeds available liquidity.");var d={assetIn:{amount:c,decimals:u.assetIn},assetOut:{amount:l,decimals:u.assetOut}};return{round:a.round,assetInID:i.id,assetInAmount:c,assetOutID:e,assetOutAmount:l,swapFee:Number(p),rate:Se(d),priceImpact:Ne(o({inputSupply:n,outputSupply:r},d))}}function Fn(t){return Bn.apply(this,arguments)}function Bn(){return(Bn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,Et({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,J(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,Et({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Rn(t){var e,n,r,s=t.pool,a=t.reserves,o=t.assetOut,i=t.decimals,u=BigInt(o.amount);if(o.id===s.asset1ID?(e=s.asset2ID,n=a.asset2,r=a.asset1):(e=s.asset1ID,n=a.asset1,r=a.asset2),u>r)throw new Error("Output amount exceeds available liquidity.");var c=n*r/(r-u)-n,p=c*On/(On-Nn),l=p-c,d=G(i.assetOut,Number(u))/G(i.assetIn,Number(p)),f=G(i.assetOut,Number(r))/G(i.assetIn,Number(n)),m=q({decimalPlaces:5},Math.abs(d/f-1));return{round:a.round,assetInID:e,assetInAmount:p,assetOutID:o.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Mn(t){return Cn.apply(this,arguments)}function Cn(){return(Cn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,Et({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,J(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,Et({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Vn(){return(Vn=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[bn.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[bn.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Fn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Mn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:H(a),fees:K(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(bn||(bn={}));var Xn,jn={getQuote:function(t,e,n,r,s){if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,asset:r},"Trying to swap on a non-existent pool");return t===exports.SwapType.FixedInput?Ln({pool:e,reserves:n,assetIn:r,decimals:s}):Rn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Ln,getFixedOutputSwapQuote:Rn,generateTxns:function(t){return kn.apply(this,arguments)},signTxns:function(t){return Pn.apply(this,arguments)},execute:function(t){return Vn.apply(this,arguments)},executeFixedOutputSwap:Mn},Un=4*t.ALGORAND_MIN_TX_FEE;function Qn(t){return t.filter((function(t){return!Qt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Gn=(f(Xn={},it.V1_1,jn),f(Xn,it.V2,hn),f(Xn,"getQuote",(function(t){if(t.pools.every((function(t){return Qt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?(n=(e=t).pools,r=e.assetIn,s=e.assetOut,a=e.amount,Qn(n.map((function(t){var e={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===it.V1_1?jn.getFixedInputSwapQuote(e):hn.getFixedInputSwapQuote(e)}})))):function(t){var e=t.pools,n=t.assetIn,r=t.assetOut,s=t.amount;return Qn(e.map((function(t){var e={pool:t.info,assetOut:{amount:s,id:Number(r.id)},decimals:{assetIn:n.decimals,assetOut:r.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===it.V1_1?jn.getFixedOutputSwapQuote(e):hn.getFixedOutputSwapQuote(e)}})))}(t);var e,n,r,s,a})),f(Xn,"generateTxns",(function(t){return t.pool.contractVersion===it.V1_1?jn.generateTxns(t):hn.generateTxns(t)})),f(Xn,"signTxns",(function(t){return t.pool.contractVersion===it.V1_1?jn.signTxns(t):hn.signTxns(t)})),f(Xn,"execute",(function(t){return t.contractVersion===it.V1_1?jn.execute(t):hn.execute(t)})),Xn);function qn(){return(qn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Wn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,J(n,[o]);case 7:return u=t.sent,c=v(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:K(s),confirmedRound:d,txnID:l,groupID:H(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Wn(t){return zn.apply(this,arguments)}function zn(){return(zn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=v(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Jn(){return Jn=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:K(e),groupID:H(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,J(n,[c]);case 4:p=s.sent,l=v(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),Jn.apply(this,arguments)}function Yn(){return(Yn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[$("redeem")],note:pt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Kn(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[$("commit"),u],note:L([$("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function Hn(){return(Hn=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=Kn({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[$("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=tt,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=Ze,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=xe,exports.CONTRACT_VERSION=it,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=et,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Sn,exports.Swap=Gn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=tn,exports.V2AddLiquidityTxnIndices=De,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=Q,exports.calculateAccountMinimumRequiredBalance=_t,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=zt,exports.prepareCommitTransactions=function(t){return Hn.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return Jn.apply(this,arguments)},exports.redeemExcessAsset=function(t){return qn.apply(this,arguments)},exports.sendAndWaitRawTransaction=J,exports.sumUpTxnFees=K,exports.tinymanContract_v1_1=It,exports.tinymanContract_v2=Tt,exports.tinymanJSSDKConfig=pt; diff --git a/src/util/pool/v1_1/index.ts b/src/util/pool/v1_1/index.ts index d9fd88ba..70eb93f8 100644 --- a/src/util/pool/v1_1/index.ts +++ b/src/util/pool/v1_1/index.ts @@ -69,6 +69,8 @@ export async function getPoolReserves( ); const appsLocalState = info["apps-local-state"] || []; + console.log(info); + let outstandingAsset1 = 0n; let outstandingAsset2 = 0n; let outstandingPoolTokens = 0n; @@ -133,6 +135,10 @@ export async function getPoolReserves( const minBalance = getMinBalanceForAccount(info); asset2Balance = BigInt(info.amount) - minBalance; + + if (asset2Balance < 0n) { + asset2Balance = 0n; + } } const reserves: PoolReserves = { From 6afded2f4ad97a3f0a1df679e633a71458f3202c Mon Sep 17 00:00:00 2001 From: edizcelik Date: Fri, 3 Feb 2023 11:59:09 -0800 Subject: [PATCH 04/14] chore: Remove console.log --- dist/index.js | 2 +- src/util/pool/v1_1/index.ts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 8a740ee2..c89fb36e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("algosdk"),e=require("base64-js");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=n(t),s=Uint8Array.from([1]);function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,T(Error));var e=y(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return q({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=v(z(e),2),a=s[0],o=s[1],i=v(z(Math.round(Number(W(a,o+r)))),2),u=i[0],c=i[1];return Number(W(u,c-r))}return Math.round(e)}function W(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function z(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function J(t,e){return Y.apply(this,arguments)}function Y(){return(Y=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function K(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function H(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function Z(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function $(t){return(new TextEncoder).encode(t)}var tt={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151"},et={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function nt(){return(nt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function rt(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function st(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function at(t){return 0===Number(t)}var ot,it={V1_1:"v1_1",V2:"v2"},ut={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},ct={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},pt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return $("tinyman/".concat(t===it.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),lt=(f(ot={},it.V1_1,{testnet:62368684,mainnet:552635992}),f(ot,it.V2,{testnet:148607e3,mainnet:1002541853}),ot);function dt(t,e){var n=lt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function ft(){return(ft=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:dt(s,a),note:pt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:dt(s,a),note:pt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var gt=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),It=new(function(n){m(s,gt);var r=y(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=dt(n.network,it.V1_1),s=v(st(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:_t(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function vt(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function _t(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var wt,Dt,bt=$("e");function Et(t){return St.apply(this,arguments)}function St(){return(St=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:T=k({stateArray:x}),h=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.asset1ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.asset2ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.poolTokenID)])),_=T[h],w=T[y],D=T[v],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mkt)){n.next=49;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(kt,"]): ").concat(B.issuedLiquidity));case 49:return n.abrupt("return",B);case 50:case"end":return n.stop()}}),n,null,[[9,32,35,38]])})))).apply(this,arguments)}function Rt(){return Rt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,yt(n,r);case 6:return o=t.sent,u=vt(o,dt(s,it.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Ot[it.V1_1].asset1],asset2ID:u[Ot[it.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Rt.apply(this,arguments)}var Mt=Object.freeze({__proto__:null,getPoolInfo:Lt,getPoolReserves:function(t,e){return Bt.apply(this,arguments)},getPoolAssets:function(t){return Rt.apply(this,arguments)}});function Ct(t){return Vt.apply(this,arguments)}function Vt(){return(Vt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=ht(it.V2),u=o.generateLogicSigAccountForPool(e),c=dt(r,it.V2),p=u.address(),l=st(s,a),t.next=8,yt(n,p);case 8:return d=t.sent,f=vt(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:it.V2},f&&(m.asset1ProtocolFees=BigInt(f[Ot.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Ot.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Ot.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Ot.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Ot.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Ot.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Ot.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Ot.v2.totalFeeShare]),m.poolTokenID=Number(f[Ot.v2.poolTokenID]),m.asset1ID=Number(f[Ot.v2.asset1]),m.asset2ID=Number(f[Ot.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,yt(e,n.account.address());case 2:return r=t.sent,s=vt(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Ot.v2.asset1Reserves]),a.asset2=BigInt(s[Ot.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Ot.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,yt(n,r);case 3:return a=t.sent,o=vt(a,dt(s,it.V2)),u=null,o&&(u={asset1ID:o[Ot[it.V2].asset1],asset2ID:o[Ot[it.V2].asset2],poolTokenID:o[Ot[it.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ut=Object.freeze({__proto__:null,getPoolInfo:Ct,getPoolReserves:function(t,e){return Xt.apply(this,arguments)},getPoolAssets:function(t){return jt.apply(this,arguments)}});function Qt(t){return Boolean(t&&!(t.asset1+t.asset2))}var Gt,qt,Wt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Qt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Qt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Lt(t),Ct(t)])}}),zt=o((f(Gt={},it.V1_1,o(o({},Mt),Wt)),f(Gt,it.V2,o(o({},Ut),Wt)),Gt),Wt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(qt||(qt={}));var Jt=96e4,Yt=859e3;function Kt(){return(Kt=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=rt(a,o),l=v(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=at(I),T=dt(s,it.V1_1),h=It.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),y=h.address(),_=r.default.makeApplicationOptInTxnFromObject({from:y,appIndex:T,note:pt.getAppCallTxnNoteWithClientName(it.V1_1),appArgs:[$("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:y,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:et.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:y,amount:Ht(x),suggestedParams:c}),(E=[])[qt.FUNDING_TXN]=b,E[qt.VALIDATOR_APP_CALL]=_,E[qt.POOL_TOKEN_CREATE]=w,E[qt.ASSET1_OPT_IN]=D,x||(E[qt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[qt.FUNDING_TXN],signers:[u]},{txn:S[qt.VALIDATOR_APP_CALL],signers:[y]},{txn:S[qt.POOL_TOKEN_CREATE],signers:[y]},{txn:S[qt.ASSET1_OPT_IN],signers:[y]}],S[qt.ASSET2_OPT_IN]&&N.push({txn:S[qt.ASSET2_OPT_IN],signers:[y]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ht(t){return t?Jt:Yt}function Zt(){return(Zt=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=st(o,u),f=v(d,2),m=f[0],g=f[1],I=It.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===qt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function $t(t){return te.apply(this,arguments)}function te(){return(te=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[qt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,$t({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",zt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var ne,re={generateTxns:function(t){return Kt.apply(this,arguments)},signTxns:function(t){return Zt.apply(this,arguments)},execute:function(t){return ee.apply(this,arguments)},getBootstrapFundingTxnAmount:Ht};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(ne||(ne={}));var se=5,ae=6;function oe(t,e){return ie.apply(this,arguments)}function ie(){return(ie=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ue(t,e){return ce.apply(this,arguments)}function ce(){return(ce=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,oe(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function pe(){return(pe=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=dt(a,it.V2),d=t.getApplicationAddress(l),f=rt(o,u),m=v(f,2),g=m[0].id,I=m[1].id,e.next=9,zt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=Tt.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),T=at(I),(h=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[$("bootstrap")],note:pt.getAppCallTxnNoteWithClientName(it.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=de(T),y=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:le(T),suggestedParams:p}),(_=[])[ne.FUNDING_TXN]=y,_[ne.VALIDATOR_APP_CALL]=h,w=r.default.assignGroupID(_),(D=[])[ne.FUNDING_TXN]={txn:w[ne.FUNDING_TXN],signers:[c]},D[ne.VALIDATOR_APP_CALL]={txn:w[ne.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function le(t){return function(t,e){var n=ht(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(it.V2,t)+de(t)+1e5}function de(e){return((e?se:ae)+1)*t.ALGORAND_MIN_TX_FEE}function fe(){return(fe=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=st(o,u),f=v(d,2),m=f[0],g=f[1],I=Tt.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===ne.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function me(){return(me=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,oe(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Ot.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",zt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var ge,Ie={generateTxns:function(t){return pe.apply(this,arguments)},signTxns:function(t){return fe.apply(this,arguments)},execute:function(t){return me.apply(this,arguments)},getBootstrapFundingTxnAmount:le,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+le(e)}};var Ae,xe=(f(ge={},it.V1_1,re),f(ge,it.V2,Ie),f(ge,"generateTxns",(function(t){return t.contractVersion===it.V1_1?re.generateTxns(t):Ie.generateTxns(t)})),f(ge,"signTxns",(function(t){return t.contractVersion===it.V1_1?re.signTxns(t):Ie.signTxns(t)})),f(ge,"execute",(function(t){return t.contractVersion===it.V1_1?re.execute(t):Ie.execute(t)})),f(ge,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===it.V1_1?re.getBootstrapFundingTxnAmount(n):Ie.getBootstrapFundingTxnAmount(n)})),ge);exports.V1_1AddLiquidityTxnIndices=void 0,(Ae=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[Ae.FEE_TXN=0]="FEE_TXN",Ae[Ae.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",Ae[Ae.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",Ae[Ae.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",Ae[Ae.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var Te,he,ye,ve,_e=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(ve=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",ve.FLEXIBLE="flexible",ve.INITIAL="initial";var we,De=(f(Te={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(Te,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(Te,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),Te),be=(f(he={},exports.V2AddLiquidityType.INITIAL,1),f(he,exports.V2AddLiquidityType.SINGLE,2),f(he,exports.V2AddLiquidityType.FLEXIBLE,2),he),Ee=(f(ye={},exports.V2AddLiquidityType.INITIAL,3),f(ye,exports.V2AddLiquidityType.FLEXIBLE,3),f(ye,exports.V2AddLiquidityType.SINGLE,2),ye);function Se(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function Ne(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Se({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return q({decimalPlaces:5},Math.abs(a/o-1))}function Oe(t){var e,n,r,s,a=t.reserves,o=t.totalFeeShare,i=t.asset1Amount,u=t.asset2Amount,c=t.decimals,p=a.asset1*a.asset2,l=a.asset1+BigInt(i),d=a.asset2+BigInt(u),f=l*d,m=BigInt(parseInt(String(Math.sqrt(Number(f*a.issuedLiquidity*a.issuedLiquidity/p))))),g=m-a.issuedLiquidity,I=g*l/m,A=g*d/m,x=BigInt(i)-I,T=BigInt(u)-A;if(x>T){var h=x;r=BigInt(Math.abs(Math.min(Number(T),0))),e=!0,n=h+(s=ke(h,o)),g-=s*m/(l*BigInt(2))}else{var y=T;r=BigInt(Math.abs(Math.min(Number(x),0))),e=!1,n=y+(s=ke(y,o)),g-=s*m/(d*BigInt(2))}return{poolTokenAssetAmount:g,swapFromAsset1ToAsset2:e,swapInAmount:n,swapOutAmount:r,swapTotalFeeAmount:s,swapPriceImpact:Ne({inputSupply:e?a.asset1:a.asset2,outputSupply:e?a.asset2:a.asset1,assetIn:{amount:n,decimals:c.asset1},assetOut:{amount:r,decimals:c.asset2}})}}function Pe(t,e){if(!t.amount||!e.amount)throw new Error("Both assets are required for the initial add liquidity");return BigInt(Math.floor(Math.abs(Math.sqrt(Number(t.amount)*Number(e.amount))-1e3)))}function ke(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Le(e){return(be[e]+1)*t.ALGORAND_MIN_TX_FEE}var Fe=$("add_liquidity"),Be=(f(we={},it.V1_1,[$("mint")]),f(we,it.V2,{INITIAL_LIQUIDITY:[$("add_initial_liquidity")],SINGLE_ASSET_MODE:[Fe,$("single")],FLEXIBLE_MODE:[Fe,$("flexible")]}),we);function Re(){return(Re=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=Q("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:dt(a,it.V1_1),appArgs:Be.v1_1,accounts:[d],note:pt.getAppCallTxnNoteWithClientName(it.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),T=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),h=r.default.assignGroupID([T,g,I,A,x]),t.abrupt("return",[{txn:h[0],signers:[d]},{txn:h[1],signers:[o]},{txn:h[2],signers:[d]},{txn:h[3],signers:[d]},{txn:h[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(){return(Me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=v(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ce(){return(Ce=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,Et({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,J(n,[a]);case 8:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=K(s),I=H(s),t.next=17,Et({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(T=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&T.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),T;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var Ve=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=os+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function vn(){return(vn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:pt.getAppCallTxnNoteWithClientName(it.V2),appArgs:[en,r.default.encodeUint64(Q("negative",l,c)),r.default.encodeUint64(Q("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[$e.ASSET_TRANSFER_TXN]=g,A[$e.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[$e.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[$e.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _n(){return(_n=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,T=Q("negative",l,p),c!==f){e.next=17;break}A=T,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=T,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return h=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(y=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:pt.getAppCallTxnNoteWithClientName(it.V2),appArgs:[en,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(v=[])[$e.ASSET_TRANSFER_TXN]=h,v[$e.APP_CALL_TXN]=y,_=r.default.assignGroupID(v),e.abrupt("return",[{txn:_[$e.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[$e.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wn(){return(wn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.client,s=e.txGroup,a=e.signedTxns,t.next=3,J(r,[a]);case 3:return o=t.sent,u=v(o,1),c=u[0].txnID,t.next=8,ue(r,s);case 8:if(t.t1=n=t.sent,t.t0=null===t.t1,t.t0){t.next=12;break}t.t0=void 0===n;case 12:if(!t.t0){t.next=16;break}t.t2=void 0,t.next=17;break;case 16:t.t2=n.map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}}));case 17:return p=t.t2,t.abrupt("return",{outputAssets:p,txnID:c});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Dn,bn,En={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=yn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=yn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=hn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=hn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,T=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:T}}}return e},generateTxns:function(t){return vn.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return _n.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return wn.apply(this,arguments)}},Sn=(f(Dn={},it.V1_1,pn),f(Dn,it.V2,En),Dn),Nn=3n,On=1000n;function Pn(){return(Pn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=v(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===bn.FEE_TXN_INDEX?c:e===bn.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function kn(){return(kn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return d=t.sent,f=a.account.address(),m=[$("swap"),o===exports.SwapType.FixedInput?$("fi"):$("fo")],g=r.default.makeApplicationNoOpTxnFromObject({from:f,appIndex:a.validatorAppID,appArgs:m,accounts:[l],note:pt.getAppCallTxnNoteWithClientName(it.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:d}),I=o===exports.SwapType.FixedOutput?Q("positive",p,u.amount):u.amount,A=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:I,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:f,assetIndex:u.id,amount:I,suggestedParams:d}),x=o===exports.SwapType.FixedInput?Q("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:f,to:l,amount:x,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:f,to:l,assetIndex:c.id,amount:x,suggestedParams:d}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:g.fee+T.fee,note:s,suggestedParams:d}),y=r.default.assignGroupID([h,g,A,T]),t.abrupt("return",[{txn:y[0],signers:[l]},{txn:y[1],signers:[f]},{txn:y[2],signers:[l]},{txn:y[3],signers:[f]}]);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ln(t){var e,n,r,s=t.pool,a=t.reserves,i=t.assetIn,u=t.decimals,c=BigInt(i.amount);i.id===s.asset1ID?(e=s.asset2ID,n=a.asset1,r=a.asset2):(e=s.asset1ID,n=a.asset2,r=a.asset1);var p=c*Nn/On,l=r-n*r/(n+(c-p));if(l>r)throw new Error("Output amount exceeds available liquidity.");var d={assetIn:{amount:c,decimals:u.assetIn},assetOut:{amount:l,decimals:u.assetOut}};return{round:a.round,assetInID:i.id,assetInAmount:c,assetOutID:e,assetOutAmount:l,swapFee:Number(p),rate:Se(d),priceImpact:Ne(o({inputSupply:n,outputSupply:r},d))}}function Fn(t){return Bn.apply(this,arguments)}function Bn(){return(Bn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,Et({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,J(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,Et({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Rn(t){var e,n,r,s=t.pool,a=t.reserves,o=t.assetOut,i=t.decimals,u=BigInt(o.amount);if(o.id===s.asset1ID?(e=s.asset2ID,n=a.asset2,r=a.asset1):(e=s.asset1ID,n=a.asset1,r=a.asset2),u>r)throw new Error("Output amount exceeds available liquidity.");var c=n*r/(r-u)-n,p=c*On/(On-Nn),l=p-c,d=G(i.assetOut,Number(u))/G(i.assetIn,Number(p)),f=G(i.assetOut,Number(r))/G(i.assetIn,Number(n)),m=q({decimalPlaces:5},Math.abs(d/f-1));return{round:a.round,assetInID:e,assetInAmount:p,assetOutID:o.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Mn(t){return Cn.apply(this,arguments)}function Cn(){return(Cn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,Et({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,J(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,Et({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Vn(){return(Vn=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[bn.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[bn.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Fn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Mn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:H(a),fees:K(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(bn||(bn={}));var Xn,jn={getQuote:function(t,e,n,r,s){if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,asset:r},"Trying to swap on a non-existent pool");return t===exports.SwapType.FixedInput?Ln({pool:e,reserves:n,assetIn:r,decimals:s}):Rn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Ln,getFixedOutputSwapQuote:Rn,generateTxns:function(t){return kn.apply(this,arguments)},signTxns:function(t){return Pn.apply(this,arguments)},execute:function(t){return Vn.apply(this,arguments)},executeFixedOutputSwap:Mn},Un=4*t.ALGORAND_MIN_TX_FEE;function Qn(t){return t.filter((function(t){return!Qt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Gn=(f(Xn={},it.V1_1,jn),f(Xn,it.V2,hn),f(Xn,"getQuote",(function(t){if(t.pools.every((function(t){return Qt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?(n=(e=t).pools,r=e.assetIn,s=e.assetOut,a=e.amount,Qn(n.map((function(t){var e={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===it.V1_1?jn.getFixedInputSwapQuote(e):hn.getFixedInputSwapQuote(e)}})))):function(t){var e=t.pools,n=t.assetIn,r=t.assetOut,s=t.amount;return Qn(e.map((function(t){var e={pool:t.info,assetOut:{amount:s,id:Number(r.id)},decimals:{assetIn:n.decimals,assetOut:r.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===it.V1_1?jn.getFixedOutputSwapQuote(e):hn.getFixedOutputSwapQuote(e)}})))}(t);var e,n,r,s,a})),f(Xn,"generateTxns",(function(t){return t.pool.contractVersion===it.V1_1?jn.generateTxns(t):hn.generateTxns(t)})),f(Xn,"signTxns",(function(t){return t.pool.contractVersion===it.V1_1?jn.signTxns(t):hn.signTxns(t)})),f(Xn,"execute",(function(t){return t.contractVersion===it.V1_1?jn.execute(t):hn.execute(t)})),Xn);function qn(){return(qn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Wn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,J(n,[o]);case 7:return u=t.sent,c=v(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:K(s),confirmedRound:d,txnID:l,groupID:H(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Wn(t){return zn.apply(this,arguments)}function zn(){return(zn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=v(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Jn(){return Jn=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:K(e),groupID:H(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,J(n,[c]);case 4:p=s.sent,l=v(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),Jn.apply(this,arguments)}function Yn(){return(Yn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[$("redeem")],note:pt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Kn(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[$("commit"),u],note:L([$("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function Hn(){return(Hn=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=Kn({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[$("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=tt,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=Ze,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=xe,exports.CONTRACT_VERSION=it,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=et,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Sn,exports.Swap=Gn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=tn,exports.V2AddLiquidityTxnIndices=De,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=Q,exports.calculateAccountMinimumRequiredBalance=_t,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=zt,exports.prepareCommitTransactions=function(t){return Hn.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return Jn.apply(this,arguments)},exports.redeemExcessAsset=function(t){return qn.apply(this,arguments)},exports.sendAndWaitRawTransaction=J,exports.sumUpTxnFees=K,exports.tinymanContract_v1_1=It,exports.tinymanContract_v2=Tt,exports.tinymanJSSDKConfig=pt; +i=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new w(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(s,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===s)throw a;return b()}for(n.method=s,n.arg=a;;){var o=n.delegate;if(o){var i=y(o,n);if(i){if(i===l)continue;return i}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,o),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function d(){}function f(){}function m(){}var g={};u(g,s,(function(){return this}));var I=Object.getPrototypeOf,A=I&&I(I(D([])));A&&A!==e&&n.call(A,s)&&(g=A);var x=m.prototype=d.prototype=Object.create(g);function T(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function h(t,e){function r(s,a,o,i){var u=p(t[s],t,a);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,o,i)}),(function(t){r("throw",t,o,i)})):e.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return r("throw",t,o,i)}))}i(u.arg)}var s;this._invoke=function(t,n){function a(){return new e((function(e,s){r(t,n,e,s)}))}return s=s?s.then(a,a):a()}}function y(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,y(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=p(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var s=r.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function v(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(v,this),this.reset(!0)}function D(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,T(Error));var e=y(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return q({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=v(z(e),2),a=s[0],o=s[1],i=v(z(Math.round(Number(W(a,o+r)))),2),u=i[0],c=i[1];return Number(W(u,c-r))}return Math.round(e)}function W(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function z(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function J(t,e){return Y.apply(this,arguments)}function Y(){return(Y=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function K(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function H(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function Z(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function $(t){return(new TextEncoder).encode(t)}var tt={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151"},et={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function nt(){return(nt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function rt(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function st(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function at(t){return 0===Number(t)}var ot,it={V1_1:"v1_1",V2:"v2"},ut={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},ct={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},pt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return $("tinyman/".concat(t===it.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),lt=(f(ot={},it.V1_1,{testnet:62368684,mainnet:552635992}),f(ot,it.V2,{testnet:148607e3,mainnet:1002541853}),ot);function dt(t,e){var n=lt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function ft(){return(ft=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:dt(s,a),note:pt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:dt(s,a),note:pt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var gt=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),It=new(function(n){m(s,gt);var r=y(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=dt(n.network,it.V1_1),s=v(st(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:_t(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function vt(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function _t(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var wt,Dt,bt=$("e");function Et(t){return St.apply(this,arguments)}function St(){return(St=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:T=k({stateArray:x}),h=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.asset1ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.asset2ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,bt,r.default.encodeUint64(o.poolTokenID)])),_=T[h],w=T[y],D=T[v],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mkt)){n.next=48;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(kt,"]): ").concat(B.issuedLiquidity));case 48:return n.abrupt("return",B);case 49:case"end":return n.stop()}}),n,null,[[8,31,34,37]])})))).apply(this,arguments)}function Rt(){return Rt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,yt(n,r);case 6:return o=t.sent,u=vt(o,dt(s,it.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Ot[it.V1_1].asset1],asset2ID:u[Ot[it.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Rt.apply(this,arguments)}var Mt=Object.freeze({__proto__:null,getPoolInfo:Lt,getPoolReserves:function(t,e){return Bt.apply(this,arguments)},getPoolAssets:function(t){return Rt.apply(this,arguments)}});function Ct(t){return Vt.apply(this,arguments)}function Vt(){return(Vt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=ht(it.V2),u=o.generateLogicSigAccountForPool(e),c=dt(r,it.V2),p=u.address(),l=st(s,a),t.next=8,yt(n,p);case 8:return d=t.sent,f=vt(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:it.V2},f&&(m.asset1ProtocolFees=BigInt(f[Ot.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Ot.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Ot.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Ot.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Ot.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Ot.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Ot.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Ot.v2.totalFeeShare]),m.poolTokenID=Number(f[Ot.v2.poolTokenID]),m.asset1ID=Number(f[Ot.v2.asset1]),m.asset2ID=Number(f[Ot.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,yt(e,n.account.address());case 2:return r=t.sent,s=vt(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Ot.v2.asset1Reserves]),a.asset2=BigInt(s[Ot.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Ot.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,yt(n,r);case 3:return a=t.sent,o=vt(a,dt(s,it.V2)),u=null,o&&(u={asset1ID:o[Ot[it.V2].asset1],asset2ID:o[Ot[it.V2].asset2],poolTokenID:o[Ot[it.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ut=Object.freeze({__proto__:null,getPoolInfo:Ct,getPoolReserves:function(t,e){return Xt.apply(this,arguments)},getPoolAssets:function(t){return jt.apply(this,arguments)}});function Qt(t){return Boolean(t&&!(t.asset1+t.asset2))}var Gt,qt,Wt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Qt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Qt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Lt(t),Ct(t)])}}),zt=o((f(Gt={},it.V1_1,o(o({},Mt),Wt)),f(Gt,it.V2,o(o({},Ut),Wt)),Gt),Wt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(qt||(qt={}));var Jt=96e4,Yt=859e3;function Kt(){return(Kt=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=rt(a,o),l=v(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=at(I),T=dt(s,it.V1_1),h=It.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),y=h.address(),_=r.default.makeApplicationOptInTxnFromObject({from:y,appIndex:T,note:pt.getAppCallTxnNoteWithClientName(it.V1_1),appArgs:[$("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:y,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:et.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:y,amount:Ht(x),suggestedParams:c}),(E=[])[qt.FUNDING_TXN]=b,E[qt.VALIDATOR_APP_CALL]=_,E[qt.POOL_TOKEN_CREATE]=w,E[qt.ASSET1_OPT_IN]=D,x||(E[qt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[qt.FUNDING_TXN],signers:[u]},{txn:S[qt.VALIDATOR_APP_CALL],signers:[y]},{txn:S[qt.POOL_TOKEN_CREATE],signers:[y]},{txn:S[qt.ASSET1_OPT_IN],signers:[y]}],S[qt.ASSET2_OPT_IN]&&N.push({txn:S[qt.ASSET2_OPT_IN],signers:[y]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ht(t){return t?Jt:Yt}function Zt(){return(Zt=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=st(o,u),f=v(d,2),m=f[0],g=f[1],I=It.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===qt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function $t(t){return te.apply(this,arguments)}function te(){return(te=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[qt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,$t({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",zt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var ne,re={generateTxns:function(t){return Kt.apply(this,arguments)},signTxns:function(t){return Zt.apply(this,arguments)},execute:function(t){return ee.apply(this,arguments)},getBootstrapFundingTxnAmount:Ht};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(ne||(ne={}));var se=5,ae=6;function oe(t,e){return ie.apply(this,arguments)}function ie(){return(ie=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ue(t,e){return ce.apply(this,arguments)}function ce(){return(ce=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,oe(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function pe(){return(pe=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=dt(a,it.V2),d=t.getApplicationAddress(l),f=rt(o,u),m=v(f,2),g=m[0].id,I=m[1].id,e.next=9,zt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=Tt.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),T=at(I),(h=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[$("bootstrap")],note:pt.getAppCallTxnNoteWithClientName(it.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=de(T),y=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:le(T),suggestedParams:p}),(_=[])[ne.FUNDING_TXN]=y,_[ne.VALIDATOR_APP_CALL]=h,w=r.default.assignGroupID(_),(D=[])[ne.FUNDING_TXN]={txn:w[ne.FUNDING_TXN],signers:[c]},D[ne.VALIDATOR_APP_CALL]={txn:w[ne.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function le(t){return function(t,e){var n=ht(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(it.V2,t)+de(t)+1e5}function de(e){return((e?se:ae)+1)*t.ALGORAND_MIN_TX_FEE}function fe(){return(fe=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=st(o,u),f=v(d,2),m=f[0],g=f[1],I=Tt.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===ne.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function me(){return(me=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,oe(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Ot.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",zt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var ge,Ie={generateTxns:function(t){return pe.apply(this,arguments)},signTxns:function(t){return fe.apply(this,arguments)},execute:function(t){return me.apply(this,arguments)},getBootstrapFundingTxnAmount:le,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+le(e)}};var Ae,xe=(f(ge={},it.V1_1,re),f(ge,it.V2,Ie),f(ge,"generateTxns",(function(t){return t.contractVersion===it.V1_1?re.generateTxns(t):Ie.generateTxns(t)})),f(ge,"signTxns",(function(t){return t.contractVersion===it.V1_1?re.signTxns(t):Ie.signTxns(t)})),f(ge,"execute",(function(t){return t.contractVersion===it.V1_1?re.execute(t):Ie.execute(t)})),f(ge,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===it.V1_1?re.getBootstrapFundingTxnAmount(n):Ie.getBootstrapFundingTxnAmount(n)})),ge);exports.V1_1AddLiquidityTxnIndices=void 0,(Ae=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[Ae.FEE_TXN=0]="FEE_TXN",Ae[Ae.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",Ae[Ae.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",Ae[Ae.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",Ae[Ae.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var Te,he,ye,ve,_e=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(ve=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",ve.FLEXIBLE="flexible",ve.INITIAL="initial";var we,De=(f(Te={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(Te,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(Te,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),Te),be=(f(he={},exports.V2AddLiquidityType.INITIAL,1),f(he,exports.V2AddLiquidityType.SINGLE,2),f(he,exports.V2AddLiquidityType.FLEXIBLE,2),he),Ee=(f(ye={},exports.V2AddLiquidityType.INITIAL,3),f(ye,exports.V2AddLiquidityType.FLEXIBLE,3),f(ye,exports.V2AddLiquidityType.SINGLE,2),ye);function Se(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function Ne(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Se({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return q({decimalPlaces:5},Math.abs(a/o-1))}function Oe(t){var e,n,r,s,a=t.reserves,o=t.totalFeeShare,i=t.asset1Amount,u=t.asset2Amount,c=t.decimals,p=a.asset1*a.asset2,l=a.asset1+BigInt(i),d=a.asset2+BigInt(u),f=l*d,m=BigInt(parseInt(String(Math.sqrt(Number(f*a.issuedLiquidity*a.issuedLiquidity/p))))),g=m-a.issuedLiquidity,I=g*l/m,A=g*d/m,x=BigInt(i)-I,T=BigInt(u)-A;if(x>T){var h=x;r=BigInt(Math.abs(Math.min(Number(T),0))),e=!0,n=h+(s=ke(h,o)),g-=s*m/(l*BigInt(2))}else{var y=T;r=BigInt(Math.abs(Math.min(Number(x),0))),e=!1,n=y+(s=ke(y,o)),g-=s*m/(d*BigInt(2))}return{poolTokenAssetAmount:g,swapFromAsset1ToAsset2:e,swapInAmount:n,swapOutAmount:r,swapTotalFeeAmount:s,swapPriceImpact:Ne({inputSupply:e?a.asset1:a.asset2,outputSupply:e?a.asset2:a.asset1,assetIn:{amount:n,decimals:c.asset1},assetOut:{amount:r,decimals:c.asset2}})}}function Pe(t,e){if(!t.amount||!e.amount)throw new Error("Both assets are required for the initial add liquidity");return BigInt(Math.floor(Math.abs(Math.sqrt(Number(t.amount)*Number(e.amount))-1e3)))}function ke(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Le(e){return(be[e]+1)*t.ALGORAND_MIN_TX_FEE}var Fe=$("add_liquidity"),Be=(f(we={},it.V1_1,[$("mint")]),f(we,it.V2,{INITIAL_LIQUIDITY:[$("add_initial_liquidity")],SINGLE_ASSET_MODE:[Fe,$("single")],FLEXIBLE_MODE:[Fe,$("flexible")]}),we);function Re(){return(Re=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=Q("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:dt(a,it.V1_1),appArgs:Be.v1_1,accounts:[d],note:pt.getAppCallTxnNoteWithClientName(it.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),T=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),h=r.default.assignGroupID([T,g,I,A,x]),t.abrupt("return",[{txn:h[0],signers:[d]},{txn:h[1],signers:[o]},{txn:h[2],signers:[d]},{txn:h[3],signers:[d]},{txn:h[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(){return(Me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=v(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ce(){return(Ce=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,Et({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,J(n,[a]);case 8:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=K(s),I=H(s),t.next=17,Et({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(T=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&T.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),T;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var Ve=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=os+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function vn(){return(vn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:pt.getAppCallTxnNoteWithClientName(it.V2),appArgs:[en,r.default.encodeUint64(Q("negative",l,c)),r.default.encodeUint64(Q("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[$e.ASSET_TRANSFER_TXN]=g,A[$e.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[$e.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[$e.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _n(){return(_n=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y,v,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,T=Q("negative",l,p),c!==f){e.next=17;break}A=T,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=T,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return h=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(y=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:pt.getAppCallTxnNoteWithClientName(it.V2),appArgs:[en,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(v=[])[$e.ASSET_TRANSFER_TXN]=h,v[$e.APP_CALL_TXN]=y,_=r.default.assignGroupID(v),e.abrupt("return",[{txn:_[$e.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[$e.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wn(){return(wn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.client,s=e.txGroup,a=e.signedTxns,t.next=3,J(r,[a]);case 3:return o=t.sent,u=v(o,1),c=u[0].txnID,t.next=8,ue(r,s);case 8:if(t.t1=n=t.sent,t.t0=null===t.t1,t.t0){t.next=12;break}t.t0=void 0===n;case 12:if(!t.t0){t.next=16;break}t.t2=void 0,t.next=17;break;case 16:t.t2=n.map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}}));case 17:return p=t.t2,t.abrupt("return",{outputAssets:p,txnID:c});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Dn,bn,En={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=yn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=yn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=hn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=hn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,T=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:T}}}return e},generateTxns:function(t){return vn.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return _n.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return wn.apply(this,arguments)}},Sn=(f(Dn={},it.V1_1,pn),f(Dn,it.V2,En),Dn),Nn=3n,On=1000n;function Pn(){return(Pn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=v(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===bn.FEE_TXN_INDEX?c:e===bn.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function kn(){return(kn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,T,h,y;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return d=t.sent,f=a.account.address(),m=[$("swap"),o===exports.SwapType.FixedInput?$("fi"):$("fo")],g=r.default.makeApplicationNoOpTxnFromObject({from:f,appIndex:a.validatorAppID,appArgs:m,accounts:[l],note:pt.getAppCallTxnNoteWithClientName(it.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:d}),I=o===exports.SwapType.FixedOutput?Q("positive",p,u.amount):u.amount,A=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:I,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:f,assetIndex:u.id,amount:I,suggestedParams:d}),x=o===exports.SwapType.FixedInput?Q("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:f,to:l,amount:x,suggestedParams:d}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:f,to:l,assetIndex:c.id,amount:x,suggestedParams:d}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:f,amount:g.fee+T.fee,note:s,suggestedParams:d}),y=r.default.assignGroupID([h,g,A,T]),t.abrupt("return",[{txn:y[0],signers:[l]},{txn:y[1],signers:[f]},{txn:y[2],signers:[l]},{txn:y[3],signers:[f]}]);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ln(t){var e,n,r,s=t.pool,a=t.reserves,i=t.assetIn,u=t.decimals,c=BigInt(i.amount);i.id===s.asset1ID?(e=s.asset2ID,n=a.asset1,r=a.asset2):(e=s.asset1ID,n=a.asset2,r=a.asset1);var p=c*Nn/On,l=r-n*r/(n+(c-p));if(l>r)throw new Error("Output amount exceeds available liquidity.");var d={assetIn:{amount:c,decimals:u.assetIn},assetOut:{amount:l,decimals:u.assetOut}};return{round:a.round,assetInID:i.id,assetInAmount:c,assetOutID:e,assetOutAmount:l,swapFee:Number(p),rate:Se(d),priceImpact:Ne(o({inputSupply:n,outputSupply:r},d))}}function Fn(t){return Bn.apply(this,arguments)}function Bn(){return(Bn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,Et({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,J(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,Et({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Rn(t){var e,n,r,s=t.pool,a=t.reserves,o=t.assetOut,i=t.decimals,u=BigInt(o.amount);if(o.id===s.asset1ID?(e=s.asset2ID,n=a.asset2,r=a.asset1):(e=s.asset1ID,n=a.asset1,r=a.asset2),u>r)throw new Error("Output amount exceeds available liquidity.");var c=n*r/(r-u)-n,p=c*On/(On-Nn),l=p-c,d=G(i.assetOut,Number(u))/G(i.assetIn,Number(p)),f=G(i.assetOut,Number(r))/G(i.assetIn,Number(n)),m=q({decimalPlaces:5},Math.abs(d/f-1));return{round:a.round,assetInID:e,assetInAmount:p,assetOutID:o.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Mn(t){return Cn.apply(this,arguments)}function Cn(){return(Cn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,Et({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,J(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,Et({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Vn(){return(Vn=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[bn.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[bn.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[bn.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Fn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Mn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:H(a),fees:K(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(bn||(bn={}));var Xn,jn={getQuote:function(t,e,n,r,s){if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,asset:r},"Trying to swap on a non-existent pool");return t===exports.SwapType.FixedInput?Ln({pool:e,reserves:n,assetIn:r,decimals:s}):Rn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Ln,getFixedOutputSwapQuote:Rn,generateTxns:function(t){return kn.apply(this,arguments)},signTxns:function(t){return Pn.apply(this,arguments)},execute:function(t){return Vn.apply(this,arguments)},executeFixedOutputSwap:Mn},Un=4*t.ALGORAND_MIN_TX_FEE;function Qn(t){return t.filter((function(t){return!Qt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Gn=(f(Xn={},it.V1_1,jn),f(Xn,it.V2,hn),f(Xn,"getQuote",(function(t){if(t.pools.every((function(t){return Qt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?(n=(e=t).pools,r=e.assetIn,s=e.assetOut,a=e.amount,Qn(n.map((function(t){var e={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===it.V1_1?jn.getFixedInputSwapQuote(e):hn.getFixedInputSwapQuote(e)}})))):function(t){var e=t.pools,n=t.assetIn,r=t.assetOut,s=t.amount;return Qn(e.map((function(t){var e={pool:t.info,assetOut:{amount:s,id:Number(r.id)},decimals:{assetIn:n.decimals,assetOut:r.decimals},reserves:t.reserves};return{pool:t,quote:t.info.contractVersion===it.V1_1?jn.getFixedOutputSwapQuote(e):hn.getFixedOutputSwapQuote(e)}})))}(t);var e,n,r,s,a})),f(Xn,"generateTxns",(function(t){return t.pool.contractVersion===it.V1_1?jn.generateTxns(t):hn.generateTxns(t)})),f(Xn,"signTxns",(function(t){return t.pool.contractVersion===it.V1_1?jn.signTxns(t):hn.signTxns(t)})),f(Xn,"execute",(function(t){return t.contractVersion===it.V1_1?jn.execute(t):hn.execute(t)})),Xn);function qn(){return(qn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Wn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,J(n,[o]);case 7:return u=t.sent,c=v(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:K(s),confirmedRound:d,txnID:l,groupID:H(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Wn(t){return zn.apply(this,arguments)}function zn(){return(zn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=v(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Jn(){return Jn=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:K(e),groupID:H(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,J(n,[c]);case 4:p=s.sent,l=v(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),Jn.apply(this,arguments)}function Yn(){return(Yn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[$("redeem")],note:pt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Kn(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[$("commit"),u],note:L([$("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function Hn(){return(Hn=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=Kn({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[$("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=tt,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=Ze,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=xe,exports.CONTRACT_VERSION=it,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=et,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Sn,exports.Swap=Gn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=tn,exports.V2AddLiquidityTxnIndices=De,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=Q,exports.calculateAccountMinimumRequiredBalance=_t,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=zt,exports.prepareCommitTransactions=function(t){return Hn.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return Jn.apply(this,arguments)},exports.redeemExcessAsset=function(t){return qn.apply(this,arguments)},exports.sendAndWaitRawTransaction=J,exports.sumUpTxnFees=K,exports.tinymanContract_v1_1=It,exports.tinymanContract_v2=Tt,exports.tinymanJSSDKConfig=pt; diff --git a/src/util/pool/v1_1/index.ts b/src/util/pool/v1_1/index.ts index 70eb93f8..e1cacfba 100644 --- a/src/util/pool/v1_1/index.ts +++ b/src/util/pool/v1_1/index.ts @@ -69,8 +69,6 @@ export async function getPoolReserves( ); const appsLocalState = info["apps-local-state"] || []; - console.log(info); - let outstandingAsset1 = 0n; let outstandingAsset2 = 0n; let outstandingPoolTokens = 0n; From 24c46ef6ece2efe1cfa42d41ef6164ee9f91e5a3 Mon Sep 17 00:00:00 2001 From: Cem KIRAY Date: Thu, 23 Feb 2023 13:44:43 +0100 Subject: [PATCH 05/14] fix: make sure to return correct asset data in execution response objects --- dist/index.js | 2 +- dist/swap/types.d.ts | 6 ++--- dist/util/transaction/transactionUtils.d.ts | 8 +++--- src/add-liquidity/v2/common.ts | 7 ++--- src/remove-liquidity/v2/index.ts | 29 +++++++++++++++++---- src/swap/types.ts | 6 ++--- src/swap/v2/index.ts | 15 ++++++----- src/util/transaction/transactionUtils.ts | 5 +++- 8 files changed, 50 insertions(+), 28 deletions(-) diff --git a/dist/index.js b/dist/index.js index 435615a3..4b83f6bf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("algosdk"),e=require("base64-js");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=n(t),s=Uint8Array.from([1]);function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,h(Error));var e=v(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return W({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){return W({decimalPlaces:0},Math.pow(10,Number(t))*Number(e))}function W(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=y(J(e),2),a=s[0],o=s[1],i=y(J(Math.round(Number(z(a,o+r)))),2),u=i[0],c=i[1];return Number(z(u,c-r))}return Math.round(e)}function z(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function J(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function Y(t,e){return K.apply(this,arguments)}function K(){return(K=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function H(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function Z(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function $(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function tt(t){return(new TextEncoder).encode(t)}var et={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151"},nt={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function rt(){return(rt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function st(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function at(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function ot(t){return 0===Number(t)}var it,ut={V1_1:"v1_1",V2:"v2"},ct={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},pt={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},lt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return tt("tinyman/".concat(t===ut.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),dt=(f(it={},ut.V1_1,{testnet:62368684,mainnet:552635992}),f(it,ut.V2,{testnet:148607e3,mainnet:1002541853}),it);function ft(t,e){var n=dt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function gt(){return(gt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var It=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),At=new(function(n){m(s,It);var r=v(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=ft(n.network,ut.V1_1),s=y(at(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:wt(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function _t(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function wt(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var Dt,bt,Et=tt("e");function St(t){return Nt.apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,y,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:h=k({stateArray:x}),T=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset1ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset2ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.poolTokenID)])),_=h[T],w=h[v],D=h[y],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Ot(){return(Ot=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mLt)){n.next=48;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(Lt,"]): ").concat(B.issuedLiquidity));case 48:return n.abrupt("return",B);case 49:case"end":return n.stop()}}),n,null,[[8,31,34,37]])})))).apply(this,arguments)}function Mt(){return Mt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,yt(n,r);case 6:return o=t.sent,u=_t(o,ft(s,ut.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Pt[ut.V1_1].asset1],asset2ID:u[Pt[ut.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Mt.apply(this,arguments)}var Ct=Object.freeze({__proto__:null,getPoolInfo:Ft,getPoolReserves:function(t,e){return Rt.apply(this,arguments)},getPoolAssets:function(t){return Mt.apply(this,arguments)}});function Vt(t){return Xt.apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=vt(ut.V2),u=o.generateLogicSigAccountForPool(e),c=ft(r,ut.V2),p=u.address(),l=at(s,a),t.next=8,yt(n,p);case 8:return d=t.sent,f=_t(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:ut.V2},f&&(m.asset1ProtocolFees=BigInt(f[Pt.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Pt.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Pt.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Pt.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Pt.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Pt.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Pt.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Pt.v2.totalFeeShare]),m.poolTokenID=Number(f[Pt.v2.poolTokenID]),m.asset1ID=Number(f[Pt.v2.asset1]),m.asset2ID=Number(f[Pt.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,yt(e,n.account.address());case 2:return r=t.sent,s=_t(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Pt.v2.asset1Reserves]),a.asset2=BigInt(s[Pt.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Pt.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ut(){return(Ut=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,yt(n,r);case 3:return a=t.sent,o=_t(a,ft(s,ut.V2)),u=null,o&&(u={asset1ID:o[Pt[ut.V2].asset1],asset2ID:o[Pt[ut.V2].asset2],poolTokenID:o[Pt[ut.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Qt=Object.freeze({__proto__:null,getPoolInfo:Vt,getPoolReserves:function(t,e){return jt.apply(this,arguments)},getPoolAssets:function(t){return Ut.apply(this,arguments)}});function Gt(t){return Boolean(t&&!(t.asset1+t.asset2))}var qt,Wt,zt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Gt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Gt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Ft(t),Vt(t)])}}),Jt=o((f(qt={},ut.V1_1,o(o({},Ct),zt)),f(qt,ut.V2,o(o({},Qt),zt)),qt),zt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(Wt||(Wt={}));var Yt=96e4,Kt=859e3;function Ht(){return(Ht=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=st(a,o),l=y(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=ot(I),h=ft(s,ut.V1_1),T=At.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),v=T.address(),_=r.default.makeApplicationOptInTxnFromObject({from:v,appIndex:h,note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),appArgs:[tt("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:v,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:nt.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:v,to:v,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:v,amount:Zt(x),suggestedParams:c}),(E=[])[Wt.FUNDING_TXN]=b,E[Wt.VALIDATOR_APP_CALL]=_,E[Wt.POOL_TOKEN_CREATE]=w,E[Wt.ASSET1_OPT_IN]=D,x||(E[Wt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:v,to:v,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[Wt.FUNDING_TXN],signers:[u]},{txn:S[Wt.VALIDATOR_APP_CALL],signers:[v]},{txn:S[Wt.POOL_TOKEN_CREATE],signers:[v]},{txn:S[Wt.ASSET1_OPT_IN],signers:[v]}],S[Wt.ASSET2_OPT_IN]&&N.push({txn:S[Wt.ASSET2_OPT_IN],signers:[v]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zt(t){return t?Yt:Kt}function $t(){return($t=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=y(c,1),l=p[0],d=at(o,u),f=y(d,2),m=f[0],g=f[1],I=At.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===Wt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function te(t){return ee.apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[Wt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ne(){return(ne=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,te({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",Jt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var re,se={generateTxns:function(t){return Ht.apply(this,arguments)},signTxns:function(t){return $t.apply(this,arguments)},execute:function(t){return ne.apply(this,arguments)},getBootstrapFundingTxnAmount:Zt};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(re||(re={}));var ae=5,oe=6;function ie(t,e){return ue.apply(this,arguments)}function ue(){return(ue=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ce(t,e){return pe.apply(this,arguments)}function pe(){return(pe=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ie(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function le(){return(le=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=ft(a,ut.V2),d=t.getApplicationAddress(l),f=st(o,u),m=y(f,2),g=m[0].id,I=m[1].id,e.next=9,Jt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=Tt.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),h=ot(I),(T=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[tt("bootstrap")],note:lt.getAppCallTxnNoteWithClientName(ut.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=fe(h),v=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:de(h),suggestedParams:p}),(_=[])[re.FUNDING_TXN]=v,_[re.VALIDATOR_APP_CALL]=T,w=r.default.assignGroupID(_),(D=[])[re.FUNDING_TXN]={txn:w[re.FUNDING_TXN],signers:[c]},D[re.VALIDATOR_APP_CALL]={txn:w[re.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function de(t){return function(t,e){var n=vt(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(ut.V2,t)+fe(t)+1e5}function fe(e){return((e?ae:oe)+1)*t.ALGORAND_MIN_TX_FEE}function me(){return(me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=y(c,1),l=p[0],d=at(o,u),f=y(d,2),m=f[0],g=f[1],I=Tt.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===re.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ge(){return(ge=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,ie(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Pt.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",Jt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var Ie,Ae={generateTxns:function(t){return le.apply(this,arguments)},signTxns:function(t){return me.apply(this,arguments)},execute:function(t){return ge.apply(this,arguments)},getBootstrapFundingTxnAmount:de,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+de(e)}};var xe,he=(f(Ie={},ut.V1_1,se),f(Ie,ut.V2,Ae),f(Ie,"generateTxns",(function(t){return t.contractVersion===ut.V1_1?se.generateTxns(t):Ae.generateTxns(t)})),f(Ie,"signTxns",(function(t){return t.contractVersion===ut.V1_1?se.signTxns(t):Ae.signTxns(t)})),f(Ie,"execute",(function(t){return t.contractVersion===ut.V1_1?se.execute(t):Ae.execute(t)})),f(Ie,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===ut.V1_1?se.getBootstrapFundingTxnAmount(n):Ae.getBootstrapFundingTxnAmount(n)})),Ie);exports.V1_1AddLiquidityTxnIndices=void 0,(xe=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[xe.FEE_TXN=0]="FEE_TXN",xe[xe.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",xe[xe.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",xe[xe.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",xe[xe.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var Te,ve,ye,_e,we=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(_e=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",_e.FLEXIBLE="flexible",_e.INITIAL="initial";var De,be=(f(Te={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(Te,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(Te,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),Te),Ee=(f(ve={},exports.V2AddLiquidityType.INITIAL,1),f(ve,exports.V2AddLiquidityType.SINGLE,2),f(ve,exports.V2AddLiquidityType.FLEXIBLE,2),ve),Se=(f(ye={},exports.V2AddLiquidityType.INITIAL,3),f(ye,exports.V2AddLiquidityType.FLEXIBLE,3),f(ye,exports.V2AddLiquidityType.SINGLE,2),ye);function Ne(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function Oe(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Ne({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return W({decimalPlaces:5},Math.abs(a/o-1))}function Pe(t){var e,n,r,s,a=t.reserves,o=t.totalFeeShare,i=t.asset1Amount,u=t.asset2Amount,c=t.decimals,p=a.asset1*a.asset2,l=a.asset1+BigInt(i),d=a.asset2+BigInt(u),f=l*d,m=BigInt(parseInt(String(Math.sqrt(Number(f*a.issuedLiquidity*a.issuedLiquidity/p))))),g=m-a.issuedLiquidity,I=g*l/m,A=g*d/m,x=BigInt(i)-I,h=BigInt(u)-A;if(x>h){var T=x;r=BigInt(Math.abs(Math.min(Number(h),0))),e=!0,n=T+(s=ke(T,o)),g-=s*m/(l*BigInt(2))}else{var v=h;r=BigInt(Math.abs(Math.min(Number(x),0))),e=!1,n=v+(s=ke(v,o)),g-=s*m/(d*BigInt(2))}return{poolTokenAssetAmount:g,swapFromAsset1ToAsset2:e,swapInAmount:n,swapOutAmount:r,swapTotalFeeAmount:s,swapPriceImpact:Oe({inputSupply:e?a.asset1:a.asset2,outputSupply:e?a.asset2:a.asset1,assetIn:{amount:n,decimals:c.asset1},assetOut:{amount:r,decimals:c.asset2}})}}function ke(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Le(e){return(Ee[e]+1)*t.ALGORAND_MIN_TX_FEE}var Fe=tt("add_liquidity"),Be=(f(De={},ut.V1_1,[tt("mint")]),f(De,ut.V2,{INITIAL_LIQUIDITY:[tt("add_initial_liquidity")],SINGLE_ASSET_MODE:[Fe,tt("single")],FLEXIBLE_MODE:[Fe,tt("flexible")]}),De);function Re(){return(Re=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=Q("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:ft(a,ut.V1_1),appArgs:Be.v1_1,accounts:[d],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),T=r.default.assignGroupID([h,g,I,A,x]),t.abrupt("return",[{txn:T[0],signers:[d]},{txn:T[1],signers:[o]},{txn:T[2],signers:[d]},{txn:T[3],signers:[d]},{txn:T[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(){return(Me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=y(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ce(){return(Ce=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,St({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,Y(n,[a]);case 8:return p=t.sent,l=y(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=H(s),I=Z(s),t.next=17,St({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(h=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&h.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),h;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var Ve=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=o0&&void 0!==arguments[0]?arguments[0]:"Output amount exceeds available liquidity";return p(this,n),e.call(this,t)}return d(n)}();function gn(){return(gn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,s=e.pool,a=e.swapType,o=e.assetIn,u=e.assetOut,c=e.initiatorAddr,p=e.slippage,l=s.account.address(),(d=[s.asset1ID,s.asset2ID]).includes(o.id)&&d.includes(u.id)&&o.id!==u.id){t.next=5;break}throw new P({pool:s,assetIn:o,assetOut:u},"Input asset (#".concat(o.id,") and output asset (#").concat(u.id,") provided to generate transactions do not belong to the pool ").concat(l,"."));case 5:return t.next=7,n.getTransactionParams().do();case 7:return f=t.sent,m=ot(o.id),g=a===exports.SwapType.FixedInput?o.amount:Q("positive",p,o.amount),I=a===exports.SwapType.FixedOutput?u.amount:Q("negative",p,u.amount),A=m?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:g,suggestedParams:f}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:c,to:l,amount:g,assetIndex:o.id,suggestedParams:f}),(x=r.default.makeApplicationNoOpTxnFromObject({from:c,appIndex:s.validatorAppID,appArgs:[dn,fn[a],r.default.encodeUint64(I)],note:lt.getAppCallTxnNoteWithClientName(ut.V2),accounts:[l],foreignAssets:[s.asset1ID,s.asset2ID],suggestedParams:f})).fee=In(a),(h=[])[cn.INPUT_TXN]=A,h[cn.APP_CALL_TXN]=x,T=r.default.assignGroupID(h),t.abrupt("return",[{txn:T[cn.INPUT_TXN],signers:[c]},{txn:T[cn.APP_CALL_TXN],signers:[c]}]);case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function In(e){return(ln[e]+1)*t.ALGORAND_MIN_TX_FEE}function An(){return(An=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=e.client,a=e.pool,o=e.txGroup,u=e.signedTxns,c=e.network,p=e.assetIn,t.next=3,Y(s,[u]);case 3:return l=t.sent,d=y(l,1),f=d[0],m=f.confirmedRound,g=f.txnID,t.next=10,ce(s,o);case 10:return I=t.sent,A=[a.asset1ID,a.asset2ID].filter((function(t){return t!==p.id}))[0],x=null==I||null===(n=I.find((function(t){return t.txn.txn.xaid===p.id})))||void 0===n?void 0:n.txn.txn,h=null==I||null===(r=I.find((function(t){return t.txn.txn.xaid===A})))||void 0===r?void 0:r.txn.txn,t.t0=m,t.t1=x&&{amount:BigInt(p.amount)-BigInt(x.aamt||0),id:p.id},t.t2=h&&{amount:h.aamt,id:A},t.next=19,Jt.v2.getPoolInfo({client:s,network:c,asset1ID:a.asset1ID,asset2ID:a.asset2ID});case 19:return t.t3=t.sent,t.t4=g,t.abrupt("return",{round:t.t0,assetIn:t.t1,assetOut:t.t2,pool:t.t3,txnID:t.t4});case 22:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function xn(t){var e=t.pool,n=t.assetIn,r=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetIn:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset1Reserves,o=e.asset2Reserves;else{if(n.id!==e.asset2ID)throw new P({pool:e,assetIn:n},"Input asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset2Reserves,o=e.asset1Reserves}var c=Tn({inputSupply:a,outputSupply:o,swapInputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapOutputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(p>o)throw new mn;return{assetInID:n.id,assetInAmount:i,assetOutID:s,assetOutAmount:p,swapFee:Number(l),rate:G(r.assetOut,Number(p))/G(r.assetIn,Number(i)),priceImpact:d}}function hn(t){var e=t.pool,n=t.assetOut,r=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetOut:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset2Reserves,o=e.asset1Reserves;else{if(n.id!==e.asset2ID)throw new P({pool:e,assetOut:n},"Output asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset1Reserves,o=e.asset2Reserves}var c=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapOutputAmount,s=t.totalFeeShare,a=t.decimals,o=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.outputAmount,s=BigInt(e*n/(n-r))-e;return s+=BigInt(1)}({inputSupply:e,outputSupply:n,outputAmount:r}),i=function(t){var e=t.swapAmount,n=t.totalFeeShare,r=Math.floor(Number(e*BigInt(1e4)/(BigInt(1e4)-BigInt(n))));return BigInt(r)-e}({swapAmount:o,totalFeeShare:s}),u=o+i,c=Oe({inputSupply:e,outputSupply:n,assetIn:{amount:u,decimals:a.assetIn},assetOut:{amount:r,decimals:a.assetOut}});return{swapInputAmount:u,totalFeeAmount:i,priceImpact:c}}({inputSupply:a,outputSupply:o,swapOutputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapInputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(i>o)throw new mn;return{assetInID:s,assetInAmount:p,assetOutID:n.id,assetOutAmount:i,swapFee:Number(l),rate:G(r.assetOut,Number(i))/G(r.assetIn,Number(p)),priceImpact:d}}function Tn(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapInputAmount,s=t.totalFeeShare,a=t.decimals,o=BigInt(function(t){var e=t.inputAmount,n=t.totalFeeShare;return Math.floor(Number(e*BigInt(n))/1e4)}({inputAmount:r,totalFeeShare:s})),i=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapAmount,s=n-BigInt(e*n/(e+BigInt(r)));return s-=BigInt(1)}({inputSupply:e,outputSupply:n,swapAmount:r-o});return{swapOutputAmount:i,totalFeeAmount:o,priceImpact:Oe({inputSupply:e,outputSupply:n,assetIn:{amount:r,decimals:a.assetIn},assetOut:{amount:i,decimals:a.assetOut}})}}var vn={getQuote:function(t,e,n,r){return t===exports.SwapType.FixedInput?xn({pool:e,assetIn:n,decimals:r}):hn({pool:e,assetOut:n,decimals:r})},getFixedInputSwapQuote:xn,getFixedOutputSwapQuote:hn,generateTxns:function(t){return gn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return An.apply(this,arguments)},calculateFixedInputSwap:Tn};function yn(t,e){var n,r,s=BigInt(t),a=e.issuedLiquidity;return a>s+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function _n(){return(_n=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[en,r.default.encodeUint64(Q("negative",l,c)),r.default.encodeUint64(Q("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[$e.ASSET_TRANSFER_TXN]=g,A[$e.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[$e.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[$e.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wn(){return(wn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,y,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,h=Q("negative",l,p),c!==f){e.next=17;break}A=h,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=h,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return T=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(v=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[en,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(y=[])[$e.ASSET_TRANSFER_TXN]=T,y[$e.APP_CALL_TXN]=v,_=r.default.assignGroupID(y),e.abrupt("return",[{txn:_[$e.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[$e.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dn(){return(Dn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.client,s=e.txGroup,a=e.signedTxns,t.next=3,Y(r,[a]);case 3:return o=t.sent,u=y(o,1),c=u[0].txnID,t.next=8,ce(r,s);case 8:if(t.t1=n=t.sent,t.t0=null===t.t1,t.t0){t.next=12;break}t.t0=void 0===n;case 12:if(!t.t0){t.next=16;break}t.t2=void 0,t.next=17;break;case 16:t.t2=n.map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}}));case 17:return p=t.t2,t.abrupt("return",{outputAssets:p,txnID:c});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var bn,En,Sn={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=yn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=yn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=vn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=vn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,h=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:h}}}return e},generateTxns:function(t){return _n.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return wn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return Dn.apply(this,arguments)}},Nn=(f(bn={},ut.V1_1,pn),f(bn,ut.V2,Sn),bn),On=3n,Pn=1000n;function kn(){return(kn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=y(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===En.FEE_TXN_INDEX?c:e===En.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ln(){return(Ln=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,y;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,d=a.account.address(),(f=[a.asset1ID,a.asset2ID]).includes(u.id)&&f.includes(c.id)&&u.id!==c.id){t.next=5;break}throw new P({pool:a,assetIn:u,assetOut:c},"Input asset (#".concat(u.id,") and output asset (#").concat(c.id,") provided to generate transactions do not belong to the pool ").concat(d,"."));case 5:return t.next=7,n.getTransactionParams().do();case 7:return m=t.sent,g=[tt("swap"),o===exports.SwapType.FixedInput?tt("fi"):tt("fo")],I=r.default.makeApplicationNoOpTxnFromObject({from:d,appIndex:a.validatorAppID,appArgs:g,accounts:[l],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:m}),A=o===exports.SwapType.FixedOutput?Q("positive",p,u.amount):u.amount,x=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:d,amount:A,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:d,assetIndex:u.id,amount:A,suggestedParams:m}),h=o===exports.SwapType.FixedInput?Q("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:l,amount:h,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:l,assetIndex:c.id,amount:h,suggestedParams:m}),v=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:d,amount:I.fee+T.fee,note:s,suggestedParams:m}),y=r.default.assignGroupID([v,I,x,T]),t.abrupt("return",[{txn:y[0],signers:[l]},{txn:y[1],signers:[d]},{txn:y[2],signers:[l]},{txn:y[3],signers:[d]}]);case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Fn(t){var e=t.pool,n=t.reserves,r=t.assetIn,s=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetIn:r},"Trying to swap on a non-existent pool");var a,i,u,c=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,i=n.asset1,u=n.asset2;else{if(r.id!==e.asset2ID)throw new P({pool:e,assetIn:r},"Input asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,i=n.asset2,u=n.asset1}var p=c*On/Pn,l=u-i*u/(i+(c-p));if(l>u)throw new mn;var d={assetIn:{amount:c,decimals:s.assetIn},assetOut:{amount:l,decimals:s.assetOut}};return{round:n.round,assetInID:r.id,assetInAmount:c,assetOutID:a,assetOutAmount:l,swapFee:Number(p),rate:Ne(d),priceImpact:Oe(o({inputSupply:i,outputSupply:u},d))}}function Bn(t){return Rn.apply(this,arguments)}function Rn(){return(Rn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=y(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Mn(t){var e=t.pool,n=t.reserves,r=t.assetOut,s=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetOut:r},"Trying to swap on a non-existent pool");var a,o,i,u=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,o=n.asset2,i=n.asset1;else{if(r.id!==e.asset2ID)throw new P({pool:e,assetOut:r},"Output asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,o=n.asset1,i=n.asset2}if(u>i)throw new mn;var c=o*i/(i-u)-o,p=c*Pn/(Pn-On),l=p-c,d=G(s.assetOut,Number(u))/G(s.assetIn,Number(p)),f=G(s.assetOut,Number(i))/G(s.assetIn,Number(o)),m=W({decimalPlaces:5},Math.abs(d/f-1));return{round:n.round,assetInID:a,assetInAmount:p,assetOutID:r.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Cn(t){return Vn.apply(this,arguments)}function Vn(){return(Vn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=y(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xn(){return(Xn=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[En.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[En.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[En.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[En.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Bn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Cn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:Z(a),fees:H(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(En||(En={}));var jn,Un={getQuote:function(t,e,n,r,s){return t===exports.SwapType.FixedInput?Fn({pool:e,reserves:n,assetIn:r,decimals:s}):Mn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Fn,getFixedOutputSwapQuote:Mn,generateTxns:function(t){return Ln.apply(this,arguments)},signTxns:function(t){return kn.apply(this,arguments)},execute:function(t){return Xn.apply(this,arguments)},executeFixedOutputSwap:Cn},Qn=4*t.ALGORAND_MIN_TX_FEE;function Gn(t){return Promise.allSettled(t).then((function(t){if(t.every((function(t){return"rejected"===t.status&&t.reason instanceof mn})))throw new mn;return t.filter((function(t){return"fulfilled"===t.status&&void 0!==t.value.quote})).map((function(t){return t.value}))}))}function qn(){return(qn=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===ut.V1_1?Un.getFixedInputSwapQuote(i):vn.getFixedInputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,Gn(o);case 4:return u=t.sent,t.abrupt("return",zn(u));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Wn(){return(Wn=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetOut:{amount:a,id:Number(s.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===ut.V1_1?Un.getFixedOutputSwapQuote(i):vn.getFixedOutputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,Gn(o);case 4:return u=t.sent,t.abrupt("return",zn(u));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function zn(t){return t.filter((function(t){return!Gt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Jn=(f(jn={},ut.V1_1,Un),f(jn,ut.V2,vn),f(jn,"getQuote",(function(t){if(t.pools.every((function(t){return Gt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?function(t){return qn.apply(this,arguments)}(t):function(t){return Wn.apply(this,arguments)}(t)})),f(jn,"generateTxns",(function(t){return t.pool.contractVersion===ut.V1_1?Un.generateTxns(t):vn.generateTxns(t)})),f(jn,"signTxns",(function(t){return t.pool.contractVersion===ut.V1_1?Un.signTxns(t):vn.signTxns(t)})),f(jn,"execute",(function(t){return t.contractVersion===ut.V1_1?Un.execute(t):vn.execute(t)})),jn);function Yn(){return(Yn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Kn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,Y(n,[o]);case 7:return u=t.sent,c=y(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:H(s),confirmedRound:d,txnID:l,groupID:Z(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Kn(t){return Hn.apply(this,arguments)}function Hn(){return(Hn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=y(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zn(){return Zn=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:H(e),groupID:Z(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,Y(n,[c]);case 4:p=s.sent,l=y(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),Zn.apply(this,arguments)}function $n(){return($n=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[tt("redeem")],note:lt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function tr(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[tt("commit"),u],note:L([tt("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function er(){return(er=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=tr({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[tt("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=et,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=Ze,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=he,exports.CONTRACT_VERSION=ut,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=nt,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Nn,exports.Swap=Jn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=tn,exports.V2AddLiquidityTxnIndices=be,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=Q,exports.calculateAccountMinimumRequiredBalance=wt,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=Jt,exports.prepareCommitTransactions=function(t){return er.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return Zn.apply(this,arguments)},exports.redeemExcessAsset=function(t){return Yn.apply(this,arguments)},exports.sendAndWaitRawTransaction=Y,exports.sumUpTxnFees=H,exports.tinymanContract_v1_1=At,exports.tinymanContract_v2=Tt,exports.tinymanJSSDKConfig=lt; +i=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new w(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(s,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===s)throw a;return b()}for(n.method=s,n.arg=a;;){var o=n.delegate;if(o){var i=y(o,n);if(i){if(i===l)continue;return i}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,o),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function d(){}function f(){}function m(){}var g={};u(g,s,(function(){return this}));var I=Object.getPrototypeOf,A=I&&I(I(D([])));A&&A!==e&&n.call(A,s)&&(g=A);var x=m.prototype=d.prototype=Object.create(g);function h(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(s,a,o,i){var u=p(t[s],t,a);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,o,i)}),(function(t){r("throw",t,o,i)})):e.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return r("throw",t,o,i)}))}i(u.arg)}var s;this._invoke=function(t,n){function a(){return new e((function(e,s){r(t,n,e,s)}))}return s=s?s.then(a,a):a()}}function y(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,y(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=p(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var s=r.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function v(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(v,this),this.reset(!0)}function D(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,h(Error));var e=y(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return W({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){return W({decimalPlaces:0},Math.pow(10,Number(t))*Number(e))}function W(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=v(J(e),2),a=s[0],o=s[1],i=v(J(Math.round(Number(z(a,o+r)))),2),u=i[0],c=i[1];return Number(z(u,c-r))}return Math.round(e)}function z(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function J(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function Y(t,e){return K.apply(this,arguments)}function K(){return(K=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function H(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function Z(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function $(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function tt(t){return(new TextEncoder).encode(t)}var et={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151"},nt={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function rt(){return(rt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function st(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function at(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function ot(t){return 0===Number(t)}var it,ut={V1_1:"v1_1",V2:"v2"},ct={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},pt={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},lt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return tt("tinyman/".concat(t===ut.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),dt=(f(it={},ut.V1_1,{testnet:62368684,mainnet:552635992}),f(it,ut.V2,{testnet:148607e3,mainnet:1002541853}),it);function ft(t,e){var n=dt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function gt(){return(gt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var It=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),At=new(function(n){m(s,It);var r=y(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=ft(n.network,ut.V1_1),s=v(at(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:wt(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function _t(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function wt(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var Dt,bt,Et=tt("e");function St(t){return Nt.apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,y,v,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:h=k({stateArray:x}),T=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset1ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset2ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.poolTokenID)])),_=h[T],w=h[y],D=h[v],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Ot(){return(Ot=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mLt)){n.next=48;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(Lt,"]): ").concat(B.issuedLiquidity));case 48:return n.abrupt("return",B);case 49:case"end":return n.stop()}}),n,null,[[8,31,34,37]])})))).apply(this,arguments)}function Mt(){return Mt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,vt(n,r);case 6:return o=t.sent,u=_t(o,ft(s,ut.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Pt[ut.V1_1].asset1],asset2ID:u[Pt[ut.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Mt.apply(this,arguments)}var Ct=Object.freeze({__proto__:null,getPoolInfo:Ft,getPoolReserves:function(t,e){return Rt.apply(this,arguments)},getPoolAssets:function(t){return Mt.apply(this,arguments)}});function Vt(t){return Xt.apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=yt(ut.V2),u=o.generateLogicSigAccountForPool(e),c=ft(r,ut.V2),p=u.address(),l=at(s,a),t.next=8,vt(n,p);case 8:return d=t.sent,f=_t(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:ut.V2},f&&(m.asset1ProtocolFees=BigInt(f[Pt.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Pt.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Pt.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Pt.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Pt.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Pt.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Pt.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Pt.v2.totalFeeShare]),m.poolTokenID=Number(f[Pt.v2.poolTokenID]),m.asset1ID=Number(f[Pt.v2.asset1]),m.asset2ID=Number(f[Pt.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,vt(e,n.account.address());case 2:return r=t.sent,s=_t(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Pt.v2.asset1Reserves]),a.asset2=BigInt(s[Pt.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Pt.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ut(){return(Ut=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,vt(n,r);case 3:return a=t.sent,o=_t(a,ft(s,ut.V2)),u=null,o&&(u={asset1ID:o[Pt[ut.V2].asset1],asset2ID:o[Pt[ut.V2].asset2],poolTokenID:o[Pt[ut.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Qt=Object.freeze({__proto__:null,getPoolInfo:Vt,getPoolReserves:function(t,e){return jt.apply(this,arguments)},getPoolAssets:function(t){return Ut.apply(this,arguments)}});function Gt(t){return Boolean(t&&!(t.asset1+t.asset2))}var qt,Wt,zt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Gt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Gt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Ft(t),Vt(t)])}}),Jt=o((f(qt={},ut.V1_1,o(o({},Ct),zt)),f(qt,ut.V2,o(o({},Qt),zt)),qt),zt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(Wt||(Wt={}));var Yt=96e4,Kt=859e3;function Ht(){return(Ht=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,y,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=st(a,o),l=v(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=ot(I),h=ft(s,ut.V1_1),T=At.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),y=T.address(),_=r.default.makeApplicationOptInTxnFromObject({from:y,appIndex:h,note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),appArgs:[tt("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:y,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:nt.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:y,amount:Zt(x),suggestedParams:c}),(E=[])[Wt.FUNDING_TXN]=b,E[Wt.VALIDATOR_APP_CALL]=_,E[Wt.POOL_TOKEN_CREATE]=w,E[Wt.ASSET1_OPT_IN]=D,x||(E[Wt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[Wt.FUNDING_TXN],signers:[u]},{txn:S[Wt.VALIDATOR_APP_CALL],signers:[y]},{txn:S[Wt.POOL_TOKEN_CREATE],signers:[y]},{txn:S[Wt.ASSET1_OPT_IN],signers:[y]}],S[Wt.ASSET2_OPT_IN]&&N.push({txn:S[Wt.ASSET2_OPT_IN],signers:[y]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zt(t){return t?Yt:Kt}function $t(){return($t=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=at(o,u),f=v(d,2),m=f[0],g=f[1],I=At.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===Wt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function te(t){return ee.apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[Wt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ne(){return(ne=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,te({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",Jt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var re,se={generateTxns:function(t){return Ht.apply(this,arguments)},signTxns:function(t){return $t.apply(this,arguments)},execute:function(t){return ne.apply(this,arguments)},getBootstrapFundingTxnAmount:Zt};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(re||(re={}));var ae=5,oe=6;function ie(t,e){return ue.apply(this,arguments)}function ue(){return(ue=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ce(t,e){return pe.apply(this,arguments)}function pe(){return(pe=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ie(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function le(){return(le=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,y,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=ft(a,ut.V2),d=t.getApplicationAddress(l),f=st(o,u),m=v(f,2),g=m[0].id,I=m[1].id,e.next=9,Jt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=Tt.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),h=ot(I),(T=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[tt("bootstrap")],note:lt.getAppCallTxnNoteWithClientName(ut.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=fe(h),y=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:de(h),suggestedParams:p}),(_=[])[re.FUNDING_TXN]=y,_[re.VALIDATOR_APP_CALL]=T,w=r.default.assignGroupID(_),(D=[])[re.FUNDING_TXN]={txn:w[re.FUNDING_TXN],signers:[c]},D[re.VALIDATOR_APP_CALL]={txn:w[re.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function de(t){return function(t,e){var n=yt(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(ut.V2,t)+fe(t)+1e5}function fe(e){return((e?ae:oe)+1)*t.ALGORAND_MIN_TX_FEE}function me(){return(me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=at(o,u),f=v(d,2),m=f[0],g=f[1],I=Tt.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===re.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ge(){return(ge=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,ie(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Pt.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",Jt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var Ie,Ae={generateTxns:function(t){return le.apply(this,arguments)},signTxns:function(t){return me.apply(this,arguments)},execute:function(t){return ge.apply(this,arguments)},getBootstrapFundingTxnAmount:de,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+de(e)}};var xe,he=(f(Ie={},ut.V1_1,se),f(Ie,ut.V2,Ae),f(Ie,"generateTxns",(function(t){return t.contractVersion===ut.V1_1?se.generateTxns(t):Ae.generateTxns(t)})),f(Ie,"signTxns",(function(t){return t.contractVersion===ut.V1_1?se.signTxns(t):Ae.signTxns(t)})),f(Ie,"execute",(function(t){return t.contractVersion===ut.V1_1?se.execute(t):Ae.execute(t)})),f(Ie,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===ut.V1_1?se.getBootstrapFundingTxnAmount(n):Ae.getBootstrapFundingTxnAmount(n)})),Ie);exports.V1_1AddLiquidityTxnIndices=void 0,(xe=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[xe.FEE_TXN=0]="FEE_TXN",xe[xe.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",xe[xe.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",xe[xe.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",xe[xe.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var Te,ye,ve,_e,we=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(_e=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",_e.FLEXIBLE="flexible",_e.INITIAL="initial";var De,be=(f(Te={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(Te,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(Te,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),Te),Ee=(f(ye={},exports.V2AddLiquidityType.INITIAL,1),f(ye,exports.V2AddLiquidityType.SINGLE,2),f(ye,exports.V2AddLiquidityType.FLEXIBLE,2),ye),Se=(f(ve={},exports.V2AddLiquidityType.INITIAL,3),f(ve,exports.V2AddLiquidityType.FLEXIBLE,3),f(ve,exports.V2AddLiquidityType.SINGLE,2),ve);function Ne(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function Oe(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Ne({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return W({decimalPlaces:5},Math.abs(a/o-1))}function Pe(t){var e,n,r,s,a=t.reserves,o=t.totalFeeShare,i=t.asset1Amount,u=t.asset2Amount,c=t.decimals,p=a.asset1*a.asset2,l=a.asset1+BigInt(i),d=a.asset2+BigInt(u),f=l*d,m=BigInt(parseInt(String(Math.sqrt(Number(f*a.issuedLiquidity*a.issuedLiquidity/p))))),g=m-a.issuedLiquidity,I=g*l/m,A=g*d/m,x=BigInt(i)-I,h=BigInt(u)-A;if(x>h){var T=x;r=BigInt(Math.abs(Math.min(Number(h),0))),e=!0,n=T+(s=ke(T,o)),g-=s*m/(l*BigInt(2))}else{var y=h;r=BigInt(Math.abs(Math.min(Number(x),0))),e=!1,n=y+(s=ke(y,o)),g-=s*m/(d*BigInt(2))}return{poolTokenAssetAmount:g,swapFromAsset1ToAsset2:e,swapInAmount:n,swapOutAmount:r,swapTotalFeeAmount:s,swapPriceImpact:Oe({inputSupply:e?a.asset1:a.asset2,outputSupply:e?a.asset2:a.asset1,assetIn:{amount:n,decimals:c.asset1},assetOut:{amount:r,decimals:c.asset2}})}}function ke(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Le(e){return(Ee[e]+1)*t.ALGORAND_MIN_TX_FEE}var Fe=tt("add_liquidity"),Be=(f(De={},ut.V1_1,[tt("mint")]),f(De,ut.V2,{INITIAL_LIQUIDITY:[tt("add_initial_liquidity")],SINGLE_ASSET_MODE:[Fe,tt("single")],FLEXIBLE_MODE:[Fe,tt("flexible")]}),De);function Re(){return(Re=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=Q("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:ft(a,ut.V1_1),appArgs:Be.v1_1,accounts:[d],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),T=r.default.assignGroupID([h,g,I,A,x]),t.abrupt("return",[{txn:T[0],signers:[d]},{txn:T[1],signers:[o]},{txn:T[2],signers:[d]},{txn:T[3],signers:[d]},{txn:T[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(){return(Me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=v(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ce(){return(Ce=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,St({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,Y(n,[a]);case 8:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=H(s),I=Z(s),t.next=17,St({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(h=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&h.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),h;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var Ve=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=o0&&void 0!==arguments[0]?arguments[0]:"Output amount exceeds available liquidity";return p(this,n),e.call(this,t)}return d(n)}();function gn(){return(gn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,s=e.pool,a=e.swapType,o=e.assetIn,u=e.assetOut,c=e.initiatorAddr,p=e.slippage,l=s.account.address(),(d=[s.asset1ID,s.asset2ID]).includes(o.id)&&d.includes(u.id)&&o.id!==u.id){t.next=5;break}throw new P({pool:s,assetIn:o,assetOut:u},"Input asset (#".concat(o.id,") and output asset (#").concat(u.id,") provided to generate transactions do not belong to the pool ").concat(l,"."));case 5:return t.next=7,n.getTransactionParams().do();case 7:return f=t.sent,m=ot(o.id),g=a===exports.SwapType.FixedInput?o.amount:Q("positive",p,o.amount),I=a===exports.SwapType.FixedOutput?u.amount:Q("negative",p,u.amount),A=m?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:g,suggestedParams:f}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:c,to:l,amount:g,assetIndex:o.id,suggestedParams:f}),(x=r.default.makeApplicationNoOpTxnFromObject({from:c,appIndex:s.validatorAppID,appArgs:[dn,fn[a],r.default.encodeUint64(I)],note:lt.getAppCallTxnNoteWithClientName(ut.V2),accounts:[l],foreignAssets:[s.asset1ID,s.asset2ID],suggestedParams:f})).fee=In(a),(h=[])[cn.INPUT_TXN]=A,h[cn.APP_CALL_TXN]=x,T=r.default.assignGroupID(h),t.abrupt("return",[{txn:T[cn.INPUT_TXN],signers:[c]},{txn:T[cn.APP_CALL_TXN],signers:[c]}]);case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function In(e){return(ln[e]+1)*t.ALGORAND_MIN_TX_FEE}function An(){return(An=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=e.client,a=e.pool,o=e.txGroup,u=e.signedTxns,c=e.network,p=e.assetIn,t.next=3,Y(s,[u]);case 3:return l=t.sent,d=v(l,1),f=d[0],m=f.confirmedRound,g=f.txnID,t.next=10,ce(s,o);case 10:return I=t.sent,A=[a.asset1ID,a.asset2ID].filter((function(t){return t!==p.id}))[0],x=null==I||null===(n=I.find((function(t){return t.txn.txn.xaid===p.id})))||void 0===n?void 0:n.txn.txn,h=null==I||null===(r=I.find((function(t){return Boolean(t.txn.txn.xaid===A&&t.txn.txn.xaid)})))||void 0===r?void 0:r.txn.txn,t.t0=m,t.t1={amount:BigInt(p.amount)-(null!=x&&x.aamt?BigInt(x.aamt):0n),id:p.id},t.t2=h&&{amount:h.aamt||0,id:A},t.next=19,Jt.v2.getPoolInfo({client:s,network:c,asset1ID:a.asset1ID,asset2ID:a.asset2ID});case 19:return t.t3=t.sent,t.t4=g,t.abrupt("return",{round:t.t0,assetIn:t.t1,assetOut:t.t2,pool:t.t3,txnID:t.t4});case 22:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function xn(t){var e=t.pool,n=t.assetIn,r=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetIn:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset1Reserves,o=e.asset2Reserves;else{if(n.id!==e.asset2ID)throw new P({pool:e,assetIn:n},"Input asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset2Reserves,o=e.asset1Reserves}var c=Tn({inputSupply:a,outputSupply:o,swapInputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapOutputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(p>o)throw new mn;return{assetInID:n.id,assetInAmount:i,assetOutID:s,assetOutAmount:p,swapFee:Number(l),rate:G(r.assetOut,Number(p))/G(r.assetIn,Number(i)),priceImpact:d}}function hn(t){var e=t.pool,n=t.assetOut,r=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetOut:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset2Reserves,o=e.asset1Reserves;else{if(n.id!==e.asset2ID)throw new P({pool:e,assetOut:n},"Output asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset1Reserves,o=e.asset2Reserves}var c=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapOutputAmount,s=t.totalFeeShare,a=t.decimals,o=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.outputAmount,s=BigInt(e*n/(n-r))-e;return s+=BigInt(1)}({inputSupply:e,outputSupply:n,outputAmount:r}),i=function(t){var e=t.swapAmount,n=t.totalFeeShare,r=Math.floor(Number(e*BigInt(1e4)/(BigInt(1e4)-BigInt(n))));return BigInt(r)-e}({swapAmount:o,totalFeeShare:s}),u=o+i,c=Oe({inputSupply:e,outputSupply:n,assetIn:{amount:u,decimals:a.assetIn},assetOut:{amount:r,decimals:a.assetOut}});return{swapInputAmount:u,totalFeeAmount:i,priceImpact:c}}({inputSupply:a,outputSupply:o,swapOutputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapInputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(i>o)throw new mn;return{assetInID:s,assetInAmount:p,assetOutID:n.id,assetOutAmount:i,swapFee:Number(l),rate:G(r.assetOut,Number(i))/G(r.assetIn,Number(p)),priceImpact:d}}function Tn(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapInputAmount,s=t.totalFeeShare,a=t.decimals,o=BigInt(function(t){var e=t.inputAmount,n=t.totalFeeShare;return Math.floor(Number(e*BigInt(n))/1e4)}({inputAmount:r,totalFeeShare:s})),i=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapAmount,s=n-BigInt(e*n/(e+BigInt(r)));return s-=BigInt(1)}({inputSupply:e,outputSupply:n,swapAmount:r-o});return{swapOutputAmount:i,totalFeeAmount:o,priceImpact:Oe({inputSupply:e,outputSupply:n,assetIn:{amount:r,decimals:a.assetIn},assetOut:{amount:i,decimals:a.assetOut}})}}var yn={getQuote:function(t,e,n,r){return t===exports.SwapType.FixedInput?xn({pool:e,assetIn:n,decimals:r}):hn({pool:e,assetOut:n,decimals:r})},getFixedInputSwapQuote:xn,getFixedOutputSwapQuote:hn,generateTxns:function(t){return gn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return An.apply(this,arguments)},calculateFixedInputSwap:Tn};function vn(t,e){var n,r,s=BigInt(t),a=e.issuedLiquidity;return a>s+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function _n(){return(_n=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[en,r.default.encodeUint64(Q("negative",l,c)),r.default.encodeUint64(Q("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[$e.ASSET_TRANSFER_TXN]=g,A[$e.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[$e.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[$e.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wn(){return(wn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,y,v,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,h=Q("negative",l,p),c!==f){e.next=17;break}A=h,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=h,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return T=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(y=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[en,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(v=[])[$e.ASSET_TRANSFER_TXN]=T,v[$e.APP_CALL_TXN]=y,_=r.default.assignGroupID(v),e.abrupt("return",[{txn:_[$e.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[$e.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dn(){return(Dn=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.txGroup,a=n.signedTxns,e.next=3,Y(r,[a]);case 3:return o=e.sent,u=v(o,1),c=u[0].txnID,e.next=8,ce(r,s);case 8:return p=e.sent,console.log({appCallInnerTxns:p}),l=null==p?void 0:p.map((function(t){return t.txn.txn})),console.log(JSON.stringify(l,null,2)),d=null==p?void 0:p.filter((function(e){return e.txn.txn.type===t.TransactionType.axfer&&e.txn.txn.xaid&&e.txn.txn.aamt})).map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}})),e.abrupt("return",{outputAssets:d,txnID:c});case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var bn,En,Sn={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=vn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=vn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=yn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=yn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,h=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:h}}}return e},generateTxns:function(t){return _n.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return wn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return Dn.apply(this,arguments)}},Nn=(f(bn={},ut.V1_1,pn),f(bn,ut.V2,Sn),bn),On=3n,Pn=1000n;function kn(){return(kn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=v(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===En.FEE_TXN_INDEX?c:e===En.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ln(){return(Ln=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,y,v;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,d=a.account.address(),(f=[a.asset1ID,a.asset2ID]).includes(u.id)&&f.includes(c.id)&&u.id!==c.id){t.next=5;break}throw new P({pool:a,assetIn:u,assetOut:c},"Input asset (#".concat(u.id,") and output asset (#").concat(c.id,") provided to generate transactions do not belong to the pool ").concat(d,"."));case 5:return t.next=7,n.getTransactionParams().do();case 7:return m=t.sent,g=[tt("swap"),o===exports.SwapType.FixedInput?tt("fi"):tt("fo")],I=r.default.makeApplicationNoOpTxnFromObject({from:d,appIndex:a.validatorAppID,appArgs:g,accounts:[l],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:m}),A=o===exports.SwapType.FixedOutput?Q("positive",p,u.amount):u.amount,x=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:d,amount:A,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:d,assetIndex:u.id,amount:A,suggestedParams:m}),h=o===exports.SwapType.FixedInput?Q("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:l,amount:h,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:l,assetIndex:c.id,amount:h,suggestedParams:m}),y=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:d,amount:I.fee+T.fee,note:s,suggestedParams:m}),v=r.default.assignGroupID([y,I,x,T]),t.abrupt("return",[{txn:v[0],signers:[l]},{txn:v[1],signers:[d]},{txn:v[2],signers:[l]},{txn:v[3],signers:[d]}]);case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Fn(t){var e=t.pool,n=t.reserves,r=t.assetIn,s=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetIn:r},"Trying to swap on a non-existent pool");var a,i,u,c=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,i=n.asset1,u=n.asset2;else{if(r.id!==e.asset2ID)throw new P({pool:e,assetIn:r},"Input asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,i=n.asset2,u=n.asset1}var p=c*On/Pn,l=u-i*u/(i+(c-p));if(l>u)throw new mn;var d={assetIn:{amount:c,decimals:s.assetIn},assetOut:{amount:l,decimals:s.assetOut}};return{round:n.round,assetInID:r.id,assetInAmount:c,assetOutID:a,assetOutAmount:l,swapFee:Number(p),rate:Ne(d),priceImpact:Oe(o({inputSupply:i,outputSupply:u},d))}}function Bn(t){return Rn.apply(this,arguments)}function Rn(){return(Rn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Mn(t){var e=t.pool,n=t.reserves,r=t.assetOut,s=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetOut:r},"Trying to swap on a non-existent pool");var a,o,i,u=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,o=n.asset2,i=n.asset1;else{if(r.id!==e.asset2ID)throw new P({pool:e,assetOut:r},"Output asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,o=n.asset1,i=n.asset2}if(u>i)throw new mn;var c=o*i/(i-u)-o,p=c*Pn/(Pn-On),l=p-c,d=G(s.assetOut,Number(u))/G(s.assetIn,Number(p)),f=G(s.assetOut,Number(i))/G(s.assetIn,Number(o)),m=W({decimalPlaces:5},Math.abs(d/f-1));return{round:n.round,assetInID:a,assetInAmount:p,assetOutID:r.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Cn(t){return Vn.apply(this,arguments)}function Vn(){return(Vn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xn(){return(Xn=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[En.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[En.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[En.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[En.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Bn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Cn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:Z(a),fees:H(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(En||(En={}));var jn,Un={getQuote:function(t,e,n,r,s){return t===exports.SwapType.FixedInput?Fn({pool:e,reserves:n,assetIn:r,decimals:s}):Mn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Fn,getFixedOutputSwapQuote:Mn,generateTxns:function(t){return Ln.apply(this,arguments)},signTxns:function(t){return kn.apply(this,arguments)},execute:function(t){return Xn.apply(this,arguments)},executeFixedOutputSwap:Cn},Qn=4*t.ALGORAND_MIN_TX_FEE;function Gn(t){return Promise.allSettled(t).then((function(t){if(t.every((function(t){return"rejected"===t.status&&t.reason instanceof mn})))throw new mn;return t.filter((function(t){return"fulfilled"===t.status&&void 0!==t.value.quote})).map((function(t){return t.value}))}))}function qn(){return(qn=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===ut.V1_1?Un.getFixedInputSwapQuote(i):yn.getFixedInputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,Gn(o);case 4:return u=t.sent,t.abrupt("return",zn(u));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Wn(){return(Wn=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetOut:{amount:a,id:Number(s.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===ut.V1_1?Un.getFixedOutputSwapQuote(i):yn.getFixedOutputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,Gn(o);case 4:return u=t.sent,t.abrupt("return",zn(u));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function zn(t){return t.filter((function(t){return!Gt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Jn=(f(jn={},ut.V1_1,Un),f(jn,ut.V2,yn),f(jn,"getQuote",(function(t){if(t.pools.every((function(t){return Gt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?function(t){return qn.apply(this,arguments)}(t):function(t){return Wn.apply(this,arguments)}(t)})),f(jn,"generateTxns",(function(t){return t.pool.contractVersion===ut.V1_1?Un.generateTxns(t):yn.generateTxns(t)})),f(jn,"signTxns",(function(t){return t.pool.contractVersion===ut.V1_1?Un.signTxns(t):yn.signTxns(t)})),f(jn,"execute",(function(t){return t.contractVersion===ut.V1_1?Un.execute(t):yn.execute(t)})),jn);function Yn(){return(Yn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Kn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,Y(n,[o]);case 7:return u=t.sent,c=v(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:H(s),confirmedRound:d,txnID:l,groupID:Z(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Kn(t){return Hn.apply(this,arguments)}function Hn(){return(Hn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=v(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zn(){return Zn=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:H(e),groupID:Z(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,Y(n,[c]);case 4:p=s.sent,l=v(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),Zn.apply(this,arguments)}function $n(){return($n=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[tt("redeem")],note:lt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function tr(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[tt("commit"),u],note:L([tt("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function er(){return(er=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=tr({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[tt("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=et,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=Ze,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=he,exports.CONTRACT_VERSION=ut,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=nt,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Nn,exports.Swap=Jn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=tn,exports.V2AddLiquidityTxnIndices=be,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=Q,exports.calculateAccountMinimumRequiredBalance=wt,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=Jt,exports.prepareCommitTransactions=function(t){return er.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return Zn.apply(this,arguments)},exports.redeemExcessAsset=function(t){return Yn.apply(this,arguments)},exports.sendAndWaitRawTransaction=Y,exports.sumUpTxnFees=H,exports.tinymanContract_v1_1=At,exports.tinymanContract_v2=Tt,exports.tinymanJSSDKConfig=lt; diff --git a/dist/swap/types.d.ts b/dist/swap/types.d.ts index e215f49e..ffa07383 100644 --- a/dist/swap/types.d.ts +++ b/dist/swap/types.d.ts @@ -50,11 +50,9 @@ export interface V1SwapExecution { groupID: string; } export interface V2SwapExecution { + assetIn: AssetWithIdAndAmount; /** Can be `undefined` if the execution was successful, but there was an issue while - * extracting the input asset data fron the transaction response */ - assetIn: AssetWithIdAndAmount | undefined; - /** Can be `undefined` if the execution was successful, but there was an issue while - * extracting the output asset data fron the transaction response */ + * extracting the output asset data from the transaction response */ assetOut: AssetWithIdAndAmount | undefined; pool: V2PoolInfo; txnID: string; diff --git a/dist/util/transaction/transactionUtils.d.ts b/dist/util/transaction/transactionUtils.d.ts index fcd0d028..99249bd7 100644 --- a/dist/util/transaction/transactionUtils.d.ts +++ b/dist/util/transaction/transactionUtils.d.ts @@ -1,4 +1,4 @@ -import { Algodv2 } from "algosdk"; +import { Algodv2, TransactionType } from "algosdk"; import { SignerTransaction } from "../commonTypes"; export declare function getAppCallTxnResponse(client: Algodv2, txGroup: SignerTransaction[]): Promise | undefined>; /** @@ -8,9 +8,9 @@ export declare function getAppCallTxnResponse(client: Algodv2, txGroup: SignerTr export declare function getAppCallInnerTxns(client: Algodv2, txGroup: SignerTransaction[]): Promise<{ txn: { txn: { - xaid: number; - aamt: number; - type: string; + xaid?: number; + aamt?: number; + type: TransactionType; }; }; }[] | undefined>; diff --git a/src/add-liquidity/v2/common.ts b/src/add-liquidity/v2/common.ts index 3d2d5979..acfb967f 100644 --- a/src/add-liquidity/v2/common.ts +++ b/src/add-liquidity/v2/common.ts @@ -45,9 +45,10 @@ export async function execute({ return { round: confirmedRound, - assetOut: assetOutInnerTxn - ? {amount: assetOutInnerTxn.aamt, id: assetOutInnerTxn.xaid} - : undefined, + assetOut: + assetOutInnerTxn?.aamt && assetOutInnerTxn?.xaid + ? {amount: assetOutInnerTxn.aamt, id: assetOutInnerTxn.xaid} + : undefined, fees: sumUpTxnFees(txGroup), poolTokenID: pool.poolTokenID!, txnID, diff --git a/src/remove-liquidity/v2/index.ts b/src/remove-liquidity/v2/index.ts index 71a21055..00cef93e 100644 --- a/src/remove-liquidity/v2/index.ts +++ b/src/remove-liquidity/v2/index.ts @@ -1,4 +1,9 @@ -import algosdk, {Algodv2, ALGORAND_MIN_TX_FEE, Transaction} from "algosdk"; +import algosdk, { + Algodv2, + ALGORAND_MIN_TX_FEE, + Transaction, + TransactionType +} from "algosdk"; import {tinymanJSSDKConfig} from "../../config"; import {CONTRACT_VERSION} from "../../contract/constants"; @@ -325,10 +330,24 @@ async function execute({ signedTxns: Uint8Array[]; }): Promise { const [{txnID}] = await sendAndWaitRawTransaction(client, [signedTxns]); - const outputAssets = (await getAppCallInnerTxns(client, txGroup))?.map((data) => ({ - assetId: data.txn.txn.xaid, - amount: data.txn.txn.aamt - })); + const appCallInnerTxns = await getAppCallInnerTxns(client, txGroup); + + console.log({appCallInnerTxns}); + + const txns = appCallInnerTxns?.map((data) => data.txn.txn); + + console.log(JSON.stringify(txns, null, 2)); + const outputAssets = appCallInnerTxns + ?.filter( + (data) => + data.txn.txn.type === TransactionType.axfer && + data.txn.txn.xaid && + data.txn.txn.aamt + ) + .map((data) => ({ + assetId: data.txn.txn.xaid!, + amount: data.txn.txn.aamt! + })); return { outputAssets, diff --git a/src/swap/types.ts b/src/swap/types.ts index c8847f5f..5958fb46 100644 --- a/src/swap/types.ts +++ b/src/swap/types.ts @@ -53,11 +53,9 @@ export interface V1SwapExecution { } export interface V2SwapExecution { + assetIn: AssetWithIdAndAmount; /** Can be `undefined` if the execution was successful, but there was an issue while - * extracting the input asset data fron the transaction response */ - assetIn: AssetWithIdAndAmount | undefined; - /** Can be `undefined` if the execution was successful, but there was an issue while - * extracting the output asset data fron the transaction response */ + * extracting the output asset data from the transaction response */ assetOut: AssetWithIdAndAmount | undefined; pool: V2PoolInfo; txnID: string; diff --git a/src/swap/v2/index.ts b/src/swap/v2/index.ts index d75ddc2a..d890dc69 100644 --- a/src/swap/v2/index.ts +++ b/src/swap/v2/index.ts @@ -172,18 +172,21 @@ async function execute({ const assetInChangeInnerTxn = innerTxns?.find( (item) => item.txn.txn.xaid === assetIn.id )?.txn.txn; - const assetOutInnerTxn = innerTxns?.find((item) => item.txn.txn.xaid === assetOutId) - ?.txn.txn; + const assetOutInnerTxn = innerTxns?.find((item) => + Boolean(item.txn.txn.xaid === assetOutId && item.txn.txn.xaid) + )?.txn.txn; return { round: confirmedRound, - assetIn: assetInChangeInnerTxn && { - // The actual spent amount is the input amount minus the change (refunded) amount - amount: BigInt(assetIn.amount) - BigInt(assetInChangeInnerTxn.aamt || 0), + assetIn: { + // The actual spent amount is the input amount minus the change (refunded) amount, if any + amount: + BigInt(assetIn.amount) - + (assetInChangeInnerTxn?.aamt ? BigInt(assetInChangeInnerTxn.aamt) : 0n), id: assetIn.id }, assetOut: assetOutInnerTxn && { - amount: assetOutInnerTxn.aamt, + amount: assetOutInnerTxn.aamt || 0, id: assetOutId }, pool: await poolUtils.v2.getPoolInfo({ diff --git a/src/util/transaction/transactionUtils.ts b/src/util/transaction/transactionUtils.ts index db6b3f63..4de5e5d8 100644 --- a/src/util/transaction/transactionUtils.ts +++ b/src/util/transaction/transactionUtils.ts @@ -3,6 +3,7 @@ import { assignGroupID, decodeUnsignedTransaction, encodeUnsignedTransaction, + TransactionType, waitForConfirmation } from "algosdk"; @@ -32,7 +33,9 @@ export async function getAppCallTxnResponse( export async function getAppCallInnerTxns( client: Algodv2, txGroup: SignerTransaction[] -): Promise<{txn: {txn: {xaid: number; aamt: number; type: string}}}[] | undefined> { +): Promise< + {txn: {txn: {xaid?: number; aamt?: number; type: TransactionType}}}[] | undefined +> { const txResponse = await getAppCallTxnResponse(client, txGroup); return txResponse?.["inner-txns"]; From 3504499bdf93ad9f352c8d3e0ba5734db3304cdd Mon Sep 17 00:00:00 2001 From: Cem KIRAY Date: Fri, 24 Feb 2023 14:00:55 +0100 Subject: [PATCH 06/14] fix: improve inner txn type checks --- src/add-liquidity/v2/common.ts | 12 +++++++----- src/remove-liquidity/v2/index.ts | 10 ++-------- src/swap/v2/index.ts | 6 ++---- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/add-liquidity/v2/common.ts b/src/add-liquidity/v2/common.ts index acfb967f..56db97c6 100644 --- a/src/add-liquidity/v2/common.ts +++ b/src/add-liquidity/v2/common.ts @@ -40,15 +40,17 @@ export async function execute({ signedTxns ]); const assetOutInnerTxn = (await getAppCallInnerTxns(client, txGroup))?.find( - (item) => item.txn.txn.type === "axfer" + (item) => + item.txn.txn.type === "axfer" && + item.txn.txn.xaid !== undefined && + item.txn.txn.aamt !== undefined )?.txn.txn; return { round: confirmedRound, - assetOut: - assetOutInnerTxn?.aamt && assetOutInnerTxn?.xaid - ? {amount: assetOutInnerTxn.aamt, id: assetOutInnerTxn.xaid} - : undefined, + assetOut: assetOutInnerTxn + ? {amount: assetOutInnerTxn.aamt!, id: assetOutInnerTxn.xaid!} + : undefined, fees: sumUpTxnFees(txGroup), poolTokenID: pool.poolTokenID!, txnID, diff --git a/src/remove-liquidity/v2/index.ts b/src/remove-liquidity/v2/index.ts index 00cef93e..b54c6b53 100644 --- a/src/remove-liquidity/v2/index.ts +++ b/src/remove-liquidity/v2/index.ts @@ -331,18 +331,12 @@ async function execute({ }): Promise { const [{txnID}] = await sendAndWaitRawTransaction(client, [signedTxns]); const appCallInnerTxns = await getAppCallInnerTxns(client, txGroup); - - console.log({appCallInnerTxns}); - - const txns = appCallInnerTxns?.map((data) => data.txn.txn); - - console.log(JSON.stringify(txns, null, 2)); const outputAssets = appCallInnerTxns ?.filter( (data) => data.txn.txn.type === TransactionType.axfer && - data.txn.txn.xaid && - data.txn.txn.aamt + data.txn.txn.xaid !== undefined && + data.txn.txn.aamt !== undefined ) .map((data) => ({ assetId: data.txn.txn.xaid!, diff --git a/src/swap/v2/index.ts b/src/swap/v2/index.ts index d890dc69..8d3f3f1a 100644 --- a/src/swap/v2/index.ts +++ b/src/swap/v2/index.ts @@ -173,16 +173,14 @@ async function execute({ (item) => item.txn.txn.xaid === assetIn.id )?.txn.txn; const assetOutInnerTxn = innerTxns?.find((item) => - Boolean(item.txn.txn.xaid === assetOutId && item.txn.txn.xaid) + Boolean(item.txn.txn.xaid === assetOutId) )?.txn.txn; return { round: confirmedRound, assetIn: { // The actual spent amount is the input amount minus the change (refunded) amount, if any - amount: - BigInt(assetIn.amount) - - (assetInChangeInnerTxn?.aamt ? BigInt(assetInChangeInnerTxn.aamt) : 0n), + amount: BigInt(assetIn.amount) - BigInt(assetInChangeInnerTxn?.aamt || 0), id: assetIn.id }, assetOut: assetOutInnerTxn && { From 6d7119ae9291598be95c4ada127acf0175e27387 Mon Sep 17 00:00:00 2001 From: Cem KIRAY Date: Fri, 24 Feb 2023 14:02:10 +0100 Subject: [PATCH 07/14] chore: remove redundant Boolean cast --- src/swap/v2/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/swap/v2/index.ts b/src/swap/v2/index.ts index 8d3f3f1a..b171f9c8 100644 --- a/src/swap/v2/index.ts +++ b/src/swap/v2/index.ts @@ -172,9 +172,8 @@ async function execute({ const assetInChangeInnerTxn = innerTxns?.find( (item) => item.txn.txn.xaid === assetIn.id )?.txn.txn; - const assetOutInnerTxn = innerTxns?.find((item) => - Boolean(item.txn.txn.xaid === assetOutId) - )?.txn.txn; + const assetOutInnerTxn = innerTxns?.find((item) => item.txn.txn.xaid === assetOutId) + ?.txn.txn; return { round: confirmedRound, From de854b98bb1fc82bd172430fbb62ada01d3bd434 Mon Sep 17 00:00:00 2001 From: Cem KIRAY Date: Fri, 24 Feb 2023 16:04:53 +0100 Subject: [PATCH 08/14] fix(execute): extract asset data from inner txns correctly --- src/add-liquidity/v2/common.ts | 16 ++++------ src/remove-liquidity/v2/index.ts | 22 ++----------- src/remove-liquidity/v2/types.ts | 4 ++- src/swap/v2/index.ts | 20 +++++------- src/util/commonTypes.ts | 28 ++++++++++++++++- src/util/transaction/transactionUtils.ts | 40 +++++++++++++++++++++--- 6 files changed, 83 insertions(+), 47 deletions(-) diff --git a/src/add-liquidity/v2/common.ts b/src/add-liquidity/v2/common.ts index 56db97c6..92ec10da 100644 --- a/src/add-liquidity/v2/common.ts +++ b/src/add-liquidity/v2/common.ts @@ -3,7 +3,7 @@ import {Algodv2} from "algosdk"; import {InitiatorSigner, SignerTransaction} from "../../util/commonTypes"; import TinymanError from "../../util/error/TinymanError"; import {V2PoolInfo} from "../../util/pool/poolTypes"; -import {getAppCallInnerTxns} from "../../util/transaction/transactionUtils"; +import {getAppCallInnerAssetData} from "../../util/transaction/transactionUtils"; import {getTxnGroupID, sendAndWaitRawTransaction, sumUpTxnFees} from "../../util/util"; import {V2AddLiquidityExecution} from "./types"; @@ -39,18 +39,14 @@ export async function execute({ const [{confirmedRound, txnID}] = await sendAndWaitRawTransaction(client, [ signedTxns ]); - const assetOutInnerTxn = (await getAppCallInnerTxns(client, txGroup))?.find( - (item) => - item.txn.txn.type === "axfer" && - item.txn.txn.xaid !== undefined && - item.txn.txn.aamt !== undefined - )?.txn.txn; + const assetOut = (await getAppCallInnerAssetData(client, txGroup))?.find( + // Output asset is the pool token for add liquidity + ({id}) => id === pool.poolTokenID + ); return { round: confirmedRound, - assetOut: assetOutInnerTxn - ? {amount: assetOutInnerTxn.aamt!, id: assetOutInnerTxn.xaid!} - : undefined, + assetOut, fees: sumUpTxnFees(txGroup), poolTokenID: pool.poolTokenID!, txnID, diff --git a/src/remove-liquidity/v2/index.ts b/src/remove-liquidity/v2/index.ts index b54c6b53..292cb561 100644 --- a/src/remove-liquidity/v2/index.ts +++ b/src/remove-liquidity/v2/index.ts @@ -1,9 +1,4 @@ -import algosdk, { - Algodv2, - ALGORAND_MIN_TX_FEE, - Transaction, - TransactionType -} from "algosdk"; +import algosdk, {Algodv2, ALGORAND_MIN_TX_FEE, Transaction} from "algosdk"; import {tinymanJSSDKConfig} from "../../config"; import {CONTRACT_VERSION} from "../../contract/constants"; @@ -11,7 +6,7 @@ import {SwapV2} from "../../swap/v2"; import {SignerTransaction, InitiatorSigner} from "../../util/commonTypes"; import {V2_LOCKED_POOL_TOKENS} from "../../util/pool/poolConstants"; import {PoolReserves, V2PoolInfo} from "../../util/pool/poolTypes"; -import {getAppCallInnerTxns} from "../../util/transaction/transactionUtils"; +import {getAppCallInnerAssetData} from "../../util/transaction/transactionUtils"; import {applySlippageToAmount, sendAndWaitRawTransaction} from "../../util/util"; import { V2RemoveLiquidityTxnIndices, @@ -330,18 +325,7 @@ async function execute({ signedTxns: Uint8Array[]; }): Promise { const [{txnID}] = await sendAndWaitRawTransaction(client, [signedTxns]); - const appCallInnerTxns = await getAppCallInnerTxns(client, txGroup); - const outputAssets = appCallInnerTxns - ?.filter( - (data) => - data.txn.txn.type === TransactionType.axfer && - data.txn.txn.xaid !== undefined && - data.txn.txn.aamt !== undefined - ) - .map((data) => ({ - assetId: data.txn.txn.xaid!, - amount: data.txn.txn.aamt! - })); + const outputAssets = await getAppCallInnerAssetData(client, txGroup); return { outputAssets, diff --git a/src/remove-liquidity/v2/types.ts b/src/remove-liquidity/v2/types.ts index 597380e7..77dd4990 100644 --- a/src/remove-liquidity/v2/types.ts +++ b/src/remove-liquidity/v2/types.ts @@ -1,3 +1,5 @@ +import {AssetWithIdAndAmount} from "../../util/asset/assetModels"; + export interface V2QuoteAssetAmount { assetId: number; amount: bigint; @@ -33,6 +35,6 @@ export interface V2RemoveLiquidityExecution { * Can be `undefined` if the execution was successful, but there was an issue while * extracting the output asset data fron the transaction response */ - outputAssets: {assetId: number; amount: number}[] | undefined; + outputAssets: AssetWithIdAndAmount[] | undefined; txnID: string; } diff --git a/src/swap/v2/index.ts b/src/swap/v2/index.ts index b171f9c8..590aed21 100644 --- a/src/swap/v2/index.ts +++ b/src/swap/v2/index.ts @@ -23,7 +23,7 @@ import { import {poolUtils} from "../../util/pool"; import {isAlgo} from "../../util/asset/assetUtils"; import {calculatePriceImpact} from "../common/utils"; -import {getAppCallInnerTxns} from "../../util/transaction/transactionUtils"; +import {getAppCallInnerAssetData} from "../../util/transaction/transactionUtils"; import OutputAmountExceedsAvailableLiquidityError from "../../util/error/OutputAmountExceedsAvailableLiquidityError"; import {AssetWithIdAndAmount} from "../../util/asset/assetModels"; import {tinymanJSSDKConfig} from "../../config"; @@ -160,8 +160,8 @@ async function execute({ assetIn: AssetWithIdAndAmount; }): Promise { let [{confirmedRound, txnID}] = await sendAndWaitRawTransaction(client, [signedTxns]); - const innerTxns = await getAppCallInnerTxns(client, txGroup); const assetOutId = [pool.asset1ID, pool.asset2ID].filter((id) => id !== assetIn.id)[0]; + const innerTxnAssetData = await getAppCallInnerAssetData(client, txGroup); /** * If the swap type if Fixed Output, usually there will be a difference between * input amount and the actual used input amount. The change will be returned to the user @@ -169,23 +169,19 @@ async function execute({ * If it is `undefined`, it means that the input amount was exactly the amount used, * or the swap type is fixed input. */ - const assetInChangeInnerTxn = innerTxns?.find( - (item) => item.txn.txn.xaid === assetIn.id - )?.txn.txn; - const assetOutInnerTxn = innerTxns?.find((item) => item.txn.txn.xaid === assetOutId) - ?.txn.txn; + const assetInChangeAmount = innerTxnAssetData?.find( + ({id}) => id === assetIn.id + )?.amount; + const assetOut = innerTxnAssetData?.find(({id}) => id === assetOutId); return { round: confirmedRound, assetIn: { // The actual spent amount is the input amount minus the change (refunded) amount, if any - amount: BigInt(assetIn.amount) - BigInt(assetInChangeInnerTxn?.aamt || 0), + amount: BigInt(assetIn.amount) - BigInt(assetInChangeAmount || 0), id: assetIn.id }, - assetOut: assetOutInnerTxn && { - amount: assetOutInnerTxn.aamt || 0, - id: assetOutId - }, + assetOut, pool: await poolUtils.v2.getPoolInfo({ client, network, diff --git a/src/util/commonTypes.ts b/src/util/commonTypes.ts index d76cc5fe..fe69949d 100644 --- a/src/util/commonTypes.ts +++ b/src/util/commonTypes.ts @@ -1,4 +1,4 @@ -import {Transaction} from "algosdk"; +import {Transaction, TransactionType} from "algosdk"; export interface SignerTransaction { txn: Transaction; @@ -15,3 +15,29 @@ export type InitiatorSigner = ( ) => Promise; export type SupportedNetwork = "testnet" | "mainnet"; + +/** + * Type of the waitForConfirmation()["inner-txns"] + * NOT a complete type, only the fields we need. + */ +export type TxnResponseInnerTxns = { + txn: { + txn: + | { + type: TransactionType.axfer; + xaid: number; + aamt: number; + } + | { + type: TransactionType.pay; + amt: number; + } + | { + /** + * This is not a real txn type, only added to + * demonstrate that there can be other types + */ + type: "other"; + }; + }; +}[]; diff --git a/src/util/transaction/transactionUtils.ts b/src/util/transaction/transactionUtils.ts index 4de5e5d8..d3fa6e46 100644 --- a/src/util/transaction/transactionUtils.ts +++ b/src/util/transaction/transactionUtils.ts @@ -7,7 +7,9 @@ import { waitForConfirmation } from "algosdk"; -import {SignerTransaction} from "../commonTypes"; +import {ALGO_ASSET_ID} from "../asset/assetConstants"; +import {AssetWithIdAndAmount} from "../asset/assetModels"; +import {SignerTransaction, TxnResponseInnerTxns} from "../commonTypes"; import {DEFAULT_WAIT_FOR_CONFIRMATION_ROUNDS} from "../constant"; export async function getAppCallTxnResponse( @@ -33,14 +35,44 @@ export async function getAppCallTxnResponse( export async function getAppCallInnerTxns( client: Algodv2, txGroup: SignerTransaction[] -): Promise< - {txn: {txn: {xaid?: number; aamt?: number; type: TransactionType}}}[] | undefined -> { +): Promise { const txResponse = await getAppCallTxnResponse(client, txGroup); return txResponse?.["inner-txns"]; } +/** + * Tries to find the asset related (asset transfer / payment (i.e. ALGO transfer)) + * inner transactions in the app call, and return the extracted asset data. + * Useful for getting the asset data after an "execute" operation. + */ +export async function getAppCallInnerAssetData( + client: Algodv2, + txGroup: SignerTransaction[] +): Promise { + const innerTxns = await getAppCallInnerTxns(client, txGroup); + + return innerTxns?.reduce((assets, {txn}) => { + let updatedAssets = assets; + const {txn: innerTxn} = txn; + + if (innerTxn.type === TransactionType.axfer) { + updatedAssets.push({ + id: innerTxn.xaid, + amount: innerTxn.aamt + }); + } else if (innerTxn.type === TransactionType.pay) { + updatedAssets.push({ + // Payment transactions are always in ALGO + id: ALGO_ASSET_ID, + amount: innerTxn.amt + }); + } + + return updatedAssets; + }, []); +} + /** * Combines the provided signer transaction groups into one signer transaction group, with a new group ID * @param signerTransactions - The signer transaction groups to combine From 9bbfbe7236165cfef04da31c1da76db8f0a022d3 Mon Sep 17 00:00:00 2001 From: Cem KIRAY Date: Wed, 1 Mar 2023 13:34:36 +0100 Subject: [PATCH 09/14] fix: ignore error cases of `getAppCallInnerAssetData` calls --- dist/index.js | 2 +- dist/remove-liquidity/v2/types.d.ts | 6 ++---- dist/util/commonTypes.d.ts | 24 ++++++++++++++++++++- dist/util/transaction/transactionUtils.d.ts | 21 +++++++++--------- src/add-liquidity/v2/common.ts | 16 ++++++++++---- src/remove-liquidity/v2/index.ts | 9 +++++++- src/swap/v2/index.ts | 11 ++++++++-- 7 files changed, 65 insertions(+), 24 deletions(-) diff --git a/dist/index.js b/dist/index.js index 4b83f6bf..c9816a46 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("algosdk"),e=require("base64-js");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=n(t),s=Uint8Array.from([1]);function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,h(Error));var e=y(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return W({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){return W({decimalPlaces:0},Math.pow(10,Number(t))*Number(e))}function W(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=v(J(e),2),a=s[0],o=s[1],i=v(J(Math.round(Number(z(a,o+r)))),2),u=i[0],c=i[1];return Number(z(u,c-r))}return Math.round(e)}function z(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function J(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function Y(t,e){return K.apply(this,arguments)}function K(){return(K=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function H(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function Z(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function $(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function tt(t){return(new TextEncoder).encode(t)}var et={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151"},nt={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function rt(){return(rt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function st(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function at(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function ot(t){return 0===Number(t)}var it,ut={V1_1:"v1_1",V2:"v2"},ct={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},pt={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},lt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return tt("tinyman/".concat(t===ut.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),dt=(f(it={},ut.V1_1,{testnet:62368684,mainnet:552635992}),f(it,ut.V2,{testnet:148607e3,mainnet:1002541853}),it);function ft(t,e){var n=dt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function gt(){return(gt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var It=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),At=new(function(n){m(s,It);var r=y(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=ft(n.network,ut.V1_1),s=v(at(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:wt(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function _t(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function wt(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var Dt,bt,Et=tt("e");function St(t){return Nt.apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,y,v,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:h=k({stateArray:x}),T=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset1ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset2ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.poolTokenID)])),_=h[T],w=h[y],D=h[v],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Ot(){return(Ot=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mLt)){n.next=48;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(Lt,"]): ").concat(B.issuedLiquidity));case 48:return n.abrupt("return",B);case 49:case"end":return n.stop()}}),n,null,[[8,31,34,37]])})))).apply(this,arguments)}function Mt(){return Mt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,vt(n,r);case 6:return o=t.sent,u=_t(o,ft(s,ut.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Pt[ut.V1_1].asset1],asset2ID:u[Pt[ut.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Mt.apply(this,arguments)}var Ct=Object.freeze({__proto__:null,getPoolInfo:Ft,getPoolReserves:function(t,e){return Rt.apply(this,arguments)},getPoolAssets:function(t){return Mt.apply(this,arguments)}});function Vt(t){return Xt.apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=yt(ut.V2),u=o.generateLogicSigAccountForPool(e),c=ft(r,ut.V2),p=u.address(),l=at(s,a),t.next=8,vt(n,p);case 8:return d=t.sent,f=_t(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:ut.V2},f&&(m.asset1ProtocolFees=BigInt(f[Pt.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Pt.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Pt.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Pt.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Pt.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Pt.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Pt.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Pt.v2.totalFeeShare]),m.poolTokenID=Number(f[Pt.v2.poolTokenID]),m.asset1ID=Number(f[Pt.v2.asset1]),m.asset2ID=Number(f[Pt.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,vt(e,n.account.address());case 2:return r=t.sent,s=_t(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Pt.v2.asset1Reserves]),a.asset2=BigInt(s[Pt.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Pt.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ut(){return(Ut=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,vt(n,r);case 3:return a=t.sent,o=_t(a,ft(s,ut.V2)),u=null,o&&(u={asset1ID:o[Pt[ut.V2].asset1],asset2ID:o[Pt[ut.V2].asset2],poolTokenID:o[Pt[ut.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Qt=Object.freeze({__proto__:null,getPoolInfo:Vt,getPoolReserves:function(t,e){return jt.apply(this,arguments)},getPoolAssets:function(t){return Ut.apply(this,arguments)}});function Gt(t){return Boolean(t&&!(t.asset1+t.asset2))}var qt,Wt,zt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Gt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Gt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Ft(t),Vt(t)])}}),Jt=o((f(qt={},ut.V1_1,o(o({},Ct),zt)),f(qt,ut.V2,o(o({},Qt),zt)),qt),zt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(Wt||(Wt={}));var Yt=96e4,Kt=859e3;function Ht(){return(Ht=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,y,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=st(a,o),l=v(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=ot(I),h=ft(s,ut.V1_1),T=At.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),y=T.address(),_=r.default.makeApplicationOptInTxnFromObject({from:y,appIndex:h,note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),appArgs:[tt("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:y,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:nt.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:y,amount:Zt(x),suggestedParams:c}),(E=[])[Wt.FUNDING_TXN]=b,E[Wt.VALIDATOR_APP_CALL]=_,E[Wt.POOL_TOKEN_CREATE]=w,E[Wt.ASSET1_OPT_IN]=D,x||(E[Wt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:y,to:y,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[Wt.FUNDING_TXN],signers:[u]},{txn:S[Wt.VALIDATOR_APP_CALL],signers:[y]},{txn:S[Wt.POOL_TOKEN_CREATE],signers:[y]},{txn:S[Wt.ASSET1_OPT_IN],signers:[y]}],S[Wt.ASSET2_OPT_IN]&&N.push({txn:S[Wt.ASSET2_OPT_IN],signers:[y]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zt(t){return t?Yt:Kt}function $t(){return($t=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=at(o,u),f=v(d,2),m=f[0],g=f[1],I=At.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===Wt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function te(t){return ee.apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[Wt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ne(){return(ne=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,te({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",Jt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var re,se={generateTxns:function(t){return Ht.apply(this,arguments)},signTxns:function(t){return $t.apply(this,arguments)},execute:function(t){return ne.apply(this,arguments)},getBootstrapFundingTxnAmount:Zt};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(re||(re={}));var ae=5,oe=6;function ie(t,e){return ue.apply(this,arguments)}function ue(){return(ue=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ce(t,e){return pe.apply(this,arguments)}function pe(){return(pe=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ie(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function le(){return(le=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,y,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=ft(a,ut.V2),d=t.getApplicationAddress(l),f=st(o,u),m=v(f,2),g=m[0].id,I=m[1].id,e.next=9,Jt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=Tt.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),h=ot(I),(T=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[tt("bootstrap")],note:lt.getAppCallTxnNoteWithClientName(ut.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=fe(h),y=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:de(h),suggestedParams:p}),(_=[])[re.FUNDING_TXN]=y,_[re.VALIDATOR_APP_CALL]=T,w=r.default.assignGroupID(_),(D=[])[re.FUNDING_TXN]={txn:w[re.FUNDING_TXN],signers:[c]},D[re.VALIDATOR_APP_CALL]={txn:w[re.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function de(t){return function(t,e){var n=yt(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(ut.V2,t)+fe(t)+1e5}function fe(e){return((e?ae:oe)+1)*t.ALGORAND_MIN_TX_FEE}function me(){return(me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=v(c,1),l=p[0],d=at(o,u),f=v(d,2),m=f[0],g=f[1],I=Tt.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===re.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ge(){return(ge=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,ie(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Pt.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",Jt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var Ie,Ae={generateTxns:function(t){return le.apply(this,arguments)},signTxns:function(t){return me.apply(this,arguments)},execute:function(t){return ge.apply(this,arguments)},getBootstrapFundingTxnAmount:de,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+de(e)}};var xe,he=(f(Ie={},ut.V1_1,se),f(Ie,ut.V2,Ae),f(Ie,"generateTxns",(function(t){return t.contractVersion===ut.V1_1?se.generateTxns(t):Ae.generateTxns(t)})),f(Ie,"signTxns",(function(t){return t.contractVersion===ut.V1_1?se.signTxns(t):Ae.signTxns(t)})),f(Ie,"execute",(function(t){return t.contractVersion===ut.V1_1?se.execute(t):Ae.execute(t)})),f(Ie,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===ut.V1_1?se.getBootstrapFundingTxnAmount(n):Ae.getBootstrapFundingTxnAmount(n)})),Ie);exports.V1_1AddLiquidityTxnIndices=void 0,(xe=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[xe.FEE_TXN=0]="FEE_TXN",xe[xe.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",xe[xe.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",xe[xe.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",xe[xe.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var Te,ye,ve,_e,we=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(_e=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",_e.FLEXIBLE="flexible",_e.INITIAL="initial";var De,be=(f(Te={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(Te,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(Te,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),Te),Ee=(f(ye={},exports.V2AddLiquidityType.INITIAL,1),f(ye,exports.V2AddLiquidityType.SINGLE,2),f(ye,exports.V2AddLiquidityType.FLEXIBLE,2),ye),Se=(f(ve={},exports.V2AddLiquidityType.INITIAL,3),f(ve,exports.V2AddLiquidityType.FLEXIBLE,3),f(ve,exports.V2AddLiquidityType.SINGLE,2),ve);function Ne(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function Oe(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Ne({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return W({decimalPlaces:5},Math.abs(a/o-1))}function Pe(t){var e,n,r,s,a=t.reserves,o=t.totalFeeShare,i=t.asset1Amount,u=t.asset2Amount,c=t.decimals,p=a.asset1*a.asset2,l=a.asset1+BigInt(i),d=a.asset2+BigInt(u),f=l*d,m=BigInt(parseInt(String(Math.sqrt(Number(f*a.issuedLiquidity*a.issuedLiquidity/p))))),g=m-a.issuedLiquidity,I=g*l/m,A=g*d/m,x=BigInt(i)-I,h=BigInt(u)-A;if(x>h){var T=x;r=BigInt(Math.abs(Math.min(Number(h),0))),e=!0,n=T+(s=ke(T,o)),g-=s*m/(l*BigInt(2))}else{var y=h;r=BigInt(Math.abs(Math.min(Number(x),0))),e=!1,n=y+(s=ke(y,o)),g-=s*m/(d*BigInt(2))}return{poolTokenAssetAmount:g,swapFromAsset1ToAsset2:e,swapInAmount:n,swapOutAmount:r,swapTotalFeeAmount:s,swapPriceImpact:Oe({inputSupply:e?a.asset1:a.asset2,outputSupply:e?a.asset2:a.asset1,assetIn:{amount:n,decimals:c.asset1},assetOut:{amount:r,decimals:c.asset2}})}}function ke(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Le(e){return(Ee[e]+1)*t.ALGORAND_MIN_TX_FEE}var Fe=tt("add_liquidity"),Be=(f(De={},ut.V1_1,[tt("mint")]),f(De,ut.V2,{INITIAL_LIQUIDITY:[tt("add_initial_liquidity")],SINGLE_ASSET_MODE:[Fe,tt("single")],FLEXIBLE_MODE:[Fe,tt("flexible")]}),De);function Re(){return(Re=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=Q("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:ft(a,ut.V1_1),appArgs:Be.v1_1,accounts:[d],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),T=r.default.assignGroupID([h,g,I,A,x]),t.abrupt("return",[{txn:T[0],signers:[d]},{txn:T[1],signers:[o]},{txn:T[2],signers:[d]},{txn:T[3],signers:[d]},{txn:T[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(){return(Me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=v(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ce(){return(Ce=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,St({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,Y(n,[a]);case 8:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=H(s),I=Z(s),t.next=17,St({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(h=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&h.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),h;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var Ve=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=o0&&void 0!==arguments[0]?arguments[0]:"Output amount exceeds available liquidity";return p(this,n),e.call(this,t)}return d(n)}();function gn(){return(gn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,s=e.pool,a=e.swapType,o=e.assetIn,u=e.assetOut,c=e.initiatorAddr,p=e.slippage,l=s.account.address(),(d=[s.asset1ID,s.asset2ID]).includes(o.id)&&d.includes(u.id)&&o.id!==u.id){t.next=5;break}throw new P({pool:s,assetIn:o,assetOut:u},"Input asset (#".concat(o.id,") and output asset (#").concat(u.id,") provided to generate transactions do not belong to the pool ").concat(l,"."));case 5:return t.next=7,n.getTransactionParams().do();case 7:return f=t.sent,m=ot(o.id),g=a===exports.SwapType.FixedInput?o.amount:Q("positive",p,o.amount),I=a===exports.SwapType.FixedOutput?u.amount:Q("negative",p,u.amount),A=m?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:g,suggestedParams:f}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:c,to:l,amount:g,assetIndex:o.id,suggestedParams:f}),(x=r.default.makeApplicationNoOpTxnFromObject({from:c,appIndex:s.validatorAppID,appArgs:[dn,fn[a],r.default.encodeUint64(I)],note:lt.getAppCallTxnNoteWithClientName(ut.V2),accounts:[l],foreignAssets:[s.asset1ID,s.asset2ID],suggestedParams:f})).fee=In(a),(h=[])[cn.INPUT_TXN]=A,h[cn.APP_CALL_TXN]=x,T=r.default.assignGroupID(h),t.abrupt("return",[{txn:T[cn.INPUT_TXN],signers:[c]},{txn:T[cn.APP_CALL_TXN],signers:[c]}]);case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function In(e){return(ln[e]+1)*t.ALGORAND_MIN_TX_FEE}function An(){return(An=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=e.client,a=e.pool,o=e.txGroup,u=e.signedTxns,c=e.network,p=e.assetIn,t.next=3,Y(s,[u]);case 3:return l=t.sent,d=v(l,1),f=d[0],m=f.confirmedRound,g=f.txnID,t.next=10,ce(s,o);case 10:return I=t.sent,A=[a.asset1ID,a.asset2ID].filter((function(t){return t!==p.id}))[0],x=null==I||null===(n=I.find((function(t){return t.txn.txn.xaid===p.id})))||void 0===n?void 0:n.txn.txn,h=null==I||null===(r=I.find((function(t){return Boolean(t.txn.txn.xaid===A&&t.txn.txn.xaid)})))||void 0===r?void 0:r.txn.txn,t.t0=m,t.t1={amount:BigInt(p.amount)-(null!=x&&x.aamt?BigInt(x.aamt):0n),id:p.id},t.t2=h&&{amount:h.aamt||0,id:A},t.next=19,Jt.v2.getPoolInfo({client:s,network:c,asset1ID:a.asset1ID,asset2ID:a.asset2ID});case 19:return t.t3=t.sent,t.t4=g,t.abrupt("return",{round:t.t0,assetIn:t.t1,assetOut:t.t2,pool:t.t3,txnID:t.t4});case 22:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function xn(t){var e=t.pool,n=t.assetIn,r=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetIn:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset1Reserves,o=e.asset2Reserves;else{if(n.id!==e.asset2ID)throw new P({pool:e,assetIn:n},"Input asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset2Reserves,o=e.asset1Reserves}var c=Tn({inputSupply:a,outputSupply:o,swapInputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapOutputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(p>o)throw new mn;return{assetInID:n.id,assetInAmount:i,assetOutID:s,assetOutAmount:p,swapFee:Number(l),rate:G(r.assetOut,Number(p))/G(r.assetIn,Number(i)),priceImpact:d}}function hn(t){var e=t.pool,n=t.assetOut,r=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetOut:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset2Reserves,o=e.asset1Reserves;else{if(n.id!==e.asset2ID)throw new P({pool:e,assetOut:n},"Output asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset1Reserves,o=e.asset2Reserves}var c=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapOutputAmount,s=t.totalFeeShare,a=t.decimals,o=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.outputAmount,s=BigInt(e*n/(n-r))-e;return s+=BigInt(1)}({inputSupply:e,outputSupply:n,outputAmount:r}),i=function(t){var e=t.swapAmount,n=t.totalFeeShare,r=Math.floor(Number(e*BigInt(1e4)/(BigInt(1e4)-BigInt(n))));return BigInt(r)-e}({swapAmount:o,totalFeeShare:s}),u=o+i,c=Oe({inputSupply:e,outputSupply:n,assetIn:{amount:u,decimals:a.assetIn},assetOut:{amount:r,decimals:a.assetOut}});return{swapInputAmount:u,totalFeeAmount:i,priceImpact:c}}({inputSupply:a,outputSupply:o,swapOutputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapInputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(i>o)throw new mn;return{assetInID:s,assetInAmount:p,assetOutID:n.id,assetOutAmount:i,swapFee:Number(l),rate:G(r.assetOut,Number(i))/G(r.assetIn,Number(p)),priceImpact:d}}function Tn(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapInputAmount,s=t.totalFeeShare,a=t.decimals,o=BigInt(function(t){var e=t.inputAmount,n=t.totalFeeShare;return Math.floor(Number(e*BigInt(n))/1e4)}({inputAmount:r,totalFeeShare:s})),i=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapAmount,s=n-BigInt(e*n/(e+BigInt(r)));return s-=BigInt(1)}({inputSupply:e,outputSupply:n,swapAmount:r-o});return{swapOutputAmount:i,totalFeeAmount:o,priceImpact:Oe({inputSupply:e,outputSupply:n,assetIn:{amount:r,decimals:a.assetIn},assetOut:{amount:i,decimals:a.assetOut}})}}var yn={getQuote:function(t,e,n,r){return t===exports.SwapType.FixedInput?xn({pool:e,assetIn:n,decimals:r}):hn({pool:e,assetOut:n,decimals:r})},getFixedInputSwapQuote:xn,getFixedOutputSwapQuote:hn,generateTxns:function(t){return gn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return An.apply(this,arguments)},calculateFixedInputSwap:Tn};function vn(t,e){var n,r,s=BigInt(t),a=e.issuedLiquidity;return a>s+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function _n(){return(_n=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[en,r.default.encodeUint64(Q("negative",l,c)),r.default.encodeUint64(Q("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[$e.ASSET_TRANSFER_TXN]=g,A[$e.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[$e.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[$e.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wn(){return(wn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,y,v,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,h=Q("negative",l,p),c!==f){e.next=17;break}A=h,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=h,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return T=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(y=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[en,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(v=[])[$e.ASSET_TRANSFER_TXN]=T,v[$e.APP_CALL_TXN]=y,_=r.default.assignGroupID(v),e.abrupt("return",[{txn:_[$e.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[$e.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dn(){return(Dn=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.txGroup,a=n.signedTxns,e.next=3,Y(r,[a]);case 3:return o=e.sent,u=v(o,1),c=u[0].txnID,e.next=8,ce(r,s);case 8:return p=e.sent,console.log({appCallInnerTxns:p}),l=null==p?void 0:p.map((function(t){return t.txn.txn})),console.log(JSON.stringify(l,null,2)),d=null==p?void 0:p.filter((function(e){return e.txn.txn.type===t.TransactionType.axfer&&e.txn.txn.xaid&&e.txn.txn.aamt})).map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}})),e.abrupt("return",{outputAssets:d,txnID:c});case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var bn,En,Sn={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=vn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=vn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=yn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=yn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,h=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:h}}}return e},generateTxns:function(t){return _n.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return wn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return Dn.apply(this,arguments)}},Nn=(f(bn={},ut.V1_1,pn),f(bn,ut.V2,Sn),bn),On=3n,Pn=1000n;function kn(){return(kn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=v(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===En.FEE_TXN_INDEX?c:e===En.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ln(){return(Ln=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,y,v;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,d=a.account.address(),(f=[a.asset1ID,a.asset2ID]).includes(u.id)&&f.includes(c.id)&&u.id!==c.id){t.next=5;break}throw new P({pool:a,assetIn:u,assetOut:c},"Input asset (#".concat(u.id,") and output asset (#").concat(c.id,") provided to generate transactions do not belong to the pool ").concat(d,"."));case 5:return t.next=7,n.getTransactionParams().do();case 7:return m=t.sent,g=[tt("swap"),o===exports.SwapType.FixedInput?tt("fi"):tt("fo")],I=r.default.makeApplicationNoOpTxnFromObject({from:d,appIndex:a.validatorAppID,appArgs:g,accounts:[l],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:m}),A=o===exports.SwapType.FixedOutput?Q("positive",p,u.amount):u.amount,x=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:d,amount:A,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:d,assetIndex:u.id,amount:A,suggestedParams:m}),h=o===exports.SwapType.FixedInput?Q("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:l,amount:h,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:l,assetIndex:c.id,amount:h,suggestedParams:m}),y=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:d,amount:I.fee+T.fee,note:s,suggestedParams:m}),v=r.default.assignGroupID([y,I,x,T]),t.abrupt("return",[{txn:v[0],signers:[l]},{txn:v[1],signers:[d]},{txn:v[2],signers:[l]},{txn:v[3],signers:[d]}]);case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Fn(t){var e=t.pool,n=t.reserves,r=t.assetIn,s=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetIn:r},"Trying to swap on a non-existent pool");var a,i,u,c=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,i=n.asset1,u=n.asset2;else{if(r.id!==e.asset2ID)throw new P({pool:e,assetIn:r},"Input asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,i=n.asset2,u=n.asset1}var p=c*On/Pn,l=u-i*u/(i+(c-p));if(l>u)throw new mn;var d={assetIn:{amount:c,decimals:s.assetIn},assetOut:{amount:l,decimals:s.assetOut}};return{round:n.round,assetInID:r.id,assetInAmount:c,assetOutID:a,assetOutAmount:l,swapFee:Number(p),rate:Ne(d),priceImpact:Oe(o({inputSupply:i,outputSupply:u},d))}}function Bn(t){return Rn.apply(this,arguments)}function Rn(){return(Rn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Mn(t){var e=t.pool,n=t.reserves,r=t.assetOut,s=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetOut:r},"Trying to swap on a non-existent pool");var a,o,i,u=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,o=n.asset2,i=n.asset1;else{if(r.id!==e.asset2ID)throw new P({pool:e,assetOut:r},"Output asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,o=n.asset1,i=n.asset2}if(u>i)throw new mn;var c=o*i/(i-u)-o,p=c*Pn/(Pn-On),l=p-c,d=G(s.assetOut,Number(u))/G(s.assetIn,Number(p)),f=G(s.assetOut,Number(i))/G(s.assetIn,Number(o)),m=W({decimalPlaces:5},Math.abs(d/f-1));return{round:n.round,assetInID:a,assetInAmount:p,assetOutID:r.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Cn(t){return Vn.apply(this,arguments)}function Vn(){return(Vn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=v(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xn(){return(Xn=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[En.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[En.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[En.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[En.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Bn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Cn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:Z(a),fees:H(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(En||(En={}));var jn,Un={getQuote:function(t,e,n,r,s){return t===exports.SwapType.FixedInput?Fn({pool:e,reserves:n,assetIn:r,decimals:s}):Mn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Fn,getFixedOutputSwapQuote:Mn,generateTxns:function(t){return Ln.apply(this,arguments)},signTxns:function(t){return kn.apply(this,arguments)},execute:function(t){return Xn.apply(this,arguments)},executeFixedOutputSwap:Cn},Qn=4*t.ALGORAND_MIN_TX_FEE;function Gn(t){return Promise.allSettled(t).then((function(t){if(t.every((function(t){return"rejected"===t.status&&t.reason instanceof mn})))throw new mn;return t.filter((function(t){return"fulfilled"===t.status&&void 0!==t.value.quote})).map((function(t){return t.value}))}))}function qn(){return(qn=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===ut.V1_1?Un.getFixedInputSwapQuote(i):yn.getFixedInputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,Gn(o);case 4:return u=t.sent,t.abrupt("return",zn(u));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Wn(){return(Wn=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetOut:{amount:a,id:Number(s.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===ut.V1_1?Un.getFixedOutputSwapQuote(i):yn.getFixedOutputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,Gn(o);case 4:return u=t.sent,t.abrupt("return",zn(u));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function zn(t){return t.filter((function(t){return!Gt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Jn=(f(jn={},ut.V1_1,Un),f(jn,ut.V2,yn),f(jn,"getQuote",(function(t){if(t.pools.every((function(t){return Gt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?function(t){return qn.apply(this,arguments)}(t):function(t){return Wn.apply(this,arguments)}(t)})),f(jn,"generateTxns",(function(t){return t.pool.contractVersion===ut.V1_1?Un.generateTxns(t):yn.generateTxns(t)})),f(jn,"signTxns",(function(t){return t.pool.contractVersion===ut.V1_1?Un.signTxns(t):yn.signTxns(t)})),f(jn,"execute",(function(t){return t.contractVersion===ut.V1_1?Un.execute(t):yn.execute(t)})),jn);function Yn(){return(Yn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Kn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,Y(n,[o]);case 7:return u=t.sent,c=v(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:H(s),confirmedRound:d,txnID:l,groupID:Z(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Kn(t){return Hn.apply(this,arguments)}function Hn(){return(Hn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=v(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zn(){return Zn=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:H(e),groupID:Z(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,Y(n,[c]);case 4:p=s.sent,l=v(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),Zn.apply(this,arguments)}function $n(){return($n=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[tt("redeem")],note:lt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function tr(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[tt("commit"),u],note:L([tt("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function er(){return(er=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=tr({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[tt("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=et,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=Ze,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=he,exports.CONTRACT_VERSION=ut,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=nt,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Nn,exports.Swap=Jn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=tn,exports.V2AddLiquidityTxnIndices=be,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=Q,exports.calculateAccountMinimumRequiredBalance=wt,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=Jt,exports.prepareCommitTransactions=function(t){return er.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return Zn.apply(this,arguments)},exports.redeemExcessAsset=function(t){return Yn.apply(this,arguments)},exports.sendAndWaitRawTransaction=Y,exports.sumUpTxnFees=H,exports.tinymanContract_v1_1=At,exports.tinymanContract_v2=Tt,exports.tinymanJSSDKConfig=lt; +i=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new w(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(s,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===s)throw a;return b()}for(n.method=s,n.arg=a;;){var o=n.delegate;if(o){var i=v(o,n);if(i){if(i===l)continue;return i}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,o),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function d(){}function f(){}function m(){}var g={};u(g,s,(function(){return this}));var I=Object.getPrototypeOf,A=I&&I(I(D([])));A&&A!==e&&n.call(A,s)&&(g=A);var x=m.prototype=d.prototype=Object.create(g);function h(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(s,a,o,i){var u=p(t[s],t,a);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,o,i)}),(function(t){r("throw",t,o,i)})):e.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return r("throw",t,o,i)}))}i(u.arg)}var s;this._invoke=function(t,n){function a(){return new e((function(e,s){r(t,n,e,s)}))}return s=s?s.then(a,a):a()}}function v(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,v(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=p(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var s=r.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function y(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(y,this),this.reset(!0)}function D(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,h(Error));var e=v(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return W({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){return W({decimalPlaces:0},Math.pow(10,Number(t))*Number(e))}function W(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=y(J(e),2),a=s[0],o=s[1],i=y(J(Math.round(Number(z(a,o+r)))),2),u=i[0],c=i[1];return Number(z(u,c-r))}return Math.round(e)}function z(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function J(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function Y(t,e){return K.apply(this,arguments)}function K(){return(K=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function H(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function Z(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function $(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function tt(t){return(new TextEncoder).encode(t)}var et={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151"},nt={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function rt(){return(rt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function st(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function at(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function ot(t){return 0===Number(t)}var it,ut={V1_1:"v1_1",V2:"v2"},ct={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},pt={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},lt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return tt("tinyman/".concat(t===ut.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),dt=(f(it={},ut.V1_1,{testnet:62368684,mainnet:552635992}),f(it,ut.V2,{testnet:148607e3,mainnet:1002541853}),it);function ft(t,e){var n=dt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function gt(){return(gt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var It=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),At=new(function(n){m(s,It);var r=v(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=ft(n.network,ut.V1_1),s=y(at(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:wt(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function _t(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function wt(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var Dt,bt,Et=tt("e");function St(t){return Nt.apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,y,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:h=k({stateArray:x}),T=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset1ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset2ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.poolTokenID)])),_=h[T],w=h[v],D=h[y],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Ot(){return(Ot=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mLt)){n.next=48;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(Lt,"]): ").concat(B.issuedLiquidity));case 48:return n.abrupt("return",B);case 49:case"end":return n.stop()}}),n,null,[[8,31,34,37]])})))).apply(this,arguments)}function Mt(){return Mt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,yt(n,r);case 6:return o=t.sent,u=_t(o,ft(s,ut.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Pt[ut.V1_1].asset1],asset2ID:u[Pt[ut.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Mt.apply(this,arguments)}var Ct=Object.freeze({__proto__:null,getPoolInfo:Ft,getPoolReserves:function(t,e){return Rt.apply(this,arguments)},getPoolAssets:function(t){return Mt.apply(this,arguments)}});function Vt(t){return Xt.apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=vt(ut.V2),u=o.generateLogicSigAccountForPool(e),c=ft(r,ut.V2),p=u.address(),l=at(s,a),t.next=8,yt(n,p);case 8:return d=t.sent,f=_t(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:ut.V2},f&&(m.asset1ProtocolFees=BigInt(f[Pt.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Pt.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Pt.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Pt.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Pt.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Pt.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Pt.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Pt.v2.totalFeeShare]),m.poolTokenID=Number(f[Pt.v2.poolTokenID]),m.asset1ID=Number(f[Pt.v2.asset1]),m.asset2ID=Number(f[Pt.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,yt(e,n.account.address());case 2:return r=t.sent,s=_t(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Pt.v2.asset1Reserves]),a.asset2=BigInt(s[Pt.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Pt.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ut(){return(Ut=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,yt(n,r);case 3:return a=t.sent,o=_t(a,ft(s,ut.V2)),u=null,o&&(u={asset1ID:o[Pt[ut.V2].asset1],asset2ID:o[Pt[ut.V2].asset2],poolTokenID:o[Pt[ut.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Qt=Object.freeze({__proto__:null,getPoolInfo:Vt,getPoolReserves:function(t,e){return jt.apply(this,arguments)},getPoolAssets:function(t){return Ut.apply(this,arguments)}});function Gt(t){return Boolean(t&&!(t.asset1+t.asset2))}var qt,Wt,zt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Gt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Gt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Ft(t),Vt(t)])}}),Jt=o((f(qt={},ut.V1_1,o(o({},Ct),zt)),f(qt,ut.V2,o(o({},Qt),zt)),qt),zt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(Wt||(Wt={}));var Yt=96e4,Kt=859e3;function Ht(){return(Ht=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=st(a,o),l=y(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=ot(I),h=ft(s,ut.V1_1),T=At.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),v=T.address(),_=r.default.makeApplicationOptInTxnFromObject({from:v,appIndex:h,note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),appArgs:[tt("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:v,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:nt.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:v,to:v,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:v,amount:Zt(x),suggestedParams:c}),(E=[])[Wt.FUNDING_TXN]=b,E[Wt.VALIDATOR_APP_CALL]=_,E[Wt.POOL_TOKEN_CREATE]=w,E[Wt.ASSET1_OPT_IN]=D,x||(E[Wt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:v,to:v,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[Wt.FUNDING_TXN],signers:[u]},{txn:S[Wt.VALIDATOR_APP_CALL],signers:[v]},{txn:S[Wt.POOL_TOKEN_CREATE],signers:[v]},{txn:S[Wt.ASSET1_OPT_IN],signers:[v]}],S[Wt.ASSET2_OPT_IN]&&N.push({txn:S[Wt.ASSET2_OPT_IN],signers:[v]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zt(t){return t?Yt:Kt}function $t(){return($t=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=y(c,1),l=p[0],d=at(o,u),f=y(d,2),m=f[0],g=f[1],I=At.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===Wt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function te(t){return ee.apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[Wt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ne(){return(ne=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,te({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",Jt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var re,se={generateTxns:function(t){return Ht.apply(this,arguments)},signTxns:function(t){return $t.apply(this,arguments)},execute:function(t){return ne.apply(this,arguments)},getBootstrapFundingTxnAmount:Zt};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(re||(re={}));var ae=5,oe=6;function ie(t,e){return ue.apply(this,arguments)}function ue(){return(ue=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ce(t,e){return pe.apply(this,arguments)}function pe(){return(pe=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ie(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function le(t,e){return de.apply(this,arguments)}function de(){return(de=c(i().mark((function e(n,r){var s;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ce(n,r);case 2:return s=e.sent,e.abrupt("return",null==s?void 0:s.reduce((function(e,n){var r=e,s=n.txn.txn;return s.type===t.TransactionType.axfer?r.push({id:s.xaid,amount:s.aamt}):s.type===t.TransactionType.pay&&r.push({id:0,amount:s.amt}),r}),[]));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fe(){return(fe=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=ft(a,ut.V2),d=t.getApplicationAddress(l),f=st(o,u),m=y(f,2),g=m[0].id,I=m[1].id,e.next=9,Jt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=Tt.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),h=ot(I),(T=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[tt("bootstrap")],note:lt.getAppCallTxnNoteWithClientName(ut.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=ge(h),v=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:me(h),suggestedParams:p}),(_=[])[re.FUNDING_TXN]=v,_[re.VALIDATOR_APP_CALL]=T,w=r.default.assignGroupID(_),(D=[])[re.FUNDING_TXN]={txn:w[re.FUNDING_TXN],signers:[c]},D[re.VALIDATOR_APP_CALL]={txn:w[re.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function me(t){return function(t,e){var n=vt(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(ut.V2,t)+ge(t)+1e5}function ge(e){return((e?ae:oe)+1)*t.ALGORAND_MIN_TX_FEE}function Ie(){return(Ie=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=y(c,1),l=p[0],d=at(o,u),f=y(d,2),m=f[0],g=f[1],I=Tt.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===re.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ae(){return(Ae=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,ie(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Pt.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",Jt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var xe,he={generateTxns:function(t){return fe.apply(this,arguments)},signTxns:function(t){return Ie.apply(this,arguments)},execute:function(t){return Ae.apply(this,arguments)},getBootstrapFundingTxnAmount:me,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+me(e)}};var Te,ve=(f(xe={},ut.V1_1,se),f(xe,ut.V2,he),f(xe,"generateTxns",(function(t){return t.contractVersion===ut.V1_1?se.generateTxns(t):he.generateTxns(t)})),f(xe,"signTxns",(function(t){return t.contractVersion===ut.V1_1?se.signTxns(t):he.signTxns(t)})),f(xe,"execute",(function(t){return t.contractVersion===ut.V1_1?se.execute(t):he.execute(t)})),f(xe,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===ut.V1_1?se.getBootstrapFundingTxnAmount(n):he.getBootstrapFundingTxnAmount(n)})),xe);exports.V1_1AddLiquidityTxnIndices=void 0,(Te=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[Te.FEE_TXN=0]="FEE_TXN",Te[Te.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",Te[Te.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",Te[Te.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",Te[Te.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var ye,_e,we,De,be=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(De=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",De.FLEXIBLE="flexible",De.INITIAL="initial";var Ee,Se=(f(ye={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(ye,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(ye,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),ye),Ne=(f(_e={},exports.V2AddLiquidityType.INITIAL,1),f(_e,exports.V2AddLiquidityType.SINGLE,2),f(_e,exports.V2AddLiquidityType.FLEXIBLE,2),_e),Oe=(f(we={},exports.V2AddLiquidityType.INITIAL,3),f(we,exports.V2AddLiquidityType.FLEXIBLE,3),f(we,exports.V2AddLiquidityType.SINGLE,2),we);function Pe(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function ke(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Pe({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return W({decimalPlaces:5},Math.abs(a/o-1))}function Le(t){var e,n,r,s,a=t.reserves,o=t.totalFeeShare,i=t.asset1Amount,u=t.asset2Amount,c=t.decimals,p=a.asset1*a.asset2,l=a.asset1+BigInt(i),d=a.asset2+BigInt(u),f=l*d,m=BigInt(parseInt(String(Math.sqrt(Number(f*a.issuedLiquidity*a.issuedLiquidity/p))))),g=m-a.issuedLiquidity,I=g*l/m,A=g*d/m,x=BigInt(i)-I,h=BigInt(u)-A;if(x>h){var T=x;r=BigInt(Math.abs(Math.min(Number(h),0))),e=!0,n=T+(s=Fe(T,o)),g-=s*m/(l*BigInt(2))}else{var v=h;r=BigInt(Math.abs(Math.min(Number(x),0))),e=!1,n=v+(s=Fe(v,o)),g-=s*m/(d*BigInt(2))}return{poolTokenAssetAmount:g,swapFromAsset1ToAsset2:e,swapInAmount:n,swapOutAmount:r,swapTotalFeeAmount:s,swapPriceImpact:ke({inputSupply:e?a.asset1:a.asset2,outputSupply:e?a.asset2:a.asset1,assetIn:{amount:n,decimals:c.asset1},assetOut:{amount:r,decimals:c.asset2}})}}function Fe(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Be(e){return(Ne[e]+1)*t.ALGORAND_MIN_TX_FEE}var Re=tt("add_liquidity"),Me=(f(Ee={},ut.V1_1,[tt("mint")]),f(Ee,ut.V2,{INITIAL_LIQUIDITY:[tt("add_initial_liquidity")],SINGLE_ASSET_MODE:[Re,tt("single")],FLEXIBLE_MODE:[Re,tt("flexible")]}),Ee);function Ce(){return(Ce=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=Q("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:ft(a,ut.V1_1),appArgs:Me.v1_1,accounts:[d],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),T=r.default.assignGroupID([h,g,I,A,x]),t.abrupt("return",[{txn:T[0],signers:[d]},{txn:T[1],signers:[o]},{txn:T[2],signers:[d]},{txn:T[3],signers:[d]},{txn:T[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ve(){return(Ve=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=y(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xe(){return(Xe=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,St({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,Y(n,[a]);case 8:return p=t.sent,l=y(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=H(s),I=Z(s),t.next=17,St({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(h=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&h.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),h;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var je=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=o0&&void 0!==arguments[0]?arguments[0]:"Output amount exceeds available liquidity";return p(this,n),e.call(this,t)}return d(n)}();function An(){return(An=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,s=e.pool,a=e.swapType,o=e.assetIn,u=e.assetOut,c=e.initiatorAddr,p=e.slippage,l=s.account.address(),(d=[s.asset1ID,s.asset2ID]).includes(o.id)&&d.includes(u.id)&&o.id!==u.id){t.next=5;break}throw new P({pool:s,assetIn:o,assetOut:u},"Input asset (#".concat(o.id,") and output asset (#").concat(u.id,") provided to generate transactions do not belong to the pool ").concat(l,"."));case 5:return t.next=7,n.getTransactionParams().do();case 7:return f=t.sent,m=ot(o.id),g=a===exports.SwapType.FixedInput?o.amount:Q("positive",p,o.amount),I=a===exports.SwapType.FixedOutput?u.amount:Q("negative",p,u.amount),A=m?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:g,suggestedParams:f}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:c,to:l,amount:g,assetIndex:o.id,suggestedParams:f}),(x=r.default.makeApplicationNoOpTxnFromObject({from:c,appIndex:s.validatorAppID,appArgs:[mn,gn[a],r.default.encodeUint64(I)],note:lt.getAppCallTxnNoteWithClientName(ut.V2),accounts:[l],foreignAssets:[s.asset1ID,s.asset2ID],suggestedParams:f})).fee=xn(a),(h=[])[ln.INPUT_TXN]=A,h[ln.APP_CALL_TXN]=x,T=r.default.assignGroupID(h),t.abrupt("return",[{txn:T[ln.INPUT_TXN],signers:[c]},{txn:T[ln.APP_CALL_TXN],signers:[c]}]);case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function xn(e){return(fn[e]+1)*t.ALGORAND_MIN_TX_FEE}function hn(){return(hn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.client,o=e.pool,u=e.txGroup,c=e.signedTxns,p=e.network,l=e.assetIn,t.next=3,Y(a,[c]);case 3:return d=t.sent,f=y(d,1),m=f[0],g=m.confirmedRound,I=m.txnID,A=[o.asset1ID,o.asset2ID].filter((function(t){return t!==l.id}))[0],t.prev=9,t.next=12,le(a,u);case 12:x=t.sent,t.next=17;break;case 15:t.prev=15,t.t0=t.catch(9);case 17:return h=null===(n=x)||void 0===n||null===(r=n.find((function(t){return t.id===l.id})))||void 0===r?void 0:r.amount,T=null===(s=x)||void 0===s?void 0:s.find((function(t){return t.id===A})),t.t1=g,t.t2={amount:BigInt(l.amount)-BigInt(h||0),id:l.id},t.t3=T,t.next=24,Jt.v2.getPoolInfo({client:a,network:p,asset1ID:o.asset1ID,asset2ID:o.asset2ID});case 24:return t.t4=t.sent,t.t5=I,t.abrupt("return",{round:t.t1,assetIn:t.t2,assetOut:t.t3,pool:t.t4,txnID:t.t5});case 27:case"end":return t.stop()}}),t,null,[[9,15]])})))).apply(this,arguments)}function Tn(t){var e=t.pool,n=t.assetIn,r=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetIn:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset1Reserves,o=e.asset2Reserves;else{if(n.id!==e.asset2ID)throw new P({pool:e,assetIn:n},"Input asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset2Reserves,o=e.asset1Reserves}var c=yn({inputSupply:a,outputSupply:o,swapInputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapOutputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(p>o)throw new In;return{assetInID:n.id,assetInAmount:i,assetOutID:s,assetOutAmount:p,swapFee:Number(l),rate:G(r.assetOut,Number(p))/G(r.assetIn,Number(i)),priceImpact:d}}function vn(t){var e=t.pool,n=t.assetOut,r=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetOut:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset2Reserves,o=e.asset1Reserves;else{if(n.id!==e.asset2ID)throw new P({pool:e,assetOut:n},"Output asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset1Reserves,o=e.asset2Reserves}var c=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapOutputAmount,s=t.totalFeeShare,a=t.decimals,o=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.outputAmount,s=BigInt(e*n/(n-r))-e;return s+=BigInt(1)}({inputSupply:e,outputSupply:n,outputAmount:r}),i=function(t){var e=t.swapAmount,n=t.totalFeeShare,r=Math.floor(Number(e*BigInt(1e4)/(BigInt(1e4)-BigInt(n))));return BigInt(r)-e}({swapAmount:o,totalFeeShare:s}),u=o+i,c=ke({inputSupply:e,outputSupply:n,assetIn:{amount:u,decimals:a.assetIn},assetOut:{amount:r,decimals:a.assetOut}});return{swapInputAmount:u,totalFeeAmount:i,priceImpact:c}}({inputSupply:a,outputSupply:o,swapOutputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapInputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(i>o)throw new In;return{assetInID:s,assetInAmount:p,assetOutID:n.id,assetOutAmount:i,swapFee:Number(l),rate:G(r.assetOut,Number(i))/G(r.assetIn,Number(p)),priceImpact:d}}function yn(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapInputAmount,s=t.totalFeeShare,a=t.decimals,o=BigInt(function(t){var e=t.inputAmount,n=t.totalFeeShare;return Math.floor(Number(e*BigInt(n))/1e4)}({inputAmount:r,totalFeeShare:s})),i=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapAmount,s=n-BigInt(e*n/(e+BigInt(r)));return s-=BigInt(1)}({inputSupply:e,outputSupply:n,swapAmount:r-o});return{swapOutputAmount:i,totalFeeAmount:o,priceImpact:ke({inputSupply:e,outputSupply:n,assetIn:{amount:r,decimals:a.assetIn},assetOut:{amount:i,decimals:a.assetOut}})}}var _n={getQuote:function(t,e,n,r){return t===exports.SwapType.FixedInput?Tn({pool:e,assetIn:n,decimals:r}):vn({pool:e,assetOut:n,decimals:r})},getFixedInputSwapQuote:Tn,getFixedOutputSwapQuote:vn,generateTxns:function(t){return An.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return hn.apply(this,arguments)},calculateFixedInputSwap:yn};function wn(t,e){var n,r,s=BigInt(t),a=e.issuedLiquidity;return a>s+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function Dn(){return(Dn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[rn,r.default.encodeUint64(Q("negative",l,c)),r.default.encodeUint64(Q("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[en.ASSET_TRANSFER_TXN]=g,A[en.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[en.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[en.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bn(){return(bn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,y,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,h=Q("negative",l,p),c!==f){e.next=17;break}A=h,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=h,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return T=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(v=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[rn,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(y=[])[en.ASSET_TRANSFER_TXN]=T,y[en.APP_CALL_TXN]=v,_=r.default.assignGroupID(y),e.abrupt("return",[{txn:_[en.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[en.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function En(){return(En=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.txGroup,s=e.signedTxns,t.next=3,Y(n,[s]);case 3:return a=t.sent,o=y(a,1),u=o[0].txnID,t.prev=6,t.next=9,le(n,r);case 9:c=t.sent,t.next=14;break;case 12:t.prev=12,t.t0=t.catch(6);case 14:return t.abrupt("return",{outputAssets:c,txnID:u});case 15:case"end":return t.stop()}}),t,null,[[6,12]])})))).apply(this,arguments)}var Sn,Nn,On={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=wn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=wn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=_n.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=_n.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,h=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:h}}}return e},generateTxns:function(t){return Dn.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return bn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return En.apply(this,arguments)}},Pn=(f(Sn={},ut.V1_1,dn),f(Sn,ut.V2,On),Sn),kn=3n,Ln=1000n;function Fn(){return(Fn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=y(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===Nn.FEE_TXN_INDEX?c:e===Nn.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Bn(){return(Bn=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,y;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,d=a.account.address(),(f=[a.asset1ID,a.asset2ID]).includes(u.id)&&f.includes(c.id)&&u.id!==c.id){t.next=5;break}throw new P({pool:a,assetIn:u,assetOut:c},"Input asset (#".concat(u.id,") and output asset (#").concat(c.id,") provided to generate transactions do not belong to the pool ").concat(d,"."));case 5:return t.next=7,n.getTransactionParams().do();case 7:return m=t.sent,g=[tt("swap"),o===exports.SwapType.FixedInput?tt("fi"):tt("fo")],I=r.default.makeApplicationNoOpTxnFromObject({from:d,appIndex:a.validatorAppID,appArgs:g,accounts:[l],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:m}),A=o===exports.SwapType.FixedOutput?Q("positive",p,u.amount):u.amount,x=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:d,amount:A,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:d,assetIndex:u.id,amount:A,suggestedParams:m}),h=o===exports.SwapType.FixedInput?Q("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:l,amount:h,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:l,assetIndex:c.id,amount:h,suggestedParams:m}),v=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:d,amount:I.fee+T.fee,note:s,suggestedParams:m}),y=r.default.assignGroupID([v,I,x,T]),t.abrupt("return",[{txn:y[0],signers:[l]},{txn:y[1],signers:[d]},{txn:y[2],signers:[l]},{txn:y[3],signers:[d]}]);case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Rn(t){var e=t.pool,n=t.reserves,r=t.assetIn,s=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetIn:r},"Trying to swap on a non-existent pool");var a,i,u,c=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,i=n.asset1,u=n.asset2;else{if(r.id!==e.asset2ID)throw new P({pool:e,assetIn:r},"Input asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,i=n.asset2,u=n.asset1}var p=c*kn/Ln,l=u-i*u/(i+(c-p));if(l>u)throw new In;var d={assetIn:{amount:c,decimals:s.assetIn},assetOut:{amount:l,decimals:s.assetOut}};return{round:n.round,assetInID:r.id,assetInAmount:c,assetOutID:a,assetOutAmount:l,swapFee:Number(p),rate:Pe(d),priceImpact:ke(o({inputSupply:i,outputSupply:u},d))}}function Mn(t){return Cn.apply(this,arguments)}function Cn(){return(Cn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=y(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Vn(t){var e=t.pool,n=t.reserves,r=t.assetOut,s=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetOut:r},"Trying to swap on a non-existent pool");var a,o,i,u=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,o=n.asset2,i=n.asset1;else{if(r.id!==e.asset2ID)throw new P({pool:e,assetOut:r},"Output asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,o=n.asset1,i=n.asset2}if(u>i)throw new In;var c=o*i/(i-u)-o,p=c*Ln/(Ln-kn),l=p-c,d=G(s.assetOut,Number(u))/G(s.assetIn,Number(p)),f=G(s.assetOut,Number(i))/G(s.assetIn,Number(o)),m=W({decimalPlaces:5},Math.abs(d/f-1));return{round:n.round,assetInID:a,assetInAmount:p,assetOutID:r.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Xn(t){return jn.apply(this,arguments)}function jn(){return(jn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=y(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Un(){return(Un=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[Nn.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[Nn.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[Nn.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[Nn.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Mn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Xn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:Z(a),fees:H(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(Nn||(Nn={}));var Qn,Gn={getQuote:function(t,e,n,r,s){return t===exports.SwapType.FixedInput?Rn({pool:e,reserves:n,assetIn:r,decimals:s}):Vn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Rn,getFixedOutputSwapQuote:Vn,generateTxns:function(t){return Bn.apply(this,arguments)},signTxns:function(t){return Fn.apply(this,arguments)},execute:function(t){return Un.apply(this,arguments)},executeFixedOutputSwap:Xn},qn=4*t.ALGORAND_MIN_TX_FEE;function Wn(t){return Promise.allSettled(t).then((function(t){if(t.every((function(t){return"rejected"===t.status&&t.reason instanceof In})))throw new In;return t.filter((function(t){return"fulfilled"===t.status&&void 0!==t.value.quote})).map((function(t){return t.value}))}))}function zn(){return(zn=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===ut.V1_1?Gn.getFixedInputSwapQuote(i):_n.getFixedInputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,Wn(o);case 4:return u=t.sent,t.abrupt("return",Yn(u));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Jn(){return(Jn=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetOut:{amount:a,id:Number(s.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===ut.V1_1?Gn.getFixedOutputSwapQuote(i):_n.getFixedOutputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,Wn(o);case 4:return u=t.sent,t.abrupt("return",Yn(u));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Yn(t){return t.filter((function(t){return!Gt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Kn=(f(Qn={},ut.V1_1,Gn),f(Qn,ut.V2,_n),f(Qn,"getQuote",(function(t){if(t.pools.every((function(t){return Gt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?function(t){return zn.apply(this,arguments)}(t):function(t){return Jn.apply(this,arguments)}(t)})),f(Qn,"generateTxns",(function(t){return t.pool.contractVersion===ut.V1_1?Gn.generateTxns(t):_n.generateTxns(t)})),f(Qn,"signTxns",(function(t){return t.pool.contractVersion===ut.V1_1?Gn.signTxns(t):_n.signTxns(t)})),f(Qn,"execute",(function(t){return t.contractVersion===ut.V1_1?Gn.execute(t):_n.execute(t)})),Qn);function Hn(){return(Hn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Zn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,Y(n,[o]);case 7:return u=t.sent,c=y(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:H(s),confirmedRound:d,txnID:l,groupID:Z(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Zn(t){return $n.apply(this,arguments)}function $n(){return($n=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=y(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function tr(){return tr=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:H(e),groupID:Z(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,Y(n,[c]);case 4:p=s.sent,l=y(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),tr.apply(this,arguments)}function er(){return(er=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[tt("redeem")],note:lt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function nr(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[tt("commit"),u],note:L([tt("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function rr(){return(rr=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=nr({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[tt("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=et,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=tn,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=ve,exports.CONTRACT_VERSION=ut,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=nt,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Pn,exports.Swap=Kn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=nn,exports.V2AddLiquidityTxnIndices=Se,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=Q,exports.calculateAccountMinimumRequiredBalance=wt,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=Jt,exports.prepareCommitTransactions=function(t){return rr.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return tr.apply(this,arguments)},exports.redeemExcessAsset=function(t){return Hn.apply(this,arguments)},exports.sendAndWaitRawTransaction=Y,exports.sumUpTxnFees=H,exports.tinymanContract_v1_1=At,exports.tinymanContract_v2=Tt,exports.tinymanJSSDKConfig=lt; diff --git a/dist/remove-liquidity/v2/types.d.ts b/dist/remove-liquidity/v2/types.d.ts index 909aa4bc..5881d0ee 100644 --- a/dist/remove-liquidity/v2/types.d.ts +++ b/dist/remove-liquidity/v2/types.d.ts @@ -1,3 +1,4 @@ +import { AssetWithIdAndAmount } from "../../util/asset/assetModels"; export interface V2QuoteAssetAmount { assetId: number; amount: bigint; @@ -29,10 +30,7 @@ export interface V2RemoveLiquidityExecution { * Can be `undefined` if the execution was successful, but there was an issue while * extracting the output asset data fron the transaction response */ - outputAssets: { - assetId: number; - amount: number; - }[] | undefined; + outputAssets: AssetWithIdAndAmount[] | undefined; txnID: string; } export {}; diff --git a/dist/util/commonTypes.d.ts b/dist/util/commonTypes.d.ts index 2d934200..2b287ce0 100644 --- a/dist/util/commonTypes.d.ts +++ b/dist/util/commonTypes.d.ts @@ -1,4 +1,4 @@ -import { Transaction } from "algosdk"; +import { Transaction, TransactionType } from "algosdk"; export interface SignerTransaction { txn: Transaction; /** @@ -10,3 +10,25 @@ export interface SignerTransaction { } export declare type InitiatorSigner = (txGroupList: SignerTransaction[][]) => Promise; export declare type SupportedNetwork = "testnet" | "mainnet"; +/** + * Type of the waitForConfirmation()["inner-txns"] + * NOT a complete type, only the fields we need. + */ +export declare type TxnResponseInnerTxns = { + txn: { + txn: { + type: TransactionType.axfer; + xaid: number; + aamt: number; + } | { + type: TransactionType.pay; + amt: number; + } | { + /** + * This is not a real txn type, only added to + * demonstrate that there can be other types + */ + type: "other"; + }; + }; +}[]; diff --git a/dist/util/transaction/transactionUtils.d.ts b/dist/util/transaction/transactionUtils.d.ts index 99249bd7..d24ccbd4 100644 --- a/dist/util/transaction/transactionUtils.d.ts +++ b/dist/util/transaction/transactionUtils.d.ts @@ -1,19 +1,18 @@ -import { Algodv2, TransactionType } from "algosdk"; -import { SignerTransaction } from "../commonTypes"; +import { Algodv2 } from "algosdk"; +import { AssetWithIdAndAmount } from "../asset/assetModels"; +import { SignerTransaction, TxnResponseInnerTxns } from "../commonTypes"; export declare function getAppCallTxnResponse(client: Algodv2, txGroup: SignerTransaction[]): Promise | undefined>; /** * Tries to find the app call transaction in the group, get the response, and extract the inner txns data. * @returns the innter transactions of the app call transaction or `undefined` if no app call transaction was found. */ -export declare function getAppCallInnerTxns(client: Algodv2, txGroup: SignerTransaction[]): Promise<{ - txn: { - txn: { - xaid?: number; - aamt?: number; - type: TransactionType; - }; - }; -}[] | undefined>; +export declare function getAppCallInnerTxns(client: Algodv2, txGroup: SignerTransaction[]): Promise; +/** + * Tries to find the asset related (asset transfer / payment (i.e. ALGO transfer)) + * inner transactions in the app call, and return the extracted asset data. + * Useful for getting the asset data after an "execute" operation. + */ +export declare function getAppCallInnerAssetData(client: Algodv2, txGroup: SignerTransaction[]): Promise; /** * Combines the provided signer transaction groups into one signer transaction group, with a new group ID * @param signerTransactions - The signer transaction groups to combine diff --git a/src/add-liquidity/v2/common.ts b/src/add-liquidity/v2/common.ts index 92ec10da..7effa715 100644 --- a/src/add-liquidity/v2/common.ts +++ b/src/add-liquidity/v2/common.ts @@ -1,5 +1,6 @@ import {Algodv2} from "algosdk"; +import {AssetWithIdAndAmount} from "../../util/asset/assetModels"; import {InitiatorSigner, SignerTransaction} from "../../util/commonTypes"; import TinymanError from "../../util/error/TinymanError"; import {V2PoolInfo} from "../../util/pool/poolTypes"; @@ -39,10 +40,17 @@ export async function execute({ const [{confirmedRound, txnID}] = await sendAndWaitRawTransaction(client, [ signedTxns ]); - const assetOut = (await getAppCallInnerAssetData(client, txGroup))?.find( - // Output asset is the pool token for add liquidity - ({id}) => id === pool.poolTokenID - ); + + let assetOut: AssetWithIdAndAmount | undefined; + + try { + assetOut = (await getAppCallInnerAssetData(client, txGroup))?.find( + // Output asset is the pool token for add liquidity + ({id}) => id === pool.poolTokenID + ); + } catch (_error) { + // We can ignore this error since the main execution was successful + } return { round: confirmedRound, diff --git a/src/remove-liquidity/v2/index.ts b/src/remove-liquidity/v2/index.ts index 292cb561..c0175c9f 100644 --- a/src/remove-liquidity/v2/index.ts +++ b/src/remove-liquidity/v2/index.ts @@ -3,6 +3,7 @@ import algosdk, {Algodv2, ALGORAND_MIN_TX_FEE, Transaction} from "algosdk"; import {tinymanJSSDKConfig} from "../../config"; import {CONTRACT_VERSION} from "../../contract/constants"; import {SwapV2} from "../../swap/v2"; +import {AssetWithIdAndAmount} from "../../util/asset/assetModels"; import {SignerTransaction, InitiatorSigner} from "../../util/commonTypes"; import {V2_LOCKED_POOL_TOKENS} from "../../util/pool/poolConstants"; import {PoolReserves, V2PoolInfo} from "../../util/pool/poolTypes"; @@ -325,7 +326,13 @@ async function execute({ signedTxns: Uint8Array[]; }): Promise { const [{txnID}] = await sendAndWaitRawTransaction(client, [signedTxns]); - const outputAssets = await getAppCallInnerAssetData(client, txGroup); + let outputAssets: AssetWithIdAndAmount[] | undefined; + + try { + outputAssets = await getAppCallInnerAssetData(client, txGroup); + } catch (_error) { + // We can ignore this error since the main execution was successful + } return { outputAssets, diff --git a/src/swap/v2/index.ts b/src/swap/v2/index.ts index 590aed21..86d4668c 100644 --- a/src/swap/v2/index.ts +++ b/src/swap/v2/index.ts @@ -159,9 +159,16 @@ async function execute({ signedTxns: Uint8Array[]; assetIn: AssetWithIdAndAmount; }): Promise { - let [{confirmedRound, txnID}] = await sendAndWaitRawTransaction(client, [signedTxns]); + const [{confirmedRound, txnID}] = await sendAndWaitRawTransaction(client, [signedTxns]); const assetOutId = [pool.asset1ID, pool.asset2ID].filter((id) => id !== assetIn.id)[0]; - const innerTxnAssetData = await getAppCallInnerAssetData(client, txGroup); + let innerTxnAssetData: AssetWithIdAndAmount[] | undefined; + + try { + innerTxnAssetData = await getAppCallInnerAssetData(client, txGroup); + } catch (_error) { + // We can ignore this error since the main execution was successful + } + /** * If the swap type if Fixed Output, usually there will be a difference between * input amount and the actual used input amount. The change will be returned to the user From 051443f8a9f47b7072765c399249014138e31efa Mon Sep 17 00:00:00 2001 From: Cem KIRAY Date: Tue, 21 Mar 2023 13:02:13 +0100 Subject: [PATCH 10/14] chore: upgrade dependencies --- package-lock.json | 5678 ++++++++++++++++++++++++--------------------- package.json | 44 +- 2 files changed, 3047 insertions(+), 2675 deletions(-) diff --git a/package-lock.json b/package-lock.json index b2b4758a..af4fd9e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,36 +9,36 @@ "version": "2.0.7", "license": "MIT", "dependencies": { - "algosdk": "^1.20.0", + "algosdk": "^2.1.0", "base64-js": "^1.5.1" }, "devDependencies": { - "@babel/preset-env": "^7.19.0", - "@babel/preset-typescript": "^7.18.6", - "@hipo/eslint-config-base": "^4.2.1", + "@babel/preset-env": "^7.20.2", + "@babel/preset-typescript": "^7.21.0", + "@hipo/eslint-config-base": "^4.3.0", "@hipo/eslint-config-typescript": "^1.2.0", - "@rollup/plugin-babel": "^5.3.1", - "@rollup/plugin-commonjs": "^22.0.2", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^14.0.0", - "@types/jest": "^29.4.0", - "@types/node": "^14.14.14", - "@typescript-eslint/eslint-plugin": "^5.36.2", - "@typescript-eslint/parser": "^5.36.2", - "eslint": "^8.23.0", - "eslint-config-prettier": "^8.5.0", + "@rollup/plugin-babel": "^6.0.3", + "@rollup/plugin-commonjs": "^24.0.1", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "@types/jest": "^29.5.0", + "@types/node": "^18.15.5", + "@typescript-eslint/eslint-plugin": "^5.56.0", + "@typescript-eslint/parser": "^5.56.0", + "eslint": "^8.36.0", + "eslint-config-prettier": "^8.8.0", "eslint-import-resolver-typescript": "^2.7.1", - "eslint-plugin-import": "^2.26.0", - "husky": "^7.0.4", - "jest": "^29.4.1", + "eslint-plugin-import": "^2.27.5", + "husky": "^8.0.3", + "jest": "^29.5.0", "js-sha512": "^0.8.0", - "lint-staged": "^12.4.1", - "prettier": "^2.7.1", - "rollup": "^2.79.0", + "lint-staged": "^13.2.0", + "prettier": "^2.8.6", + "rollup": "^3.20.0", "rollup-plugin-eslint": "^7.0.0", "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-typescript2": "^0.33.0", - "typescript": "^4.8.2" + "rollup-plugin-typescript2": "^0.34.1", + "typescript": "^5.0.2" } }, "node_modules/@ampproject/remapping": { @@ -67,9 +67,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.0.tgz", - "integrity": "sha512-y5rqgTTPTmaF5e2nVhOxw+Ur9HDJLsWb6U/KpgUzRZEdPfE6VOubXBKLdbcUTijzRptednSBDQbYZBOSqJxpJw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.0.tgz", + "integrity": "sha512-gMuZsmsgxk/ENC3O/fRw5QY8A9/uxQbbCEypnLIiYYc/qVJtEV7ouxC3EllIIwNzMqAQee5tanFabWsUOutS7g==", "dev": true, "engines": { "node": ">=6.9.0" @@ -127,13 +127,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.0.tgz", - "integrity": "sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.3.tgz", + "integrity": "sha512-QS3iR1GYC/YGUnW7IdggFeN5c1poPUurnGttOV/bZgPGV+izC/D8HnD6DLwod0fsatNyVn1G3EVWMYIF0nHbeA==", "dev": true, "dependencies": { - "@babel/types": "^7.19.0", + "@babel/types": "^7.21.3", "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" }, "engines": { @@ -180,14 +181,15 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.0.tgz", - "integrity": "sha512-Ai5bNWXIvwDvWM7njqsG3feMlL9hCVQsPYXodsZyLwshYkZVJt59Gftau4VrE8S9IT9asd2uSP1hG6wCNw+sXA==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz", + "integrity": "sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.19.0", + "@babel/compat-data": "^7.20.5", "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.20.2", + "browserslist": "^4.21.3", + "lru-cache": "^5.1.1", "semver": "^6.3.0" }, "engines": { @@ -197,6 +199,15 @@ "@babel/core": "^7.0.0" } }, + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "dependencies": { + "yallist": "^3.0.2" + } + }, "node_modules/@babel/helper-compilation-targets/node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -206,18 +217,25 @@ "semver": "bin/semver.js" } }, + "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.19.0.tgz", - "integrity": "sha512-NRz8DwF4jT3UfrmUoZjd0Uph9HQnP30t7Ash+weACcyNkiYTywpIjDBgReJMKgr+n86sn2nPVVmJ28Dm053Kqw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.21.0.tgz", + "integrity": "sha512-Q8wNiMIdwsv5la5SPxNYzzkPnjgC0Sy0i7jLkVOCdllu/xcVNkr3TeZzbHBJrj+XXRqzX5uCyCoV9eu6xUG7KQ==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.18.6", "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-member-expression-to-functions": "^7.18.9", + "@babel/helper-function-name": "^7.21.0", + "@babel/helper-member-expression-to-functions": "^7.21.0", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-replace-supers": "^7.18.9", + "@babel/helper-replace-supers": "^7.20.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.20.0", "@babel/helper-split-export-declaration": "^7.18.6" }, "engines": { @@ -228,13 +246,13 @@ } }, "node_modules/@babel/helper-create-regexp-features-plugin": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.19.0.tgz", - "integrity": "sha512-htnV+mHX32DF81amCDrwIDr8nrp1PTm+3wfBN9/v8QJOLEioOCOG7qNyq0nHeFiWbT3Eb7gsPwEmV64UCQ1jzw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.21.0.tgz", + "integrity": "sha512-N+LaFW/auRSWdx7SHD/HiARwXQju1vXTW4fKr4u5SgBUTm51OKEjKgj+cs00ggW3kEvNqwErnlwuq7Y3xBe4eg==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.18.6", - "regexpu-core": "^5.1.0" + "regexpu-core": "^5.3.1" }, "engines": { "node": ">=6.9.0" @@ -244,9 +262,9 @@ } }, "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.2.tgz", - "integrity": "sha512-r9QJJ+uDWrd+94BSPcP6/de67ygLtvVy6cK4luE6MOuDsZIdoaPBnfSpbO/+LTifjPckbKXRuI9BB/Z2/y3iTg==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", + "integrity": "sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww==", "dev": true, "dependencies": { "@babel/helper-compilation-targets": "^7.17.7", @@ -291,13 +309,13 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", - "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", + "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", "dev": true, "dependencies": { - "@babel/template": "^7.18.10", - "@babel/types": "^7.19.0" + "@babel/template": "^7.20.7", + "@babel/types": "^7.21.0" }, "engines": { "node": ">=6.9.0" @@ -316,12 +334,12 @@ } }, "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.18.9.tgz", - "integrity": "sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.0.tgz", + "integrity": "sha512-Muu8cdZwNN6mRRNG6lAYErJ5X3bRevgYR2O8wN0yn7jJSnGDu6eG59RfT29JHxGUovyfrh6Pj0XzmR7drNVL3Q==", "dev": true, "dependencies": { - "@babel/types": "^7.18.9" + "@babel/types": "^7.21.0" }, "engines": { "node": ">=6.9.0" @@ -340,19 +358,19 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz", - "integrity": "sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ==", + "version": "7.21.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz", + "integrity": "sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" + "@babel/helper-validator-identifier": "^7.19.1", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.2", + "@babel/types": "^7.21.2" }, "engines": { "node": ">=6.9.0" @@ -371,9 +389,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz", - "integrity": "sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", + "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -398,40 +416,41 @@ } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.18.9.tgz", - "integrity": "sha512-dNsWibVI4lNT6HiuOIBr1oyxo40HvIVmbwPUm3XZ7wMh4k2WxrxTqZwSqw/eEmXDS9np0ey5M2bz9tBmO9c+YQ==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.20.7.tgz", + "integrity": "sha512-vujDMtB6LVfNW13jhlCrp48QNslK6JXi7lQG736HVbHz/mbf4Dc7tIRh1Xf5C0rF7BP8iiSxGMCmY6Ci1ven3A==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-member-expression-to-functions": "^7.18.9", + "@babel/helper-member-expression-to-functions": "^7.20.7", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.20.7", + "@babel/types": "^7.20.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz", - "integrity": "sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.20.2" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.18.9.tgz", - "integrity": "sha512-imytd2gHi3cJPsybLRbmFrF7u5BIEuI2cNheyKi3/iOBC63kNn3q8Crn2xVuESli0aM4KYsyEqKyS7lFL8YVtw==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.20.0.tgz", + "integrity": "sha512-5y1JYeNKfvnT8sZcK9DVRtpTbGiomYIHviSP3OQWmDPU3DeH4a1ZlT/N2lyQ5P8egjcRaT/Y9aNqUxK0WsnIIg==", "dev": true, "dependencies": { - "@babel/types": "^7.18.9" + "@babel/types": "^7.20.0" }, "engines": { "node": ">=6.9.0" @@ -468,9 +487,9 @@ } }, "node_modules/@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz", + "integrity": "sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -591,9 +610,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.20.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.13.tgz", - "integrity": "sha512-gFDLKMfpiXCsjt4za2JA9oTMn70CeseCehb11kRZgvd7+F67Hih3OHOK24cRrWECJ/ljfPGac6ygXAs/C8kIvw==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.3.tgz", + "integrity": "sha512-lobG0d7aOfQRXh8AyklEAgZGvA4FShxo6xQbUrrT/cNBPUdIDojlokwJsQyCC/eKia7ifqM0yP+2DRZ4WKw2RQ==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -635,13 +654,13 @@ } }, "node_modules/@babel/plugin-proposal-async-generator-functions": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.0.tgz", - "integrity": "sha512-nhEByMUTx3uZueJ/QkJuSlCfN4FGg+xy+vRsfGQGzSauq5ks2Deid2+05Q3KhfaUjvec1IGhw/Zm3cFm8JigTQ==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.7.tgz", + "integrity": "sha512-xMbiLsn/8RK7Wq7VeVytytS2L6qE69bXPB10YCmMdDZbKF4okCqY74pI/jJQ/8U0b/F6NrT2+14b8/P9/3AMGA==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-plugin-utils": "^7.19.0", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/helper-remap-async-to-generator": "^7.18.9", "@babel/plugin-syntax-async-generators": "^7.8.4" }, @@ -782,16 +801,16 @@ } }, "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz", - "integrity": "sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz", + "integrity": "sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", + "@babel/compat-data": "^7.20.5", + "@babel/helper-compilation-targets": "^7.20.7", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" + "@babel/plugin-transform-parameters": "^7.20.7" }, "engines": { "node": ">=6.9.0" @@ -959,12 +978,12 @@ } }, "node_modules/@babel/plugin-syntax-import-assertions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz", - "integrity": "sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.20.0.tgz", + "integrity": "sha512-IUh1vakzNoWalR8ch/areW7qFopR2AEw03JlG7BbrDqmQ4X3q9uuipQwSGrUn7oGiemKjtSLDhNtQHzMHr1JdQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.19.0" }, "engines": { "node": ">=6.9.0" @@ -1115,12 +1134,12 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.18.6.tgz", - "integrity": "sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz", + "integrity": "sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.19.0" }, "engines": { "node": ">=6.9.0" @@ -1177,12 +1196,12 @@ } }, "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.9.tgz", - "integrity": "sha512-5sDIJRV1KtQVEbt/EIBwGy4T01uYIo4KRB3VUqzkhrAIOGx7AoctL9+Ux88btY0zXdDyPJ9mW+bg+v+XEkGmtw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.21.0.tgz", + "integrity": "sha512-Mdrbunoh9SxwFZapeHVrwFmri16+oYotcZysSzhNIVDwIAb1UV+kvnxULSYq9J3/q5MDG+4X6w8QVgD1zhBXNQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1192,18 +1211,18 @@ } }, "node_modules/@babel/plugin-transform-classes": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.19.0.tgz", - "integrity": "sha512-YfeEE9kCjqTS9IitkgfJuxjcEtLUHMqa8yUJ6zdz8vR7hKuo6mOy2C05P0F1tdMmDCeuyidKnlrw/iTppHcr2A==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.21.0.tgz", + "integrity": "sha512-RZhbYTCEUAe6ntPehC4hlslPWosNHDox+vAs4On/mCLRLfoDVHf6hVEd7kuxr1RnHwJmxFfUM3cZiZRmPxJPXQ==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-compilation-targets": "^7.19.0", + "@babel/helper-compilation-targets": "^7.20.7", "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", + "@babel/helper-function-name": "^7.21.0", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-replace-supers": "^7.18.9", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-replace-supers": "^7.20.7", "@babel/helper-split-export-declaration": "^7.18.6", "globals": "^11.1.0" }, @@ -1214,15 +1233,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-classes/node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/plugin-transform-computed-properties": { "version": "7.18.9", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.18.9.tgz", @@ -1239,12 +1249,12 @@ } }, "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.13.tgz", - "integrity": "sha512-TodpQ29XekIsex2A+YJPj5ax2plkGa8YYY6mFjCohk/IG9IY42Rtuj1FuDeemfg2ipxIFLzPeA83SIBnlhSIow==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.21.3.tgz", + "integrity": "sha512-bp6hwMFzuiE4HqYEyoGJ/V2LeIWn+hLVKc4pnj++E5XQptwhtcGmSayM029d/j2X1bPKGTlsyPwAubuU22KhMA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1363,14 +1373,13 @@ } }, "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz", - "integrity": "sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg==", + "version": "7.20.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.20.11.tgz", + "integrity": "sha512-NuzCt5IIYOW0O30UvqktzHYR2ud5bOWbY0yaxWZ6G+aFzOMJvrs5YHNikrbdaT15+KNO31nPOy5Fim3ku6Zb5g==", "dev": true, "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.20.11", + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1380,15 +1389,14 @@ } }, "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz", - "integrity": "sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q==", + "version": "7.21.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.21.2.tgz", + "integrity": "sha512-Cln+Yy04Gxua7iPdj6nOV96smLGjpElir5YwzF0LBPKoPlLDNJePNlrGGaybAJkd0zKRnOVXOgizSqPYMNYkzA==", "dev": true, "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.21.2", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-simple-access": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1398,16 +1406,15 @@ } }, "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.0.tgz", - "integrity": "sha512-x9aiR0WXAWmOWsqcsnrzGR+ieaTMVyGyffPVA7F8cXAGt/UxefYv6uSHZLkAFChN5M5Iy1+wjE+xJuPt22H39A==", + "version": "7.20.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.20.11.tgz", + "integrity": "sha512-vVu5g9BPQKSFEmvt2TA4Da5N+QVS66EX21d8uoOihC+OCpUoGvzVsXeqFdtAEfVa5BILAeFt+U7yVmLbQnAJmw==", "dev": true, "dependencies": { "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-module-transforms": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-validator-identifier": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.20.11", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-validator-identifier": "^7.19.1" }, "engines": { "node": ">=6.9.0" @@ -1433,13 +1440,13 @@ } }, "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.19.0.tgz", - "integrity": "sha512-HDSuqOQzkU//kfGdiHBt71/hkDTApw4U/cMVgKgX7PqfB3LOaK+2GtCEsBu1dL9CkswDm0Gwehht1dCr421ULQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.20.5.tgz", + "integrity": "sha512-mOW4tTzi5iTLnw+78iEq3gr8Aoq4WNRGpmSlrogqaiCBoR1HFhpU4JkpQFOHfeYx3ReVIFWOQJS4aZBRvuZ6mA==", "dev": true, "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0" + "@babel/helper-create-regexp-features-plugin": "^7.20.5", + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1480,12 +1487,12 @@ } }, "node_modules/@babel/plugin-transform-parameters": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz", - "integrity": "sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.21.3.tgz", + "integrity": "sha512-Wxc+TvppQG9xWFYatvCGPvZ6+SIUxQ2ZdiBP+PHYMIjnPXD+uThCshaz4NZOnODAtBjjcVQQ/3OKs9LW28purQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1617,14 +1624,15 @@ } }, "node_modules/@babel/plugin-transform-typescript": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.19.0.tgz", - "integrity": "sha512-DOOIywxPpkQHXijXv+s9MDAyZcLp12oYRl3CMWZ6u7TjSoCBq/KqHR/nNFR3+i2xqheZxoF0H2XyL7B6xeSRuA==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.21.3.tgz", + "integrity": "sha512-RQxPz6Iqt8T0uw/WsJNReuBpWpBqs/n7mNo18sKLoTbMp+UrEekhH+pKSVC7gWz+DNjo9gryfV8YzCiT45RgMw==", "dev": true, "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/plugin-syntax-typescript": "^7.18.6" + "@babel/helper-annotate-as-pure": "^7.18.6", + "@babel/helper-create-class-features-plugin": "^7.21.0", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/plugin-syntax-typescript": "^7.20.0" }, "engines": { "node": ">=6.9.0" @@ -1665,18 +1673,18 @@ } }, "node_modules/@babel/preset-env": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.19.0.tgz", - "integrity": "sha512-1YUju1TAFuzjIQqNM9WsF4U6VbD/8t3wEAlw3LFYuuEr+ywqLRcSXxFKz4DCEj+sN94l/XTDiUXYRrsvMpz9WQ==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.20.2.tgz", + "integrity": "sha512-1G0efQEWR1EHkKvKHqbG+IN/QdgwfByUpM5V5QroDzGV2t3S/WXNQd693cHiHTlCFMpr9B6FkPFXDA2lQcKoDg==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.19.0", - "@babel/helper-compilation-targets": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0", + "@babel/compat-data": "^7.20.1", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/helper-validator-option": "^7.18.6", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-async-generator-functions": "^7.19.0", + "@babel/plugin-proposal-async-generator-functions": "^7.20.1", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-class-static-block": "^7.18.6", "@babel/plugin-proposal-dynamic-import": "^7.18.6", @@ -1685,7 +1693,7 @@ "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", + "@babel/plugin-proposal-object-rest-spread": "^7.20.2", "@babel/plugin-proposal-optional-catch-binding": "^7.18.6", "@babel/plugin-proposal-optional-chaining": "^7.18.9", "@babel/plugin-proposal-private-methods": "^7.18.6", @@ -1696,7 +1704,7 @@ "@babel/plugin-syntax-class-static-block": "^7.14.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.18.6", + "@babel/plugin-syntax-import-assertions": "^7.20.0", "@babel/plugin-syntax-json-strings": "^7.8.3", "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", @@ -1709,10 +1717,10 @@ "@babel/plugin-transform-arrow-functions": "^7.18.6", "@babel/plugin-transform-async-to-generator": "^7.18.6", "@babel/plugin-transform-block-scoped-functions": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.18.9", - "@babel/plugin-transform-classes": "^7.19.0", + "@babel/plugin-transform-block-scoping": "^7.20.2", + "@babel/plugin-transform-classes": "^7.20.2", "@babel/plugin-transform-computed-properties": "^7.18.9", - "@babel/plugin-transform-destructuring": "^7.18.13", + "@babel/plugin-transform-destructuring": "^7.20.2", "@babel/plugin-transform-dotall-regex": "^7.18.6", "@babel/plugin-transform-duplicate-keys": "^7.18.9", "@babel/plugin-transform-exponentiation-operator": "^7.18.6", @@ -1720,14 +1728,14 @@ "@babel/plugin-transform-function-name": "^7.18.9", "@babel/plugin-transform-literals": "^7.18.9", "@babel/plugin-transform-member-expression-literals": "^7.18.6", - "@babel/plugin-transform-modules-amd": "^7.18.6", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/plugin-transform-modules-systemjs": "^7.19.0", + "@babel/plugin-transform-modules-amd": "^7.19.6", + "@babel/plugin-transform-modules-commonjs": "^7.19.6", + "@babel/plugin-transform-modules-systemjs": "^7.19.6", "@babel/plugin-transform-modules-umd": "^7.18.6", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.19.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.19.1", "@babel/plugin-transform-new-target": "^7.18.6", "@babel/plugin-transform-object-super": "^7.18.6", - "@babel/plugin-transform-parameters": "^7.18.8", + "@babel/plugin-transform-parameters": "^7.20.1", "@babel/plugin-transform-property-literals": "^7.18.6", "@babel/plugin-transform-regenerator": "^7.18.6", "@babel/plugin-transform-reserved-words": "^7.18.6", @@ -1739,11 +1747,11 @@ "@babel/plugin-transform-unicode-escapes": "^7.18.10", "@babel/plugin-transform-unicode-regex": "^7.18.6", "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.19.0", - "babel-plugin-polyfill-corejs2": "^0.3.2", - "babel-plugin-polyfill-corejs3": "^0.5.3", - "babel-plugin-polyfill-regenerator": "^0.4.0", - "core-js-compat": "^3.22.1", + "@babel/types": "^7.20.2", + "babel-plugin-polyfill-corejs2": "^0.3.3", + "babel-plugin-polyfill-corejs3": "^0.6.0", + "babel-plugin-polyfill-regenerator": "^0.4.1", + "core-js-compat": "^3.25.1", "semver": "^6.3.0" }, "engines": { @@ -1779,14 +1787,14 @@ } }, "node_modules/@babel/preset-typescript": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.18.6.tgz", - "integrity": "sha512-s9ik86kXBAnD760aybBucdpnLsAt0jK1xqJn2juOn9lkOvSHV60os5hxoVJsPzMQxvnUJFAlkont2DvvaYEBtQ==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.21.0.tgz", + "integrity": "sha512-myc9mpoVA5m1rF8K8DgLEatOYFDpwC+RkMkjZ0Du6uI62YvDe8uxIEYVs/VCdSJ097nlALiU/yBC7//3nI+hNg==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-validator-option": "^7.18.6", - "@babel/plugin-transform-typescript": "^7.18.6" + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-validator-option": "^7.21.0", + "@babel/plugin-transform-typescript": "^7.21.0" }, "engines": { "node": ">=6.9.0" @@ -1795,6 +1803,12 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==", + "dev": true + }, "node_modules/@babel/runtime": { "version": "7.19.0", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.0.tgz", @@ -1808,33 +1822,33 @@ } }, "node_modules/@babel/template": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", - "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", + "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.0.tgz", - "integrity": "sha512-4pKpFRDh+utd2mbRC8JLnlsMUii3PMHjpL6a0SZ4NMZy7YFP9aXORxEhdMVOc9CpWtDF09IkciQLEhK7Ml7gRA==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.3.tgz", + "integrity": "sha512-XLyopNeaTancVitYZe2MlUEvgKb6YVVPXzofHgqHijCImG33b/uTurMS488ht/Hbsb2XK3U2BnSTxKVNGV3nGQ==", "dev": true, "dependencies": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.0", + "@babel/generator": "^7.21.3", "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", + "@babel/helper-function-name": "^7.21.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.0", - "@babel/types": "^7.19.0", + "@babel/parser": "^7.21.3", + "@babel/types": "^7.21.3", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -1842,19 +1856,10 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/traverse/node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/types": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.7.tgz", - "integrity": "sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.3.tgz", + "integrity": "sha512-sBGdETxC+/M4o/zKC0sl6sjWv62WFR/uzxrJ6uYyMLZOUlPnwzw0tKgVHOXxaAd5l2g8pEDM5RZ495GPQI77kg==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.19.4", @@ -1871,16 +1876,40 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz", + "integrity": "sha512-v3oplH6FYCULtFuCeqyuTd9D2WKO937Dxdq+GmHOLL72TTRriLxz2VLlNfkZRsvj6PKnOPAtuT6dwrs/pA5DvA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.4.0.tgz", + "integrity": "sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, "node_modules/@eslint/eslintrc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz", - "integrity": "sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.1.tgz", + "integrity": "sha512-eFRmABvW2E5Ho6f5fHLqgena46rOj7r7OKHYfLElqcBfGFHHpjBhivyi5+jOEQuSpdc/1phIZJlbC2te+tZNIw==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.15.0", + "espree": "^9.5.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -1894,19 +1923,55 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@eslint/eslintrc/node_modules/ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true, "engines": { "node": ">= 4" } }, + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "8.36.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.36.0.tgz", + "integrity": "sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/@hipo/eslint-config-base": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@hipo/eslint-config-base/-/eslint-config-base-4.2.1.tgz", - "integrity": "sha512-Mp+b27lqwuX6aSkVxr8OzxvinPRs4EOKnNPBHFhVrRv4vwZ1TaDTLaltpGAAfVUnYjyoofIE+e75rJqpu24sGA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@hipo/eslint-config-base/-/eslint-config-base-4.3.0.tgz", + "integrity": "sha512-0va9TxkzGYbhaiudc4MrpUUzASIiH4iCF2q5J0vplP8PLnkCyq6H0/ck5qlsfsY64nwO8OlNcUw1CI/O0c2NCA==", "dev": true, "peerDependencies": { "eslint": "^8.6.0", @@ -1926,29 +1991,19 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz", - "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==", + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", - "minimatch": "^3.0.4" + "minimatch": "^3.0.5" }, "engines": { "node": ">=10.10.0" } }, - "node_modules/@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -2058,15 +2113,6 @@ "node": ">=8" } }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", @@ -2086,16 +2132,16 @@ } }, "node_modules/@jest/console": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.4.1.tgz", - "integrity": "sha512-m+XpwKSi3PPM9znm5NGS8bBReeAJJpSkL1OuFCqaMaJL2YX9YXLkkI+MBchMPwu+ZuM2rynL51sgfkQteQ1CKQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.5.0.tgz", + "integrity": "sha512-NEpkObxPwyw/XxZVLPmAGKE89IQRp4puc6IQRPru6JKd1M3fW9v1xM1AnzIJE65hbCkzQAdnL8P47e9hzhiYLQ==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", "slash": "^3.0.0" }, "engines": { @@ -2103,37 +2149,37 @@ } }, "node_modules/@jest/core": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.4.1.tgz", - "integrity": "sha512-RXFTohpBqpaTebNdg5l3I5yadnKo9zLBajMT0I38D0tDhreVBYv3fA8kywthI00sWxPztWLD3yjiUkewwu/wKA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.5.0.tgz", + "integrity": "sha512-28UzQc7ulUrOQw1IsN/kv1QES3q2kkbl/wGslyhAclqZ/8cMdB5M68BffkIdSJgKBUt50d3hbwJ92XESlE7LiQ==", "dev": true, "dependencies": { - "@jest/console": "^29.4.1", - "@jest/reporters": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.5.0", + "@jest/reporters": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "ci-info": "^3.2.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.4.0", - "jest-config": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-resolve-dependencies": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", - "jest-watcher": "^29.4.1", + "jest-changed-files": "^29.5.0", + "jest-config": "^29.5.0", + "jest-haste-map": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-resolve-dependencies": "^29.5.0", + "jest-runner": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", + "jest-watcher": "^29.5.0", "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", + "pretty-format": "^29.5.0", "slash": "^3.0.0", "strip-ansi": "^6.0.0" }, @@ -2171,88 +2217,88 @@ } }, "node_modules/@jest/environment": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.4.1.tgz", - "integrity": "sha512-pJ14dHGSQke7Q3mkL/UZR9ZtTOxqskZaC91NzamEH4dlKRt42W+maRBXiw/LWkdJe+P0f/zDR37+SPMplMRlPg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.5.0.tgz", + "integrity": "sha512-5FXw2+wD29YU1d4I2htpRX7jYnAyTRjP2CsXQdo9SAM8g3ifxWPSV0HnClSn71xwctr0U3oZIIH+dtbfmnbXVQ==", "dev": true, "dependencies": { - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/fake-timers": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", - "jest-mock": "^29.4.1" + "jest-mock": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-ZxKJP5DTUNF2XkpJeZIzvnzF1KkfrhEF6Rz0HGG69fHl6Bgx5/GoU3XyaeFYEjuuKSOOsbqD/k72wFvFxc3iTw==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.5.0.tgz", + "integrity": "sha512-PueDR2HGihN3ciUNGr4uelropW7rqUfTiOn+8u0leg/42UhblPxHkfoh0Ruu3I9Y1962P3u2DY4+h7GVTSVU6g==", "dev": true, "dependencies": { - "expect": "^29.4.1", - "jest-snapshot": "^29.4.1" + "expect": "^29.5.0", + "jest-snapshot": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/expect-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.4.1.tgz", - "integrity": "sha512-w6YJMn5DlzmxjO00i9wu2YSozUYRBhIoJ6nQwpMYcBMtiqMGJm1QBzOf6DDgRao8dbtpDoaqLg6iiQTvv0UHhQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.5.0.tgz", + "integrity": "sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg==", "dev": true, "dependencies": { - "jest-get-type": "^29.2.0" + "jest-get-type": "^29.4.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/fake-timers": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.4.1.tgz", - "integrity": "sha512-/1joI6rfHFmmm39JxNfmNAO3Nwm6Y0VoL5fJDy7H1AtWrD1CgRtqJbN9Ld6rhAkGO76qqp4cwhhxJ9o9kYjQMw==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.5.0.tgz", + "integrity": "sha512-9ARvuAAQcBwDAqOnglWq2zwNIRUDtk/SCkp/ToGEhFv5r86K21l+VEs0qNTaXtyiY0lEePl3kylijSYJQqdbDg==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@sinonjs/fake-timers": "^10.0.2", "@types/node": "*", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" + "jest-message-util": "^29.5.0", + "jest-mock": "^29.5.0", + "jest-util": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/globals": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.4.1.tgz", - "integrity": "sha512-znoK2EuFytbHH0ZSf2mQK2K1xtIgmaw4Da21R2C/NE/+NnItm5mPEFQmn8gmF3f0rfOlmZ3Y3bIf7bFj7DHxAA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.5.0.tgz", + "integrity": "sha512-S02y0qMWGihdzNbUiqSAiKSpSozSuHX5UYc7QbnHP+D9Lyw8DgGGCinrN9uSuHPeKgSSzvPom2q1nAtBvUsvPQ==", "dev": true, "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/types": "^29.4.1", - "jest-mock": "^29.4.1" + "@jest/environment": "^29.5.0", + "@jest/expect": "^29.5.0", + "@jest/types": "^29.5.0", + "jest-mock": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/reporters": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.4.1.tgz", - "integrity": "sha512-AISY5xpt2Xpxj9R6y0RF1+O6GRy9JsGa8+vK23Lmzdy1AYcpQn5ItX79wJSsTmfzPKSAcsY1LNt/8Y5Xe5LOSg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.5.0.tgz", + "integrity": "sha512-D05STXqj/M8bP9hQNSICtPqz97u7ffGzZu+9XLucXhkOFBqKcXe04JLZOgIekOxdb73MAoBUFnqvf7MCpKk5OA==", "dev": true, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", "@jridgewell/trace-mapping": "^0.3.15", "@types/node": "*", "chalk": "^4.0.0", @@ -2265,9 +2311,9 @@ "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", + "jest-worker": "^29.5.0", "slash": "^3.0.0", "string-length": "^4.0.1", "strip-ansi": "^6.0.0", @@ -2295,13 +2341,13 @@ } }, "node_modules/@jest/reporters/node_modules/jest-worker": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz", - "integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz", + "integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==", "dev": true, "dependencies": { "@types/node": "*", - "jest-util": "^29.4.1", + "jest-util": "^29.5.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" }, @@ -2337,9 +2383,9 @@ } }, "node_modules/@jest/schemas": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.0.tgz", - "integrity": "sha512-0E01f/gOZeNTG76i5eWWSupvSHaIINrTie7vCyjiYFKgzNdyEGd12BUv4oNBFHOqlHDbtoJi3HrQ38KCC90NsQ==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.3.tgz", + "integrity": "sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg==", "dev": true, "dependencies": { "@sinclair/typebox": "^0.25.16" @@ -2349,9 +2395,9 @@ } }, "node_modules/@jest/source-map": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.2.0.tgz", - "integrity": "sha512-1NX9/7zzI0nqa6+kgpSdKPK+WU1p+SJk3TloWZf5MzPbxri9UEeXX5bWZAPCzbQcyuAzubcdUHA7hcNznmRqWQ==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.4.3.tgz", + "integrity": "sha512-qyt/mb6rLyd9j1jUts4EQncvS6Yy3PM9HghnNv86QBlV+zdL2inCdK1tuVlL+J+lpiw2BI67qXOrX3UurBqQ1w==", "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.15", @@ -2363,13 +2409,13 @@ } }, "node_modules/@jest/test-result": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.4.1.tgz", - "integrity": "sha512-WRt29Lwt+hEgfN8QDrXqXGgCTidq1rLyFqmZ4lmJOpVArC8daXrZWkWjiaijQvgd3aOUj2fM8INclKHsQW9YyQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.5.0.tgz", + "integrity": "sha512-fGl4rfitnbfLsrfx1uUpDEESS7zM8JdgZgOCQuxQvL1Sn/I6ijeAVQWGfXI9zb1i9Mzo495cIpVZhA0yr60PkQ==", "dev": true, "dependencies": { - "@jest/console": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.5.0", + "@jest/types": "^29.5.0", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" }, @@ -2378,14 +2424,14 @@ } }, "node_modules/@jest/test-sequencer": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.4.1.tgz", - "integrity": "sha512-v5qLBNSsM0eHzWLXsQ5fiB65xi49A3ILPSFQKPXzGL4Vyux0DPZAIN7NAFJa9b4BiTDP9MBF/Zqc/QA1vuiJ0w==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.5.0.tgz", + "integrity": "sha512-yPafQEcKjkSfDXyvtgiV4pevSeyuA6MQr6ZIdVkWJly9vkqjnFfcfhRQqpD5whjoU8EORki752xQmjaqoFjzMQ==", "dev": true, "dependencies": { - "@jest/test-result": "^29.4.1", + "@jest/test-result": "^29.5.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", + "jest-haste-map": "^29.5.0", "slash": "^3.0.0" }, "engines": { @@ -2393,26 +2439,26 @@ } }, "node_modules/@jest/transform": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.4.1.tgz", - "integrity": "sha512-5w6YJrVAtiAgr0phzKjYd83UPbCXsBRTeYI4BXokv9Er9CcrH9hfXL/crCvP2d2nGOcovPUnlYiLPFLZrkG5Hg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.5.0.tgz", + "integrity": "sha512-8vbeZWqLJOvHaDfeMuoHITGKSz5qWc9u04lnWrQE3VyuSw604PzQM824ZeX9XSjUCeDiE3GuxZe5UKa8J61NQw==", "dev": true, "dependencies": { "@babel/core": "^7.11.6", - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@jridgewell/trace-mapping": "^0.3.15", "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", + "jest-haste-map": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.5.0", "micromatch": "^4.0.4", "pirates": "^4.0.4", "slash": "^3.0.0", - "write-file-atomic": "^5.0.0" + "write-file-atomic": "^4.0.2" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -2425,12 +2471,12 @@ "dev": true }, "node_modules/@jest/types": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.1.tgz", - "integrity": "sha512-zbrAXDUOnpJ+FMST2rV7QZOgec8rskg2zv8g2ajeqitp4tvZiyqTCYXANrKsM+ryj5o+LI+ZN2EgU9drrkiwSA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.5.0.tgz", + "integrity": "sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==", "dev": true, "dependencies": { - "@jest/schemas": "^29.4.0", + "@jest/schemas": "^29.4.3", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", @@ -2503,13 +2549,13 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.15", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", - "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", + "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" } }, "node_modules/@nodelib/fs.scandir": { @@ -2548,190 +2594,246 @@ } }, "node_modules/@rollup/plugin-babel": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz", - "integrity": "sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-6.0.3.tgz", + "integrity": "sha512-fKImZKppa1A/gX73eg4JGo+8kQr/q1HBQaCGKECZ0v4YBBv3lFqi14+7xyApECzvkLTHCifx+7ntcrvtBIRcpg==", "dev": true, "dependencies": { - "@babel/helper-module-imports": "^7.10.4", - "@rollup/pluginutils": "^3.1.0" + "@babel/helper-module-imports": "^7.18.6", + "@rollup/pluginutils": "^5.0.1" }, "engines": { - "node": ">= 10.0.0" + "node": ">=14.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0", "@types/babel__core": "^7.1.9", - "rollup": "^1.20.0||^2.0.0" + "rollup": "^1.20.0||^2.0.0||^3.0.0" }, "peerDependenciesMeta": { "@types/babel__core": { "optional": true + }, + "rollup": { + "optional": true } } }, "node_modules/@rollup/plugin-babel/node_modules/@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", + "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", "dev": true, "dependencies": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" }, "engines": { - "node": ">= 8.0.0" + "node": ">=14.0.0" }, "peerDependencies": { - "rollup": "^1.20.0||^2.0.0" + "rollup": "^1.20.0||^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } } }, - "node_modules/@rollup/plugin-babel/node_modules/estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - }, "node_modules/@rollup/plugin-commonjs": { - "version": "22.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-22.0.2.tgz", - "integrity": "sha512-//NdP6iIwPbMTcazYsiBMbJW7gfmpHom33u1beiIoHDEM0Q9clvtQB1T0efvMqHeKsGohiHo97BCPCkBXdscwg==", + "version": "24.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-24.0.1.tgz", + "integrity": "sha512-15LsiWRZk4eOGqvrJyu3z3DaBu5BhXIMeWnijSRvd8irrrg9SHpQ1pH+BUK4H6Z9wL9yOxZJMTLU+Au86XHxow==", "dev": true, "dependencies": { - "@rollup/pluginutils": "^3.1.0", + "@rollup/pluginutils": "^5.0.1", "commondir": "^1.0.1", - "estree-walker": "^2.0.1", - "glob": "^7.1.6", - "is-reference": "^1.2.1", - "magic-string": "^0.25.7", - "resolve": "^1.17.0" + "estree-walker": "^2.0.2", + "glob": "^8.0.3", + "is-reference": "1.2.1", + "magic-string": "^0.27.0" }, "engines": { - "node": ">= 12.0.0" + "node": ">=14.0.0" }, "peerDependencies": { - "rollup": "^2.68.0" + "rollup": "^2.68.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } } }, "node_modules/@rollup/plugin-commonjs/node_modules/@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", + "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", "dev": true, "dependencies": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" }, "engines": { - "node": ">= 8.0.0" + "node": ">=14.0.0" }, "peerDependencies": { - "rollup": "^1.20.0||^2.0.0" + "rollup": "^1.20.0||^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } } }, - "node_modules/@rollup/plugin-commonjs/node_modules/@rollup/pluginutils/node_modules/estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - }, - "node_modules/@rollup/plugin-json": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", - "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", + "node_modules/@rollup/plugin-commonjs/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "@rollup/pluginutils": "^3.0.8" - }, - "peerDependencies": { - "rollup": "^1.20.0 || ^2.0.0" + "balanced-match": "^1.0.0" } }, - "node_modules/@rollup/plugin-json/node_modules/@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "node_modules/@rollup/plugin-commonjs/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", "dev": true, "dependencies": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" }, "engines": { - "node": ">= 8.0.0" + "node": ">=12" }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0" + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@rollup/plugin-json/node_modules/estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - }, - "node_modules/@rollup/plugin-node-resolve": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-14.0.0.tgz", - "integrity": "sha512-XkWfpgp/zGiFu8LS+JAiQeZN4oYYA4/ViFJiZhwQegTg5ZbzKTvM9YyKXVBNnmZ8Et76WnlVgwRUu1rhKF4ayw==", + "node_modules/@rollup/plugin-commonjs/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, "dependencies": { - "@rollup/pluginutils": "^3.1.0", - "@types/resolve": "1.17.1", - "deepmerge": "^4.2.2", - "is-builtin-module": "^3.1.0", - "is-module": "^1.0.0", - "resolve": "^1.19.0" + "brace-expansion": "^2.0.1" }, "engines": { - "node": ">= 10.0.0" - }, - "peerDependencies": { - "rollup": "^2.78.0" + "node": ">=10" } }, - "node_modules/@rollup/plugin-node-resolve/node_modules/@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "node_modules/@rollup/plugin-json": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.0.0.tgz", + "integrity": "sha512-i/4C5Jrdr1XUarRhVu27EEwjt4GObltD7c+MkCIpO2QIbojw8MUs+CCTqOphQi3Qtg1FLmYt+l+6YeoIf51J7w==", "dev": true, "dependencies": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" + "@rollup/pluginutils": "^5.0.1" }, "engines": { - "node": ">= 8.0.0" + "node": ">=14.0.0" }, "peerDependencies": { - "rollup": "^1.20.0||^2.0.0" + "rollup": "^1.20.0||^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } } }, - "node_modules/@rollup/plugin-node-resolve/node_modules/estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - }, - "node_modules/@rollup/pluginutils": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz", - "integrity": "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==", + "node_modules/@rollup/plugin-json/node_modules/@rollup/pluginutils": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", + "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", "dev": true, "dependencies": { - "estree-walker": "^2.0.1", - "picomatch": "^2.2.2" + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "15.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.1.tgz", + "integrity": "sha512-ReY88T7JhJjeRVbfCyNj+NXAG3IIsVMsX9b5/9jC98dRP8/yxlZdz7mHZbHk5zHr24wZZICS5AcXsFZAXYUQEg==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", + "deepmerge": "^4.2.2", + "is-builtin-module": "^3.2.0", + "is-module": "^1.0.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.78.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve/node_modules/@rollup/pluginutils": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", + "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz", + "integrity": "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==", + "dev": true, + "dependencies": { + "estree-walker": "^2.0.1", + "picomatch": "^2.2.2" }, "engines": { "node": ">= 8.0.0" } }, "node_modules/@sinclair/typebox": { - "version": "0.25.21", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", - "integrity": "sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==", + "version": "0.25.24", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", + "integrity": "sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==", "dev": true }, "node_modules/@sinonjs/commons": { @@ -2794,9 +2896,9 @@ } }, "node_modules/@types/estree": { - "version": "0.0.39", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", - "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz", + "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==", "dev": true }, "node_modules/@types/graceful-fs": { @@ -2833,9 +2935,9 @@ } }, "node_modules/@types/jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.4.0.tgz", - "integrity": "sha512-VaywcGQ9tPorCX/Jkkni7RWGFfI11whqzs8dvxF41P17Z+z872thvEvlIbznjPJ02kl1HMX3LmLOonsj2n7HeQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.0.tgz", + "integrity": "sha512-3Emr5VOl/aoBwnWcH/EFQvlSAmjV+XtV9GGu5mwdYew5vhQh0IUZx/60x0TzHDu09Bi7HMx10t/namdJw5QIcg==", "dev": true, "dependencies": { "expect": "^29.0.0", @@ -2855,9 +2957,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "14.14.44", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.44.tgz", - "integrity": "sha512-+gaugz6Oce6ZInfI/tK4Pq5wIIkJMEJUu92RB3Eu93mtj4wjjjz9EB5mLp5s1pSsLXdC/CPut/xF20ZzAQJbTA==", + "version": "18.15.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.5.tgz", + "integrity": "sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew==", "dev": true }, "node_modules/@types/prettier": { @@ -2867,13 +2969,16 @@ "dev": true }, "node_modules/@types/resolve": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", - "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", - "dev": true, - "dependencies": { - "@types/node": "*" - } + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", + "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", + "dev": true + }, + "node_modules/@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true }, "node_modules/@types/stack-utils": { "version": "2.0.1", @@ -2897,18 +3002,19 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.2.tgz", - "integrity": "sha512-OwwR8LRwSnI98tdc2z7mJYgY60gf7I9ZfGjN5EjCwwns9bdTuQfAXcsjSB2wSQ/TVNYSGKf4kzVXbNGaZvwiXw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.56.0.tgz", + "integrity": "sha512-ZNW37Ccl3oMZkzxrYDUX4o7cnuPgU+YrcaYXzsRtLB16I1FR5SHMqga3zGsaSliZADCWo2v8qHWqAYIj8nWCCg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/type-utils": "5.36.2", - "@typescript-eslint/utils": "5.36.2", + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.56.0", + "@typescript-eslint/type-utils": "5.56.0", + "@typescript-eslint/utils": "5.56.0", "debug": "^4.3.4", - "functional-red-black-tree": "^1.0.1", + "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", - "regexpp": "^3.2.0", + "natural-compare-lite": "^1.4.0", "semver": "^7.3.7", "tsutils": "^3.21.0" }, @@ -2939,14 +3045,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.36.2.tgz", - "integrity": "sha512-qS/Kb0yzy8sR0idFspI9Z6+t7mqk/oRjnAYfewG+VN73opAUvmYL3oPIMmgOX6CnQS6gmVIXGshlb5RY/R22pA==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.56.0.tgz", + "integrity": "sha512-sn1OZmBxUsgxMmR8a8U5QM/Wl+tyqlH//jTqCg8daTAmhAk26L2PFhcqPLlYBhYUJMZJK276qLXlHN3a83o2cg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/typescript-estree": "5.36.2", + "@typescript-eslint/scope-manager": "5.56.0", + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/typescript-estree": "5.56.0", "debug": "^4.3.4" }, "engines": { @@ -2966,13 +3072,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.36.2.tgz", - "integrity": "sha512-cNNP51L8SkIFSfce8B1NSUBTJTu2Ts4nWeWbFrdaqjmn9yKrAaJUBHkyTZc0cL06OFHpb+JZq5AUHROS398Orw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.56.0.tgz", + "integrity": "sha512-jGYKyt+iBakD0SA5Ww8vFqGpoV2asSjwt60Gl6YcO8ksQ8s2HlUEyHBMSa38bdLopYqGf7EYQMUIGdT/Luw+sw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/visitor-keys": "5.36.2" + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/visitor-keys": "5.56.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2983,13 +3089,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.36.2.tgz", - "integrity": "sha512-rPQtS5rfijUWLouhy6UmyNquKDPhQjKsaKH0WnY6hl/07lasj8gPaH2UD8xWkePn6SC+jW2i9c2DZVDnL+Dokw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.56.0.tgz", + "integrity": "sha512-8WxgOgJjWRy6m4xg9KoSHPzBNZeQbGlQOH7l2QEhQID/+YseaFxg5J/DLwWSsi9Axj4e/cCiKx7PVzOq38tY4A==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.36.2", - "@typescript-eslint/utils": "5.36.2", + "@typescript-eslint/typescript-estree": "5.56.0", + "@typescript-eslint/utils": "5.56.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -3010,9 +3116,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.36.2.tgz", - "integrity": "sha512-9OJSvvwuF1L5eS2EQgFUbECb99F0mwq501w0H0EkYULkhFa19Qq7WFbycdw1PexAc929asupbZcgjVIe6OK/XQ==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.56.0.tgz", + "integrity": "sha512-JyAzbTJcIyhuUhogmiu+t79AkdnqgPUEsxMTMc/dCZczGMJQh1MK2wgrju++yMN6AWroVAy2jxyPcPr3SWCq5w==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -3023,13 +3129,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.2.tgz", - "integrity": "sha512-8fyH+RfbKc0mTspfuEjlfqA4YywcwQK2Amcf6TDOwaRLg7Vwdu4bZzyvBZp4bjt1RRjQ5MDnOZahxMrt2l5v9w==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.56.0.tgz", + "integrity": "sha512-41CH/GncsLXOJi0jb74SnC7jVPWeVJ0pxQj8bOjH1h2O26jXN3YHKDT1ejkVz5YeTEQPeLCCRY0U2r68tfNOcg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/visitor-keys": "5.36.2", + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/visitor-keys": "5.56.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -3050,17 +3156,19 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.36.2.tgz", - "integrity": "sha512-uNcopWonEITX96v9pefk9DC1bWMdkweeSsewJ6GeC7L6j2t0SJywisgkr9wUTtXk90fi2Eljj90HSHm3OGdGRg==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.56.0.tgz", + "integrity": "sha512-XhZDVdLnUJNtbzaJeDSCIYaM+Tgr59gZGbFuELgF7m0IY03PlciidS7UQNKLE0+WpUTn1GlycEr6Ivb/afjbhA==", "dev": true, "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/typescript-estree": "5.36.2", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.56.0", + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/typescript-estree": "5.56.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "semver": "^7.3.7" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -3074,12 +3182,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.2.tgz", - "integrity": "sha512-BtRvSR6dEdrNt7Net2/XDjbYKU5Ml6GqJgVfXT0CxTCJlnIqK7rAGreuWKMT2t8cFUT2Msv5oxw0GMRD7T5J7A==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.56.0.tgz", + "integrity": "sha512-1mFdED7u5bZpX6Xxf5N9U2c18sb+8EvU3tyOIj6LQZ5OOvnmj8BVeNNP603OFPm5KkS1a7IvCIcwrdHXaEMG/Q==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.36.2", + "@typescript-eslint/types": "5.56.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -3145,37 +3253,23 @@ } }, "node_modules/algosdk": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/algosdk/-/algosdk-1.20.0.tgz", - "integrity": "sha512-KKfSIIdQTgdj3rKaYGLu3n16KC5obx0n+6XvlwAhyGxqG1K5bCJ9F1zbblhCE9aKEv+buNR23Lw6hXGQ54PA1A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/algosdk/-/algosdk-2.1.0.tgz", + "integrity": "sha512-KogpdRK3u7Efvw0FVduyFQEOwI+uGvMJmXUvzdmQJjK0hWhEYUl13X/X1QqNKwyEZjw2qutf9pf23UbNnBEAwA==", "dependencies": { "algo-msgpack-with-bigint": "^2.1.1", - "buffer": "^6.0.2", + "buffer": "^6.0.3", + "cross-fetch": "^3.1.5", "hi-base32": "^0.5.1", "js-sha256": "^0.9.0", "js-sha3": "^0.8.0", "js-sha512": "^0.8.0", "json-bigint": "^1.0.0", - "superagent": "^6.1.0", "tweetnacl": "^1.0.3", "vlq": "^2.0.4" }, - "optionalDependencies": { - "fsevents": "2.1.2" - } - }, - "node_modules/algosdk/node_modules/fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "deprecated": "\"Please update to latest v2.3 or v2.2\"", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + "node": ">=14.0.0" } }, "node_modules/ansi-escapes": { @@ -3233,16 +3327,29 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array-includes": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", - "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", + "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1", - "get-intrinsic": "^1.1.1", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "get-intrinsic": "^1.1.3", "is-string": "^1.0.7" }, "engines": { @@ -3262,14 +3369,32 @@ } }, "node_modules/array.prototype.flat": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", - "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", + "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz", + "integrity": "sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", "es-shim-unscopables": "^1.0.0" }, "engines": { @@ -3288,21 +3413,28 @@ "node": ">=8" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/babel-jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.4.1.tgz", - "integrity": "sha512-xBZa/pLSsF/1sNpkgsiT3CmY7zV1kAsZ9OxxtrFqYucnOuRftXAfcJqcDVyOPeN4lttWTwhLdu0T9f8uvoPEUg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.5.0.tgz", + "integrity": "sha512-mA4eCDh5mSo2EcA9xQjVTpmbbNk32Zb3Q3QFQsNhaK56Q+yoXowzFodLux30HRgyOho5rsQ6B0P9QpMkvvnJ0Q==", "dev": true, "dependencies": { - "@jest/transform": "^29.4.1", + "@jest/transform": "^29.5.0", "@types/babel__core": "^7.1.14", "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.4.0", + "babel-preset-jest": "^29.5.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "slash": "^3.0.0" @@ -3314,15 +3446,6 @@ "@babel/core": "^7.8.0" } }, - "node_modules/babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dev": true, - "dependencies": { - "object.assign": "^4.1.0" - } - }, "node_modules/babel-plugin-istanbul": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", @@ -3340,9 +3463,9 @@ } }, "node_modules/babel-plugin-jest-hoist": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.4.0.tgz", - "integrity": "sha512-a/sZRLQJEmsmejQ2rPEUe35nO1+C9dc9O1gplH1SXmJxveQSRUYdBk8yGZG/VOUuZs1u2aHZJusEGoRMbhhwCg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.5.0.tgz", + "integrity": "sha512-zSuuuAlTMT4mzLj2nPnUm6fsE6270vdOfnpbJ+RmruU75UhLFvL0N2NgI7xpeS7NaB6hGqmd5pVpGTDYvi4Q3w==", "dev": true, "dependencies": { "@babel/template": "^7.3.3", @@ -3355,13 +3478,13 @@ } }, "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.2.tgz", - "integrity": "sha512-LPnodUl3lS0/4wN3Rb+m+UK8s7lj2jcLRrjho4gLw+OJs+I4bvGXshINesY5xx/apM+biTnQ9reDI8yj+0M5+Q==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", + "integrity": "sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==", "dev": true, "dependencies": { "@babel/compat-data": "^7.17.7", - "@babel/helper-define-polyfill-provider": "^0.3.2", + "@babel/helper-define-polyfill-provider": "^0.3.3", "semver": "^6.1.1" }, "peerDependencies": { @@ -3378,25 +3501,25 @@ } }, "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.3.tgz", - "integrity": "sha512-zKsXDh0XjnrUEW0mxIHLfjBfnXSMr5Q/goMe/fxpQnLm07mcOZiIZHBNWCMx60HmdvjxfXcalac0tfFg0wqxyw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.6.0.tgz", + "integrity": "sha512-+eHqR6OPcBhJOGgsIar7xoAB1GcSwVUA3XjAd7HJNzOXT4wv6/H7KIdA/Nc60cvUlDbKApmqNvD1B1bzOt4nyA==", "dev": true, "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.2", - "core-js-compat": "^3.21.0" + "@babel/helper-define-polyfill-provider": "^0.3.3", + "core-js-compat": "^3.25.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.0.tgz", - "integrity": "sha512-RW1cnryiADFeHmfLS+WW/G431p1PsW5qdRdz0SDRi7TKcUgc7Oh/uXkT7MZ/+tGsT1BkczEAmD5XjUyJ5SWDTw==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.1.tgz", + "integrity": "sha512-NtQGmyQDXjQqQ+IzRkBVwEOz9lQ4zxAQZgoAYEtU9dJjnl1Oc98qnN7jcp+bE7O7aYzVpavXE3/VKXNzUbh7aw==", "dev": true, "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.2" + "@babel/helper-define-polyfill-provider": "^0.3.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" @@ -3426,12 +3549,12 @@ } }, "node_modules/babel-preset-jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.4.0.tgz", - "integrity": "sha512-fUB9vZflUSM3dO/6M2TCAepTzvA4VkOvl67PjErcrQMGt9Eve7uazaeyCZ2th3UtI7ljpiBJES0F7A1vBRsLZA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.5.0.tgz", + "integrity": "sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg==", "dev": true, "dependencies": { - "babel-plugin-jest-hoist": "^29.4.0", + "babel-plugin-jest-hoist": "^29.5.0", "babel-preset-current-node-syntax": "^1.0.0" }, "engines": { @@ -3483,9 +3606,9 @@ } }, "node_modules/browserslist": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.3.tgz", - "integrity": "sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==", + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", "dev": true, "funding": [ { @@ -3498,10 +3621,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001370", - "electron-to-chromium": "^1.4.202", - "node-releases": "^2.0.6", - "update-browserslist-db": "^1.0.5" + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" }, "bin": { "browserslist": "cli.js" @@ -3550,9 +3673,13 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/callsites": { @@ -3574,9 +3701,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001390", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001390.tgz", - "integrity": "sha512-sS4CaUM+/+vqQUlCvCJ2WtDlV81aWtHhqeEVkLokVJJa3ViN4zDxAGfq9R8i1m90uGHxo99cy10Od+lvn3hf0g==", + "version": "1.0.30001469", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001469.tgz", + "integrity": "sha512-Rcp7221ScNqQPP3W+lVOYDyjdR6dC+neEQCttoNr5bAyz54AboB4iwpnWgyi8P4YUsPybVzT4LgWiBbI3drL4g==", "dev": true, "funding": [ { @@ -3602,18 +3729,6 @@ "node": ">=10" } }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/char-regex": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", @@ -3789,29 +3904,18 @@ "dev": true }, "node_modules/colorette": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz", - "integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==", + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", + "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", "dev": true }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/commander": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", - "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.0.tgz", + "integrity": "sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==", "dev": true, "engines": { - "node": ">= 12" + "node": ">=14" } }, "node_modules/commondir": { @@ -3820,11 +3924,6 @@ "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, - "node_modules/component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -3846,32 +3945,25 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "node_modules/cookiejar": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", - "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" - }, "node_modules/core-js-compat": { - "version": "3.25.0", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.25.0.tgz", - "integrity": "sha512-extKQM0g8/3GjFx9US12FAgx8KJawB7RCQ5y8ipYLbmfzEzmFRWdDjIlxDx82g7ygcNG85qMVUSRyABouELdow==", + "version": "3.29.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.29.1.tgz", + "integrity": "sha512-QmchCua884D8wWskMX8tW5ydINzd8oSJVx38lx/pVkFGqztxt73GYre3pm/hyYq8bPf+MW5In4I/uRShFDsbrA==", "dev": true, "dependencies": { - "browserslist": "^4.21.3", - "semver": "7.0.0" + "browserslist": "^4.21.5" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/core-js" } }, - "node_modules/core-js-compat/node_modules/semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" + "node_modules/cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "dependencies": { + "node-fetch": "2.6.7" } }, "node_modules/cross-spawn": { @@ -3892,6 +3984,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -3907,7 +4000,8 @@ "node_modules/debug/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "node_modules/dedent": { "version": "0.7.0", @@ -3931,9 +4025,9 @@ } }, "node_modules/define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", + "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", "dev": true, "dependencies": { "has-property-descriptors": "^1.0.0", @@ -3946,14 +4040,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -3964,9 +4050,9 @@ } }, "node_modules/diff-sequences": { - "version": "29.3.1", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz", - "integrity": "sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", + "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", "dev": true, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -4003,9 +4089,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.243", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.243.tgz", - "integrity": "sha512-BgLD2gBX43OSXwlT01oYRRD5NIB4n3okTRxkzEAC6G0SZG4TTlyrWMjbOo0fajCwqwpRtMHXQNMjtRN6qpNtfw==", + "version": "1.4.334", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.334.tgz", + "integrity": "sha512-laZ1odk+TRen6q0GeyQx/JEkpD3iSZT7ewopCpKqg9bTjP1l8XRfU3Bg20CFjNPZkp5+NDBl3iqd4o/kPO+Vew==", "dev": true }, "node_modules/emittery": { @@ -4036,31 +4122,45 @@ } }, "node_modules/es-abstract": { - "version": "1.19.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.5.tgz", - "integrity": "sha512-Aa2G2+Rd3b6kxEUKTF4TaW67czBLyAv3z7VOhYRU50YBx+bbsYZ9xQP4lMNazePuFlybXI0V4MruPos7qUo5fA==", + "version": "1.21.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz", + "integrity": "sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg==", "dev": true, "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.2.0", "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.2", "is-string": "^1.0.7", + "is-typed-array": "^1.1.10", "is-weakref": "^1.0.2", - "object-inspect": "^1.12.0", + "object-inspect": "^1.12.3", "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.7", + "string.prototype.trimend": "^1.0.6", + "string.prototype.trimstart": "^1.0.6", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.9" }, "engines": { "node": ">= 0.4" @@ -4069,6 +4169,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-shim-unscopables": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", @@ -4114,15 +4228,18 @@ } }, "node_modules/eslint": { - "version": "8.23.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.0.tgz", - "integrity": "sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==", + "version": "8.36.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.36.0.tgz", + "integrity": "sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.1", - "@humanwhocodes/config-array": "^0.10.4", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.0.1", + "@eslint/js": "8.36.0", + "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -4130,23 +4247,22 @@ "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "espree": "^9.5.0", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", - "globby": "^11.1.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", @@ -4154,7 +4270,6 @@ "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.1", - "regexpp": "^3.2.0", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" @@ -4170,9 +4285,9 @@ } }, "node_modules/eslint-config-prettier": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz", - "integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz", + "integrity": "sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==", "dev": true, "bin": { "eslint-config-prettier": "bin/cli.js" @@ -4182,13 +4297,14 @@ } }, "node_modules/eslint-import-resolver-node": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", - "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz", + "integrity": "sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==", "dev": true, "dependencies": { "debug": "^3.2.7", - "resolve": "^1.20.0" + "is-core-module": "^2.11.0", + "resolve": "^1.22.1" } }, "node_modules/eslint-import-resolver-node/node_modules/debug": { @@ -4220,37 +4336,21 @@ "eslint-plugin-import": "*" } }, - "node_modules/eslint-import-resolver-typescript/node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/eslint-module-utils": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", - "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz", + "integrity": "sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==", "dev": true, "dependencies": { - "debug": "^3.2.7", - "find-up": "^2.1.0" + "debug": "^3.2.7" }, "engines": { "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } } }, "node_modules/eslint-module-utils/node_modules/debug": { @@ -4262,82 +4362,26 @@ "ms": "^2.1.1" } }, - "node_modules/eslint-module-utils/node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "dependencies": { - "locate-path": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "dependencies": { - "p-try": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "dependencies": { - "p-limit": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/eslint-plugin-import": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", - "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", + "version": "2.27.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz", + "integrity": "sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==", "dev": true, "dependencies": { - "array-includes": "^3.1.4", - "array.prototype.flat": "^1.2.5", - "debug": "^2.6.9", + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "array.prototype.flatmap": "^1.3.1", + "debug": "^3.2.7", "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.3", + "eslint-import-resolver-node": "^0.3.7", + "eslint-module-utils": "^2.7.4", "has": "^1.0.3", - "is-core-module": "^2.8.1", + "is-core-module": "^2.11.0", "is-glob": "^4.0.3", "minimatch": "^3.1.2", - "object.values": "^1.1.5", - "resolve": "^1.22.0", + "object.values": "^1.1.6", + "resolve": "^1.22.1", + "semver": "^6.3.0", "tsconfig-paths": "^3.14.1" }, "engines": { @@ -4348,12 +4392,12 @@ } }, "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "node_modules/eslint-plugin-import/node_modules/doctrine": { @@ -4368,11 +4412,14 @@ "node": ">=0.10.0" } }, - "node_modules/eslint-plugin-import/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } }, "node_modules/eslint-scope": { "version": "5.1.1", @@ -4387,33 +4434,6 @@ "node": ">=8.0.0" } }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/eslint-visitor-keys": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", @@ -4466,6 +4486,21 @@ "node": ">=10.13.0" } }, + "node_modules/eslint/node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/eslint/node_modules/ignore": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", @@ -4487,10 +4522,22 @@ "node": ">=8" } }, + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/espree": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", - "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.0.tgz", + "integrity": "sha512-JPbJGhKc47++oo4JkEoTe2wjy4fmMwvFpgJT9cQzmfXKp22Dr6Hf1tdCteLz1h0P3t+mGvWZ+4Uankvh8+c6zw==", "dev": true, "dependencies": { "acorn": "^8.8.0", @@ -4505,9 +4552,9 @@ } }, "node_modules/espree/node_modules/acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -4530,9 +4577,9 @@ } }, "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "dependencies": { "estraverse": "^5.1.0" @@ -4628,16 +4675,16 @@ } }, "node_modules/expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-OKrGESHOaMxK3b6zxIq9SOW8kEXztKff/Dvg88j4xIJxur1hspEbedVkR3GpHe5LO+WB2Qw7OWN0RMTdp6as5A==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.5.0.tgz", + "integrity": "sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg==", "dev": true, "dependencies": { - "@jest/expect-utils": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1" + "@jest/expect-utils": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -4676,9 +4723,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -4703,15 +4750,10 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, - "node_modules/fast-safe-stringify": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", - "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" - }, "node_modules/fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -4823,24 +4865,15 @@ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true }, - "node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" + "is-callable": "^1.1.3" } }, - "node_modules/formidable": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.2.tgz", - "integrity": "sha512-V8gLm+41I/8kguQ4/o1D3RIHRmhYFG4pnNyonvua+40rqcEmT4+V71yaZ3B457xbbgCsCfjSPi65u/W6vK1U5Q==" - }, "node_modules/fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -4874,17 +4907,45 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -4904,13 +4965,17 @@ } }, "node_modules/get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/get-package-type": { @@ -4951,20 +5016,23 @@ } }, "node_modules/glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { @@ -4980,30 +5048,27 @@ } }, "node_modules/globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=4" } }, - "node_modules/globals/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", "dev": true, + "dependencies": { + "define-properties": "^1.1.3" + }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/globby": { @@ -5027,14 +5092,26 @@ } }, "node_modules/globby/node_modules/ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true, "engines": { "node": ">= 4" } }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -5051,6 +5128,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "dependencies": { "function-bind": "^1.1.1" }, @@ -5088,10 +5166,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -5135,15 +5226,15 @@ } }, "node_modules/husky": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", - "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true, "bin": { "husky": "lib/bin.js" }, "engines": { - "node": ">=12" + "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/typicode" @@ -5238,7 +5329,8 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "node_modules/inquirer": { "version": "7.3.3", @@ -5309,12 +5401,12 @@ } }, "node_modules/internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", "dev": true, "dependencies": { - "get-intrinsic": "^1.1.0", + "get-intrinsic": "^1.2.0", "has": "^1.0.3", "side-channel": "^1.0.4" }, @@ -5322,6 +5414,20 @@ "node": ">= 0.4" } }, + "node_modules/is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -5372,9 +5478,9 @@ } }, "node_modules/is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "dev": true, "engines": { "node": ">= 0.4" @@ -5384,9 +5490,9 @@ } }, "node_modules/is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -5491,6 +5597,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-reference": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", @@ -5570,6 +5685,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -5636,18 +5770,6 @@ "node": ">=8" } }, - "node_modules/istanbul-lib-report/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/istanbul-lib-source-maps": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", @@ -5676,15 +5798,15 @@ } }, "node_modules/jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.4.1.tgz", - "integrity": "sha512-cknimw7gAXPDOmj0QqztlxVtBVCw2lYY9CeIE5N6kD+kET1H4H79HSNISJmijb1HF+qk+G+ploJgiDi5k/fRlg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.5.0.tgz", + "integrity": "sha512-juMg3he2uru1QoXX078zTa7pO85QyB9xajZc6bU+d9yEGwrKX6+vGmJQ3UdVZsvTEUARIdObzH68QItim6OSSQ==", "dev": true, "dependencies": { - "@jest/core": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/core": "^29.5.0", + "@jest/types": "^29.5.0", "import-local": "^3.0.2", - "jest-cli": "^29.4.1" + "jest-cli": "^29.5.0" }, "bin": { "jest": "bin/jest.js" @@ -5702,9 +5824,9 @@ } }, "node_modules/jest-changed-files": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.4.0.tgz", - "integrity": "sha512-rnI1oPxgFghoz32Y8eZsGJMjW54UlqT17ycQeCEktcxxwqqKdlj9afl8LNeO0Pbu+h2JQHThQP0BzS67eTRx4w==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.5.0.tgz", + "integrity": "sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag==", "dev": true, "dependencies": { "execa": "^5.0.0", @@ -5715,28 +5837,29 @@ } }, "node_modules/jest-circus": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.4.1.tgz", - "integrity": "sha512-v02NuL5crMNY4CGPHBEflLzl4v91NFb85a+dH9a1pUNx6Xjggrd8l9pPy4LZ1VYNRXlb+f65+7O/MSIbLir6pA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.5.0.tgz", + "integrity": "sha512-gq/ongqeQKAplVxqJmbeUOJJKkW3dDNPY8PjhJ5G0lBRvu0e3EWGxGy5cI4LAGA7gV2UHCtWBI4EMXK8c9nQKA==", "dev": true, "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/environment": "^29.5.0", + "@jest/expect": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", "dedent": "^0.7.0", "is-generator-fn": "^2.0.0", - "jest-each": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", + "jest-each": "^29.5.0", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", "p-limit": "^3.1.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.5.0", + "pure-rand": "^6.0.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, @@ -5745,21 +5868,21 @@ } }, "node_modules/jest-cli": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.4.1.tgz", - "integrity": "sha512-jz7GDIhtxQ37M+9dlbv5K+/FVcIo1O/b1sX3cJgzlQUf/3VG25nvuWzlDC4F1FLLzUThJeWLu8I7JF9eWpuURQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.5.0.tgz", + "integrity": "sha512-L1KcP1l4HtfwdxXNFCL5bmUbLQiKrakMUriBEcc1Vfz6gx31ORKdreuWvmQVBit+1ss9NNR3yxjwfwzZNdQXJw==", "dev": true, "dependencies": { - "@jest/core": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/core": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", "chalk": "^4.0.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", "import-local": "^3.0.2", - "jest-config": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-config": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", "prompts": "^2.0.1", "yargs": "^17.3.1" }, @@ -5779,31 +5902,31 @@ } }, "node_modules/jest-config": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.4.1.tgz", - "integrity": "sha512-g7p3q4NuXiM4hrS4XFATTkd+2z0Ml2RhFmFPM8c3WyKwVDNszbl4E7cV7WIx1YZeqqCtqbtTtZhGZWJlJqngzg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.5.0.tgz", + "integrity": "sha512-kvDUKBnNJPNBmFFOhDbm59iu1Fii1Q6SxyhXfvylq3UTHbg6o7j/g8k2dZyXWLvfdKB1vAPxNZnMgtKJcmu3kA==", "dev": true, "dependencies": { "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.4.1", - "@jest/types": "^29.4.1", - "babel-jest": "^29.4.1", + "@jest/test-sequencer": "^29.5.0", + "@jest/types": "^29.5.0", + "babel-jest": "^29.5.0", "chalk": "^4.0.0", "ci-info": "^3.2.0", "deepmerge": "^4.2.2", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-circus": "^29.4.1", - "jest-environment-node": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-circus": "^29.5.0", + "jest-environment-node": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-runner": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", "micromatch": "^4.0.4", "parse-json": "^5.2.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.5.0", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" }, @@ -5824,24 +5947,24 @@ } }, "node_modules/jest-diff": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.4.1.tgz", - "integrity": "sha512-uazdl2g331iY56CEyfbNA0Ut7Mn2ulAG5vUaEHXycf1L6IPyuImIxSz4F0VYBKi7LYIuxOwTZzK3wh5jHzASMw==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.5.0.tgz", + "integrity": "sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw==", "dev": true, "dependencies": { "chalk": "^4.0.0", - "diff-sequences": "^29.3.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "diff-sequences": "^29.4.3", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-docblock": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.2.0.tgz", - "integrity": "sha512-bkxUsxTgWQGbXV5IENmfiIuqZhJcyvF7tU4zJ/7ioTutdz4ToB5Yx6JOFBpgI+TphRY4lhOyCWGNH/QFQh5T6A==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.4.3.tgz", + "integrity": "sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg==", "dev": true, "dependencies": { "detect-newline": "^3.0.0" @@ -5851,62 +5974,62 @@ } }, "node_modules/jest-each": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.4.1.tgz", - "integrity": "sha512-QlYFiX3llJMWUV0BtWht/esGEz9w+0i7BHwODKCze7YzZzizgExB9MOfiivF/vVT0GSQ8wXLhvHXh3x2fVD4QQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.5.0.tgz", + "integrity": "sha512-HM5kIJ1BTnVt+DQZ2ALp3rzXEl+g726csObrW/jpEGl+CDSSQpOJJX2KE/vEg8cxcMXdyEPu6U4QX5eruQv5hA==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "jest-util": "^29.4.1", - "pretty-format": "^29.4.1" + "jest-get-type": "^29.4.3", + "jest-util": "^29.5.0", + "pretty-format": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-environment-node": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.4.1.tgz", - "integrity": "sha512-x/H2kdVgxSkxWAIlIh9MfMuBa0hZySmfsC5lCsWmWr6tZySP44ediRKDUiNggX/eHLH7Cd5ZN10Rw+XF5tXsqg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.5.0.tgz", + "integrity": "sha512-ExxuIK/+yQ+6PRGaHkKewYtg6hto2uGCgvKdb2nfJfKXgZ17DfXjvbZ+jA1Qt9A8EQSfPnt5FKIfnOO3u1h9qw==", "dev": true, "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/environment": "^29.5.0", + "@jest/fake-timers": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" + "jest-mock": "^29.5.0", + "jest-util": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-get-type": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz", - "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz", + "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==", "dev": true, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-haste-map": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.4.1.tgz", - "integrity": "sha512-imTjcgfVVTvg02khXL11NNLTx9ZaofbAWhilrMg/G8dIkp+HYCswhxf0xxJwBkfhWb3e8dwbjuWburvxmcr58w==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.5.0.tgz", + "integrity": "sha512-IspOPnnBro8YfVYSw6yDRKh/TiCdRngjxeacCps1cQ9cgVN6+10JUcuJ1EabrgYLOATsIAigxA0rLR9x/YlrSA==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@types/graceful-fs": "^4.1.3", "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.5.0", + "jest-worker": "^29.5.0", "micromatch": "^4.0.4", "walker": "^1.0.8" }, @@ -5918,13 +6041,13 @@ } }, "node_modules/jest-haste-map/node_modules/jest-worker": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz", - "integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz", + "integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==", "dev": true, "dependencies": { "@types/node": "*", - "jest-util": "^29.4.1", + "jest-util": "^29.5.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" }, @@ -5948,46 +6071,46 @@ } }, "node_modules/jest-leak-detector": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.4.1.tgz", - "integrity": "sha512-akpZv7TPyGMnH2RimOCgy+hPmWZf55EyFUvymQ4LMsQP8xSPlZumCPtXGoDhFNhUE2039RApZkTQDKU79p/FiQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.5.0.tgz", + "integrity": "sha512-u9YdeeVnghBUtpN5mVxjID7KbkKE1QU4f6uUwuxiY0vYRi9BUCLKlPEZfDGR67ofdFmDz9oPAy2G92Ujrntmow==", "dev": true, "dependencies": { - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-matcher-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.4.1.tgz", - "integrity": "sha512-k5h0u8V4nAEy6lSACepxL/rw78FLDkBnXhZVgFneVpnJONhb2DhZj/Gv4eNe+1XqQ5IhgUcqj745UwH0HJmMnA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.5.0.tgz", + "integrity": "sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw==", "dev": true, "dependencies": { "chalk": "^4.0.0", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "jest-diff": "^29.5.0", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-message-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.4.1.tgz", - "integrity": "sha512-H4/I0cXUaLeCw6FM+i4AwCnOwHRgitdaUFOdm49022YD5nfyr8C/DrbXOBEyJaj+w/y0gGJ57klssOaUiLLQGQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.5.0.tgz", + "integrity": "sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", + "pretty-format": "^29.5.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, @@ -5996,14 +6119,14 @@ } }, "node_modules/jest-mock": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.4.1.tgz", - "integrity": "sha512-MwA4hQ7zBOcgVCVnsM8TzaFLVUD/pFWTfbkY953Y81L5ret3GFRZtmPmRFAjKQSdCKoJvvqOu6Bvfpqlwwb0dQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.5.0.tgz", + "integrity": "sha512-GqOzvdWDE4fAV2bWQLQCkujxYWL7RxjCnj71b5VhDAGOevB3qj3Ovg26A5NI84ZpODxyzaozXLOh2NCgkbvyaw==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@types/node": "*", - "jest-util": "^29.4.1" + "jest-util": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -6027,26 +6150,26 @@ } }, "node_modules/jest-regex-util": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.2.0.tgz", - "integrity": "sha512-6yXn0kg2JXzH30cr2NlThF+70iuO/3irbaB4mh5WyqNIvLLP+B6sFdluO1/1RJmslyh/f9osnefECflHvTbwVA==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.4.3.tgz", + "integrity": "sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg==", "dev": true, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-resolve": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.4.1.tgz", - "integrity": "sha512-j/ZFNV2lm9IJ2wmlq1uYK0Y/1PiyDq9g4HEGsNTNr3viRbJdV+8Lf1SXIiLZXFvyiisu0qUyIXGBnw+OKWkJwQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.5.0.tgz", + "integrity": "sha512-1TzxJ37FQq7J10jPtQjcc+MkCkE3GBpBecsSUWJ0qZNJpmg6m0D9/7II03yJulm3H/fvVjgqLh/k2eYg+ui52w==", "dev": true, "dependencies": { "chalk": "^4.0.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", + "jest-haste-map": "^29.5.0", "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", "resolve": "^1.20.0", "resolve.exports": "^2.0.0", "slash": "^3.0.0" @@ -6056,43 +6179,43 @@ } }, "node_modules/jest-resolve-dependencies": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.4.1.tgz", - "integrity": "sha512-Y3QG3M1ncAMxfjbYgtqNXC5B595zmB6e//p/qpA/58JkQXu/IpLDoLeOa8YoYfsSglBKQQzNUqtfGJJT/qLmJg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.5.0.tgz", + "integrity": "sha512-sjV3GFr0hDJMBpYeUuGduP+YeCRbd7S/ck6IvL3kQ9cpySYKqcqhdLLC2rFwrcL7tz5vYibomBrsFYWkIGGjOg==", "dev": true, "dependencies": { - "jest-regex-util": "^29.2.0", - "jest-snapshot": "^29.4.1" + "jest-regex-util": "^29.4.3", + "jest-snapshot": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-runner": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.4.1.tgz", - "integrity": "sha512-8d6XXXi7GtHmsHrnaqBKWxjKb166Eyj/ksSaUYdcBK09VbjPwIgWov1VwSmtupCIz8q1Xv4Qkzt/BTo3ZqiCeg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.5.0.tgz", + "integrity": "sha512-m7b6ypERhFghJsslMLhydaXBiLf7+jXy8FwGRHO3BGV1mcQpPbwiqiKUR2zU2NJuNeMenJmlFZCsIqzJCTeGLQ==", "dev": true, "dependencies": { - "@jest/console": "^29.4.1", - "@jest/environment": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.5.0", + "@jest/environment": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", "chalk": "^4.0.0", "emittery": "^0.13.1", "graceful-fs": "^4.2.9", - "jest-docblock": "^29.2.0", - "jest-environment-node": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-leak-detector": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-resolve": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-util": "^29.4.1", - "jest-watcher": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-docblock": "^29.4.3", + "jest-environment-node": "^29.5.0", + "jest-haste-map": "^29.5.0", + "jest-leak-detector": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-resolve": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-util": "^29.5.0", + "jest-watcher": "^29.5.0", + "jest-worker": "^29.5.0", "p-limit": "^3.1.0", "source-map-support": "0.5.13" }, @@ -6101,13 +6224,13 @@ } }, "node_modules/jest-runner/node_modules/jest-worker": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz", - "integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz", + "integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==", "dev": true, "dependencies": { "@types/node": "*", - "jest-util": "^29.4.1", + "jest-util": "^29.5.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" }, @@ -6141,32 +6264,31 @@ } }, "node_modules/jest-runtime": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.4.1.tgz", - "integrity": "sha512-UXTMU9uKu2GjYwTtoAw5rn4STxWw/nadOfW7v1sx6LaJYa3V/iymdCLQM6xy3+7C6mY8GfX22vKpgxY171UIoA==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/globals": "^29.4.1", - "@jest/source-map": "^29.2.0", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.5.0.tgz", + "integrity": "sha512-1Hr6Hh7bAgXQP+pln3homOiEZtCDZFqwmle7Ew2j8OlbkIu6uE3Y/etJQG8MLQs3Zy90xrp2C0BRrtPHG4zryw==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.5.0", + "@jest/fake-timers": "^29.5.0", + "@jest/globals": "^29.5.0", + "@jest/source-map": "^29.4.3", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "semver": "^7.3.5", + "jest-haste-map": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-mock": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", "slash": "^3.0.0", "strip-bom": "^4.0.0" }, @@ -6184,9 +6306,9 @@ } }, "node_modules/jest-snapshot": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.4.1.tgz", - "integrity": "sha512-l4iV8EjGgQWVz3ee/LR9sULDk2pCkqb71bjvlqn+qp90lFwpnulHj4ZBT8nm1hA1C5wowXLc7MGnw321u0tsYA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.5.0.tgz", + "integrity": "sha512-x7Wolra5V0tt3wRs3/ts3S6ciSQVypgGQlJpz2rsdQYoUKxMxPNaoHMGJN6qAuPJqS+2iQ1ZUn5kl7HCyls84g==", "dev": true, "dependencies": { "@babel/core": "^7.11.6", @@ -6195,23 +6317,22 @@ "@babel/plugin-syntax-typescript": "^7.7.2", "@babel/traverse": "^7.7.2", "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/expect-utils": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", "@types/babel__traverse": "^7.0.6", "@types/prettier": "^2.1.5", "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", - "expect": "^29.4.1", + "expect": "^29.5.0", "graceful-fs": "^4.2.9", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-haste-map": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", + "jest-diff": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", "natural-compare": "^1.4.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.5.0", "semver": "^7.3.5" }, "engines": { @@ -6219,12 +6340,12 @@ } }, "node_modules/jest-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.1.tgz", - "integrity": "sha512-bQy9FPGxVutgpN4VRc0hk6w7Hx/m6L53QxpDreTZgJd9gfx/AV2MjyPde9tGyZRINAUrSv57p2inGBu2dRLmkQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.5.0.tgz", + "integrity": "sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -6236,17 +6357,17 @@ } }, "node_modules/jest-validate": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.4.1.tgz", - "integrity": "sha512-qNZXcZQdIQx4SfUB/atWnI4/I2HUvhz8ajOSYUu40CSmf9U5emil8EDHgE7M+3j9/pavtk3knlZBDsgFvv/SWw==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.5.0.tgz", + "integrity": "sha512-pC26etNIi+y3HV8A+tUGr/lph9B18GnzSRAkPaaZJIE1eFdiYm6/CewuiJQ8/RlfHd1u/8Ioi8/sJ+CmbA+zAQ==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "camelcase": "^6.2.0", "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", + "jest-get-type": "^29.4.3", "leven": "^3.1.0", - "pretty-format": "^29.4.1" + "pretty-format": "^29.5.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -6265,18 +6386,18 @@ } }, "node_modules/jest-watcher": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.4.1.tgz", - "integrity": "sha512-vFOzflGFs27nU6h8dpnVRER3O2rFtL+VMEwnG0H3KLHcllLsU8y9DchSh0AL/Rg5nN1/wSiQ+P4ByMGpuybaVw==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.5.0.tgz", + "integrity": "sha512-KmTojKcapuqYrKDpRwfqcQ3zjMlwu27SYext9pt4GlF5FUgB+7XE1mcCnSm6a4uUpFyQIkb6ZhzZvHl+jiBCiA==", "dev": true, "dependencies": { - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "emittery": "^0.13.1", - "jest-util": "^29.4.1", + "jest-util": "^29.5.0", "string-length": "^4.0.1" }, "engines": { @@ -6297,16 +6418,14 @@ "node": ">= 10.13.0" } }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/js-sdsl": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" } }, "node_modules/js-sha256": { @@ -6436,9 +6555,9 @@ } }, "node_modules/lilconfig": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.4.tgz", - "integrity": "sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", "dev": true, "engines": { "node": ">=10" @@ -6451,53 +6570,174 @@ "dev": true }, "node_modules/lint-staged": { - "version": "12.4.1", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.1.tgz", - "integrity": "sha512-PTXgzpflrQ+pODQTG116QNB+Q6uUTDg5B5HqGvNhoQSGt8Qy+MA/6zSnR8n38+sxP5TapzeQGTvoKni0KRS8Vg==", + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.0.tgz", + "integrity": "sha512-GbyK5iWinax5Dfw5obm2g2ccUiZXNGtAS4mCbJ0Lv4rq6iEtfBSjOYdcbOtAIFtM114t0vdpViDDetjVTSd8Vw==", "dev": true, "dependencies": { + "chalk": "5.2.0", "cli-truncate": "^3.1.0", - "colorette": "^2.0.16", - "commander": "^8.3.0", - "debug": "^4.3.3", - "execa": "^5.1.1", - "lilconfig": "2.0.4", - "listr2": "^4.0.1", - "micromatch": "^4.0.4", + "commander": "^10.0.0", + "debug": "^4.3.4", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", + "micromatch": "^4.0.5", "normalize-path": "^3.0.0", - "object-inspect": "^1.12.0", - "pidtree": "^0.5.0", + "object-inspect": "^1.12.3", + "pidtree": "^0.6.0", "string-argv": "^0.3.1", - "supports-color": "^9.2.1", - "yaml": "^1.10.2" + "yaml": "^2.2.1" }, "bin": { "lint-staged": "bin/lint-staged.js" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": "^14.13.1 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/lint-staged" } }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/execa": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", + "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/lint-staged/node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/lint-staged/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/listr2": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-4.0.5.tgz", - "integrity": "sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", "dev": true, "dependencies": { "cli-truncate": "^2.1.0", - "colorette": "^2.0.16", + "colorette": "^2.0.19", "log-update": "^4.0.0", "p-map": "^4.0.0", "rfdc": "^1.3.0", - "rxjs": "^7.5.5", + "rxjs": "^7.8.0", "through": "^2.3.8", "wrap-ansi": "^7.0.0" }, "engines": { - "node": ">=12" + "node": "^14.13.1 || >=16.0.0" }, "peerDependencies": { "enquirer": ">= 2.3.0 < 3" @@ -6543,9 +6783,9 @@ } }, "node_modules/listr2/node_modules/rxjs": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.5.tgz", - "integrity": "sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz", + "integrity": "sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==", "dev": true, "dependencies": { "tslib": "^2.1.0" @@ -6592,9 +6832,9 @@ } }, "node_modules/listr2/node_modules/tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", "dev": true }, "node_modules/locate-path": { @@ -6727,6 +6967,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -6735,12 +6976,15 @@ } }, "node_modules/magic-string": { - "version": "0.25.9", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", + "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==", "dev": true, "dependencies": { - "sourcemap-codec": "^1.4.8" + "@jridgewell/sourcemap-codec": "^1.4.13" + }, + "engines": { + "node": ">=12" } }, "node_modules/make-dir": { @@ -6791,57 +7035,19 @@ "node": ">= 8" } }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" + "braces": "^3.0.2", + "picomatch": "^2.3.1" }, "engines": { "node": ">=8.6" } }, - "node_modules/mime": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", - "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mime-db": { - "version": "1.47.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz", - "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.30", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz", - "integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==", - "dependencies": { - "mime-db": "1.47.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -6899,12 +7105,37 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "node_modules/natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -6912,9 +7143,9 @@ "dev": true }, "node_modules/node-releases": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", "dev": true }, "node_modules/normalize-path": { @@ -6939,9 +7170,10 @@ } }, "node_modules/object-inspect": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", - "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -6956,14 +7188,14 @@ } }, "node_modules/object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", "object-keys": "^1.1.1" }, "engines": { @@ -6974,14 +7206,14 @@ } }, "node_modules/object.values": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", - "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", + "integrity": "sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" }, "engines": { "node": ">= 0.4" @@ -7083,12 +7315,12 @@ } }, "node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true, "engines": { - "node": ">=4" + "node": ">=6" } }, "node_modules/parent-module": { @@ -7170,18 +7402,21 @@ "dev": true }, "node_modules/picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "engines": { "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/pidtree": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.5.0.tgz", - "integrity": "sha512-9nxspIM7OpZuhBxPg73Zvyq7j1QMPMPsGKTqRc2XOaFQauDvoNz9fM1Wdkjmeo7l9GXOZiRs97sPkuayl39wjA==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", "dev": true, "bin": { "pidtree": "bin/pidtree.js" @@ -7263,15 +7498,6 @@ "node": ">=8" } }, - "node_modules/pkg-dir/node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -7282,9 +7508,9 @@ } }, "node_modules/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.6.tgz", + "integrity": "sha512-mtuzdiBbHwPEgl7NxWlqOkithPyp4VN93V7VeHVWBF+ad3I5avc0RVDT4oImXQy9H/AqxA2NSQH8pSxHW6FYbQ==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -7297,12 +7523,12 @@ } }, "node_modules/pretty-format": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.1.tgz", - "integrity": "sha512-dt/Z761JUVsrIKaY215o1xQJBGlSmTx/h4cSqXqjHLnU1+Kt+mavVE7UgqJJO5ukx5HjSswHfmXz4LjS2oIJfg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.5.0.tgz", + "integrity": "sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw==", "dev": true, "dependencies": { - "@jest/schemas": "^29.4.0", + "@jest/schemas": "^29.4.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" }, @@ -7353,16 +7579,21 @@ "node": ">=6" } }, - "node_modules/qs": { - "version": "6.10.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", - "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - } + "node_modules/pure-rand": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.1.tgz", + "integrity": "sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ] }, "node_modules/queue-microtask": { "version": "1.2.3", @@ -7399,19 +7630,6 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "dev": true }, - "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/regenerate": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", @@ -7419,9 +7637,9 @@ "dev": true }, "node_modules/regenerate-unicode-properties": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.0.1.tgz", - "integrity": "sha512-vn5DU6yg6h8hP/2OkQo3K7uVILvY4iu0oI4t3HFa81UPkhGJwkRwM10JEc3upjdhHjs/k8GJY1sRBhk5sr69Bw==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz", + "integrity": "sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ==", "dev": true, "dependencies": { "regenerate": "^1.4.2" @@ -7445,45 +7663,44 @@ "@babel/runtime": "^7.8.4" } }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "node_modules/regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/mysticatea" + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/regexpu-core": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.1.0.tgz", - "integrity": "sha512-bb6hk+xWd2PEOkj5It46A16zFMs2mv86Iwpdu94la4S3sJ7C973h2dHpYKwIBGaWSO7cIRJ+UX0IeMaWcO4qwA==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", + "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", "dev": true, "dependencies": { + "@babel/regjsgen": "^0.8.0", "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.0.1", - "regjsgen": "^0.6.0", - "regjsparser": "^0.8.2", + "regenerate-unicode-properties": "^10.1.0", + "regjsparser": "^0.9.1", "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.0.0" + "unicode-match-property-value-ecmascript": "^2.1.0" }, "engines": { "node": ">=4" } }, - "node_modules/regjsgen": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.6.0.tgz", - "integrity": "sha512-ozE883Uigtqj3bx7OhL1KNbCzGyW2NQZPl6Hs09WTvCuZD5sTI4JY58bkbQWa/Y9hxIsvJ3M8Nbf7j54IqeZbA==", - "dev": true - }, "node_modules/regjsparser": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.8.4.tgz", - "integrity": "sha512-J3LABycON/VNEu3abOviqGHuB/LOtOQj8SKmfP9anY5GfAVw/SPjwzSjxGjbZXIxbGfqTHtJw58C2Li/WkStmA==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", + "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", "dev": true, "dependencies": { "jsesc": "~0.5.0" @@ -7511,12 +7728,12 @@ } }, "node_modules/resolve": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", - "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", "dev": true, "dependencies": { - "is-core-module": "^2.8.1", + "is-core-module": "^2.9.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -7558,9 +7775,9 @@ } }, "node_modules/resolve.exports": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.0.tgz", - "integrity": "sha512-6K/gDlqgQscOlg9fSRpWstA8sYe8rbELsSTNpx+3kTrsVCzvSl0zIvRErM7fdl9ERWDsKnrLnwB+Ne89918XOg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.1.tgz", + "integrity": "sha512-OEJWVeimw8mgQuj3HfkNl4KqRevH7lzeQNaWRPfx0PPse7Jk6ozcsG4FKVgtzDsC1KUF+YlTHh17NcgHOPykLw==", "dev": true, "engines": { "node": ">=10" @@ -7608,15 +7825,16 @@ } }, "node_modules/rollup": { - "version": "2.79.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.0.tgz", - "integrity": "sha512-x4KsrCgwQ7ZJPcFA/SUu6QVcYlO7uRLfLAy0DSA4NS2eG8japdbpM50ToH7z4iObodRYOJ0soneF0iaQRJ6zhA==", + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.20.0.tgz", + "integrity": "sha512-YsIfrk80NqUDrxrjWPXUa7PWvAfegZEXHuPsEZg58fGCdjL1I9C1i/NaG+L+27kxxwkrG/QEDEQc8s/ynXWWGQ==", "dev": true, "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=10.0.0" + "node": ">=14.18.0", + "npm": ">=8.0.0" }, "optionalDependencies": { "fsevents": "~2.3.2" @@ -8122,14 +8340,15 @@ } }, "node_modules/rollup-plugin-typescript2": { - "version": "0.33.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.33.0.tgz", - "integrity": "sha512-7ZXoZeX93kNb4/ICzOi2AlperVV6cAsNz8THqrbz+KNvpn47P2F/nFdK/BGhkoOsOwuYDuY57vccdZZrcd8/dA==", + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.34.1.tgz", + "integrity": "sha512-P4cHLtGikESmqi1CA+tdMDUv8WbQV48mzPYt77TSTOPJpERyZ9TXdDgjSDix8Fkqce6soYz3+fa4lrC93IEkcw==", "dev": true, "dependencies": { "@rollup/pluginutils": "^4.1.2", "find-cache-dir": "^3.3.2", "fs-extra": "^10.0.0", + "semver": "^7.3.7", "tslib": "^2.4.0" }, "peerDependencies": { @@ -8205,7 +8424,22 @@ "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/safer-buffer": { "version": "2.1.2", @@ -8217,6 +8451,7 @@ "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -8252,10 +8487,14 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/signal-exit": { @@ -8338,12 +8577,6 @@ "source-map": "^0.6.0" } }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "dev": true - }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -8371,14 +8604,6 @@ "node": ">=8" } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/string-argv": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", @@ -8445,29 +8670,46 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, + "node_modules/string.prototype.trim": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz", + "integrity": "sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/string.prototype.trimend": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", - "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz", + "integrity": "sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "es-abstract": "^1.20.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", - "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz", + "integrity": "sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "es-abstract": "^1.20.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -8515,37 +8757,16 @@ "node": ">=8" } }, - "node_modules/superagent": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", - "integrity": "sha512-OUDHEssirmplo3F+1HWKUrUjvnQuA+nZI6i/JJBdXb5eq9IyEQwPyPpqND+SSsxf6TygpBEkUjISVRN4/VOpeg==", - "dependencies": { - "component-emitter": "^1.3.0", - "cookiejar": "^2.1.2", - "debug": "^4.1.1", - "fast-safe-stringify": "^2.0.7", - "form-data": "^3.0.0", - "formidable": "^1.2.2", - "methods": "^1.1.2", - "mime": "^2.4.6", - "qs": "^6.9.4", - "readable-stream": "^3.6.0", - "semver": "^7.3.2" - }, - "engines": { - "node": ">= 7.0.0" - } - }, "node_modules/supports-color": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.2.2.tgz", - "integrity": "sha512-XC6g/Kgux+rJXmwokjm9ECpD6k/smUoS5LKlUCcsYr4IY3rW0XyAympon2RmxGrlnZURMpg5T18gWDP9CsHXFA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, - "engines": { - "node": ">=12" + "dependencies": { + "has-flag": "^4.0.0" }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "engines": { + "node": ">=8" } }, "node_modules/supports-preserve-symlinks-flag": { @@ -8649,6 +8870,11 @@ "node": ">=8.0" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/tsconfig-paths": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", @@ -8717,17 +8943,31 @@ "node": ">=10" } }, + "node_modules/typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/typescript": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", - "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", + "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=12.20" } }, "node_modules/unbox-primitive": { @@ -8768,18 +9008,18 @@ } }, "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", - "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", + "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", - "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", "dev": true, "engines": { "node": ">=4" @@ -8795,9 +9035,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.7.tgz", - "integrity": "sha512-iN/XYesmZ2RmmWAiI4Z5rq0YqSiv0brj9Ce9CfhNE4xIW2h+MFxcgkxIzZ+ShkFPUkjU3gQ+3oypadD3RAMtrg==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", + "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", "dev": true, "funding": [ { @@ -8829,11 +9069,6 @@ "punycode": "^2.1.0" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, "node_modules/v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", @@ -8841,9 +9076,9 @@ "dev": true }, "node_modules/v8-to-istanbul": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz", - "integrity": "sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.12", @@ -8868,6 +9103,20 @@ "makeerror": "1.0.12" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -8899,6 +9148,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -8988,16 +9257,16 @@ } }, "node_modules/write-file-atomic": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.0.tgz", - "integrity": "sha512-R7NYMnHSlV42K54lwY9lvW6MnSm1HSJqZL3xiSgi9E7//FYaI74r2G0rd+/X6VAMkHEdzxQaU5HUOXWUz5kA/w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^3.0.7" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/y18n": { @@ -9012,21 +9281,22 @@ "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz", + "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==", "dev": true, "engines": { - "node": ">= 6" + "node": ">= 14" } }, "node_modules/yargs": { - "version": "17.6.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", - "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", "dev": true, "dependencies": { "cliui": "^8.0.1", @@ -9128,9 +9398,9 @@ } }, "@babel/compat-data": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.0.tgz", - "integrity": "sha512-y5rqgTTPTmaF5e2nVhOxw+Ur9HDJLsWb6U/KpgUzRZEdPfE6VOubXBKLdbcUTijzRptednSBDQbYZBOSqJxpJw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.0.tgz", + "integrity": "sha512-gMuZsmsgxk/ENC3O/fRw5QY8A9/uxQbbCEypnLIiYYc/qVJtEV7ouxC3EllIIwNzMqAQee5tanFabWsUOutS7g==", "dev": true }, "@babel/core": { @@ -9171,13 +9441,14 @@ } }, "@babel/generator": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.0.tgz", - "integrity": "sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.3.tgz", + "integrity": "sha512-QS3iR1GYC/YGUnW7IdggFeN5c1poPUurnGttOV/bZgPGV+izC/D8HnD6DLwod0fsatNyVn1G3EVWMYIF0nHbeA==", "dev": true, "requires": { - "@babel/types": "^7.19.0", + "@babel/types": "^7.21.3", "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" }, "dependencies": { @@ -9214,54 +9485,71 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.0.tgz", - "integrity": "sha512-Ai5bNWXIvwDvWM7njqsG3feMlL9hCVQsPYXodsZyLwshYkZVJt59Gftau4VrE8S9IT9asd2uSP1hG6wCNw+sXA==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz", + "integrity": "sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==", "dev": true, "requires": { - "@babel/compat-data": "^7.19.0", + "@babel/compat-data": "^7.20.5", "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.20.2", + "browserslist": "^4.21.3", + "lru-cache": "^5.1.1", "semver": "^6.3.0" }, "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true } } }, "@babel/helper-create-class-features-plugin": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.19.0.tgz", - "integrity": "sha512-NRz8DwF4jT3UfrmUoZjd0Uph9HQnP30t7Ash+weACcyNkiYTywpIjDBgReJMKgr+n86sn2nPVVmJ28Dm053Kqw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.21.0.tgz", + "integrity": "sha512-Q8wNiMIdwsv5la5SPxNYzzkPnjgC0Sy0i7jLkVOCdllu/xcVNkr3TeZzbHBJrj+XXRqzX5uCyCoV9eu6xUG7KQ==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.18.6", "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-member-expression-to-functions": "^7.18.9", + "@babel/helper-function-name": "^7.21.0", + "@babel/helper-member-expression-to-functions": "^7.21.0", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-replace-supers": "^7.18.9", + "@babel/helper-replace-supers": "^7.20.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.20.0", "@babel/helper-split-export-declaration": "^7.18.6" } }, "@babel/helper-create-regexp-features-plugin": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.19.0.tgz", - "integrity": "sha512-htnV+mHX32DF81amCDrwIDr8nrp1PTm+3wfBN9/v8QJOLEioOCOG7qNyq0nHeFiWbT3Eb7gsPwEmV64UCQ1jzw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.21.0.tgz", + "integrity": "sha512-N+LaFW/auRSWdx7SHD/HiARwXQju1vXTW4fKr4u5SgBUTm51OKEjKgj+cs00ggW3kEvNqwErnlwuq7Y3xBe4eg==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.18.6", - "regexpu-core": "^5.1.0" + "regexpu-core": "^5.3.1" } }, "@babel/helper-define-polyfill-provider": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.2.tgz", - "integrity": "sha512-r9QJJ+uDWrd+94BSPcP6/de67ygLtvVy6cK4luE6MOuDsZIdoaPBnfSpbO/+LTifjPckbKXRuI9BB/Z2/y3iTg==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", + "integrity": "sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww==", "dev": true, "requires": { "@babel/helper-compilation-targets": "^7.17.7", @@ -9296,13 +9584,13 @@ } }, "@babel/helper-function-name": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", - "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", + "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", "dev": true, "requires": { - "@babel/template": "^7.18.10", - "@babel/types": "^7.19.0" + "@babel/template": "^7.20.7", + "@babel/types": "^7.21.0" } }, "@babel/helper-hoist-variables": { @@ -9315,12 +9603,12 @@ } }, "@babel/helper-member-expression-to-functions": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.18.9.tgz", - "integrity": "sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.0.tgz", + "integrity": "sha512-Muu8cdZwNN6mRRNG6lAYErJ5X3bRevgYR2O8wN0yn7jJSnGDu6eG59RfT29JHxGUovyfrh6Pj0XzmR7drNVL3Q==", "dev": true, "requires": { - "@babel/types": "^7.18.9" + "@babel/types": "^7.21.0" } }, "@babel/helper-module-imports": { @@ -9333,19 +9621,19 @@ } }, "@babel/helper-module-transforms": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz", - "integrity": "sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ==", + "version": "7.21.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz", + "integrity": "sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==", "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", - "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" + "@babel/helper-validator-identifier": "^7.19.1", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.2", + "@babel/types": "^7.21.2" } }, "@babel/helper-optimise-call-expression": { @@ -9358,9 +9646,9 @@ } }, "@babel/helper-plugin-utils": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz", - "integrity": "sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", + "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", "dev": true }, "@babel/helper-remap-async-to-generator": { @@ -9376,34 +9664,35 @@ } }, "@babel/helper-replace-supers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.18.9.tgz", - "integrity": "sha512-dNsWibVI4lNT6HiuOIBr1oyxo40HvIVmbwPUm3XZ7wMh4k2WxrxTqZwSqw/eEmXDS9np0ey5M2bz9tBmO9c+YQ==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.20.7.tgz", + "integrity": "sha512-vujDMtB6LVfNW13jhlCrp48QNslK6JXi7lQG736HVbHz/mbf4Dc7tIRh1Xf5C0rF7BP8iiSxGMCmY6Ci1ven3A==", "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-member-expression-to-functions": "^7.18.9", + "@babel/helper-member-expression-to-functions": "^7.20.7", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.20.7", + "@babel/types": "^7.20.7" } }, "@babel/helper-simple-access": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz", - "integrity": "sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", "dev": true, "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.20.2" } }, "@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.18.9.tgz", - "integrity": "sha512-imytd2gHi3cJPsybLRbmFrF7u5BIEuI2cNheyKi3/iOBC63kNn3q8Crn2xVuESli0aM4KYsyEqKyS7lFL8YVtw==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.20.0.tgz", + "integrity": "sha512-5y1JYeNKfvnT8sZcK9DVRtpTbGiomYIHviSP3OQWmDPU3DeH4a1ZlT/N2lyQ5P8egjcRaT/Y9aNqUxK0WsnIIg==", "dev": true, "requires": { - "@babel/types": "^7.18.9" + "@babel/types": "^7.20.0" } }, "@babel/helper-split-export-declaration": { @@ -9428,9 +9717,9 @@ "dev": true }, "@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz", + "integrity": "sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==", "dev": true }, "@babel/helper-wrap-function": { @@ -9526,9 +9815,9 @@ } }, "@babel/parser": { - "version": "7.20.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.13.tgz", - "integrity": "sha512-gFDLKMfpiXCsjt4za2JA9oTMn70CeseCehb11kRZgvd7+F67Hih3OHOK24cRrWECJ/ljfPGac6ygXAs/C8kIvw==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.3.tgz", + "integrity": "sha512-lobG0d7aOfQRXh8AyklEAgZGvA4FShxo6xQbUrrT/cNBPUdIDojlokwJsQyCC/eKia7ifqM0yP+2DRZ4WKw2RQ==", "dev": true }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { @@ -9552,13 +9841,13 @@ } }, "@babel/plugin-proposal-async-generator-functions": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.0.tgz", - "integrity": "sha512-nhEByMUTx3uZueJ/QkJuSlCfN4FGg+xy+vRsfGQGzSauq5ks2Deid2+05Q3KhfaUjvec1IGhw/Zm3cFm8JigTQ==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.7.tgz", + "integrity": "sha512-xMbiLsn/8RK7Wq7VeVytytS2L6qE69bXPB10YCmMdDZbKF4okCqY74pI/jJQ/8U0b/F6NrT2+14b8/P9/3AMGA==", "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-plugin-utils": "^7.19.0", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/helper-remap-async-to-generator": "^7.18.9", "@babel/plugin-syntax-async-generators": "^7.8.4" } @@ -9645,16 +9934,16 @@ } }, "@babel/plugin-proposal-object-rest-spread": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz", - "integrity": "sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz", + "integrity": "sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg==", "dev": true, "requires": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", + "@babel/compat-data": "^7.20.5", + "@babel/helper-compilation-targets": "^7.20.7", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" + "@babel/plugin-transform-parameters": "^7.20.7" } }, "@babel/plugin-proposal-optional-catch-binding": { @@ -9765,12 +10054,12 @@ } }, "@babel/plugin-syntax-import-assertions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz", - "integrity": "sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.20.0.tgz", + "integrity": "sha512-IUh1vakzNoWalR8ch/areW7qFopR2AEw03JlG7BbrDqmQ4X3q9uuipQwSGrUn7oGiemKjtSLDhNtQHzMHr1JdQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.19.0" } }, "@babel/plugin-syntax-import-meta": { @@ -9873,12 +10162,12 @@ } }, "@babel/plugin-syntax-typescript": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.18.6.tgz", - "integrity": "sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz", + "integrity": "sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.19.0" } }, "@babel/plugin-transform-arrow-functions": { @@ -9911,37 +10200,29 @@ } }, "@babel/plugin-transform-block-scoping": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.9.tgz", - "integrity": "sha512-5sDIJRV1KtQVEbt/EIBwGy4T01uYIo4KRB3VUqzkhrAIOGx7AoctL9+Ux88btY0zXdDyPJ9mW+bg+v+XEkGmtw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.21.0.tgz", + "integrity": "sha512-Mdrbunoh9SxwFZapeHVrwFmri16+oYotcZysSzhNIVDwIAb1UV+kvnxULSYq9J3/q5MDG+4X6w8QVgD1zhBXNQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.20.2" } }, "@babel/plugin-transform-classes": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.19.0.tgz", - "integrity": "sha512-YfeEE9kCjqTS9IitkgfJuxjcEtLUHMqa8yUJ6zdz8vR7hKuo6mOy2C05P0F1tdMmDCeuyidKnlrw/iTppHcr2A==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.21.0.tgz", + "integrity": "sha512-RZhbYTCEUAe6ntPehC4hlslPWosNHDox+vAs4On/mCLRLfoDVHf6hVEd7kuxr1RnHwJmxFfUM3cZiZRmPxJPXQ==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-compilation-targets": "^7.19.0", + "@babel/helper-compilation-targets": "^7.20.7", "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", + "@babel/helper-function-name": "^7.21.0", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-replace-supers": "^7.18.9", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-replace-supers": "^7.20.7", "@babel/helper-split-export-declaration": "^7.18.6", "globals": "^11.1.0" - }, - "dependencies": { - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - } } }, "@babel/plugin-transform-computed-properties": { @@ -9954,12 +10235,12 @@ } }, "@babel/plugin-transform-destructuring": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.13.tgz", - "integrity": "sha512-TodpQ29XekIsex2A+YJPj5ax2plkGa8YYY6mFjCohk/IG9IY42Rtuj1FuDeemfg2ipxIFLzPeA83SIBnlhSIow==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.21.3.tgz", + "integrity": "sha512-bp6hwMFzuiE4HqYEyoGJ/V2LeIWn+hLVKc4pnj++E5XQptwhtcGmSayM029d/j2X1bPKGTlsyPwAubuU22KhMA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.20.2" } }, "@babel/plugin-transform-dotall-regex": { @@ -10030,39 +10311,36 @@ } }, "@babel/plugin-transform-modules-amd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz", - "integrity": "sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg==", + "version": "7.20.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.20.11.tgz", + "integrity": "sha512-NuzCt5IIYOW0O30UvqktzHYR2ud5bOWbY0yaxWZ6G+aFzOMJvrs5YHNikrbdaT15+KNO31nPOy5Fim3ku6Zb5g==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.20.11", + "@babel/helper-plugin-utils": "^7.20.2" } }, "@babel/plugin-transform-modules-commonjs": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz", - "integrity": "sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q==", + "version": "7.21.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.21.2.tgz", + "integrity": "sha512-Cln+Yy04Gxua7iPdj6nOV96smLGjpElir5YwzF0LBPKoPlLDNJePNlrGGaybAJkd0zKRnOVXOgizSqPYMNYkzA==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.21.2", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-simple-access": "^7.20.2" } }, "@babel/plugin-transform-modules-systemjs": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.0.tgz", - "integrity": "sha512-x9aiR0WXAWmOWsqcsnrzGR+ieaTMVyGyffPVA7F8cXAGt/UxefYv6uSHZLkAFChN5M5Iy1+wjE+xJuPt22H39A==", + "version": "7.20.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.20.11.tgz", + "integrity": "sha512-vVu5g9BPQKSFEmvt2TA4Da5N+QVS66EX21d8uoOihC+OCpUoGvzVsXeqFdtAEfVa5BILAeFt+U7yVmLbQnAJmw==", "dev": true, "requires": { "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-module-transforms": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-validator-identifier": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.20.11", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-validator-identifier": "^7.19.1" } }, "@babel/plugin-transform-modules-umd": { @@ -10076,13 +10354,13 @@ } }, "@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.19.0.tgz", - "integrity": "sha512-HDSuqOQzkU//kfGdiHBt71/hkDTApw4U/cMVgKgX7PqfB3LOaK+2GtCEsBu1dL9CkswDm0Gwehht1dCr421ULQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.20.5.tgz", + "integrity": "sha512-mOW4tTzi5iTLnw+78iEq3gr8Aoq4WNRGpmSlrogqaiCBoR1HFhpU4JkpQFOHfeYx3ReVIFWOQJS4aZBRvuZ6mA==", "dev": true, "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0" + "@babel/helper-create-regexp-features-plugin": "^7.20.5", + "@babel/helper-plugin-utils": "^7.20.2" } }, "@babel/plugin-transform-new-target": { @@ -10105,12 +10383,12 @@ } }, "@babel/plugin-transform-parameters": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz", - "integrity": "sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.21.3.tgz", + "integrity": "sha512-Wxc+TvppQG9xWFYatvCGPvZ6+SIUxQ2ZdiBP+PHYMIjnPXD+uThCshaz4NZOnODAtBjjcVQQ/3OKs9LW28purQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.20.2" } }, "@babel/plugin-transform-property-literals": { @@ -10188,14 +10466,15 @@ } }, "@babel/plugin-transform-typescript": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.19.0.tgz", - "integrity": "sha512-DOOIywxPpkQHXijXv+s9MDAyZcLp12oYRl3CMWZ6u7TjSoCBq/KqHR/nNFR3+i2xqheZxoF0H2XyL7B6xeSRuA==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.21.3.tgz", + "integrity": "sha512-RQxPz6Iqt8T0uw/WsJNReuBpWpBqs/n7mNo18sKLoTbMp+UrEekhH+pKSVC7gWz+DNjo9gryfV8YzCiT45RgMw==", "dev": true, "requires": { - "@babel/helper-create-class-features-plugin": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/plugin-syntax-typescript": "^7.18.6" + "@babel/helper-annotate-as-pure": "^7.18.6", + "@babel/helper-create-class-features-plugin": "^7.21.0", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/plugin-syntax-typescript": "^7.20.0" } }, "@babel/plugin-transform-unicode-escapes": { @@ -10218,18 +10497,18 @@ } }, "@babel/preset-env": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.19.0.tgz", - "integrity": "sha512-1YUju1TAFuzjIQqNM9WsF4U6VbD/8t3wEAlw3LFYuuEr+ywqLRcSXxFKz4DCEj+sN94l/XTDiUXYRrsvMpz9WQ==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.20.2.tgz", + "integrity": "sha512-1G0efQEWR1EHkKvKHqbG+IN/QdgwfByUpM5V5QroDzGV2t3S/WXNQd693cHiHTlCFMpr9B6FkPFXDA2lQcKoDg==", "dev": true, "requires": { - "@babel/compat-data": "^7.19.0", - "@babel/helper-compilation-targets": "^7.19.0", - "@babel/helper-plugin-utils": "^7.19.0", + "@babel/compat-data": "^7.20.1", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/helper-validator-option": "^7.18.6", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-async-generator-functions": "^7.19.0", + "@babel/plugin-proposal-async-generator-functions": "^7.20.1", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-class-static-block": "^7.18.6", "@babel/plugin-proposal-dynamic-import": "^7.18.6", @@ -10238,7 +10517,7 @@ "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", + "@babel/plugin-proposal-object-rest-spread": "^7.20.2", "@babel/plugin-proposal-optional-catch-binding": "^7.18.6", "@babel/plugin-proposal-optional-chaining": "^7.18.9", "@babel/plugin-proposal-private-methods": "^7.18.6", @@ -10249,7 +10528,7 @@ "@babel/plugin-syntax-class-static-block": "^7.14.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.18.6", + "@babel/plugin-syntax-import-assertions": "^7.20.0", "@babel/plugin-syntax-json-strings": "^7.8.3", "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", @@ -10262,10 +10541,10 @@ "@babel/plugin-transform-arrow-functions": "^7.18.6", "@babel/plugin-transform-async-to-generator": "^7.18.6", "@babel/plugin-transform-block-scoped-functions": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.18.9", - "@babel/plugin-transform-classes": "^7.19.0", + "@babel/plugin-transform-block-scoping": "^7.20.2", + "@babel/plugin-transform-classes": "^7.20.2", "@babel/plugin-transform-computed-properties": "^7.18.9", - "@babel/plugin-transform-destructuring": "^7.18.13", + "@babel/plugin-transform-destructuring": "^7.20.2", "@babel/plugin-transform-dotall-regex": "^7.18.6", "@babel/plugin-transform-duplicate-keys": "^7.18.9", "@babel/plugin-transform-exponentiation-operator": "^7.18.6", @@ -10273,14 +10552,14 @@ "@babel/plugin-transform-function-name": "^7.18.9", "@babel/plugin-transform-literals": "^7.18.9", "@babel/plugin-transform-member-expression-literals": "^7.18.6", - "@babel/plugin-transform-modules-amd": "^7.18.6", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/plugin-transform-modules-systemjs": "^7.19.0", + "@babel/plugin-transform-modules-amd": "^7.19.6", + "@babel/plugin-transform-modules-commonjs": "^7.19.6", + "@babel/plugin-transform-modules-systemjs": "^7.19.6", "@babel/plugin-transform-modules-umd": "^7.18.6", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.19.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.19.1", "@babel/plugin-transform-new-target": "^7.18.6", "@babel/plugin-transform-object-super": "^7.18.6", - "@babel/plugin-transform-parameters": "^7.18.8", + "@babel/plugin-transform-parameters": "^7.20.1", "@babel/plugin-transform-property-literals": "^7.18.6", "@babel/plugin-transform-regenerator": "^7.18.6", "@babel/plugin-transform-reserved-words": "^7.18.6", @@ -10292,11 +10571,11 @@ "@babel/plugin-transform-unicode-escapes": "^7.18.10", "@babel/plugin-transform-unicode-regex": "^7.18.6", "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.19.0", - "babel-plugin-polyfill-corejs2": "^0.3.2", - "babel-plugin-polyfill-corejs3": "^0.5.3", - "babel-plugin-polyfill-regenerator": "^0.4.0", - "core-js-compat": "^3.22.1", + "@babel/types": "^7.20.2", + "babel-plugin-polyfill-corejs2": "^0.3.3", + "babel-plugin-polyfill-corejs3": "^0.6.0", + "babel-plugin-polyfill-regenerator": "^0.4.1", + "core-js-compat": "^3.25.1", "semver": "^6.3.0" }, "dependencies": { @@ -10322,16 +10601,22 @@ } }, "@babel/preset-typescript": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.18.6.tgz", - "integrity": "sha512-s9ik86kXBAnD760aybBucdpnLsAt0jK1xqJn2juOn9lkOvSHV60os5hxoVJsPzMQxvnUJFAlkont2DvvaYEBtQ==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.21.0.tgz", + "integrity": "sha512-myc9mpoVA5m1rF8K8DgLEatOYFDpwC+RkMkjZ0Du6uI62YvDe8uxIEYVs/VCdSJ097nlALiU/yBC7//3nI+hNg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-validator-option": "^7.18.6", - "@babel/plugin-transform-typescript": "^7.18.6" + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-validator-option": "^7.21.0", + "@babel/plugin-transform-typescript": "^7.21.0" } }, + "@babel/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==", + "dev": true + }, "@babel/runtime": { "version": "7.19.0", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.0.tgz", @@ -10342,46 +10627,38 @@ } }, "@babel/template": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", - "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", + "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", "dev": true, "requires": { "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7" } }, "@babel/traverse": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.0.tgz", - "integrity": "sha512-4pKpFRDh+utd2mbRC8JLnlsMUii3PMHjpL6a0SZ4NMZy7YFP9aXORxEhdMVOc9CpWtDF09IkciQLEhK7Ml7gRA==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.3.tgz", + "integrity": "sha512-XLyopNeaTancVitYZe2MlUEvgKb6YVVPXzofHgqHijCImG33b/uTurMS488ht/Hbsb2XK3U2BnSTxKVNGV3nGQ==", "dev": true, "requires": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.0", + "@babel/generator": "^7.21.3", "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", + "@babel/helper-function-name": "^7.21.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.0", - "@babel/types": "^7.19.0", + "@babel/parser": "^7.21.3", + "@babel/types": "^7.21.3", "debug": "^4.1.0", "globals": "^11.1.0" - }, - "dependencies": { - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - } } }, "@babel/types": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.7.tgz", - "integrity": "sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.3.tgz", + "integrity": "sha512-sBGdETxC+/M4o/zKC0sl6sjWv62WFR/uzxrJ6uYyMLZOUlPnwzw0tKgVHOXxaAd5l2g8pEDM5RZ495GPQI77kg==", "dev": true, "requires": { "@babel/helper-string-parser": "^7.19.4", @@ -10395,16 +10672,31 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "@eslint-community/eslint-utils": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz", + "integrity": "sha512-v3oplH6FYCULtFuCeqyuTd9D2WKO937Dxdq+GmHOLL72TTRriLxz2VLlNfkZRsvj6PKnOPAtuT6dwrs/pA5DvA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.3.0" + } + }, + "@eslint-community/regexpp": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.4.0.tgz", + "integrity": "sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==", + "dev": true + }, "@eslint/eslintrc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz", - "integrity": "sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.1.tgz", + "integrity": "sha512-eFRmABvW2E5Ho6f5fHLqgena46rOj7r7OKHYfLElqcBfGFHHpjBhivyi5+jOEQuSpdc/1phIZJlbC2te+tZNIw==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.15.0", + "espree": "^9.5.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -10412,18 +10704,39 @@ "strip-json-comments": "^3.1.1" }, "dependencies": { + "globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true } } }, + "@eslint/js": { + "version": "8.36.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.36.0.tgz", + "integrity": "sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg==", + "dev": true + }, "@hipo/eslint-config-base": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@hipo/eslint-config-base/-/eslint-config-base-4.2.1.tgz", - "integrity": "sha512-Mp+b27lqwuX6aSkVxr8OzxvinPRs4EOKnNPBHFhVrRv4vwZ1TaDTLaltpGAAfVUnYjyoofIE+e75rJqpu24sGA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@hipo/eslint-config-base/-/eslint-config-base-4.3.0.tgz", + "integrity": "sha512-0va9TxkzGYbhaiudc4MrpUUzASIiH4iCF2q5J0vplP8PLnkCyq6H0/ck5qlsfsY64nwO8OlNcUw1CI/O0c2NCA==", "dev": true, "requires": {} }, @@ -10435,22 +10748,16 @@ "requires": {} }, "@humanwhocodes/config-array": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz", - "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==", + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", - "minimatch": "^3.0.4" + "minimatch": "^3.0.5" } }, - "@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", - "dev": true - }, "@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -10532,12 +10839,6 @@ "p-limit": "^2.2.0" } }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, "resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", @@ -10553,51 +10854,51 @@ "dev": true }, "@jest/console": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.4.1.tgz", - "integrity": "sha512-m+XpwKSi3PPM9znm5NGS8bBReeAJJpSkL1OuFCqaMaJL2YX9YXLkkI+MBchMPwu+ZuM2rynL51sgfkQteQ1CKQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.5.0.tgz", + "integrity": "sha512-NEpkObxPwyw/XxZVLPmAGKE89IQRp4puc6IQRPru6JKd1M3fW9v1xM1AnzIJE65hbCkzQAdnL8P47e9hzhiYLQ==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", "slash": "^3.0.0" } }, "@jest/core": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.4.1.tgz", - "integrity": "sha512-RXFTohpBqpaTebNdg5l3I5yadnKo9zLBajMT0I38D0tDhreVBYv3fA8kywthI00sWxPztWLD3yjiUkewwu/wKA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.5.0.tgz", + "integrity": "sha512-28UzQc7ulUrOQw1IsN/kv1QES3q2kkbl/wGslyhAclqZ/8cMdB5M68BffkIdSJgKBUt50d3hbwJ92XESlE7LiQ==", "dev": true, "requires": { - "@jest/console": "^29.4.1", - "@jest/reporters": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.5.0", + "@jest/reporters": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "ci-info": "^3.2.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.4.0", - "jest-config": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-resolve-dependencies": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", - "jest-watcher": "^29.4.1", + "jest-changed-files": "^29.5.0", + "jest-config": "^29.5.0", + "jest-haste-map": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-resolve-dependencies": "^29.5.0", + "jest-runner": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", + "jest-watcher": "^29.5.0", "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", + "pretty-format": "^29.5.0", "slash": "^3.0.0", "strip-ansi": "^6.0.0" }, @@ -10620,73 +10921,73 @@ } }, "@jest/environment": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.4.1.tgz", - "integrity": "sha512-pJ14dHGSQke7Q3mkL/UZR9ZtTOxqskZaC91NzamEH4dlKRt42W+maRBXiw/LWkdJe+P0f/zDR37+SPMplMRlPg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.5.0.tgz", + "integrity": "sha512-5FXw2+wD29YU1d4I2htpRX7jYnAyTRjP2CsXQdo9SAM8g3ifxWPSV0HnClSn71xwctr0U3oZIIH+dtbfmnbXVQ==", "dev": true, "requires": { - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/fake-timers": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", - "jest-mock": "^29.4.1" + "jest-mock": "^29.5.0" } }, "@jest/expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-ZxKJP5DTUNF2XkpJeZIzvnzF1KkfrhEF6Rz0HGG69fHl6Bgx5/GoU3XyaeFYEjuuKSOOsbqD/k72wFvFxc3iTw==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.5.0.tgz", + "integrity": "sha512-PueDR2HGihN3ciUNGr4uelropW7rqUfTiOn+8u0leg/42UhblPxHkfoh0Ruu3I9Y1962P3u2DY4+h7GVTSVU6g==", "dev": true, "requires": { - "expect": "^29.4.1", - "jest-snapshot": "^29.4.1" + "expect": "^29.5.0", + "jest-snapshot": "^29.5.0" } }, "@jest/expect-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.4.1.tgz", - "integrity": "sha512-w6YJMn5DlzmxjO00i9wu2YSozUYRBhIoJ6nQwpMYcBMtiqMGJm1QBzOf6DDgRao8dbtpDoaqLg6iiQTvv0UHhQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.5.0.tgz", + "integrity": "sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg==", "dev": true, "requires": { - "jest-get-type": "^29.2.0" + "jest-get-type": "^29.4.3" } }, "@jest/fake-timers": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.4.1.tgz", - "integrity": "sha512-/1joI6rfHFmmm39JxNfmNAO3Nwm6Y0VoL5fJDy7H1AtWrD1CgRtqJbN9Ld6rhAkGO76qqp4cwhhxJ9o9kYjQMw==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.5.0.tgz", + "integrity": "sha512-9ARvuAAQcBwDAqOnglWq2zwNIRUDtk/SCkp/ToGEhFv5r86K21l+VEs0qNTaXtyiY0lEePl3kylijSYJQqdbDg==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@sinonjs/fake-timers": "^10.0.2", "@types/node": "*", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" + "jest-message-util": "^29.5.0", + "jest-mock": "^29.5.0", + "jest-util": "^29.5.0" } }, "@jest/globals": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.4.1.tgz", - "integrity": "sha512-znoK2EuFytbHH0ZSf2mQK2K1xtIgmaw4Da21R2C/NE/+NnItm5mPEFQmn8gmF3f0rfOlmZ3Y3bIf7bFj7DHxAA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.5.0.tgz", + "integrity": "sha512-S02y0qMWGihdzNbUiqSAiKSpSozSuHX5UYc7QbnHP+D9Lyw8DgGGCinrN9uSuHPeKgSSzvPom2q1nAtBvUsvPQ==", "dev": true, "requires": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/types": "^29.4.1", - "jest-mock": "^29.4.1" + "@jest/environment": "^29.5.0", + "@jest/expect": "^29.5.0", + "@jest/types": "^29.5.0", + "jest-mock": "^29.5.0" } }, "@jest/reporters": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.4.1.tgz", - "integrity": "sha512-AISY5xpt2Xpxj9R6y0RF1+O6GRy9JsGa8+vK23Lmzdy1AYcpQn5ItX79wJSsTmfzPKSAcsY1LNt/8Y5Xe5LOSg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.5.0.tgz", + "integrity": "sha512-D05STXqj/M8bP9hQNSICtPqz97u7ffGzZu+9XLucXhkOFBqKcXe04JLZOgIekOxdb73MAoBUFnqvf7MCpKk5OA==", "dev": true, "requires": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", "@jridgewell/trace-mapping": "^0.3.15", "@types/node": "*", "chalk": "^4.0.0", @@ -10699,9 +11000,9 @@ "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", + "jest-worker": "^29.5.0", "slash": "^3.0.0", "string-length": "^4.0.1", "strip-ansi": "^6.0.0", @@ -10715,13 +11016,13 @@ "dev": true }, "jest-worker": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz", - "integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz", + "integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==", "dev": true, "requires": { "@types/node": "*", - "jest-util": "^29.4.1", + "jest-util": "^29.5.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" } @@ -10747,18 +11048,18 @@ } }, "@jest/schemas": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.0.tgz", - "integrity": "sha512-0E01f/gOZeNTG76i5eWWSupvSHaIINrTie7vCyjiYFKgzNdyEGd12BUv4oNBFHOqlHDbtoJi3HrQ38KCC90NsQ==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.3.tgz", + "integrity": "sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg==", "dev": true, "requires": { "@sinclair/typebox": "^0.25.16" } }, "@jest/source-map": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.2.0.tgz", - "integrity": "sha512-1NX9/7zzI0nqa6+kgpSdKPK+WU1p+SJk3TloWZf5MzPbxri9UEeXX5bWZAPCzbQcyuAzubcdUHA7hcNznmRqWQ==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.4.3.tgz", + "integrity": "sha512-qyt/mb6rLyd9j1jUts4EQncvS6Yy3PM9HghnNv86QBlV+zdL2inCdK1tuVlL+J+lpiw2BI67qXOrX3UurBqQ1w==", "dev": true, "requires": { "@jridgewell/trace-mapping": "^0.3.15", @@ -10767,50 +11068,50 @@ } }, "@jest/test-result": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.4.1.tgz", - "integrity": "sha512-WRt29Lwt+hEgfN8QDrXqXGgCTidq1rLyFqmZ4lmJOpVArC8daXrZWkWjiaijQvgd3aOUj2fM8INclKHsQW9YyQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.5.0.tgz", + "integrity": "sha512-fGl4rfitnbfLsrfx1uUpDEESS7zM8JdgZgOCQuxQvL1Sn/I6ijeAVQWGfXI9zb1i9Mzo495cIpVZhA0yr60PkQ==", "dev": true, "requires": { - "@jest/console": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.5.0", + "@jest/types": "^29.5.0", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" } }, "@jest/test-sequencer": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.4.1.tgz", - "integrity": "sha512-v5qLBNSsM0eHzWLXsQ5fiB65xi49A3ILPSFQKPXzGL4Vyux0DPZAIN7NAFJa9b4BiTDP9MBF/Zqc/QA1vuiJ0w==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.5.0.tgz", + "integrity": "sha512-yPafQEcKjkSfDXyvtgiV4pevSeyuA6MQr6ZIdVkWJly9vkqjnFfcfhRQqpD5whjoU8EORki752xQmjaqoFjzMQ==", "dev": true, "requires": { - "@jest/test-result": "^29.4.1", + "@jest/test-result": "^29.5.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", + "jest-haste-map": "^29.5.0", "slash": "^3.0.0" } }, "@jest/transform": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.4.1.tgz", - "integrity": "sha512-5w6YJrVAtiAgr0phzKjYd83UPbCXsBRTeYI4BXokv9Er9CcrH9hfXL/crCvP2d2nGOcovPUnlYiLPFLZrkG5Hg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.5.0.tgz", + "integrity": "sha512-8vbeZWqLJOvHaDfeMuoHITGKSz5qWc9u04lnWrQE3VyuSw604PzQM824ZeX9XSjUCeDiE3GuxZe5UKa8J61NQw==", "dev": true, "requires": { "@babel/core": "^7.11.6", - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@jridgewell/trace-mapping": "^0.3.15", "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", + "jest-haste-map": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.5.0", "micromatch": "^4.0.4", "pirates": "^4.0.4", "slash": "^3.0.0", - "write-file-atomic": "^5.0.0" + "write-file-atomic": "^4.0.2" }, "dependencies": { "convert-source-map": { @@ -10822,12 +11123,12 @@ } }, "@jest/types": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.1.tgz", - "integrity": "sha512-zbrAXDUOnpJ+FMST2rV7QZOgec8rskg2zv8g2ajeqitp4tvZiyqTCYXANrKsM+ryj5o+LI+ZN2EgU9drrkiwSA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.5.0.tgz", + "integrity": "sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==", "dev": true, "requires": { - "@jest/schemas": "^29.4.0", + "@jest/schemas": "^29.4.3", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", @@ -10887,13 +11188,13 @@ "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.15", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", - "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", + "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", "dev": true, "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" } }, "@nodelib/fs.scandir": { @@ -10923,128 +11224,132 @@ } }, "@rollup/plugin-babel": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz", - "integrity": "sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-6.0.3.tgz", + "integrity": "sha512-fKImZKppa1A/gX73eg4JGo+8kQr/q1HBQaCGKECZ0v4YBBv3lFqi14+7xyApECzvkLTHCifx+7ntcrvtBIRcpg==", "dev": true, "requires": { - "@babel/helper-module-imports": "^7.10.4", - "@rollup/pluginutils": "^3.1.0" + "@babel/helper-module-imports": "^7.18.6", + "@rollup/pluginutils": "^5.0.1" }, "dependencies": { "@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", + "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", "dev": true, "requires": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" } - }, - "estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true } } }, "@rollup/plugin-commonjs": { - "version": "22.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-22.0.2.tgz", - "integrity": "sha512-//NdP6iIwPbMTcazYsiBMbJW7gfmpHom33u1beiIoHDEM0Q9clvtQB1T0efvMqHeKsGohiHo97BCPCkBXdscwg==", + "version": "24.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-24.0.1.tgz", + "integrity": "sha512-15LsiWRZk4eOGqvrJyu3z3DaBu5BhXIMeWnijSRvd8irrrg9SHpQ1pH+BUK4H6Z9wL9yOxZJMTLU+Au86XHxow==", "dev": true, "requires": { - "@rollup/pluginutils": "^3.1.0", + "@rollup/pluginutils": "^5.0.1", "commondir": "^1.0.1", - "estree-walker": "^2.0.1", - "glob": "^7.1.6", - "is-reference": "^1.2.1", - "magic-string": "^0.25.7", - "resolve": "^1.17.0" + "estree-walker": "^2.0.2", + "glob": "^8.0.3", + "is-reference": "1.2.1", + "magic-string": "^0.27.0" }, "dependencies": { "@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", + "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", "dev": true, "requires": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" - }, - "dependencies": { - "estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - } + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, + "minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" } } } }, "@rollup/plugin-json": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", - "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.0.0.tgz", + "integrity": "sha512-i/4C5Jrdr1XUarRhVu27EEwjt4GObltD7c+MkCIpO2QIbojw8MUs+CCTqOphQi3Qtg1FLmYt+l+6YeoIf51J7w==", "dev": true, "requires": { - "@rollup/pluginutils": "^3.0.8" + "@rollup/pluginutils": "^5.0.1" }, "dependencies": { "@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", + "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", "dev": true, "requires": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" } - }, - "estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true } } }, "@rollup/plugin-node-resolve": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-14.0.0.tgz", - "integrity": "sha512-XkWfpgp/zGiFu8LS+JAiQeZN4oYYA4/ViFJiZhwQegTg5ZbzKTvM9YyKXVBNnmZ8Et76WnlVgwRUu1rhKF4ayw==", + "version": "15.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.1.tgz", + "integrity": "sha512-ReY88T7JhJjeRVbfCyNj+NXAG3IIsVMsX9b5/9jC98dRP8/yxlZdz7mHZbHk5zHr24wZZICS5AcXsFZAXYUQEg==", "dev": true, "requires": { - "@rollup/pluginutils": "^3.1.0", - "@types/resolve": "1.17.1", + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", "deepmerge": "^4.2.2", - "is-builtin-module": "^3.1.0", + "is-builtin-module": "^3.2.0", "is-module": "^1.0.0", - "resolve": "^1.19.0" + "resolve": "^1.22.1" }, "dependencies": { "@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", + "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", "dev": true, "requires": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" } - }, - "estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true } } }, @@ -11059,9 +11364,9 @@ } }, "@sinclair/typebox": { - "version": "0.25.21", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", - "integrity": "sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==", + "version": "0.25.24", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", + "integrity": "sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==", "dev": true }, "@sinonjs/commons": { @@ -11124,9 +11429,9 @@ } }, "@types/estree": { - "version": "0.0.39", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", - "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz", + "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==", "dev": true }, "@types/graceful-fs": { @@ -11163,9 +11468,9 @@ } }, "@types/jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.4.0.tgz", - "integrity": "sha512-VaywcGQ9tPorCX/Jkkni7RWGFfI11whqzs8dvxF41P17Z+z872thvEvlIbznjPJ02kl1HMX3LmLOonsj2n7HeQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.0.tgz", + "integrity": "sha512-3Emr5VOl/aoBwnWcH/EFQvlSAmjV+XtV9GGu5mwdYew5vhQh0IUZx/60x0TzHDu09Bi7HMx10t/namdJw5QIcg==", "dev": true, "requires": { "expect": "^29.0.0", @@ -11185,9 +11490,9 @@ "dev": true }, "@types/node": { - "version": "14.14.44", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.44.tgz", - "integrity": "sha512-+gaugz6Oce6ZInfI/tK4Pq5wIIkJMEJUu92RB3Eu93mtj4wjjjz9EB5mLp5s1pSsLXdC/CPut/xF20ZzAQJbTA==", + "version": "18.15.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.5.tgz", + "integrity": "sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew==", "dev": true }, "@types/prettier": { @@ -11197,13 +11502,16 @@ "dev": true }, "@types/resolve": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", - "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", - "dev": true, - "requires": { - "@types/node": "*" - } + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", + "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", + "dev": true + }, + "@types/semver": { + "version": "7.3.13", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", + "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "dev": true }, "@types/stack-utils": { "version": "2.0.1", @@ -11227,18 +11535,19 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.2.tgz", - "integrity": "sha512-OwwR8LRwSnI98tdc2z7mJYgY60gf7I9ZfGjN5EjCwwns9bdTuQfAXcsjSB2wSQ/TVNYSGKf4kzVXbNGaZvwiXw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.56.0.tgz", + "integrity": "sha512-ZNW37Ccl3oMZkzxrYDUX4o7cnuPgU+YrcaYXzsRtLB16I1FR5SHMqga3zGsaSliZADCWo2v8qHWqAYIj8nWCCg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/type-utils": "5.36.2", - "@typescript-eslint/utils": "5.36.2", + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.56.0", + "@typescript-eslint/type-utils": "5.56.0", + "@typescript-eslint/utils": "5.56.0", "debug": "^4.3.4", - "functional-red-black-tree": "^1.0.1", + "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", - "regexpp": "^3.2.0", + "natural-compare-lite": "^1.4.0", "semver": "^7.3.7", "tsutils": "^3.21.0" }, @@ -11252,53 +11561,53 @@ } }, "@typescript-eslint/parser": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.36.2.tgz", - "integrity": "sha512-qS/Kb0yzy8sR0idFspI9Z6+t7mqk/oRjnAYfewG+VN73opAUvmYL3oPIMmgOX6CnQS6gmVIXGshlb5RY/R22pA==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.56.0.tgz", + "integrity": "sha512-sn1OZmBxUsgxMmR8a8U5QM/Wl+tyqlH//jTqCg8daTAmhAk26L2PFhcqPLlYBhYUJMZJK276qLXlHN3a83o2cg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/typescript-estree": "5.36.2", + "@typescript-eslint/scope-manager": "5.56.0", + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/typescript-estree": "5.56.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.36.2.tgz", - "integrity": "sha512-cNNP51L8SkIFSfce8B1NSUBTJTu2Ts4nWeWbFrdaqjmn9yKrAaJUBHkyTZc0cL06OFHpb+JZq5AUHROS398Orw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.56.0.tgz", + "integrity": "sha512-jGYKyt+iBakD0SA5Ww8vFqGpoV2asSjwt60Gl6YcO8ksQ8s2HlUEyHBMSa38bdLopYqGf7EYQMUIGdT/Luw+sw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/visitor-keys": "5.36.2" + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/visitor-keys": "5.56.0" } }, "@typescript-eslint/type-utils": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.36.2.tgz", - "integrity": "sha512-rPQtS5rfijUWLouhy6UmyNquKDPhQjKsaKH0WnY6hl/07lasj8gPaH2UD8xWkePn6SC+jW2i9c2DZVDnL+Dokw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.56.0.tgz", + "integrity": "sha512-8WxgOgJjWRy6m4xg9KoSHPzBNZeQbGlQOH7l2QEhQID/+YseaFxg5J/DLwWSsi9Axj4e/cCiKx7PVzOq38tY4A==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.36.2", - "@typescript-eslint/utils": "5.36.2", + "@typescript-eslint/typescript-estree": "5.56.0", + "@typescript-eslint/utils": "5.56.0", "debug": "^4.3.4", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.36.2.tgz", - "integrity": "sha512-9OJSvvwuF1L5eS2EQgFUbECb99F0mwq501w0H0EkYULkhFa19Qq7WFbycdw1PexAc929asupbZcgjVIe6OK/XQ==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.56.0.tgz", + "integrity": "sha512-JyAzbTJcIyhuUhogmiu+t79AkdnqgPUEsxMTMc/dCZczGMJQh1MK2wgrju++yMN6AWroVAy2jxyPcPr3SWCq5w==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.2.tgz", - "integrity": "sha512-8fyH+RfbKc0mTspfuEjlfqA4YywcwQK2Amcf6TDOwaRLg7Vwdu4bZzyvBZp4bjt1RRjQ5MDnOZahxMrt2l5v9w==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.56.0.tgz", + "integrity": "sha512-41CH/GncsLXOJi0jb74SnC7jVPWeVJ0pxQj8bOjH1h2O26jXN3YHKDT1ejkVz5YeTEQPeLCCRY0U2r68tfNOcg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/visitor-keys": "5.36.2", + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/visitor-keys": "5.56.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -11307,26 +11616,28 @@ } }, "@typescript-eslint/utils": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.36.2.tgz", - "integrity": "sha512-uNcopWonEITX96v9pefk9DC1bWMdkweeSsewJ6GeC7L6j2t0SJywisgkr9wUTtXk90fi2Eljj90HSHm3OGdGRg==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.56.0.tgz", + "integrity": "sha512-XhZDVdLnUJNtbzaJeDSCIYaM+Tgr59gZGbFuELgF7m0IY03PlciidS7UQNKLE0+WpUTn1GlycEr6Ivb/afjbhA==", "dev": true, "requires": { + "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/typescript-estree": "5.36.2", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.56.0", + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/typescript-estree": "5.56.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "semver": "^7.3.7" } }, "@typescript-eslint/visitor-keys": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.2.tgz", - "integrity": "sha512-BtRvSR6dEdrNt7Net2/XDjbYKU5Ml6GqJgVfXT0CxTCJlnIqK7rAGreuWKMT2t8cFUT2Msv5oxw0GMRD7T5J7A==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.56.0.tgz", + "integrity": "sha512-1mFdED7u5bZpX6Xxf5N9U2c18sb+8EvU3tyOIj6LQZ5OOvnmj8BVeNNP603OFPm5KkS1a7IvCIcwrdHXaEMG/Q==", "dev": true, "requires": { - "@typescript-eslint/types": "5.36.2", + "@typescript-eslint/types": "5.56.0", "eslint-visitor-keys": "^3.3.0" } }, @@ -11371,29 +11682,20 @@ "integrity": "sha512-F1tGh056XczEaEAqu7s+hlZUDWwOBT70Eq0lfMpBP2YguSQVyxRbprLq5rELXKQOyOaixTWYhMeMQMzP0U5FoQ==" }, "algosdk": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/algosdk/-/algosdk-1.20.0.tgz", - "integrity": "sha512-KKfSIIdQTgdj3rKaYGLu3n16KC5obx0n+6XvlwAhyGxqG1K5bCJ9F1zbblhCE9aKEv+buNR23Lw6hXGQ54PA1A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/algosdk/-/algosdk-2.1.0.tgz", + "integrity": "sha512-KogpdRK3u7Efvw0FVduyFQEOwI+uGvMJmXUvzdmQJjK0hWhEYUl13X/X1QqNKwyEZjw2qutf9pf23UbNnBEAwA==", "requires": { "algo-msgpack-with-bigint": "^2.1.1", - "buffer": "^6.0.2", - "fsevents": "2.1.2", + "buffer": "^6.0.3", + "cross-fetch": "^3.1.5", "hi-base32": "^0.5.1", "js-sha256": "^0.9.0", "js-sha3": "^0.8.0", "js-sha512": "^0.8.0", "json-bigint": "^1.0.0", - "superagent": "^6.1.0", "tweetnacl": "^1.0.3", "vlq": "^2.0.4" - }, - "dependencies": { - "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", - "optional": true - } } }, "ansi-escapes": { @@ -11436,16 +11738,26 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + } + }, "array-includes": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", - "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", + "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1", - "get-intrinsic": "^1.1.1", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "get-intrinsic": "^1.1.3", "is-string": "^1.0.7" } }, @@ -11456,14 +11768,26 @@ "dev": true }, "array.prototype.flat": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", - "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", + "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", + "es-shim-unscopables": "^1.0.0" + } + }, + "array.prototype.flatmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz", + "integrity": "sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", "es-shim-unscopables": "^1.0.0" } }, @@ -11473,35 +11797,27 @@ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true }, "babel-jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.4.1.tgz", - "integrity": "sha512-xBZa/pLSsF/1sNpkgsiT3CmY7zV1kAsZ9OxxtrFqYucnOuRftXAfcJqcDVyOPeN4lttWTwhLdu0T9f8uvoPEUg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.5.0.tgz", + "integrity": "sha512-mA4eCDh5mSo2EcA9xQjVTpmbbNk32Zb3Q3QFQsNhaK56Q+yoXowzFodLux30HRgyOho5rsQ6B0P9QpMkvvnJ0Q==", "dev": true, "requires": { - "@jest/transform": "^29.4.1", + "@jest/transform": "^29.5.0", "@types/babel__core": "^7.1.14", "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.4.0", + "babel-preset-jest": "^29.5.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "slash": "^3.0.0" } }, - "babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dev": true, - "requires": { - "object.assign": "^4.1.0" - } - }, "babel-plugin-istanbul": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", @@ -11516,9 +11832,9 @@ } }, "babel-plugin-jest-hoist": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.4.0.tgz", - "integrity": "sha512-a/sZRLQJEmsmejQ2rPEUe35nO1+C9dc9O1gplH1SXmJxveQSRUYdBk8yGZG/VOUuZs1u2aHZJusEGoRMbhhwCg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.5.0.tgz", + "integrity": "sha512-zSuuuAlTMT4mzLj2nPnUm6fsE6270vdOfnpbJ+RmruU75UhLFvL0N2NgI7xpeS7NaB6hGqmd5pVpGTDYvi4Q3w==", "dev": true, "requires": { "@babel/template": "^7.3.3", @@ -11528,13 +11844,13 @@ } }, "babel-plugin-polyfill-corejs2": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.2.tgz", - "integrity": "sha512-LPnodUl3lS0/4wN3Rb+m+UK8s7lj2jcLRrjho4gLw+OJs+I4bvGXshINesY5xx/apM+biTnQ9reDI8yj+0M5+Q==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", + "integrity": "sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==", "dev": true, "requires": { "@babel/compat-data": "^7.17.7", - "@babel/helper-define-polyfill-provider": "^0.3.2", + "@babel/helper-define-polyfill-provider": "^0.3.3", "semver": "^6.1.1" }, "dependencies": { @@ -11547,22 +11863,22 @@ } }, "babel-plugin-polyfill-corejs3": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.3.tgz", - "integrity": "sha512-zKsXDh0XjnrUEW0mxIHLfjBfnXSMr5Q/goMe/fxpQnLm07mcOZiIZHBNWCMx60HmdvjxfXcalac0tfFg0wqxyw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.6.0.tgz", + "integrity": "sha512-+eHqR6OPcBhJOGgsIar7xoAB1GcSwVUA3XjAd7HJNzOXT4wv6/H7KIdA/Nc60cvUlDbKApmqNvD1B1bzOt4nyA==", "dev": true, "requires": { - "@babel/helper-define-polyfill-provider": "^0.3.2", - "core-js-compat": "^3.21.0" + "@babel/helper-define-polyfill-provider": "^0.3.3", + "core-js-compat": "^3.25.1" } }, "babel-plugin-polyfill-regenerator": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.0.tgz", - "integrity": "sha512-RW1cnryiADFeHmfLS+WW/G431p1PsW5qdRdz0SDRi7TKcUgc7Oh/uXkT7MZ/+tGsT1BkczEAmD5XjUyJ5SWDTw==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.1.tgz", + "integrity": "sha512-NtQGmyQDXjQqQ+IzRkBVwEOz9lQ4zxAQZgoAYEtU9dJjnl1Oc98qnN7jcp+bE7O7aYzVpavXE3/VKXNzUbh7aw==", "dev": true, "requires": { - "@babel/helper-define-polyfill-provider": "^0.3.2" + "@babel/helper-define-polyfill-provider": "^0.3.3" } }, "babel-preset-current-node-syntax": { @@ -11586,12 +11902,12 @@ } }, "babel-preset-jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.4.0.tgz", - "integrity": "sha512-fUB9vZflUSM3dO/6M2TCAepTzvA4VkOvl67PjErcrQMGt9Eve7uazaeyCZ2th3UtI7ljpiBJES0F7A1vBRsLZA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.5.0.tgz", + "integrity": "sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg==", "dev": true, "requires": { - "babel-plugin-jest-hoist": "^29.4.0", + "babel-plugin-jest-hoist": "^29.5.0", "babel-preset-current-node-syntax": "^1.0.0" } }, @@ -11631,15 +11947,15 @@ } }, "browserslist": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.3.tgz", - "integrity": "sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==", + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001370", - "electron-to-chromium": "^1.4.202", - "node-releases": "^2.0.6", - "update-browserslist-db": "^1.0.5" + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" } }, "bser": { @@ -11676,6 +11992,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, "requires": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -11694,9 +12011,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001390", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001390.tgz", - "integrity": "sha512-sS4CaUM+/+vqQUlCvCJ2WtDlV81aWtHhqeEVkLokVJJa3ViN4zDxAGfq9R8i1m90uGHxo99cy10Od+lvn3hf0g==", + "version": "1.0.30001469", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001469.tgz", + "integrity": "sha512-Rcp7221ScNqQPP3W+lVOYDyjdR6dC+neEQCttoNr5bAyz54AboB4iwpnWgyi8P4YUsPybVzT4LgWiBbI3drL4g==", "dev": true }, "chalk": { @@ -11707,17 +12024,6 @@ "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" - }, - "dependencies": { - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "char-regex": { @@ -11848,23 +12154,15 @@ "dev": true }, "colorette": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz", - "integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==", + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", + "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", "dev": true }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, "commander": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", - "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.0.tgz", + "integrity": "sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==", "dev": true }, "commondir": { @@ -11873,11 +12171,6 @@ "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -11901,27 +12194,21 @@ } } }, - "cookiejar": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", - "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" - }, "core-js-compat": { - "version": "3.25.0", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.25.0.tgz", - "integrity": "sha512-extKQM0g8/3GjFx9US12FAgx8KJawB7RCQ5y8ipYLbmfzEzmFRWdDjIlxDx82g7ygcNG85qMVUSRyABouELdow==", + "version": "3.29.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.29.1.tgz", + "integrity": "sha512-QmchCua884D8wWskMX8tW5ydINzd8oSJVx38lx/pVkFGqztxt73GYre3pm/hyYq8bPf+MW5In4I/uRShFDsbrA==", "dev": true, "requires": { - "browserslist": "^4.21.3", - "semver": "7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "dev": true - } + "browserslist": "^4.21.5" + } + }, + "cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "requires": { + "node-fetch": "2.6.7" } }, "cross-spawn": { @@ -11939,6 +12226,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "requires": { "ms": "2.1.2" }, @@ -11946,7 +12234,8 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true } } }, @@ -11969,20 +12258,15 @@ "dev": true }, "define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", + "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", "dev": true, "requires": { "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -11990,9 +12274,9 @@ "dev": true }, "diff-sequences": { - "version": "29.3.1", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz", - "integrity": "sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", + "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", "dev": true }, "dir-glob": { @@ -12020,9 +12304,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.4.243", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.243.tgz", - "integrity": "sha512-BgLD2gBX43OSXwlT01oYRRD5NIB4n3okTRxkzEAC6G0SZG4TTlyrWMjbOo0fajCwqwpRtMHXQNMjtRN6qpNtfw==", + "version": "1.4.334", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.334.tgz", + "integrity": "sha512-laZ1odk+TRen6q0GeyQx/JEkpD3iSZT7ewopCpKqg9bTjP1l8XRfU3Bg20CFjNPZkp5+NDBl3iqd4o/kPO+Vew==", "dev": true }, "emittery": { @@ -12047,31 +12331,56 @@ } }, "es-abstract": { - "version": "1.19.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.5.tgz", - "integrity": "sha512-Aa2G2+Rd3b6kxEUKTF4TaW67czBLyAv3z7VOhYRU50YBx+bbsYZ9xQP4lMNazePuFlybXI0V4MruPos7qUo5fA==", + "version": "1.21.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.2.tgz", + "integrity": "sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg==", "dev": true, "requires": { + "array-buffer-byte-length": "^1.0.0", + "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.2.0", "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.2", "is-string": "^1.0.7", + "is-typed-array": "^1.1.10", "is-weakref": "^1.0.2", - "object-inspect": "^1.12.0", + "object-inspect": "^1.12.3", "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.7", + "string.prototype.trimend": "^1.0.6", + "string.prototype.trimstart": "^1.0.6", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.9" + } + }, + "es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" } }, "es-shim-unscopables": { @@ -12107,15 +12416,18 @@ "dev": true }, "eslint": { - "version": "8.23.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.0.tgz", - "integrity": "sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==", + "version": "8.36.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.36.0.tgz", + "integrity": "sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.3.1", - "@humanwhocodes/config-array": "^0.10.4", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.0.1", + "@eslint/js": "8.36.0", + "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -12123,23 +12435,22 @@ "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "espree": "^9.5.0", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", - "globby": "^11.1.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", @@ -12147,7 +12458,6 @@ "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.1", - "regexpp": "^3.2.0", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" @@ -12184,6 +12494,15 @@ "is-glob": "^4.0.3" } }, + "globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, "ignore": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", @@ -12198,24 +12517,31 @@ "requires": { "ansi-regex": "^5.0.1" } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true } } }, "eslint-config-prettier": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz", - "integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz", + "integrity": "sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==", "dev": true, "requires": {} }, "eslint-import-resolver-node": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", - "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz", + "integrity": "sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==", "dev": true, "requires": { "debug": "^3.2.7", - "resolve": "^1.20.0" + "is-core-module": "^2.11.0", + "resolve": "^1.22.1" }, "dependencies": { "debug": { @@ -12240,32 +12566,15 @@ "is-glob": "^4.0.3", "resolve": "^1.22.0", "tsconfig-paths": "^3.14.1" - }, - "dependencies": { - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } } }, "eslint-module-utils": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", - "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz", + "integrity": "sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==", "dev": true, "requires": { - "debug": "^3.2.7", - "find-up": "^2.1.0" + "debug": "^3.2.7" }, "dependencies": { "debug": { @@ -12276,80 +12585,39 @@ "requires": { "ms": "^2.1.1" } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true } } }, "eslint-plugin-import": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", - "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==", + "version": "2.27.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz", + "integrity": "sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==", "dev": true, "requires": { - "array-includes": "^3.1.4", - "array.prototype.flat": "^1.2.5", - "debug": "^2.6.9", + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "array.prototype.flatmap": "^1.3.1", + "debug": "^3.2.7", "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.3", + "eslint-import-resolver-node": "^0.3.7", + "eslint-module-utils": "^2.7.4", "has": "^1.0.3", - "is-core-module": "^2.8.1", + "is-core-module": "^2.11.0", "is-glob": "^4.0.3", "minimatch": "^3.1.2", - "object.values": "^1.1.5", - "resolve": "^1.22.0", + "object.values": "^1.1.6", + "resolve": "^1.22.1", + "semver": "^6.3.0", "tsconfig-paths": "^3.14.1" }, "dependencies": { "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "doctrine": { @@ -12361,10 +12629,10 @@ "esutils": "^2.0.2" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true } } @@ -12379,23 +12647,6 @@ "estraverse": "^4.1.1" } }, - "eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^2.0.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true - } - } - }, "eslint-visitor-keys": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", @@ -12403,9 +12654,9 @@ "dev": true }, "espree": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", - "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.0.tgz", + "integrity": "sha512-JPbJGhKc47++oo4JkEoTe2wjy4fmMwvFpgJT9cQzmfXKp22Dr6Hf1tdCteLz1h0P3t+mGvWZ+4Uankvh8+c6zw==", "dev": true, "requires": { "acorn": "^8.8.0", @@ -12414,9 +12665,9 @@ }, "dependencies": { "acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true } } @@ -12428,9 +12679,9 @@ "dev": true }, "esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "requires": { "estraverse": "^5.1.0" @@ -12503,16 +12754,16 @@ "dev": true }, "expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-OKrGESHOaMxK3b6zxIq9SOW8kEXztKff/Dvg88j4xIJxur1hspEbedVkR3GpHe5LO+WB2Qw7OWN0RMTdp6as5A==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.5.0.tgz", + "integrity": "sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg==", "dev": true, "requires": { - "@jest/expect-utils": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1" + "@jest/expect-utils": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0" } }, "external-editor": { @@ -12544,9 +12795,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -12568,15 +12819,10 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, - "fast-safe-stringify": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", - "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" - }, "fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -12663,21 +12909,15 @@ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true }, - "form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" + "is-callable": "^1.1.3" } }, - "formidable": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.2.tgz", - "integrity": "sha512-V8gLm+41I/8kguQ4/o1D3RIHRmhYFG4pnNyonvua+40rqcEmT4+V71yaZ3B457xbbgCsCfjSPi65u/W6vK1U5Q==" - }, "fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -12705,7 +12945,20 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + } }, "functional-red-black-tree": { "version": "1.0.1", @@ -12713,6 +12966,12 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true + }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -12726,13 +12985,14 @@ "dev": true }, "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "dev": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.3" } }, "get-package-type": { @@ -12758,15 +13018,15 @@ } }, "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } @@ -12781,20 +13041,18 @@ } }, "globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", "dev": true, "requires": { - "type-fest": "^0.20.2" - }, - "dependencies": { - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - } + "define-properties": "^1.1.3" } }, "globby": { @@ -12812,13 +13070,22 @@ }, "dependencies": { "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true } } }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.3" + } + }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -12835,6 +13102,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -12860,10 +13128,17 @@ "get-intrinsic": "^1.1.1" } }, + "has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true + }, "has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true }, "has-tostringtag": { "version": "1.0.0", @@ -12892,9 +13167,9 @@ "dev": true }, "husky": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", - "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true }, "iconv-lite": { @@ -12962,7 +13237,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "inquirer": { "version": "7.3.3", @@ -13020,16 +13296,27 @@ } }, "internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", "dev": true, "requires": { - "get-intrinsic": "^1.1.0", + "get-intrinsic": "^1.2.0", "has": "^1.0.3", "side-channel": "^1.0.4" } }, + "is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + } + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -13065,15 +13352,15 @@ } }, "is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "dev": true }, "is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", "dev": true, "requires": { "has": "^1.0.3" @@ -13142,6 +13429,12 @@ "has-tostringtag": "^1.0.0" } }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, "is-reference": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", @@ -13194,6 +13487,19 @@ "has-symbols": "^1.0.2" } }, + "is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, "is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -13245,17 +13551,6 @@ "istanbul-lib-coverage": "^3.0.0", "make-dir": "^3.0.0", "supports-color": "^7.1.0" - }, - "dependencies": { - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "istanbul-lib-source-maps": { @@ -13280,21 +13575,21 @@ } }, "jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.4.1.tgz", - "integrity": "sha512-cknimw7gAXPDOmj0QqztlxVtBVCw2lYY9CeIE5N6kD+kET1H4H79HSNISJmijb1HF+qk+G+ploJgiDi5k/fRlg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.5.0.tgz", + "integrity": "sha512-juMg3he2uru1QoXX078zTa7pO85QyB9xajZc6bU+d9yEGwrKX6+vGmJQ3UdVZsvTEUARIdObzH68QItim6OSSQ==", "dev": true, "requires": { - "@jest/core": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/core": "^29.5.0", + "@jest/types": "^29.5.0", "import-local": "^3.0.2", - "jest-cli": "^29.4.1" + "jest-cli": "^29.5.0" } }, "jest-changed-files": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.4.0.tgz", - "integrity": "sha512-rnI1oPxgFghoz32Y8eZsGJMjW54UlqT17ycQeCEktcxxwqqKdlj9afl8LNeO0Pbu+h2JQHThQP0BzS67eTRx4w==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.5.0.tgz", + "integrity": "sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag==", "dev": true, "requires": { "execa": "^5.0.0", @@ -13302,164 +13597,165 @@ } }, "jest-circus": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.4.1.tgz", - "integrity": "sha512-v02NuL5crMNY4CGPHBEflLzl4v91NFb85a+dH9a1pUNx6Xjggrd8l9pPy4LZ1VYNRXlb+f65+7O/MSIbLir6pA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.5.0.tgz", + "integrity": "sha512-gq/ongqeQKAplVxqJmbeUOJJKkW3dDNPY8PjhJ5G0lBRvu0e3EWGxGy5cI4LAGA7gV2UHCtWBI4EMXK8c9nQKA==", "dev": true, "requires": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/environment": "^29.5.0", + "@jest/expect": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", "dedent": "^0.7.0", "is-generator-fn": "^2.0.0", - "jest-each": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", + "jest-each": "^29.5.0", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", "p-limit": "^3.1.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.5.0", + "pure-rand": "^6.0.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" } }, "jest-cli": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.4.1.tgz", - "integrity": "sha512-jz7GDIhtxQ37M+9dlbv5K+/FVcIo1O/b1sX3cJgzlQUf/3VG25nvuWzlDC4F1FLLzUThJeWLu8I7JF9eWpuURQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.5.0.tgz", + "integrity": "sha512-L1KcP1l4HtfwdxXNFCL5bmUbLQiKrakMUriBEcc1Vfz6gx31ORKdreuWvmQVBit+1ss9NNR3yxjwfwzZNdQXJw==", "dev": true, "requires": { - "@jest/core": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/core": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", "chalk": "^4.0.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", "import-local": "^3.0.2", - "jest-config": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-config": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", "prompts": "^2.0.1", "yargs": "^17.3.1" } }, "jest-config": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.4.1.tgz", - "integrity": "sha512-g7p3q4NuXiM4hrS4XFATTkd+2z0Ml2RhFmFPM8c3WyKwVDNszbl4E7cV7WIx1YZeqqCtqbtTtZhGZWJlJqngzg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.5.0.tgz", + "integrity": "sha512-kvDUKBnNJPNBmFFOhDbm59iu1Fii1Q6SxyhXfvylq3UTHbg6o7j/g8k2dZyXWLvfdKB1vAPxNZnMgtKJcmu3kA==", "dev": true, "requires": { "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.4.1", - "@jest/types": "^29.4.1", - "babel-jest": "^29.4.1", + "@jest/test-sequencer": "^29.5.0", + "@jest/types": "^29.5.0", + "babel-jest": "^29.5.0", "chalk": "^4.0.0", "ci-info": "^3.2.0", "deepmerge": "^4.2.2", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-circus": "^29.4.1", - "jest-environment-node": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-circus": "^29.5.0", + "jest-environment-node": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-runner": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", "micromatch": "^4.0.4", "parse-json": "^5.2.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.5.0", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" } }, "jest-diff": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.4.1.tgz", - "integrity": "sha512-uazdl2g331iY56CEyfbNA0Ut7Mn2ulAG5vUaEHXycf1L6IPyuImIxSz4F0VYBKi7LYIuxOwTZzK3wh5jHzASMw==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.5.0.tgz", + "integrity": "sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw==", "dev": true, "requires": { "chalk": "^4.0.0", - "diff-sequences": "^29.3.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "diff-sequences": "^29.4.3", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" } }, "jest-docblock": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.2.0.tgz", - "integrity": "sha512-bkxUsxTgWQGbXV5IENmfiIuqZhJcyvF7tU4zJ/7ioTutdz4ToB5Yx6JOFBpgI+TphRY4lhOyCWGNH/QFQh5T6A==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.4.3.tgz", + "integrity": "sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg==", "dev": true, "requires": { "detect-newline": "^3.0.0" } }, "jest-each": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.4.1.tgz", - "integrity": "sha512-QlYFiX3llJMWUV0BtWht/esGEz9w+0i7BHwODKCze7YzZzizgExB9MOfiivF/vVT0GSQ8wXLhvHXh3x2fVD4QQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.5.0.tgz", + "integrity": "sha512-HM5kIJ1BTnVt+DQZ2ALp3rzXEl+g726csObrW/jpEGl+CDSSQpOJJX2KE/vEg8cxcMXdyEPu6U4QX5eruQv5hA==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "jest-util": "^29.4.1", - "pretty-format": "^29.4.1" + "jest-get-type": "^29.4.3", + "jest-util": "^29.5.0", + "pretty-format": "^29.5.0" } }, "jest-environment-node": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.4.1.tgz", - "integrity": "sha512-x/H2kdVgxSkxWAIlIh9MfMuBa0hZySmfsC5lCsWmWr6tZySP44ediRKDUiNggX/eHLH7Cd5ZN10Rw+XF5tXsqg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.5.0.tgz", + "integrity": "sha512-ExxuIK/+yQ+6PRGaHkKewYtg6hto2uGCgvKdb2nfJfKXgZ17DfXjvbZ+jA1Qt9A8EQSfPnt5FKIfnOO3u1h9qw==", "dev": true, "requires": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/environment": "^29.5.0", + "@jest/fake-timers": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" + "jest-mock": "^29.5.0", + "jest-util": "^29.5.0" } }, "jest-get-type": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz", - "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz", + "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==", "dev": true }, "jest-haste-map": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.4.1.tgz", - "integrity": "sha512-imTjcgfVVTvg02khXL11NNLTx9ZaofbAWhilrMg/G8dIkp+HYCswhxf0xxJwBkfhWb3e8dwbjuWburvxmcr58w==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.5.0.tgz", + "integrity": "sha512-IspOPnnBro8YfVYSw6yDRKh/TiCdRngjxeacCps1cQ9cgVN6+10JUcuJ1EabrgYLOATsIAigxA0rLR9x/YlrSA==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@types/graceful-fs": "^4.1.3", "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", "fsevents": "^2.3.2", "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.5.0", + "jest-worker": "^29.5.0", "micromatch": "^4.0.4", "walker": "^1.0.8" }, "dependencies": { "jest-worker": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz", - "integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz", + "integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==", "dev": true, "requires": { "@types/node": "*", - "jest-util": "^29.4.1", + "jest-util": "^29.5.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" } @@ -13476,53 +13772,53 @@ } }, "jest-leak-detector": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.4.1.tgz", - "integrity": "sha512-akpZv7TPyGMnH2RimOCgy+hPmWZf55EyFUvymQ4LMsQP8xSPlZumCPtXGoDhFNhUE2039RApZkTQDKU79p/FiQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.5.0.tgz", + "integrity": "sha512-u9YdeeVnghBUtpN5mVxjID7KbkKE1QU4f6uUwuxiY0vYRi9BUCLKlPEZfDGR67ofdFmDz9oPAy2G92Ujrntmow==", "dev": true, "requires": { - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" } }, "jest-matcher-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.4.1.tgz", - "integrity": "sha512-k5h0u8V4nAEy6lSACepxL/rw78FLDkBnXhZVgFneVpnJONhb2DhZj/Gv4eNe+1XqQ5IhgUcqj745UwH0HJmMnA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.5.0.tgz", + "integrity": "sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw==", "dev": true, "requires": { "chalk": "^4.0.0", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "jest-diff": "^29.5.0", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" } }, "jest-message-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.4.1.tgz", - "integrity": "sha512-H4/I0cXUaLeCw6FM+i4AwCnOwHRgitdaUFOdm49022YD5nfyr8C/DrbXOBEyJaj+w/y0gGJ57klssOaUiLLQGQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.5.0.tgz", + "integrity": "sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", + "pretty-format": "^29.5.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" } }, "jest-mock": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.4.1.tgz", - "integrity": "sha512-MwA4hQ7zBOcgVCVnsM8TzaFLVUD/pFWTfbkY953Y81L5ret3GFRZtmPmRFAjKQSdCKoJvvqOu6Bvfpqlwwb0dQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.5.0.tgz", + "integrity": "sha512-GqOzvdWDE4fAV2bWQLQCkujxYWL7RxjCnj71b5VhDAGOevB3qj3Ovg26A5NI84ZpODxyzaozXLOh2NCgkbvyaw==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@types/node": "*", - "jest-util": "^29.4.1" + "jest-util": "^29.5.0" } }, "jest-pnp-resolver": { @@ -13533,75 +13829,75 @@ "requires": {} }, "jest-regex-util": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.2.0.tgz", - "integrity": "sha512-6yXn0kg2JXzH30cr2NlThF+70iuO/3irbaB4mh5WyqNIvLLP+B6sFdluO1/1RJmslyh/f9osnefECflHvTbwVA==", + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.4.3.tgz", + "integrity": "sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg==", "dev": true }, "jest-resolve": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.4.1.tgz", - "integrity": "sha512-j/ZFNV2lm9IJ2wmlq1uYK0Y/1PiyDq9g4HEGsNTNr3viRbJdV+8Lf1SXIiLZXFvyiisu0qUyIXGBnw+OKWkJwQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.5.0.tgz", + "integrity": "sha512-1TzxJ37FQq7J10jPtQjcc+MkCkE3GBpBecsSUWJ0qZNJpmg6m0D9/7II03yJulm3H/fvVjgqLh/k2eYg+ui52w==", "dev": true, "requires": { "chalk": "^4.0.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", + "jest-haste-map": "^29.5.0", "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", "resolve": "^1.20.0", "resolve.exports": "^2.0.0", "slash": "^3.0.0" } }, "jest-resolve-dependencies": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.4.1.tgz", - "integrity": "sha512-Y3QG3M1ncAMxfjbYgtqNXC5B595zmB6e//p/qpA/58JkQXu/IpLDoLeOa8YoYfsSglBKQQzNUqtfGJJT/qLmJg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.5.0.tgz", + "integrity": "sha512-sjV3GFr0hDJMBpYeUuGduP+YeCRbd7S/ck6IvL3kQ9cpySYKqcqhdLLC2rFwrcL7tz5vYibomBrsFYWkIGGjOg==", "dev": true, "requires": { - "jest-regex-util": "^29.2.0", - "jest-snapshot": "^29.4.1" + "jest-regex-util": "^29.4.3", + "jest-snapshot": "^29.5.0" } }, "jest-runner": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.4.1.tgz", - "integrity": "sha512-8d6XXXi7GtHmsHrnaqBKWxjKb166Eyj/ksSaUYdcBK09VbjPwIgWov1VwSmtupCIz8q1Xv4Qkzt/BTo3ZqiCeg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.5.0.tgz", + "integrity": "sha512-m7b6ypERhFghJsslMLhydaXBiLf7+jXy8FwGRHO3BGV1mcQpPbwiqiKUR2zU2NJuNeMenJmlFZCsIqzJCTeGLQ==", "dev": true, "requires": { - "@jest/console": "^29.4.1", - "@jest/environment": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.5.0", + "@jest/environment": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", "chalk": "^4.0.0", "emittery": "^0.13.1", "graceful-fs": "^4.2.9", - "jest-docblock": "^29.2.0", - "jest-environment-node": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-leak-detector": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-resolve": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-util": "^29.4.1", - "jest-watcher": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-docblock": "^29.4.3", + "jest-environment-node": "^29.5.0", + "jest-haste-map": "^29.5.0", + "jest-leak-detector": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-resolve": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-util": "^29.5.0", + "jest-watcher": "^29.5.0", + "jest-worker": "^29.5.0", "p-limit": "^3.1.0", "source-map-support": "0.5.13" }, "dependencies": { "jest-worker": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz", - "integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz", + "integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==", "dev": true, "requires": { "@types/node": "*", - "jest-util": "^29.4.1", + "jest-util": "^29.5.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" } @@ -13628,32 +13924,31 @@ } }, "jest-runtime": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.4.1.tgz", - "integrity": "sha512-UXTMU9uKu2GjYwTtoAw5rn4STxWw/nadOfW7v1sx6LaJYa3V/iymdCLQM6xy3+7C6mY8GfX22vKpgxY171UIoA==", - "dev": true, - "requires": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/globals": "^29.4.1", - "@jest/source-map": "^29.2.0", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.5.0.tgz", + "integrity": "sha512-1Hr6Hh7bAgXQP+pln3homOiEZtCDZFqwmle7Ew2j8OlbkIu6uE3Y/etJQG8MLQs3Zy90xrp2C0BRrtPHG4zryw==", + "dev": true, + "requires": { + "@jest/environment": "^29.5.0", + "@jest/fake-timers": "^29.5.0", + "@jest/globals": "^29.5.0", + "@jest/source-map": "^29.4.3", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "semver": "^7.3.5", + "jest-haste-map": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-mock": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", "slash": "^3.0.0", "strip-bom": "^4.0.0" }, @@ -13667,9 +13962,9 @@ } }, "jest-snapshot": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.4.1.tgz", - "integrity": "sha512-l4iV8EjGgQWVz3ee/LR9sULDk2pCkqb71bjvlqn+qp90lFwpnulHj4ZBT8nm1hA1C5wowXLc7MGnw321u0tsYA==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.5.0.tgz", + "integrity": "sha512-x7Wolra5V0tt3wRs3/ts3S6ciSQVypgGQlJpz2rsdQYoUKxMxPNaoHMGJN6qAuPJqS+2iQ1ZUn5kl7HCyls84g==", "dev": true, "requires": { "@babel/core": "^7.11.6", @@ -13678,33 +13973,32 @@ "@babel/plugin-syntax-typescript": "^7.7.2", "@babel/traverse": "^7.7.2", "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/expect-utils": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", "@types/babel__traverse": "^7.0.6", "@types/prettier": "^2.1.5", "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", - "expect": "^29.4.1", + "expect": "^29.5.0", "graceful-fs": "^4.2.9", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-haste-map": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", + "jest-diff": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", "natural-compare": "^1.4.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.5.0", "semver": "^7.3.5" } }, "jest-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.1.tgz", - "integrity": "sha512-bQy9FPGxVutgpN4VRc0hk6w7Hx/m6L53QxpDreTZgJd9gfx/AV2MjyPde9tGyZRINAUrSv57p2inGBu2dRLmkQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.5.0.tgz", + "integrity": "sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -13713,17 +14007,17 @@ } }, "jest-validate": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.4.1.tgz", - "integrity": "sha512-qNZXcZQdIQx4SfUB/atWnI4/I2HUvhz8ajOSYUu40CSmf9U5emil8EDHgE7M+3j9/pavtk3knlZBDsgFvv/SWw==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.5.0.tgz", + "integrity": "sha512-pC26etNIi+y3HV8A+tUGr/lph9B18GnzSRAkPaaZJIE1eFdiYm6/CewuiJQ8/RlfHd1u/8Ioi8/sJ+CmbA+zAQ==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.5.0", "camelcase": "^6.2.0", "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", + "jest-get-type": "^29.4.3", "leven": "^3.1.0", - "pretty-format": "^29.4.1" + "pretty-format": "^29.5.0" }, "dependencies": { "camelcase": { @@ -13735,18 +14029,18 @@ } }, "jest-watcher": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.4.1.tgz", - "integrity": "sha512-vFOzflGFs27nU6h8dpnVRER3O2rFtL+VMEwnG0H3KLHcllLsU8y9DchSh0AL/Rg5nN1/wSiQ+P4ByMGpuybaVw==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.5.0.tgz", + "integrity": "sha512-KmTojKcapuqYrKDpRwfqcQ3zjMlwu27SYext9pt4GlF5FUgB+7XE1mcCnSm6a4uUpFyQIkb6ZhzZvHl+jiBCiA==", "dev": true, "requires": { - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "emittery": "^0.13.1", - "jest-util": "^29.4.1", + "jest-util": "^29.5.0", "string-length": "^4.0.1" } }, @@ -13759,19 +14053,14 @@ "@types/node": "*", "merge-stream": "^2.0.0", "supports-color": "^7.0.0" - }, - "dependencies": { - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, + "js-sdsl": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", + "dev": true + }, "js-sha256": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", @@ -13876,9 +14165,9 @@ } }, "lilconfig": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.4.tgz", - "integrity": "sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", "dev": true }, "lines-and-columns": { @@ -13888,39 +14177,111 @@ "dev": true }, "lint-staged": { - "version": "12.4.1", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.1.tgz", - "integrity": "sha512-PTXgzpflrQ+pODQTG116QNB+Q6uUTDg5B5HqGvNhoQSGt8Qy+MA/6zSnR8n38+sxP5TapzeQGTvoKni0KRS8Vg==", + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.0.tgz", + "integrity": "sha512-GbyK5iWinax5Dfw5obm2g2ccUiZXNGtAS4mCbJ0Lv4rq6iEtfBSjOYdcbOtAIFtM114t0vdpViDDetjVTSd8Vw==", "dev": true, "requires": { + "chalk": "5.2.0", "cli-truncate": "^3.1.0", - "colorette": "^2.0.16", - "commander": "^8.3.0", - "debug": "^4.3.3", - "execa": "^5.1.1", - "lilconfig": "2.0.4", - "listr2": "^4.0.1", - "micromatch": "^4.0.4", + "commander": "^10.0.0", + "debug": "^4.3.4", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", + "micromatch": "^4.0.5", "normalize-path": "^3.0.0", - "object-inspect": "^1.12.0", - "pidtree": "^0.5.0", + "object-inspect": "^1.12.3", + "pidtree": "^0.6.0", "string-argv": "^0.3.1", - "supports-color": "^9.2.1", - "yaml": "^1.10.2" + "yaml": "^2.2.1" + }, + "dependencies": { + "chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true + }, + "execa": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", + "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + } + }, + "human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true + }, + "is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true + }, + "mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true + }, + "npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "requires": { + "path-key": "^4.0.0" + } + }, + "onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "requires": { + "mimic-fn": "^4.0.0" + } + }, + "path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true + }, + "strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true + } } }, "listr2": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-4.0.5.tgz", - "integrity": "sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", "dev": true, "requires": { "cli-truncate": "^2.1.0", - "colorette": "^2.0.16", + "colorette": "^2.0.19", "log-update": "^4.0.0", "p-map": "^4.0.0", "rfdc": "^1.3.0", - "rxjs": "^7.5.5", + "rxjs": "^7.8.0", "through": "^2.3.8", "wrap-ansi": "^7.0.0" }, @@ -13948,9 +14309,9 @@ "dev": true }, "rxjs": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.5.tgz", - "integrity": "sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz", + "integrity": "sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==", "dev": true, "requires": { "tslib": "^2.1.0" @@ -13988,9 +14349,9 @@ } }, "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", "dev": true } } @@ -14094,17 +14455,18 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, "requires": { "yallist": "^4.0.0" } }, "magic-string": { - "version": "0.25.9", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", + "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==", "dev": true, "requires": { - "sourcemap-codec": "^1.4.8" + "@jridgewell/sourcemap-codec": "^1.4.13" } }, "make-dir": { @@ -14145,37 +14507,14 @@ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, "micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "requires": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - } - }, - "mime": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", - "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==" - }, - "mime-db": { - "version": "1.47.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz", - "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==" - }, - "mime-types": { - "version": "2.1.30", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz", - "integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==", - "requires": { - "mime-db": "1.47.0" + "braces": "^3.0.2", + "picomatch": "^2.3.1" } }, "mimic-fn": { @@ -14226,12 +14565,26 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "natural-compare-lite": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", + "dev": true + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -14239,9 +14592,9 @@ "dev": true }, "node-releases": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", "dev": true }, "normalize-path": { @@ -14260,9 +14613,10 @@ } }, "object-inspect": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", - "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==" + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true }, "object-keys": { "version": "1.1.1", @@ -14271,26 +14625,26 @@ "dev": true }, "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", "object-keys": "^1.1.1" } }, "object.values": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", - "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", + "integrity": "sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" } }, "once": { @@ -14359,9 +14713,9 @@ } }, "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, "parent-module": { @@ -14422,15 +14776,15 @@ "dev": true }, "picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, "pidtree": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.5.0.tgz", - "integrity": "sha512-9nxspIM7OpZuhBxPg73Zvyq7j1QMPMPsGKTqRc2XOaFQauDvoNz9fM1Wdkjmeo7l9GXOZiRs97sPkuayl39wjA==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", "dev": true }, "pirates": { @@ -14484,12 +14838,6 @@ "requires": { "p-limit": "^2.2.0" } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true } } }, @@ -14500,18 +14848,18 @@ "dev": true }, "prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.6.tgz", + "integrity": "sha512-mtuzdiBbHwPEgl7NxWlqOkithPyp4VN93V7VeHVWBF+ad3I5avc0RVDT4oImXQy9H/AqxA2NSQH8pSxHW6FYbQ==", "dev": true }, "pretty-format": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.1.tgz", - "integrity": "sha512-dt/Z761JUVsrIKaY215o1xQJBGlSmTx/h4cSqXqjHLnU1+Kt+mavVE7UgqJJO5ukx5HjSswHfmXz4LjS2oIJfg==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.5.0.tgz", + "integrity": "sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw==", "dev": true, "requires": { - "@jest/schemas": "^29.4.0", + "@jest/schemas": "^29.4.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" }, @@ -14546,13 +14894,11 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, - "qs": { - "version": "6.10.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", - "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", - "requires": { - "side-channel": "^1.0.4" - } + "pure-rand": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.1.tgz", + "integrity": "sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg==", + "dev": true }, "queue-microtask": { "version": "1.2.3", @@ -14575,16 +14921,6 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "dev": true }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, "regenerate": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", @@ -14592,9 +14928,9 @@ "dev": true }, "regenerate-unicode-properties": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.0.1.tgz", - "integrity": "sha512-vn5DU6yg6h8hP/2OkQo3K7uVILvY4iu0oI4t3HFa81UPkhGJwkRwM10JEc3upjdhHjs/k8GJY1sRBhk5sr69Bw==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz", + "integrity": "sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ==", "dev": true, "requires": { "regenerate": "^1.4.2" @@ -14615,36 +14951,35 @@ "@babel/runtime": "^7.8.4" } }, - "regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true + "regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + } }, "regexpu-core": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.1.0.tgz", - "integrity": "sha512-bb6hk+xWd2PEOkj5It46A16zFMs2mv86Iwpdu94la4S3sJ7C973h2dHpYKwIBGaWSO7cIRJ+UX0IeMaWcO4qwA==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", + "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", "dev": true, "requires": { + "@babel/regjsgen": "^0.8.0", "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.0.1", - "regjsgen": "^0.6.0", - "regjsparser": "^0.8.2", + "regenerate-unicode-properties": "^10.1.0", + "regjsparser": "^0.9.1", "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.0.0" + "unicode-match-property-value-ecmascript": "^2.1.0" } }, - "regjsgen": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.6.0.tgz", - "integrity": "sha512-ozE883Uigtqj3bx7OhL1KNbCzGyW2NQZPl6Hs09WTvCuZD5sTI4JY58bkbQWa/Y9hxIsvJ3M8Nbf7j54IqeZbA==", - "dev": true - }, "regjsparser": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.8.4.tgz", - "integrity": "sha512-J3LABycON/VNEu3abOviqGHuB/LOtOQj8SKmfP9anY5GfAVw/SPjwzSjxGjbZXIxbGfqTHtJw58C2Li/WkStmA==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", + "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", "dev": true, "requires": { "jsesc": "~0.5.0" @@ -14665,12 +15000,12 @@ "dev": true }, "resolve": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", - "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", "dev": true, "requires": { - "is-core-module": "^2.8.1", + "is-core-module": "^2.9.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } @@ -14699,9 +15034,9 @@ "dev": true }, "resolve.exports": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.0.tgz", - "integrity": "sha512-6K/gDlqgQscOlg9fSRpWstA8sYe8rbELsSTNpx+3kTrsVCzvSl0zIvRErM7fdl9ERWDsKnrLnwB+Ne89918XOg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.1.tgz", + "integrity": "sha512-OEJWVeimw8mgQuj3HfkNl4KqRevH7lzeQNaWRPfx0PPse7Jk6ozcsG4FKVgtzDsC1KUF+YlTHh17NcgHOPykLw==", "dev": true }, "restore-cursor": { @@ -14736,9 +15071,9 @@ } }, "rollup": { - "version": "2.79.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.0.tgz", - "integrity": "sha512-x4KsrCgwQ7ZJPcFA/SUu6QVcYlO7uRLfLAy0DSA4NS2eG8japdbpM50ToH7z4iObodRYOJ0soneF0iaQRJ6zhA==", + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.20.0.tgz", + "integrity": "sha512-YsIfrk80NqUDrxrjWPXUa7PWvAfegZEXHuPsEZg58fGCdjL1I9C1i/NaG+L+27kxxwkrG/QEDEQc8s/ynXWWGQ==", "dev": true, "requires": { "fsevents": "~2.3.2" @@ -15139,14 +15474,15 @@ } }, "rollup-plugin-typescript2": { - "version": "0.33.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.33.0.tgz", - "integrity": "sha512-7ZXoZeX93kNb4/ICzOi2AlperVV6cAsNz8THqrbz+KNvpn47P2F/nFdK/BGhkoOsOwuYDuY57vccdZZrcd8/dA==", + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.34.1.tgz", + "integrity": "sha512-P4cHLtGikESmqi1CA+tdMDUv8WbQV48mzPYt77TSTOPJpERyZ9TXdDgjSDix8Fkqce6soYz3+fa4lrC93IEkcw==", "dev": true, "requires": { "@rollup/pluginutils": "^4.1.2", "find-cache-dir": "^3.3.2", "fs-extra": "^10.0.0", + "semver": "^7.3.7", "tslib": "^2.4.0" }, "dependencies": { @@ -15202,7 +15538,19 @@ "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + } }, "safer-buffer": { "version": "2.1.2", @@ -15214,6 +15562,7 @@ "version": "7.3.7", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, "requires": { "lru-cache": "^6.0.0" } @@ -15237,6 +15586,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, "requires": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -15301,12 +15651,6 @@ "source-map": "^0.6.0" } }, - "sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "dev": true - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -15330,14 +15674,6 @@ } } }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - }, "string-argv": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", @@ -15390,26 +15726,37 @@ } } }, + "string.prototype.trim": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz", + "integrity": "sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" + } + }, "string.prototype.trimend": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", - "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz", + "integrity": "sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==", "dev": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "es-abstract": "^1.20.4" } }, "string.prototype.trimstart": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", - "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz", + "integrity": "sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==", "dev": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "es-abstract": "^1.20.4" } }, "strip-ansi": { @@ -15439,30 +15786,15 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, - "superagent": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", - "integrity": "sha512-OUDHEssirmplo3F+1HWKUrUjvnQuA+nZI6i/JJBdXb5eq9IyEQwPyPpqND+SSsxf6TygpBEkUjISVRN4/VOpeg==", + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "requires": { - "component-emitter": "^1.3.0", - "cookiejar": "^2.1.2", - "debug": "^4.1.1", - "fast-safe-stringify": "^2.0.7", - "form-data": "^3.0.0", - "formidable": "^1.2.2", - "methods": "^1.1.2", - "mime": "^2.4.6", - "qs": "^6.9.4", - "readable-stream": "^3.6.0", - "semver": "^7.3.2" + "has-flag": "^4.0.0" } }, - "supports-color": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.2.2.tgz", - "integrity": "sha512-XC6g/Kgux+rJXmwokjm9ECpD6k/smUoS5LKlUCcsYr4IY3rW0XyAympon2RmxGrlnZURMpg5T18gWDP9CsHXFA==", - "dev": true - }, "supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -15539,6 +15871,11 @@ "is-number": "^7.0.0" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "tsconfig-paths": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", @@ -15592,10 +15929,21 @@ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dev": true }, + "typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + } + }, "typescript": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", - "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", + "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", "dev": true }, "unbox-primitive": { @@ -15627,15 +15975,15 @@ } }, "unicode-match-property-value-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", - "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", + "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", "dev": true }, "unicode-property-aliases-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", - "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", "dev": true }, "universalify": { @@ -15645,9 +15993,9 @@ "dev": true }, "update-browserslist-db": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.7.tgz", - "integrity": "sha512-iN/XYesmZ2RmmWAiI4Z5rq0YqSiv0brj9Ce9CfhNE4xIW2h+MFxcgkxIzZ+ShkFPUkjU3gQ+3oypadD3RAMtrg==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", + "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", "dev": true, "requires": { "escalade": "^3.1.1", @@ -15663,11 +16011,6 @@ "punycode": "^2.1.0" } }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, "v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", @@ -15675,9 +16018,9 @@ "dev": true }, "v8-to-istanbul": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz", - "integrity": "sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", "dev": true, "requires": { "@jridgewell/trace-mapping": "^0.3.12", @@ -15699,6 +16042,20 @@ "makeerror": "1.0.12" } }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -15721,6 +16078,20 @@ "is-symbol": "^1.0.3" } }, + "which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -15788,9 +16159,9 @@ } }, "write-file-atomic": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.0.tgz", - "integrity": "sha512-R7NYMnHSlV42K54lwY9lvW6MnSm1HSJqZL3xiSgi9E7//FYaI74r2G0rd+/X6VAMkHEdzxQaU5HUOXWUz5kA/w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, "requires": { "imurmurhash": "^0.1.4", @@ -15806,18 +16177,19 @@ "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz", + "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==", "dev": true }, "yargs": { - "version": "17.6.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", - "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", "dev": true, "requires": { "cliui": "^8.0.1", diff --git a/package.json b/package.json index ad53719d..cc939478 100644 --- a/package.json +++ b/package.json @@ -35,35 +35,35 @@ "javascript" ], "devDependencies": { - "@babel/preset-env": "^7.19.0", - "@babel/preset-typescript": "^7.18.6", - "@hipo/eslint-config-base": "^4.2.1", + "@babel/preset-env": "^7.20.2", + "@babel/preset-typescript": "^7.21.0", + "@hipo/eslint-config-base": "^4.3.0", "@hipo/eslint-config-typescript": "^1.2.0", - "@rollup/plugin-babel": "^5.3.1", - "@rollup/plugin-commonjs": "^22.0.2", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^14.0.0", - "@types/jest": "^29.4.0", - "@types/node": "^14.14.14", - "@typescript-eslint/eslint-plugin": "^5.36.2", - "@typescript-eslint/parser": "^5.36.2", - "eslint": "^8.23.0", - "eslint-config-prettier": "^8.5.0", + "@rollup/plugin-babel": "^6.0.3", + "@rollup/plugin-commonjs": "^24.0.1", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "@types/jest": "^29.5.0", + "@types/node": "^18.15.5", + "@typescript-eslint/eslint-plugin": "^5.56.0", + "@typescript-eslint/parser": "^5.56.0", + "eslint": "^8.36.0", + "eslint-config-prettier": "^8.8.0", "eslint-import-resolver-typescript": "^2.7.1", - "eslint-plugin-import": "^2.26.0", - "husky": "^7.0.4", - "jest": "^29.4.1", + "eslint-plugin-import": "^2.27.5", + "husky": "^8.0.3", + "jest": "^29.5.0", "js-sha512": "^0.8.0", - "lint-staged": "^12.4.1", - "prettier": "^2.7.1", - "rollup": "^2.79.0", + "lint-staged": "^13.2.0", + "prettier": "^2.8.6", + "rollup": "^3.20.0", "rollup-plugin-eslint": "^7.0.0", "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-typescript2": "^0.33.0", - "typescript": "^4.8.2" + "rollup-plugin-typescript2": "^0.34.1", + "typescript": "^5.0.2" }, "dependencies": { - "algosdk": "^1.20.0", + "algosdk": "^2.1.0", "base64-js": "^1.5.1" }, "lint-staged": { From 6998857ac29667e12c3d395c78cd81620caa68d3 Mon Sep 17 00:00:00 2001 From: Cem KIRAY Date: Thu, 23 Mar 2023 09:37:06 +0100 Subject: [PATCH 11/14] fix(build): update rollup config --- dist/contract/types.d.ts | 2 +- dist/index.js | 4 +--- dist/util/account/accountTypes.d.ts | 2 +- dist/util/commonTypes.d.ts | 4 ++-- dist/util/error/TinymanError.d.ts | 2 +- dist/util/pool/poolTypes.d.ts | 2 +- dist/util/typeUtils.d.ts | 2 +- rollup.config.js => rollup.config.mjs | 0 8 files changed, 8 insertions(+), 10 deletions(-) rename rollup.config.js => rollup.config.mjs (100%) diff --git a/dist/contract/types.d.ts b/dist/contract/types.d.ts index 540d56a8..fe4cee29 100644 --- a/dist/contract/types.d.ts +++ b/dist/contract/types.d.ts @@ -1,3 +1,3 @@ import { CONTRACT_VERSION } from "./constants"; import { ValueOf } from "../util/typeUtils"; -export declare type ContractVersionValue = ValueOf; +export type ContractVersionValue = ValueOf; diff --git a/dist/index.js b/dist/index.js index aefb904e..598be901 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("algosdk"),e=require("base64-js");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=n(t),s=Uint8Array.from([1]);function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;_(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:D(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function u(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){u(a,r,s,o,i,"next",t)}function i(t){u(a,r,s,o,i,"throw",t)}o(void 0)}))}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}var E="- would result negative",S="logic eval error:",N="exceeds schema integer count",O=/transaction \w+:/,P=function(t){m(n,h(Error));var e=v(n);function n(t,r){var s;p(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function G(t,e){var n=Number(t);return W({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function q(t,e){return W({decimalPlaces:0},Math.pow(10,Number(t))*Number(e))}function W(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=y(J(e),2),a=s[0],o=s[1],i=y(J(Math.round(Number(z(a,o+r)))),2),u=i[0],c=i[1];return Number(z(u,c-r))}return Math.round(e)}function z(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function J(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function Y(t,e){return K.apply(this,arguments)}function K(){return(K=c(i().mark((function t(e,n){var r,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=b(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return u=t.sent,c=u.txId,t.next=13,j(e,c);case 13:p=t.sent,l=p["confirmed-round"],r.push({confirmedRound:l,txnID:c});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new P(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function H(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function Z(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function $(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function tt(t){return(new TextEncoder).encode(t)}var et={id:"".concat(0),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151",clawback_address:""},nt={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function rt(){return(rt=c(i().mark((function t(e){var n,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.assetID,a=e.initiatorAddr,t.prev=1,t.next=4,n.getTransactionParams().do();case 4:return o=t.sent,u=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),t.abrupt("return",[{txn:u,signers:[a]}]);case 9:throw t.prev=9,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return t.stop()}}),t,null,[[1,9]])})))).apply(this,arguments)}function st(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[o(o({},t),{},{id:n}),o(o({},e),{},{id:r})]:[o(o({},e),{},{id:r}),o(o({},t),{},{id:n})]}function at(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function ot(t){return 0===Number(t)}var it,ut={V1_1:"v1_1",V2:"v2"},ct={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},pt={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},lt=new(function(){function t(){p(this,t),this.clientName="tinyman-js-sdk"}return d(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){return tt("tinyman/".concat(t===ut.V1_1?"v1":t,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),dt=(f(it={},ut.V1_1,{testnet:62368684,mainnet:552635992}),f(it,ut.V2,{testnet:148607e3,mainnet:1002541853}),it);function ft(t,e){var n=dt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function mt(){return(mt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationOptInTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function gt(){return(gt=c(i().mark((function t(e){var n,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.contractVersion,o=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return u=t.sent,c=r.default.makeApplicationClearStateTxnFromObject({from:o,appIndex:ft(s,a),note:lt.getAppCallTxnNoteWithClientName(a),suggestedParams:u}),t.abrupt("return",[{txn:c,signers:[o]}]);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var It=d((function t(e){p(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),At=new(function(n){m(s,It);var r=v(s);function s(t,e){var n;return p(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return d(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=ft(n.network,ut.V1_1),s=y(at(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=c(i().mark((function t(s,a){var u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:u=t.sent,s(o(o({},u),{},{minimum_required_balance:wt(u)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function _t(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?k({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function wt(t){var e=t["apps-total-schema"];return 1e5+1e5*(t.assets||[]).length+1e5*(t["created-apps"]||[]).length+1e5*(t["apps-local-state"]||[]).length+5e4*Number(e&&e["num-byte-slice"]||0)+28500*Number(e&&e["num-uint"]||0)+1e5*(t["apps-total-extra-pages"]||0)}var Dt,bt,Et=tt("e");function St(t){return Nt.apply(this,arguments)}function Nt(){return(Nt=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,y,_,w,D,E;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.pool,u=s.accountAddr,n.next=3,a.accountInformation(u).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:c=n.sent,p=c["apps-local-state"]||[],l=0n,d=0n,f=0n,m=o.account.address(),g=b(p),n.prev=10,g.s();case 12:if((I=g.n()).done){n.next=31;break}if((A=I.value).id==o.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(x=A["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:h=k({stateArray:x}),T=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset1ID)])),v=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.asset2ID)])),y=e.fromByteArray(L([r.default.decodeAddress(m).publicKey,Et,r.default.encodeUint64(o.poolTokenID)])),_=h[T],w=h[v],D=h[y],"bigint"==typeof _&&(l=_),"bigint"==typeof w&&(d=w),"bigint"==typeof D&&(f=D);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),g.e(n.t0);case 36:return n.prev=36,g.f(),n.finish(36);case 39:if(!((E={excessAsset1:l,excessAsset2:d,excessPoolTokens:f}).excessAsset1<0n||E.excessAsset2<0n||E.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(E));case 42:return n.abrupt("return",E);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Ot(){return(Ot=c(i().mark((function n(s){var a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=s.client,o=s.accountAddr,u=s.validatorAppID,n.next=3,a.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(c=n.sent,p=c["apps-local-state"]||[],l=p.find((function(t){return t.id==u})),d=[],l&&l["key-value"])for(f=k({stateArray:l["key-value"]}),m=0,g=Object.entries(f);mLt)){n.next=48;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(Lt,"]): ").concat(B.issuedLiquidity));case 48:return n.abrupt("return",B);case 49:case"end":return n.stop()}}),n,null,[[8,31,34,37]])})))).apply(this,arguments)}function Mt(){return Mt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=d.length>1&&void 0!==d[1]?d[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,yt(n,r);case 6:return o=t.sent,u=_t(o,ft(s,ut.V1_1)),c=null,u&&(l=o["created-assets"][0],p=l.index,c={asset1ID:u[Pt[ut.V1_1].asset1],asset2ID:u[Pt[ut.V1_1].asset2],poolTokenID:p},a[r]=c),t.abrupt("return",c);case 11:case"end":return t.stop()}}),t)}))),Mt.apply(this,arguments)}var Ct=Object.freeze({__proto__:null,getPoolInfo:Ft,getPoolReserves:function(t,e){return Rt.apply(this,arguments)},getPoolAssets:function(t){return Mt.apply(this,arguments)}});function Vt(t){return Xt.apply(this,arguments)}function Xt(){return(Xt=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=vt(ut.V2),u=o.generateLogicSigAccountForPool(e),c=ft(r,ut.V2),p=u.address(),l=at(s,a),t.next=8,yt(n,p);case 8:return d=t.sent,f=_t(d,c),m={account:u,validatorAppID:c,asset1ID:l[0],asset2ID:l[1],status:f?exports.PoolStatus.READY:exports.PoolStatus.NOT_CREATED,contractVersion:ut.V2},f&&(m.asset1ProtocolFees=BigInt(f[Pt.v2.asset1ProtocolFees]),m.asset2ProtocolFees=BigInt(f[Pt.v2.asset2ProtocolFees]),m.asset1Reserves=BigInt(f[Pt.v2.asset1Reserves]),m.asset2Reserves=BigInt(f[Pt.v2.asset2Reserves]),m.issuedPoolTokens=BigInt(f[Pt.v2.issuedPoolTokens]),m.cumulativePriceUpdateTimeStamp=Number(f[Pt.v2.cumulativePriceUpdateTimeStamp]),m.protocolFeeRatio=Number(f[Pt.v2.protocolFeeRatio]),m.totalFeeShare=BigInt(f[Pt.v2.totalFeeShare]),m.poolTokenID=Number(f[Pt.v2.poolTokenID]),m.asset1ID=Number(f[Pt.v2.asset1]),m.asset2ID=Number(f[Pt.v2.asset2])),t.abrupt("return",m);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function jt(){return(jt=c(i().mark((function t(e,n){var r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,yt(e,n.account.address());case 2:return r=t.sent,s=_t(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[Pt.v2.asset1Reserves]),a.asset2=BigInt(s[Pt.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[Pt.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Qt(){return(Qt=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,yt(n,r);case 3:return a=t.sent,o=_t(a,ft(s,ut.V2)),u=null,o&&(u={asset1ID:o[Pt[ut.V2].asset1],asset2ID:o[Pt[ut.V2].asset2],poolTokenID:o[Pt[ut.V2].poolTokenID]}),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ut=Object.freeze({__proto__:null,getPoolInfo:Vt,getPoolReserves:function(t,e){return jt.apply(this,arguments)},getPoolAssets:function(t){return Qt.apply(this,arguments)}});function Gt(t){return Boolean(t&&!(t.asset1+t.asset2))}var qt,Wt,zt=Object.freeze({__proto__:null,getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolPairRatio:function(t,e){var n=Gt(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=G(t.asset1,e.asset1)/G(t.asset2,e.asset2)),r},isPoolEmpty:Gt,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===exports.PoolStatus.READY},getPoolsForPair:function(t){return Promise.all([Ft(t),Vt(t)])}}),Jt=o((f(qt={},ut.V1_1,o(o({},Ct),zt)),f(qt,ut.V2,o(o({},Ut),zt)),qt),zt);!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN"}(Wt||(Wt={}));var Yt=96e4,Kt=859e3;function Ht(){return(Ht=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,_,w,D,b,E,S,N;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.network,a=e.asset_1,o=e.asset_2,u=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return c=t.sent,p=st(a,o),l=y(p,2),d=l[0],f=d.id,m=d.unit_name,g=l[1],I=g.id,A=g.unit_name,x=ot(I),h=ft(s,ut.V1_1),T=At.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:I}),v=T.address(),_=r.default.makeApplicationOptInTxnFromObject({from:v,appIndex:h,note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),appArgs:[tt("bootstrap"),r.default.encodeUint64(f),r.default.encodeUint64(I)],foreignAssets:x?[f]:[I],suggestedParams:c}),w=r.default.makeAssetCreateTxnWithSuggestedParamsFromObject({from:v,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:nt.V1_1,assetName:"TinymanPool1.1 ".concat(m,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:c}),D=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:v,to:v,assetIndex:f,amount:0,suggestedParams:c}),b=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:v,amount:Zt(x),suggestedParams:c}),(E=[])[Wt.FUNDING_TXN]=b,E[Wt.VALIDATOR_APP_CALL]=_,E[Wt.POOL_TOKEN_CREATE]=w,E[Wt.ASSET1_OPT_IN]=D,x||(E[Wt.ASSET2_OPT_IN]=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:v,to:v,assetIndex:I,amount:0,suggestedParams:c})),S=r.default.assignGroupID(E),N=[{txn:S[Wt.FUNDING_TXN],signers:[u]},{txn:S[Wt.VALIDATOR_APP_CALL],signers:[v]},{txn:S[Wt.POOL_TOKEN_CREATE],signers:[v]},{txn:S[Wt.ASSET1_OPT_IN],signers:[v]}],S[Wt.ASSET2_OPT_IN]&&N.push({txn:S[Wt.ASSET2_OPT_IN],signers:[v]}),t.abrupt("return",N);case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zt(t){return t?Yt:Kt}function $t(){return($t=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=y(c,1),l=p[0],d=at(o,u),f=y(d,2),m=f[0],g=f[1],I=At.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===Wt.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function te(t){return ee.apply(this,arguments)}function ee(){return(ee=c(i().mark((function t(e){var n,r,s,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,j(n,s[Wt.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function ne(){return(ne=c(i().mark((function t(e){var n,r,s,a,o,u,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.signedTxns,c=e.txnIDs,t.next=3,te({client:n,signedTxns:u,txnIDs:c});case 3:return t.abrupt("return",Jt.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var re,se={generateTxns:function(t){return Ht.apply(this,arguments)},signTxns:function(t){return $t.apply(this,arguments)},execute:function(t){return ne.apply(this,arguments)},getBootstrapFundingTxnAmount:Zt};!function(t){t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL"}(re||(re={}));var ae=5,oe=6;function ie(t,e){return ue.apply(this,arguments)}function ue(){return(ue=c(i().mark((function e(n,r){var s,a,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,1e3);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ce(t,e){return pe.apply(this,arguments)}function pe(){return(pe=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ie(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function le(){return(le=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,_,w,D;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.network,o=n.asset_1,u=n.asset_2,c=n.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return p=e.sent,l=ft(a,ut.V2),d=t.getApplicationAddress(l),f=st(o,u),m=y(f,2),g=m[0].id,I=m[1].id,e.next=9,Jt.v2.getPoolInfo({client:s,network:a,asset1ID:g,asset2ID:I});case 9:if(e.sent.status!==exports.PoolStatus.READY){e.next=12;break}throw new Error("Pool for ".concat(o.unit_name,"-").concat(u.unit_name," already exists"));case 12:return A=Tt.generateLogicSigAccountForPool({network:a,asset1ID:g,asset2ID:I}),x=A.address(),h=ot(I),(T=r.default.makeApplicationOptInTxnFromObject({from:x,appIndex:l,appArgs:[tt("bootstrap")],note:lt.getAppCallTxnNoteWithClientName(ut.V2),foreignAssets:[g,I],rekeyTo:d,suggestedParams:p})).fee=fe(h),v=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:x,amount:de(h),suggestedParams:p}),(_=[])[re.FUNDING_TXN]=v,_[re.VALIDATOR_APP_CALL]=T,w=r.default.assignGroupID(_),(D=[])[re.FUNDING_TXN]={txn:w[re.FUNDING_TXN],signers:[c]},D[re.VALIDATOR_APP_CALL]={txn:w[re.VALIDATOR_APP_CALL],signers:[x]},e.abrupt("return",D);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function de(t){return function(t,e){var n=vt(t).schema,r=4e5+28500*n.numLocalInts+5e4*n.numLocalByteSlices;return e||(r+=1e5),r}(ut.V2,t)+fe(t)+1e5}function fe(e){return((e?ae:oe)+1)*t.ALGORAND_MIN_TX_FEE}function me(){return(me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.network,a=e.initiatorSigner,o=e.asset1ID,u=e.asset2ID,t.next=3,a([n]);case 3:return c=t.sent,p=y(c,1),l=p[0],d=at(o,u),f=y(d,2),m=f[0],g=f[1],I=Tt.generateLogicSigAccountForPool({network:s,asset1ID:m,asset2ID:g}),A=[],x=n.map((function(t,e){if(e===re.FUNDING_TXN)return A.push(t.txn.txID().toString()),l;var n=r.default.signLogicSigTransactionObject(t.txn,I),s=n.txID,a=n.blob;return A.push(s),a})),t.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ge(){return(ge=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,u=e.txGroup,c=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(c).do();case 4:return t.next=6,ie(n,u);case 6:if(t.t1=p=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===p;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(l=p["local-state-delta"][0].delta)||void 0===l||null===(d=l.find((function(t){return t.key===btoa(Pt.v2.poolTokenID)})))||void 0===d?void 0:d.value.uint;case 15:if("number"==typeof(f=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(f));case 18:return t.abrupt("return",Jt.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new P(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var Ie,Ae={generateTxns:function(t){return le.apply(this,arguments)},signTxns:function(t){return me.apply(this,arguments)},execute:function(t){return ge.apply(this,arguments)},getBootstrapFundingTxnAmount:de,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+de(e)}};var xe,he=(f(Ie={},ut.V1_1,se),f(Ie,ut.V2,Ae),f(Ie,"generateTxns",(function(t){return t.contractVersion===ut.V1_1?se.generateTxns(t):Ae.generateTxns(t)})),f(Ie,"signTxns",(function(t){return t.contractVersion===ut.V1_1?se.signTxns(t):Ae.signTxns(t)})),f(Ie,"execute",(function(t){return t.contractVersion===ut.V1_1?se.execute(t):Ae.execute(t)})),f(Ie,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===ut.V1_1?se.getBootstrapFundingTxnAmount(n):Ae.getBootstrapFundingTxnAmount(n)})),Ie);exports.V1_1AddLiquidityTxnIndices=void 0,(xe=exports.V1_1AddLiquidityTxnIndices||(exports.V1_1AddLiquidityTxnIndices={}))[xe.FEE_TXN=0]="FEE_TXN",xe[xe.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",xe[xe.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",xe[xe.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",xe[xe.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN";var Te,ve,ye,_e,we=5*t.ALGORAND_MIN_TX_FEE;exports.V2AddLiquidityType=void 0,(_e=exports.V2AddLiquidityType||(exports.V2AddLiquidityType={})).SINGLE="single",_e.FLEXIBLE="flexible",_e.INITIAL="initial";var De,be=(f(Te={},exports.V2AddLiquidityType.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),f(Te,exports.V2AddLiquidityType.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),f(Te,exports.V2AddLiquidityType.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),Te),Ee=(f(ve={},exports.V2AddLiquidityType.INITIAL,1),f(ve,exports.V2AddLiquidityType.SINGLE,2),f(ve,exports.V2AddLiquidityType.FLEXIBLE,2),ve),Se=(f(ye={},exports.V2AddLiquidityType.INITIAL,3),f(ye,exports.V2AddLiquidityType.FLEXIBLE,3),f(ye,exports.V2AddLiquidityType.SINGLE,2),ye);function Ne(t){var e=t.assetIn,n=t.assetOut;return G(n.decimals,Number(n.amount))/G(e.decimals,Number(e.amount))}function Oe(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Ne({assetIn:r,assetOut:s}),o=G(s.decimals,Number(n))/G(r.decimals,Number(e));return W({decimalPlaces:5},Math.abs(a/o-1))}function Pe(t){var e,n,r,s=t.reserves,a=t.totalFeeShare,o=t.asset1,i=t.asset2,u=s.asset1*s.asset2,c=s.asset1+BigInt(o.amount),p=s.asset2+BigInt(i.amount),l=c*p,d=BigInt(parseInt(String(Math.sqrt(Number(l*s.issuedLiquidity*s.issuedLiquidity/u))))),f=d-s.issuedLiquidity,m=f*c/d,g=f*p/d,I=BigInt(o.amount)-m,A=BigInt(i.amount)-g;if(I>A){var x=I;r=ke(x,a),e={id:o.id,amount:x+r,decimals:o.decimals,reserves:s.asset1},n={id:i.id,amount:BigInt(Math.abs(Math.min(Number(A),0))),decimals:i.decimals,reserves:s.asset2},f-=r*d/(c*BigInt(2))}else{var h=A;r=ke(h,a),e={id:i.id,amount:h+r,decimals:i.decimals,reserves:s.asset2},n={id:o.id,amount:BigInt(Math.abs(Math.min(Number(I),0))),decimals:o.decimals,reserves:s.asset1},f-=r*d/(p*BigInt(2))}return{poolTokenOutAmount:f,internalSwapQuote:{assetIn:e,assetOut:n,swapFees:r,priceImpact:Oe({inputSupply:e.reserves,outputSupply:n.reserves,assetIn:e,assetOut:n})}}}function ke(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Le(e){return(Ee[e]+1)*t.ALGORAND_MIN_TX_FEE}var Fe=tt("add_liquidity"),Be=(f(De={},ut.V1_1,[tt("mint")]),f(De,ut.V2,{INITIAL_LIQUIDITY:[tt("add_initial_liquidity")],SINGLE_ASSET_MODE:[Fe,tt("single")],FLEXIBLE_MODE:[Fe,tt("flexible")]}),De);function Re(){return(Re=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.network,o=e.poolAddress,u=e.asset1In,c=e.asset2In,p=e.poolTokenOut,l=e.slippage,d=e.initiatorAddr,f=U("negative",l,p.amount),t.next=4,n.getTransactionParams().do();case 4:return m=t.sent,g=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:ft(a,ut.V1_1),appArgs:Be.v1_1,accounts:[d],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==c.id?[u.id,p.id]:[u.id,c.id,p.id],suggestedParams:m}),I=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:m}),A=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:c.amount,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:o,assetIndex:c.id,amount:c.amount,suggestedParams:m}),x=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:d,assetIndex:p.id,amount:f,suggestedParams:m}),h=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:o,amount:g.fee+x.fee,note:s,suggestedParams:m}),T=r.default.assignGroupID([h,g,I,A,x]),t.abrupt("return",[{txn:T[0],signers:[d]},{txn:T[1],signers:[o]},{txn:T[2],signers:[d]},{txn:T[3],signers:[d]},{txn:T[4],signers:[o]}]);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Me(){return(Me=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,o=n.account,t.next=4,a([s]);case 4:return u=t.sent,c=y(u,3),p=c[0],l=c[1],d=c[2],f=s.map((function(t,e){return e===exports.V1_1AddLiquidityTxnIndices.FEE_TXN?p:e===exports.V1_1AddLiquidityTxnIndices.ASSET1_IN_TXN?l:e===exports.V1_1AddLiquidityTxnIndices.ASSET2_IN_TXN?d:r.default.signLogicSigTransactionObject(t.txn,o).blob})),t.abrupt("return",f);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ce(){return(Ce=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,u=BigInt(s[exports.V1_1AddLiquidityTxnIndices.LIQUDITY_OUT_TXN].txn.amount),t.next=5,St({client:n,pool:r,accountAddr:o});case 5:return c=t.sent,t.next=8,Y(n,[a]);case 8:return p=t.sent,l=y(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,g=H(s),I=Z(s),t.next=17,St({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-c.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:f,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:u+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:m,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(h=new P(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&h.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),h;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var Ve=Object.freeze({__proto__:null,getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(1e3))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(1e3,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(1e3),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=o0&&void 0!==arguments[0]?arguments[0]:"Output amount exceeds available liquidity";return p(this,n),e.call(this,t)}return d(n)}();function gn(){return(gn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,s=e.pool,a=e.swapType,o=e.assetIn,u=e.assetOut,c=e.initiatorAddr,p=e.slippage,l=s.account.address(),(d=[s.asset1ID,s.asset2ID]).includes(o.id)&&d.includes(u.id)&&o.id!==u.id){t.next=5;break}throw new P({pool:s,assetIn:o,assetOut:u},"Input asset (#".concat(o.id,") and output asset (#").concat(u.id,") provided to generate transactions do not belong to the pool ").concat(l,"."));case 5:return t.next=7,n.getTransactionParams().do();case 7:return f=t.sent,m=ot(o.id),g=a===exports.SwapType.FixedInput?o.amount:U("positive",p,o.amount),I=a===exports.SwapType.FixedOutput?u.amount:U("negative",p,u.amount),A=m?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:g,suggestedParams:f}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:c,to:l,amount:g,assetIndex:o.id,suggestedParams:f}),(x=r.default.makeApplicationNoOpTxnFromObject({from:c,appIndex:s.validatorAppID,appArgs:[dn,fn[a],r.default.encodeUint64(I)],note:lt.getAppCallTxnNoteWithClientName(ut.V2),accounts:[l],foreignAssets:[s.asset1ID,s.asset2ID],suggestedParams:f})).fee=In(a),(h=[])[cn.INPUT_TXN]=A,h[cn.APP_CALL_TXN]=x,T=r.default.assignGroupID(h),t.abrupt("return",[{txn:T[cn.INPUT_TXN],signers:[c]},{txn:T[cn.APP_CALL_TXN],signers:[c]}]);case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function In(e){return(ln[e]+1)*t.ALGORAND_MIN_TX_FEE}function An(){return(An=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x,h;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=e.client,a=e.pool,o=e.txGroup,u=e.signedTxns,c=e.network,p=e.assetIn,t.next=3,Y(s,[u]);case 3:return l=t.sent,d=y(l,1),f=d[0],m=f.confirmedRound,g=f.txnID,t.next=10,ce(s,o);case 10:return I=t.sent,A=[a.asset1ID,a.asset2ID].filter((function(t){return t!==p.id}))[0],x=null==I||null===(n=I.find((function(t){return t.txn.txn.xaid===p.id})))||void 0===n?void 0:n.txn.txn,h=null==I||null===(r=I.find((function(t){return t.txn.txn.xaid===A})))||void 0===r?void 0:r.txn.txn,t.t0=m,t.t1=x&&{amount:BigInt(p.amount)-BigInt(x.aamt||0),id:p.id},t.t2=h&&{amount:h.aamt,id:A},t.next=19,Jt.v2.getPoolInfo({client:s,network:c,asset1ID:a.asset1ID,asset2ID:a.asset2ID});case 19:return t.t3=t.sent,t.t4=g,t.abrupt("return",{round:t.t0,assetIn:t.t1,assetOut:t.t2,pool:t.t3,txnID:t.t4});case 22:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function xn(t){var e=t.pool,n=t.assetIn,r=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetIn:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset1Reserves,o=e.asset2Reserves;else{if(n.id!==e.asset2ID)throw new P({pool:e,assetIn:n},"Input asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset2Reserves,o=e.asset1Reserves}var c=Tn({inputSupply:a,outputSupply:o,swapInputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapOutputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(p>o)throw new mn;return{assetInID:n.id,assetInAmount:i,assetOutID:s,assetOutAmount:p,swapFee:Number(l),rate:G(r.assetOut,Number(p))/G(r.assetIn,Number(i)),priceImpact:d}}function hn(t){var e=t.pool,n=t.assetOut,r=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetOut:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset2Reserves,o=e.asset1Reserves;else{if(n.id!==e.asset2ID)throw new P({pool:e,assetOut:n},"Output asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset1Reserves,o=e.asset2Reserves}var c=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapOutputAmount,s=t.totalFeeShare,a=t.decimals,o=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.outputAmount,s=BigInt(e*n/(n-r))-e;return s+=BigInt(1)}({inputSupply:e,outputSupply:n,outputAmount:r}),i=function(t){var e=t.swapAmount,n=t.totalFeeShare,r=Math.floor(Number(e*BigInt(1e4)/(BigInt(1e4)-BigInt(n))));return BigInt(r)-e}({swapAmount:o,totalFeeShare:s}),u=o+i,c=Oe({inputSupply:e,outputSupply:n,assetIn:{amount:u,decimals:a.assetIn},assetOut:{amount:r,decimals:a.assetOut}});return{swapInputAmount:u,totalFeeAmount:i,priceImpact:c}}({inputSupply:a,outputSupply:o,swapOutputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapInputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(i>o)throw new mn;return{assetInID:s,assetInAmount:p,assetOutID:n.id,assetOutAmount:i,swapFee:Number(l),rate:G(r.assetOut,Number(i))/G(r.assetIn,Number(p)),priceImpact:d}}function Tn(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapInputAmount,s=t.totalFeeShare,a=t.decimals,o=BigInt(function(t){var e=t.inputAmount,n=t.totalFeeShare;return Math.floor(Number(e*BigInt(n))/1e4)}({inputAmount:r,totalFeeShare:s})),i=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapAmount,s=n-BigInt(e*n/(e+BigInt(r)));return s-=BigInt(1)}({inputSupply:e,outputSupply:n,swapAmount:r-o});return{swapOutputAmount:i,totalFeeAmount:o,priceImpact:Oe({inputSupply:e,outputSupply:n,assetIn:{amount:r,decimals:a.assetIn},assetOut:{amount:i,decimals:a.assetOut}})}}var vn={getQuote:function(t,e,n,r){return t===exports.SwapType.FixedInput?xn({pool:e,assetIn:n,decimals:r}):hn({pool:e,assetOut:n,decimals:r})},getFixedInputSwapQuote:xn,getFixedOutputSwapQuote:hn,generateTxns:function(t){return gn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return An.apply(this,arguments)},calculateFixedInputSwap:Tn};function yn(t,e){var n,r,s=BigInt(t),a=e.issuedLiquidity;return a>s+BigInt(1e3)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function _n(){return(_n=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.poolTokenIn,u=n.initiatorAddr,c=n.minAsset1Amount,p=n.minAsset2Amount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.account.address(),m=a.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return g=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:f,assetIndex:m,amount:o,suggestedParams:d}),(I=r.default.makeApplicationNoOpTxnFromObject({from:u,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[en,r.default.encodeUint64(U("negative",l,c)),r.default.encodeUint64(U("negative",l,p))],accounts:[f],foreignAssets:[a.asset1ID,a.asset2ID],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(A=[])[$e.ASSET_TRANSFER_TXN]=g,A[$e.APP_CALL_TXN]=I,x=r.default.assignGroupID(A),e.abrupt("return",[{txn:x[$e.ASSET_TRANSFER_TXN],signers:[u]},{txn:x[$e.APP_CALL_TXN],signers:[u]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wn(){return(wn=c(i().mark((function e(n){var s,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,y,_;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.client,a=n.pool,o=n.initiatorAddr,u=n.poolTokenIn,c=n.outputAssetId,p=n.minOutputAssetAmount,l=n.slippage,e.next=3,s.getTransactionParams().do();case 3:if(d=e.sent,f=a.asset1ID,m=a.asset2ID,g=a.account.address(),I=a.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(A=0,x=0,h=U("negative",l,p),c!==f){e.next=17;break}A=h,x=0,e.next=23;break;case 17:if(c!==m){e.next=22;break}A=0,x=h,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return T=r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:g,assetIndex:I,amount:u,suggestedParams:d}),(v=r.default.makeApplicationNoOpTxnFromObject({from:o,appIndex:a.validatorAppID,note:lt.getAppCallTxnNoteWithClientName(ut.V2),appArgs:[en,r.default.encodeUint64(A),r.default.encodeUint64(x)],accounts:[g],foreignAssets:[c],suggestedParams:d})).fee=3*t.ALGORAND_MIN_TX_FEE,(y=[])[$e.ASSET_TRANSFER_TXN]=T,y[$e.APP_CALL_TXN]=v,_=r.default.assignGroupID(y),e.abrupt("return",[{txn:_[$e.ASSET_TRANSFER_TXN],signers:[o]},{txn:_[$e.APP_CALL_TXN],signers:[o]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dn(){return(Dn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.client,s=e.txGroup,a=e.signedTxns,t.next=3,Y(r,[a]);case 3:return o=t.sent,u=y(o,1),c=u[0].txnID,t.next=8,ce(r,s);case 8:if(t.t1=n=t.sent,t.t0=null===t.t1,t.t0){t.next=12;break}t.t0=void 0===n;case 12:if(!t.t0){t.next=16;break}t.t2=void 0,t.next=17;break;case 16:t.t2=n.map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}}));case 17:return p=t.t2,t.abrupt("return",{outputAssets:p,txnID:c});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var bn,En,Sn={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=yn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=yn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=vn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=vn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,h=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:h}}}return e},generateTxns:function(t){return _n.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return wn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return Dn.apply(this,arguments)}},Nn=(f(bn={},ut.V1_1,pn),f(bn,ut.V2,Sn),bn),On=3n,Pn=1000n;function kn(){return(kn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pool,s=e.txGroup,a=e.initiatorSigner,t.next=3,a([s]);case 3:return o=t.sent,u=y(o,2),c=u[0],p=u[1],l=s.map((function(t,e){return e===En.FEE_TXN_INDEX?c:e===En.ASSET_IN_TXN_INDEX?p:r.default.signLogicSigTransactionObject(t.txn,n.account.lsig).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ln(){return(Ln=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g,I,A,x,h,T,v,y;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,a=e.pool,o=e.swapType,u=e.assetIn,c=e.assetOut,p=e.slippage,l=e.initiatorAddr,d=a.account.address(),(f=[a.asset1ID,a.asset2ID]).includes(u.id)&&f.includes(c.id)&&u.id!==c.id){t.next=5;break}throw new P({pool:a,assetIn:u,assetOut:c},"Input asset (#".concat(u.id,") and output asset (#").concat(c.id,") provided to generate transactions do not belong to the pool ").concat(d,"."));case 5:return t.next=7,n.getTransactionParams().do();case 7:return m=t.sent,g=[tt("swap"),o===exports.SwapType.FixedInput?tt("fi"):tt("fo")],I=r.default.makeApplicationNoOpTxnFromObject({from:d,appIndex:a.validatorAppID,appArgs:g,accounts:[l],note:lt.getAppCallTxnNoteWithClientName(ut.V1_1),foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:m}),A=o===exports.SwapType.FixedOutput?U("positive",p,u.amount):u.amount,x=0===u.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:d,amount:A,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:d,assetIndex:u.id,amount:A,suggestedParams:m}),h=o===exports.SwapType.FixedInput?U("negative",p,c.amount):c.amount,T=0===c.id?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:d,to:l,amount:h,suggestedParams:m}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:d,to:l,assetIndex:c.id,amount:h,suggestedParams:m}),v=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:d,amount:I.fee+T.fee,note:s,suggestedParams:m}),y=r.default.assignGroupID([v,I,x,T]),t.abrupt("return",[{txn:y[0],signers:[l]},{txn:y[1],signers:[d]},{txn:y[2],signers:[l]},{txn:y[3],signers:[d]}]);case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Fn(t){var e=t.pool,n=t.reserves,r=t.assetIn,s=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetIn:r},"Trying to swap on a non-existent pool");var a,i,u,c=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,i=n.asset1,u=n.asset2;else{if(r.id!==e.asset2ID)throw new P({pool:e,assetIn:r},"Input asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,i=n.asset2,u=n.asset1}var p=c*On/Pn,l=u-i*u/(i+(c-p));if(l>u)throw new mn;var d={assetIn:{amount:c,decimals:s.assetIn},assetOut:{amount:l,decimals:s.assetOut}};return{round:n.round,assetInID:r.id,assetInAmount:c,assetOutID:a,assetOutAmount:l,swapFee:Number(p),rate:Ne(d),priceImpact:Oe(o({inputSupply:i,outputSupply:u},d))}}function Bn(t){return Rn.apply(this,arguments)}function Rn(){return(Rn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=y(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,o.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Mn(t){var e=t.pool,n=t.reserves,r=t.assetOut,s=t.decimals;if(e.status!==exports.PoolStatus.READY)throw new P({pool:e,assetOut:r},"Trying to swap on a non-existent pool");var a,o,i,u=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,o=n.asset2,i=n.asset1;else{if(r.id!==e.asset2ID)throw new P({pool:e,assetOut:r},"Output asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,o=n.asset1,i=n.asset2}if(u>i)throw new mn;var c=o*i/(i-u)-o,p=c*Pn/(Pn-On),l=p-c,d=G(s.assetOut,Number(u))/G(s.assetIn,Number(p)),f=G(s.assetOut,Number(i))/G(s.assetIn,Number(o)),m=W({decimalPlaces:5},Math.abs(d/f-1));return{round:n.round,assetInID:a,assetInAmount:p,assetOutID:r.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Cn(t){return Vn.apply(this,arguments)}function Vn(){return(Vn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d,f,m,g,I,A,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,u=e.initiatorAddr,t.next=3,St({client:n,pool:r,accountAddr:u});case 3:return c=t.sent,t.next=6,Y(n,[s]);case 6:return p=t.sent,l=y(p,1),d=l[0],f=d.confirmedRound,m=d.txnID,t.next=13,St({client:n,pool:r,accountAddr:u});case 13:return g=t.sent,a.id===r.asset1ID?(I=c.excessAsset1,A=g.excessAsset1):(I=c.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:f,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:m});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xn(){return(Xn=c(i().mark((function t(e){var n,r,s,a,u,c,p,l,d,f;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,u=e.signedTxns,c=e.initiatorAddr,r.status===exports.PoolStatus.READY){t.next=3;break}throw new P({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,p={id:a[En.ASSET_IN_TXN_INDEX].txn.assetIndex||0,amount:a[En.ASSET_IN_TXN_INDEX].txn.amount},l={id:a[En.ASSET_OUT_TXN_INDEX].txn.assetIndex||0,amount:a[En.ASSET_OUT_TXN_INDEX].txn.amount},s!==exports.SwapType.FixedInput){t.next=12;break}return t.next=9,Bn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 9:d=t.sent,t.next=15;break;case 12:return t.next=14,Cn({client:n,pool:r,signedTxns:u,assetIn:p,assetOut:l,initiatorAddr:c});case 14:d=t.sent;case 15:return t.abrupt("return",o(o({},d),{},{groupID:Z(a),fees:H(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(f=new P(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&f.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),f;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}!function(t){t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX"}(En||(En={}));var jn,Qn={getQuote:function(t,e,n,r,s){return t===exports.SwapType.FixedInput?Fn({pool:e,reserves:n,assetIn:r,decimals:s}):Mn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Fn,getFixedOutputSwapQuote:Mn,generateTxns:function(t){return Ln.apply(this,arguments)},signTxns:function(t){return kn.apply(this,arguments)},execute:function(t){return Xn.apply(this,arguments)},executeFixedOutputSwap:Cn},Un=4*t.ALGORAND_MIN_TX_FEE;function Gn(t){return Promise.allSettled(t).then((function(t){if(t.every((function(t){return"rejected"===t.status&&t.reason instanceof mn})))throw new mn;return t.filter((function(t){return"fulfilled"===t.status&&void 0!==t.value.quote})).map((function(t){return t.value}))}))}function qn(){return(qn=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===ut.V1_1?Qn.getFixedInputSwapQuote(i):vn.getFixedInputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,Gn(o);case 4:return u=t.sent,t.abrupt("return",zn(u));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Wn(){return(Wn=c(i().mark((function t(e){var n,r,s,a,o,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetOut:{amount:a,id:Number(s.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===ut.V1_1?Qn.getFixedOutputSwapQuote(i):vn.getFixedOutputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,Gn(o);case 4:return u=t.sent,t.abrupt("return",zn(u));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function zn(t){return t.filter((function(t){return!Gt(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var Jn=(f(jn={},ut.V1_1,Qn),f(jn,ut.V2,vn),f(jn,"getQuote",(function(t){if(t.pools.every((function(t){return Gt(t.reserves)})))throw new Error("No pools available for swap");return t.type===exports.SwapType.FixedInput?function(t){return qn.apply(this,arguments)}(t):function(t){return Wn.apply(this,arguments)}(t)})),f(jn,"generateTxns",(function(t){return t.pool.contractVersion===ut.V1_1?Qn.generateTxns(t):vn.generateTxns(t)})),f(jn,"signTxns",(function(t){return t.pool.contractVersion===ut.V1_1?Qn.signTxns(t):vn.signTxns(t)})),f(jn,"execute",(function(t){return t.contractVersion===ut.V1_1?Qn.execute(t):vn.execute(t)})),jn);function Yn(){return(Yn=c(i().mark((function t(e){var n,r,s,a,o,u,c,p,l,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,Kn({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,Y(n,[o]);case 7:return u=t.sent,c=y(u,1),p=c[0],l=p.txnID,d=p.confirmedRound,t.abrupt("return",{fees:H(s),confirmedRound:d,txnID:l,groupID:Z(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function Kn(t){return Hn.apply(this,arguments)}function Hn(){return(Hn=c(i().mark((function t(e){var n,s,a,o,u,c,p,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.txGroup,s=e.pool,a=e.initiatorSigner,t.next=3,a([n]);case 3:return o=t.sent,u=y(o,1),c=u[0],p=s.account.lsig,l=n.map((function(t,e){return 0===e?c:r.default.signLogicSigTransactionObject(t.txn,p).blob})),t.abrupt("return",l);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zn(){return Zn=c(i().mark((function t(e){var n,s,a,o,u,p;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,s=e.data,a=e.initiatorSigner,t.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:H(e),groupID:Z(e),lsig:n.account.lsig}})),t.next=5,a(o.map((function(t){return t.txns})));case 5:return u=t.sent,p=Promise.all(o.map((function(t,e){return new Promise(function(){var s=c(i().mark((function s(a,o){var c,p,l,d,f,m;return i().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,c=t.txns.map((function(n,s){return 0===s?u[e]:r.default.signLogicSigTransactionObject(n.txn,t.lsig).blob})),s.next=4,Y(n,[c]);case 4:p=s.sent,l=y(p,1),d=l[0],f=d.txnID,m=d.confirmedRound,a({fees:t.txnFees,groupID:t.groupID,txnID:f,confirmedRound:m}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),t.abrupt("return",p);case 10:throw t.prev=10,t.t0=t.catch(1),new P(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return t.stop()}}),t,null,[[1,10]])}))),Zn.apply(this,arguments)}function $n(){return($n=c(i().mark((function t(e){var n,a,o,u,c,p,l,d,f,m,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,a=e.pool,o=e.assetID,u=e.assetOut,c=e.initiatorAddr,t.next=3,n.getTransactionParams().do();case 3:return p=t.sent,l=a.account.address(),d=r.default.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:[tt("redeem")],note:lt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[c],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:p}),f=0===o?r.default.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:c,amount:BigInt(u),suggestedParams:p}):r.default.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:c,assetIndex:o,amount:BigInt(u),suggestedParams:p}),m=r.default.makePaymentTxnWithSuggestedParamsFromObject({from:c,to:l,amount:d.fee+f.fee,note:s,suggestedParams:p}),g=r.default.assignGroupID([m,d,f]),t.abrupt("return",[{txn:g[0],signers:[c]},{txn:g[1],signers:[l]},{txn:g[2],signers:[l]}]);case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function tr(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[tt("commit"),u],note:L([tt("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function er(){return(er=c(i().mark((function e(n){var r,s,a,o,u,c,p,l,d,f,m;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,u=n.liquidityAssetID,c=n.amount,p=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(l=e.sent,d=tr({suggestedParams:l,stakingAppID:s,program:a,liquidityAssetID:u,initiatorAddr:p,amount:c}),f=[d],"number"!=typeof o){e.next=10;break}return m=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:p,suggestedParams:l,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[tt("log_balance")]}),f=t.assignGroupID([d,m]),e.abrupt("return",[{txn:f[0],signers:[p]},{txn:f[1],signers:[p]}]);case 10:return e.abrupt("return",[{txn:f[0],signers:[p]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=et,exports.ALGO_ASSET_ID=0,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=Ze,exports.BASE_MINIMUM_BALANCE=1e5,exports.Bootstrap=he,exports.CONTRACT_VERSION=ut,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=1e3,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=1e5,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=5e4,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=28500,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=nt,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Nn,exports.Swap=Jn,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=tn,exports.V2AddLiquidityTxnIndices=be,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=2,exports.applySlippageToAmount=U,exports.calculateAccountMinimumRequiredBalance=wt,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=Jt,exports.prepareCommitTransactions=function(t){return er.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return Zn.apply(this,arguments)},exports.redeemExcessAsset=function(t){return Yn.apply(this,arguments)},exports.sendAndWaitRawTransaction=Y,exports.sumUpTxnFees=H,exports.tinymanContract_v1_1=At,exports.tinymanContract_v2=Tt,exports.tinymanJSSDKConfig=lt; +"use strict";var t=require("algosdk"),e=require("base64-js"),n=Uint8Array.from([1]),r=1e5,s=1e5,a=1e5,o=1e5,i=1e5,u=5e4,c=28500,p=1e3,l=1e3;function d(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function f(t){for(var e=1;e=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var i=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(i&&u){if(this.prev=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),D(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var s=r.arg;D(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function g(t,e,n,r,s,a,o){try{var i=t[a](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,s)}function I(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var a=t.apply(e,n);function o(t){g(a,r,s,o,i,"next",t)}function i(t){g(a,r,s,o,i,"throw",t)}o(void 0)}))}}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function x(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){i=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}function F(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var B="- would result negative",R="logic eval error:",M="exceeds schema integer count",C=/transaction \w+:/,X=function(t){v(n,b(Error));var e=S(n);function n(t,r){var s;A(this,n);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i1||e<0)throw new Error("Invalid slippage value. Must be between 0 and 1, got ".concat(e));var r;try{var s="negative"===t?1-e:1+e;r=BigInt(Math.floor(Number(n)*s))}catch(t){throw new Error(t.message)}return r}function Z(t,e){var n=Number(t);return tt({decimalPlaces:n},Math.pow(10,-n)*Number(e))}function $(t,e){return tt({decimalPlaces:0},Math.pow(10,Number(t))*Number(e))}function tt(t,e){var n=t.decimalPlaces,r=void 0===n?0:n;if(r>0){var s=O(nt(e),2),a=s[0],o=s[1],i=O(nt(Math.round(Number(et(a,o+r)))),2),u=i[0],c=i[1];return Number(et(u,c-r))}return Math.round(e)}function et(t,e){return t+(e<0?"e".concat(e):"e+".concat(e))}function nt(t){if(t.toString().includes("e")){var e=t.toString().split("e");return[parseFloat(e[0]),parseFloat(e[1])]}return[t,0]}function rt(t,e){return st.apply(this,arguments)}function st(){return(st=I(m().mark((function t(e,n){var r,s,a,o,i,u,c,p;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,r=[],s=L(n),t.prev=3,s.s();case 5:if((a=s.n()).done){t.next=18;break}return o=a.value,t.next=9,e.sendRawTransaction(o).do();case 9:return i=t.sent,u=i.txId,t.next=13,Y(e,u);case 13:c=t.sent,p=c["confirmed-round"],r.push({confirmedRound:p,txnID:u});case 16:t.next=5;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),s.e(t.t0);case 23:return t.prev=23,s.f(),t.finish(23);case 26:return t.abrupt("return",r);case 29:throw t.prev=29,t.t1=t.catch(0),new X(t.t1,"We encountered an error while processing this transaction. Try again later.");case 32:case"end":return t.stop()}}),t,null,[[0,29],[3,20,23,26]])})))).apply(this,arguments)}function at(t){return t.reduce((function(t,e){return t+e.txn.fee}),0)}function ot(t){return(e=t[0].txn.group)?Buffer.from(e).toString("base64"):"";var e}function it(t){for(var e=[];;){var n=127&t;if(!(t>>=7)){e.push(n);break}e.push(128|n)}return e}function ut(t){return(new TextEncoder).encode(t)}var ct=0,pt={id:"".concat(ct),name:"Algorand",unit_name:"ALGO",decimals:6,url:"https://algorand.org",is_liquidity_token:!1,total_amount:"6615503326932151",clawback_address:""},lt={V1:"TM1POOL",V1_1:"TMPOOL11",V2:"TMPOOL2"};function dt(){return(dt=I(m().mark((function e(n){var r,s,a,o,i;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.assetID,a=n.initiatorAddr,e.prev=1,e.next=4,r.getTransactionParams().do();case 4:return o=e.sent,i=t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:a,assetIndex:s,amount:0,suggestedParams:o}),e.abrupt("return",[{txn:i,signers:[a]}]);case 9:throw e.prev=9,e.t0=e.catch(1),new X(e.t0,"We encountered something unexpected while opting into this asset. Try again later.");case 12:case"end":return e.stop()}}),e,null,[[1,9]])})))).apply(this,arguments)}function ft(t,e){var n=Number(t.id),r=Number(e.id);return n>r?[f(f({},t),{},{id:n}),f(f({},e),{},{id:r})]:[f(f({},e),{},{id:r}),f(f({},t),{},{id:n})]}function mt(t,e){var n=[t,e];return[Math.max.apply(Math,n),Math.min.apply(Math,n)]}function gt(t){return Number(t)===ct}var It,At={V1_1:"v1_1",V2:"v2"},xt={type:"logicsig",logic:{bytecode:"BCAIAQCBgICAgICAgPABgICAgICAgIDwAQMEBQYlJA1EMQkyAxJEMRUyAxJEMSAyAxJEMgQiDUQzAQAxABJEMwEQIQcSRDMBGIGCgICAgICAgPABEkQzARkiEjMBGyEEEhA3ARoAgAlib290c3RyYXASEEAAXDMBGSMSRDMBG4ECEjcBGgCABHN3YXASEEACOzMBGyISRDcBGgCABG1pbnQSQAE7NwEaAIAEYnVybhJAAZg3ARoAgAZyZWRlZW0SQAJbNwEaAIAEZmVlcxJAAnkAIQYhBSQjEk0yBBJENwEaARclEjcBGgIXJBIQRDMCADEAEkQzAhAhBBJEMwIhIxJEMwIiIxwSRDMCIyEHEkQzAiQjEkQzAiWACFRNUE9PTDExEkQzAiZRAA+AD1RpbnltYW5Qb29sMS4xIBJEMwIngBNodHRwczovL3RpbnltYW4ub3JnEkQzAikyAxJEMwIqMgMSRDMCKzIDEkQzAiwyAxJEMwMAMQASRDMDECEFEkQzAxElEkQzAxQxABJEMwMSIxJEJCMTQAAQMwEBMwIBCDMDAQg1AUIBsTMEADEAEkQzBBAhBRJEMwQRJBJEMwQUMQASRDMEEiMSRDMBATMCAQgzAwEIMwQBCDUBQgF8MgQhBhJENwEcATEAE0Q3ARwBMwQUEkQzAgAxABNEMwIUMQASRDMDADMCABJEMwIRJRJEMwMUMwMHMwMQIhJNMQASRDMDESMzAxAiEk0kEkQzBAAxABJEMwQUMwIAEkQzAQEzBAEINQFCAREyBCEGEkQ3ARwBMQATRDcBHAEzAhQSRDMDFDMDBzMDECISTTcBHAESRDMCADEAEkQzAhQzBAASRDMCESUSRDMDADEAEkQzAxQzAwczAxAiEk0zBAASRDMDESMzAxAiEk0kEkQzBAAxABNEMwQUMQASRDMBATMCAQgzAwEINQFCAJAyBCEFEkQ3ARwBMQATRDMCADcBHAESRDMCADEAE0QzAwAxABJEMwIUMwIHMwIQIhJNMQASRDMDFDMDBzMDECISTTMCABJEMwEBMwMBCDUBQgA+MgQhBBJENwEcATEAE0QzAhQzAgczAhAiEk03ARwBEkQzAQEzAgEINQFCABIyBCEEEkQzAQEzAgEINQFCAAAzAAAxABNEMwAHMQASRDMACDQBD0M=",address:"ABUKAXTANWR6K6ZYV75DWJEPVWWOU6SFUVRI6QHO44E4SIDLHBTD2CZ64A",size:881,variables:[{name:"TMPL_ASSET_ID_1",type:"int",index:15,length:10},{name:"TMPL_ASSET_ID_2",type:"int",index:5,length:10},{name:"TMPL_VALIDATOR_APP_ID",type:"int",index:74,length:10}],source:"https://github.com/tinymanorg/tinyman-contracts-v1/tree/dc9ab40c58b85c15d58f63a1507e18be76720dbb/contracts/pool_logicsig.teal.tmpl"},name:"pool_logicsig"},ht={type:"app",global_state_schema:{num_uints:0,num_byte_slices:0},local_state_schema:{num_uints:16,num_byte_slices:0},name:"validator_app"},Tt=new(function(){function t(){A(this,t),this.clientName="tinyman-js-sdk"}return h(t,[{key:"getClientName",value:function(){return this.clientName}},{key:"setClientName",value:function(t){this.clientName=t}},{key:"getAppCallTxnNoteWithClientName",value:function(t){var e=t===At.V1_1?"v1":t;return ut("tinyman/".concat(e,':j{"origin":"').concat(this.clientName,'"}'))}}]),t}()),vt=(T(It={},At.V1_1,{testnet:62368684,mainnet:552635992}),T(It,At.V2,{testnet:148607e3,mainnet:1002541853}),It);function yt(t,e){var n=vt[e][t];if(!n)throw new Error("No Validator App exists for ".concat(t," network with ").concat(e," contract version"));return n}function _t(){return(_t=I(m().mark((function e(n){var r,s,a,o,i,u;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.network,a=n.contractVersion,o=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:return i=e.sent,u=t.makeApplicationOptInTxnFromObject({from:o,appIndex:yt(s,a),note:Tt.getAppCallTxnNoteWithClientName(a),suggestedParams:i}),e.abrupt("return",[{txn:u,signers:[o]}]);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wt(){return(wt=I(m().mark((function e(n){var r,s,a,o,i,u;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.network,a=n.contractVersion,o=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:return i=e.sent,u=t.makeApplicationClearStateTxnFromObject({from:o,appIndex:yt(s,a),note:Tt.getAppCallTxnNoteWithClientName(a),suggestedParams:i}),e.abrupt("return",[{txn:u,signers:[o]}]);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Dt=h((function t(e){A(this,t),this.schema={numLocalInts:e.local_state_schema.num_uints,numLocalByteSlices:e.local_state_schema.num_byte_slices,numGlobalInts:e.global_state_schema.num_uints,numGlobalByteSlices:e.global_state_schema.num_byte_slices}})),bt=new(function(n){v(s,Dt);var r=S(s);function s(t,e){var n;return A(this,s),(n=r.call(this,t)).poolLogicSigContractTemplate=e.logic.bytecode,n.templateVariables=e.logic.variables,n}return h(s,[{key:"generateLogicSigAccountForPool",value:function(n){if(n.asset1ID===n.asset2ID)throw new Error("Assets are the same");var r=yt(n.network,At.V1_1),s=O(mt(n.asset1ID,n.asset2ID),2),a=s[0],o=s[1],i=Array.from(e.toByteArray(this.poolLogicSigContractTemplate)),u={asset_id_1:a,asset_id_2:o,validator_app_id:r},c=0;this.templateVariables.sort((function(t,e){return t.index-e.index}));for(var p=0;p2&&void 0!==arguments[2]?arguments[2]:t.IntDecoding.DEFAULT;return new Promise(function(){var t=I(m().mark((function t(s,a){var o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.accountInformation(n).setIntDecoding(r).do();case 3:o=t.sent,s(f(f({},o),{},{minimum_required_balance:Lt(o)})),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),a(new Error(t.t0.message||"Failed to fetch account information"));case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}())}function kt(t,e){var n=t["apps-local-state"].find((function(t){return t.id===e}));return n?j({stateArray:n["key-value"],shouldDecodeKeys:!0}):null}function Lt(t){var e=t["apps-total-schema"];return r+s*(t.assets||[]).length+o*(t["created-apps"]||[]).length+a*(t["apps-local-state"]||[]).length+u*Number(e&&e["num-byte-slice"]||0)+c*Number(e&&e["num-uint"]||0)+i*(t["apps-total-extra-pages"]||0)}var Ft=ut("e");function Bt(t){return Rt.apply(this,arguments)}function Rt(){return(Rt=I(m().mark((function n(r){var s,a,o,i,u,c,p,l,d,f,g,I,A,x,h,T,v,y,_,w,D;return m().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=r.client,a=r.pool,o=r.accountAddr,n.next=3,s.accountInformation(o).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:i=n.sent,u=i["apps-local-state"]||[],c=0n,p=0n,l=0n,d=a.account.address(),f=L(u),n.prev=10,f.s();case 12:if((g=f.n()).done){n.next=31;break}if((I=g.value).id==a.validatorAppID){n.next=16;break}return n.abrupt("continue",29);case 16:if(A=I["key-value"]){n.next=19;break}return n.abrupt("break",31);case 19:x=j({stateArray:A}),h=e.fromByteArray(V([t.decodeAddress(d).publicKey,Ft,t.encodeUint64(a.asset1ID)])),T=e.fromByteArray(V([t.decodeAddress(d).publicKey,Ft,t.encodeUint64(a.asset2ID)])),v=e.fromByteArray(V([t.decodeAddress(d).publicKey,Ft,t.encodeUint64(a.poolTokenID)])),y=x[h],_=x[T],w=x[v],"bigint"==typeof y&&(c=y),"bigint"==typeof _&&(p=_),"bigint"==typeof w&&(l=w);case 29:n.next=12;break;case 31:n.next=36;break;case 33:n.prev=33,n.t0=n.catch(10),f.e(n.t0);case 36:return n.prev=36,f.f(),n.finish(36);case 39:if(!((D={excessAsset1:c,excessAsset2:p,excessPoolTokens:l}).excessAsset1<0n||D.excessAsset2<0n||D.excessPoolTokens<0n)){n.next=42;break}throw new Error("Invalid account excess: ".concat(D));case 42:return n.abrupt("return",D);case 43:case"end":return n.stop()}}),n,null,[[10,33,36,39]])})))).apply(this,arguments)}function Mt(){return(Mt=I(m().mark((function n(r){var s,a,o,i,u,c,p,l,d,f,g,I,A,x,h;return m().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=r.client,a=r.accountAddr,o=r.validatorAppID,n.next=3,s.accountInformation(a).setIntDecoding(t.IntDecoding.BIGINT).do();case 3:if(i=n.sent,u=i["apps-local-state"]||[],c=u.find((function(t){return t.id==o})),p=[],c&&c["key-value"])for(l=j({stateArray:c["key-value"]}),d=0,f=Object.entries(l);dUt)){n.next=48;break}throw new Error("Issued liquidity value is out of the expected range ([0n, ".concat(Ut,"]): ").concat(P.issuedLiquidity));case 48:return n.abrupt("return",P);case 49:case"end":return n.stop()}}),n,null,[[8,31,34,37]])})))).apply(this,arguments)}function zt(){return zt=I(m().mark((function t(e){var n,r,s,a,o,i,u,c,p,l=arguments;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.address,s=e.network,!(a=l.length>1&&void 0!==l[1]?l[1]:{})[r]){t.next=4;break}return t.abrupt("return",a[r]);case 4:return t.next=6,Pt(n,r);case 6:return o=t.sent,i=kt(o,yt(s,At.V1_1)),u=null,i&&(p=o["created-assets"][0],c=p.index,u={asset1ID:i[jt[At.V1_1].asset1],asset2ID:i[jt[At.V1_1].asset2],poolTokenID:c},a[r]=u),t.abrupt("return",u);case 11:case"end":return t.stop()}}),t)}))),zt.apply(this,arguments)}var Jt=Object.freeze({__proto__:null,getPoolAssets:function(t){return zt.apply(this,arguments)},getPoolInfo:Gt,getPoolReserves:function(t,e){return qt.apply(this,arguments)}});function Yt(t){return Kt.apply(this,arguments)}function Kt(){return(Kt=I(m().mark((function t(e){var n,r,s,a,o,i,u,c,p,l,d,f;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.asset1ID,a=e.asset2ID,o=Nt(At.V2),i=o.generateLogicSigAccountForPool(e),u=yt(r,At.V2),c=i.address(),p=mt(s,a),t.next=8,Pt(n,c);case 8:return l=t.sent,d=kt(l,u),f={account:i,validatorAppID:u,asset1ID:p[0],asset2ID:p[1],status:d?Xt.READY:Xt.NOT_CREATED,contractVersion:At.V2},d&&(f.asset1ProtocolFees=BigInt(d[jt.v2.asset1ProtocolFees]),f.asset2ProtocolFees=BigInt(d[jt.v2.asset2ProtocolFees]),f.asset1Reserves=BigInt(d[jt.v2.asset1Reserves]),f.asset2Reserves=BigInt(d[jt.v2.asset2Reserves]),f.issuedPoolTokens=BigInt(d[jt.v2.issuedPoolTokens]),f.cumulativePriceUpdateTimeStamp=Number(d[jt.v2.cumulativePriceUpdateTimeStamp]),f.protocolFeeRatio=Number(d[jt.v2.protocolFeeRatio]),f.totalFeeShare=BigInt(d[jt.v2.totalFeeShare]),f.poolTokenID=Number(d[jt.v2.poolTokenID]),f.asset1ID=Number(d[jt.v2.asset1]),f.asset2ID=Number(d[jt.v2.asset2])),t.abrupt("return",f);case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ht(){return(Ht=I(m().mark((function t(e,n){var r,s,a;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Pt(e,n.account.address());case 2:return r=t.sent,s=kt(r,n.validatorAppID),a={asset1:0n,asset2:0n,issuedLiquidity:0n,round:r.round},s&&(a.asset1=BigInt(s[jt.v2.asset1Reserves]),a.asset2=BigInt(s[jt.v2.asset2Reserves]),a.issuedLiquidity=BigInt(s[jt.v2.issuedPoolTokens])),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zt(){return(Zt=I(m().mark((function t(e){var n,r,s,a,o,i;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.address,s=e.network,t.next=3,Pt(n,r);case 3:return a=t.sent,o=kt(a,yt(s,At.V2)),i=null,o&&(i={asset1ID:o[jt[At.V2].asset1],asset2ID:o[jt[At.V2].asset2],poolTokenID:o[jt[At.V2].poolTokenID]}),t.abrupt("return",i);case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var $t=Object.freeze({__proto__:null,getPoolAssets:function(t){return Zt.apply(this,arguments)},getPoolInfo:Yt,getPoolReserves:function(t,e){return Ht.apply(this,arguments)}});function te(t){return Boolean(t&&!(t.asset1+t.asset2))}var ee,ne=Object.freeze({__proto__:null,getPoolPairRatio:function(t,e){var n=te(e),r=null;return e&&!n&&e.asset1&&e.asset2&&"number"==typeof t.asset2&&"number"==typeof t.asset1&&(r=Z(t.asset1,e.asset1)/Z(t.asset2,e.asset2)),r},getPoolShare:function(t,e){var n=Number(e)/Number(t);return Number.isFinite(n)||(n=0),n},getPoolsForPair:function(t){return Promise.all([Gt(t),Yt(t)])},isPoolEmpty:te,isPoolNotCreated:function(t){return(null==t?void 0:t.status)===Xt.NOT_CREATED},isPoolReady:function(t){return(null==t?void 0:t.status)===Xt.READY}}),re=f((T(ee={},At.V1_1,f(f({},Jt),ne)),T(ee,At.V2,f(f({},$t),ne)),ee),ne),se=function(t){return t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t[t.POOL_TOKEN_CREATE=2]="POOL_TOKEN_CREATE",t[t.ASSET1_OPT_IN=3]="ASSET1_OPT_IN",t[t.ASSET2_OPT_IN=4]="ASSET2_OPT_IN",t}({}),ae={ASA_ALGO:96e4,ASA_ASA:859e3};function oe(){return(oe=I(m().mark((function e(n){var r,s,a,o,i,u,c,p,l,d,f,g,I,A,x,h,T,v,y,_,w,D,b,E,S;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.network,a=n.asset_1,o=n.asset_2,i=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:return u=e.sent,c=ft(a,o),p=O(c,2),l=p[0],d=l.id,f=l.unit_name,g=p[1],I=g.id,A=g.unit_name,x=gt(I),h=yt(s,At.V1_1),T=bt.generateLogicSigAccountForPool({network:s,asset1ID:d,asset2ID:I}),v=T.address(),y=t.makeApplicationOptInTxnFromObject({from:v,appIndex:h,note:Tt.getAppCallTxnNoteWithClientName(At.V1_1),appArgs:[ut("bootstrap"),t.encodeUint64(d),t.encodeUint64(I)],foreignAssets:x?[d]:[I],suggestedParams:u}),_=t.makeAssetCreateTxnWithSuggestedParamsFromObject({from:v,total:0xffffffffffffffffn,decimals:6,defaultFrozen:!1,unitName:lt.V1_1,assetName:"TinymanPool1.1 ".concat(f,"-").concat(A),assetURL:"https://tinyman.org",suggestedParams:u}),w=t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:v,to:v,assetIndex:d,amount:0,suggestedParams:u}),D=t.makePaymentTxnWithSuggestedParamsFromObject({from:i,to:v,amount:ie(x),suggestedParams:u}),(b=[])[se.FUNDING_TXN]=D,b[se.VALIDATOR_APP_CALL]=y,b[se.POOL_TOKEN_CREATE]=_,b[se.ASSET1_OPT_IN]=w,x||(b[se.ASSET2_OPT_IN]=t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:v,to:v,assetIndex:I,amount:0,suggestedParams:u})),E=t.assignGroupID(b),S=[{txn:E[se.FUNDING_TXN],signers:[i]},{txn:E[se.VALIDATOR_APP_CALL],signers:[v]},{txn:E[se.POOL_TOKEN_CREATE],signers:[v]},{txn:E[se.ASSET1_OPT_IN],signers:[v]}],E[se.ASSET2_OPT_IN]&&S.push({txn:E[se.ASSET2_OPT_IN],signers:[v]}),e.abrupt("return",S);case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ie(t){return t?ae.ASA_ALGO:ae.ASA_ASA}function ue(){return(ue=I(m().mark((function e(n){var r,s,a,o,i,u,c,p,l,d,f,g,I,A,x;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.txGroup,s=n.network,a=n.initiatorSigner,o=n.asset1ID,i=n.asset2ID,e.next=3,a([r]);case 3:return u=e.sent,c=O(u,1),p=c[0],l=mt(o,i),d=O(l,2),f=d[0],g=d[1],I=bt.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:g}),A=[],x=r.map((function(e,n){if(n===se.FUNDING_TXN)return A.push(e.txn.txID().toString()),p;var r=t.signLogicSigTransactionObject(e.txn,I),s=r.txID,a=r.blob;return A.push(s),a})),e.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ce(t){return pe.apply(this,arguments)}function pe(){return(pe=I(m().mark((function t(e){var n,r,s,a,o;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.signedTxns,s=e.txnIDs,t.prev=1,t.next=4,n.sendRawTransaction(r).do();case 4:return t.next=6,Y(n,s[se.POOL_TOKEN_CREATE]);case 6:if(a=t.sent,"number"==typeof(o=a["asset-index"])){t.next=10;break}throw new Error("Generated ID is not valid: got ".concat(o));case 10:return t.abrupt("return",{poolTokenID:o});case 13:throw t.prev=13,t.t0=t.catch(1),new X(t.t0,"We encountered something unexpected while bootstraping the pool. Try again later.");case 16:case"end":return t.stop()}}),t,null,[[1,13]])})))).apply(this,arguments)}function le(){return(le=I(m().mark((function t(e){var n,r,s,a,o,i,u;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,i=e.signedTxns,u=e.txnIDs,t.next=3,ce({client:n,signedTxns:i,txnIDs:u});case 3:return t.abrupt("return",re.v1_1.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var de={generateTxns:function(t){return oe.apply(this,arguments)},signTxns:function(t){return ue.apply(this,arguments)},execute:function(t){return le.apply(this,arguments)},getBootstrapFundingTxnAmount:ie};var fe=function(t){return t[t.FUNDING_TXN=0]="FUNDING_TXN",t[t.VALIDATOR_APP_CALL=1]="VALIDATOR_APP_CALL",t}({}),me={ASA_ALGO:5,ASA_ASA:6};function ge(t,e){return Ie.apply(this,arguments)}function Ie(){return(Ie=I(m().mark((function e(n,r){var s,a,o;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=null===(s=r.find((function(t){return"appl"===t.txn.type})))||void 0===s?void 0:s.txn.txID())){e.next=7;break}return e.next=4,t.waitForConfirmation(n,a,l);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=void 0;case 8:return o=e.t0,e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(t,e){return xe.apply(this,arguments)}function xe(){return(xe=I(m().mark((function t(e,n){var r;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ge(e,n);case 2:return r=t.sent,t.abrupt("return",null==r?void 0:r["inner-txns"]);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function he(){return(he=I(m().mark((function e(n){var r,s,a,o,i,u,c,p,l,d,f,g,I,A,x,h,T,v,y,_;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.network,a=n.asset_1,o=n.asset_2,i=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:return u=e.sent,c=yt(s,At.V2),p=t.getApplicationAddress(c),l=ft(a,o),d=O(l,2),f=d[0].id,g=d[1].id,e.next=9,re.v2.getPoolInfo({client:r,network:s,asset1ID:f,asset2ID:g});case 9:if(e.sent.status!==Xt.READY){e.next=12;break}throw new Error("Pool for ".concat(a.unit_name,"-").concat(o.unit_name," already exists"));case 12:return I=Ot.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:g}),A=I.address(),x=gt(g),(h=t.makeApplicationOptInTxnFromObject({from:A,appIndex:c,appArgs:[ut("bootstrap")],note:Tt.getAppCallTxnNoteWithClientName(At.V2),foreignAssets:[f,g],rekeyTo:p,suggestedParams:u})).fee=ve(x),T=t.makePaymentTxnWithSuggestedParamsFromObject({from:i,to:A,amount:Te(x),suggestedParams:u}),(v=[])[fe.FUNDING_TXN]=T,v[fe.VALIDATOR_APP_CALL]=h,y=t.assignGroupID(v),(_=[])[fe.FUNDING_TXN]={txn:y[fe.FUNDING_TXN],signers:[i]},_[fe.VALIDATOR_APP_CALL]={txn:y[fe.VALIDATOR_APP_CALL],signers:[A]},e.abrupt("return",_);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(t){return function(t,e){var n=Nt(t).schema,o=n.numLocalInts,i=n.numLocalByteSlices,p=r+s+s+a+c*o+u*i;return e||(p+=s),p}(At.V2,t)+ve(t)+s}function ve(e){return((e?me.ASA_ALGO:me.ASA_ASA)+1)*t.ALGORAND_MIN_TX_FEE}function ye(){return(ye=I(m().mark((function e(n){var r,s,a,o,i,u,c,p,l,d,f,g,I,A,x;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.txGroup,s=n.network,a=n.initiatorSigner,o=n.asset1ID,i=n.asset2ID,e.next=3,a([r]);case 3:return u=e.sent,c=O(u,1),p=c[0],l=mt(o,i),d=O(l,2),f=d[0],g=d[1],I=Ot.generateLogicSigAccountForPool({network:s,asset1ID:f,asset2ID:g}),A=[],x=r.map((function(e,n){if(n===fe.FUNDING_TXN)return A.push(e.txn.txID().toString()),p;var r=t.signLogicSigTransactionObject(e.txn,I),s=r.txID,a=r.blob;return A.push(s),a})),e.abrupt("return",{signedTxns:x,txnIDs:A});case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _e(){return(_e=I(m().mark((function t(e){var n,r,s,a,o,i,u,c,p,l,d;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.network,s=e.pool,a=s.asset1ID,o=s.asset2ID,i=e.txGroup,u=e.signedTxns,t.prev=1,t.next=4,n.sendRawTransaction(u).do();case 4:return t.next=6,ge(n,i);case 6:if(t.t1=c=t.sent,t.t0=null===t.t1,t.t0){t.next=10;break}t.t0=void 0===c;case 10:if(!t.t0){t.next=14;break}t.t2=void 0,t.next=15;break;case 14:t.t2=null===(p=c["local-state-delta"][0].delta)||void 0===p||null===(l=p.find((function(t){return t.key===btoa(jt.v2.poolTokenID)})))||void 0===l?void 0:l.value.uint;case 15:if("number"==typeof(d=t.t2)){t.next=18;break}throw new Error("Generated ID is not valid: got ".concat(d));case 18:return t.abrupt("return",re.v2.getPoolInfo({client:n,network:r,asset1ID:a,asset2ID:o}));case 21:throw t.prev=21,t.t3=t.catch(1),new X(t.t3,"We encountered something unexpected while bootstraping the pool. Try again later.");case 24:case"end":return t.stop()}}),t,null,[[1,21]])})))).apply(this,arguments)}var we,De={generateTxns:function(t){return he.apply(this,arguments)},signTxns:function(t){return ye.apply(this,arguments)},execute:function(t){return _e.apply(this,arguments)},getBootstrapFundingTxnAmount:Te,getTotalCost:function(e){return t.ALGORAND_MIN_TX_FEE+Te(e)}};var be,Ee,Se,Oe,Ne=(T(we={},At.V1_1,de),T(we,At.V2,De),T(we,"generateTxns",(function(t){return t.contractVersion===At.V1_1?de.generateTxns(t):De.generateTxns(t)})),T(we,"signTxns",(function(t){return t.contractVersion===At.V1_1?de.signTxns(t):De.signTxns(t)})),T(we,"execute",(function(t){return t.contractVersion===At.V1_1?de.execute(t):De.execute(t)})),T(we,"calculateBootstrapFundingTxnAmount",(function(t){var e=t.contractVersion,n=t.isAlgoPool;return e===At.V1_1?de.getBootstrapFundingTxnAmount(n):De.getBootstrapFundingTxnAmount(n)})),we),Pe=function(t){return t[t.FEE_TXN=0]="FEE_TXN",t[t.VALIDATOR_APP_CALL_TXN=1]="VALIDATOR_APP_CALL_TXN",t[t.ASSET1_IN_TXN=2]="ASSET1_IN_TXN",t[t.ASSET2_IN_TXN=3]="ASSET2_IN_TXN",t[t.LIQUDITY_OUT_TXN=4]="LIQUDITY_OUT_TXN",t}({}),ke=5*t.ALGORAND_MIN_TX_FEE,Le=function(t){return t.SINGLE="single",t.FLEXIBLE="flexible",t.INITIAL="initial",t}({}),Fe=(T(be={},Le.FLEXIBLE,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),T(be,Le.SINGLE,{ASSET_IN_TXN:0,VALIDATOR_APP_CALL_TXN:1}),T(be,Le.INITIAL,{ASSET1_IN_TXN:0,ASSET2_IN_TXN:1,VALIDATOR_APP_CALL_TXN:2}),be),Be=(T(Ee={},Le.INITIAL,1),T(Ee,Le.SINGLE,2),T(Ee,Le.FLEXIBLE,2),Ee),Re=(T(Se={},Le.INITIAL,3),T(Se,Le.FLEXIBLE,3),T(Se,Le.SINGLE,2),Se);function Me(t){var e=t.assetIn,n=t.assetOut;return Z(n.decimals,Number(n.amount))/Z(e.decimals,Number(e.amount))}function Ce(t){var e=t.inputSupply,n=t.outputSupply,r=t.assetIn,s=t.assetOut,a=Me({assetIn:r,assetOut:s}),o=Z(s.decimals,Number(n))/Z(r.decimals,Number(e));return tt({decimalPlaces:5},Math.abs(a/o-1))}function Xe(t){var e,n,r,s=t.reserves,a=t.totalFeeShare,o=t.asset1,i=t.asset2,u=s.asset1*s.asset2,c=s.asset1+BigInt(o.amount),p=s.asset2+BigInt(i.amount),l=c*p,d=BigInt(parseInt(String(Math.sqrt(Number(l*s.issuedLiquidity*s.issuedLiquidity/u))))),f=d-s.issuedLiquidity,m=f*c/d,g=f*p/d,I=BigInt(o.amount)-m,A=BigInt(i.amount)-g;if(I>A){var x=I;r=je(x,a),e={id:o.id,amount:x+r,decimals:o.decimals,reserves:s.asset1},n={id:i.id,amount:BigInt(Math.abs(Math.min(Number(A),0))),decimals:i.decimals,reserves:s.asset2},f-=r*d/(c*BigInt(2))}else{var h=A;r=je(h,a),e={id:i.id,amount:h+r,decimals:i.decimals,reserves:s.asset2},n={id:o.id,amount:BigInt(Math.abs(Math.min(Number(I),0))),decimals:o.decimals,reserves:s.asset1},f-=r*d/(p*BigInt(2))}return{poolTokenOutAmount:f,internalSwapQuote:{assetIn:e,assetOut:n,swapFees:r,priceImpact:Ce({inputSupply:e.reserves,outputSupply:n.reserves,assetIn:e,assetOut:n})}}}function je(t,e){return t*BigInt(e)/(BigInt(1e4)-BigInt(e))}function Ve(e){return(Be[e]+1)*t.ALGORAND_MIN_TX_FEE}var Qe=ut("add_liquidity"),Ue=(T(Oe={},At.V1_1,[ut("mint")]),T(Oe,At.V2,{INITIAL_LIQUIDITY:[ut("add_initial_liquidity")],SINGLE_ASSET_MODE:[Qe,ut("single")],FLEXIBLE_MODE:[Qe,ut("flexible")]}),Oe);function Ge(){return(Ge=I(m().mark((function e(r){var s,a,o,i,u,c,p,l,d,f,g,I,A,x,h,T;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=r.client,a=r.network,o=r.poolAddress,i=r.asset1In,u=r.asset2In,c=r.poolTokenOut,p=r.slippage,l=r.initiatorAddr,d=H("negative",p,c.amount),e.next=4,s.getTransactionParams().do();case 4:return f=e.sent,g=t.makeApplicationNoOpTxnFromObject({from:o,appIndex:yt(a,At.V1_1),appArgs:Ue.v1_1,accounts:[l],note:Tt.getAppCallTxnNoteWithClientName(At.V1_1),foreignAssets:u.id==ct?[i.id,c.id]:[i.id,u.id,c.id],suggestedParams:f}),I=t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:o,assetIndex:i.id,amount:i.amount,suggestedParams:f}),A=u.id===ct?t.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:o,amount:u.amount,suggestedParams:f}):t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:o,assetIndex:u.id,amount:u.amount,suggestedParams:f}),x=t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:l,assetIndex:c.id,amount:d,suggestedParams:f}),h=t.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:o,amount:g.fee+x.fee,note:n,suggestedParams:f}),T=t.assignGroupID([h,g,I,A,x]),e.abrupt("return",[{txn:T[0],signers:[l]},{txn:T[1],signers:[o]},{txn:T[2],signers:[l]},{txn:T[3],signers:[l]},{txn:T[4],signers:[o]}]);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function We(){return(We=I(m().mark((function e(n){var r,s,a,o,i,u,c,p,l,d;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.pool,s=n.txGroup,a=n.initiatorSigner,o=r.account,e.next=4,a([s]);case 4:return i=e.sent,u=O(i,3),c=u[0],p=u[1],l=u[2],d=s.map((function(e,n){return n===Pe.FEE_TXN?c:n===Pe.ASSET1_IN_TXN?p:n===Pe.ASSET2_IN_TXN?l:t.signLogicSigTransactionObject(e.txn,o).blob})),e.abrupt("return",d);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qe(){return(qe=I(m().mark((function t(e){var n,r,s,a,o,i,u,c,p,l,d,f,g,I,A,x,h;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.signedTxns,o=e.initiatorAddr,t.prev=1,i=BigInt(s[Pe.LIQUDITY_OUT_TXN].txn.amount),t.next=5,Bt({client:n,pool:r,accountAddr:o});case 5:return u=t.sent,t.next=8,rt(n,[a]);case 8:return c=t.sent,p=O(c,1),l=p[0],d=l.confirmedRound,f=l.txnID,g=at(s),I=ot(s),t.next=17,Bt({client:n,pool:r,accountAddr:o});case 17:return A=t.sent,(x=A.excessPoolTokens-u.excessPoolTokens)<0n&&(x=0n),t.abrupt("return",{round:d,fees:g,poolTokenID:r.poolTokenID,poolTokenOut:i+x,excessAmount:{excessAmountForAddingLiquidity:x,totalExcessAmount:A.excessPoolTokens},txnID:f,groupID:I});case 23:throw t.prev=23,t.t0=t.catch(1),"SlippageTolerance"===(h=new X(t.t0,"We encountered something unexpected while adding liquidity. Try again later.")).type&&h.setMessage("Adding liquidity failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),h;case 28:case"end":return t.stop()}}),t,null,[[1,23]])})))).apply(this,arguments)}var ze=Object.freeze({__proto__:null,execute:function(t){return qe.apply(this,arguments)},generateTxns:function(t){return Ge.apply(this,arguments)},getQuote:function(t){var e=t.pool,n=t.reserves,r=t.asset1In,s=t.asset2In;if(0n===n.issuedLiquidity){var a=BigInt(Math.floor(Math.sqrt(Number(r)*Number(s))));if(a<=BigInt(p))throw new Error("Initial liquidity amount is too small. The amount must be greater than ".concat(p,", this quote is for ").concat(a,"."));return{round:n.round,asset1ID:e.asset1ID,asset1In:BigInt(r),asset2ID:e.asset2ID,asset2In:BigInt(s),poolTokenID:e.poolTokenID,poolTokenOut:a-BigInt(p),share:1}}var o=BigInt(r)*n.issuedLiquidity/n.asset1,i=BigInt(s)*n.issuedLiquidity/n.asset2,u=o0&&void 0!==arguments[0]?arguments[0]:"Output amount exceeds available liquidity";return A(this,n),e.call(this,t)}return h(n)}();function Dn(){return(Dn=I(m().mark((function e(n){var r,s,a,o,i,u,c,p,l,d,f,g,I,A,x,h,T;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.client,s=n.pool,a=n.swapType,o=n.assetIn,i=n.assetOut,u=n.initiatorAddr,c=n.slippage,p=s.account.address(),(l=[s.asset1ID,s.asset2ID]).includes(o.id)&&l.includes(i.id)&&o.id!==i.id){e.next=5;break}throw new X({pool:s,assetIn:o,assetOut:i},"Input asset (#".concat(o.id,") and output asset (#").concat(i.id,") provided to generate transactions do not belong to the pool ").concat(p,"."));case 5:return e.next=7,r.getTransactionParams().do();case 7:return d=e.sent,f=gt(o.id),g=a===xn.FixedInput?o.amount:H("positive",c,o.amount),I=a===xn.FixedOutput?i.amount:H("negative",c,i.amount),A=f?t.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:p,amount:g,suggestedParams:d}):t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:u,to:p,amount:g,assetIndex:o.id,suggestedParams:d}),(x=t.makeApplicationNoOpTxnFromObject({from:u,appIndex:s.validatorAppID,appArgs:[yn,_n[a],t.encodeUint64(I)],note:Tt.getAppCallTxnNoteWithClientName(At.V2),accounts:[p],foreignAssets:[s.asset1ID,s.asset2ID],suggestedParams:d})).fee=bn(a),(h=[])[hn.INPUT_TXN]=A,h[hn.APP_CALL_TXN]=x,T=t.assignGroupID(h),e.abrupt("return",[{txn:T[hn.INPUT_TXN],signers:[u]},{txn:T[hn.APP_CALL_TXN],signers:[u]}]);case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bn(e){return(Tn[e]+1)*t.ALGORAND_MIN_TX_FEE}function En(){return(En=I(m().mark((function t(e){var n,r,s,a,o,i,u,c,p,l,d,f,g,I,A,x,h;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=e.client,a=e.pool,o=e.txGroup,i=e.signedTxns,u=e.network,c=e.assetIn,t.next=3,rt(s,[i]);case 3:return p=t.sent,l=O(p,1),d=l[0],f=d.confirmedRound,g=d.txnID,t.next=10,Ae(s,o);case 10:return I=t.sent,A=[a.asset1ID,a.asset2ID].filter((function(t){return t!==c.id}))[0],x=null==I||null===(n=I.find((function(t){return t.txn.txn.xaid===c.id})))||void 0===n?void 0:n.txn.txn,h=null==I||null===(r=I.find((function(t){return t.txn.txn.xaid===A})))||void 0===r?void 0:r.txn.txn,t.t0=f,t.t1=x&&{amount:BigInt(c.amount)-BigInt(x.aamt||0),id:c.id},t.t2=h&&{amount:h.aamt,id:A},t.next=19,re.v2.getPoolInfo({client:s,network:u,asset1ID:a.asset1ID,asset2ID:a.asset2ID});case 19:return t.t3=t.sent,t.t4=g,t.abrupt("return",{round:t.t0,assetIn:t.t1,assetOut:t.t2,pool:t.t3,txnID:t.t4});case 22:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Sn(t){var e=t.pool,n=t.assetIn,r=t.decimals;if(e.status!==Xt.READY)throw new X({pool:e,assetIn:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset1Reserves,o=e.asset2Reserves;else{if(n.id!==e.asset2ID)throw new X({pool:e,assetIn:n},"Input asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset2Reserves,o=e.asset1Reserves}var c=Nn({inputSupply:a,outputSupply:o,swapInputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapOutputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(p>o)throw new wn;return{assetInID:n.id,assetInAmount:i,assetOutID:s,assetOutAmount:p,swapFee:Number(l),rate:Z(r.assetOut,Number(p))/Z(r.assetIn,Number(i)),priceImpact:d}}function On(t){var e=t.pool,n=t.assetOut,r=t.decimals;if(e.status!==Xt.READY)throw new X({pool:e,assetOut:n},"Trying to swap on a non-existent pool");var s,a,o,i=BigInt(n.amount),u=e.totalFeeShare;if(n.id===e.asset1ID)s=e.asset2ID,a=e.asset2Reserves,o=e.asset1Reserves;else{if(n.id!==e.asset2ID)throw new X({pool:e,assetOut:n},"Output asset (#".concat(n.id,") doesn't belong to the pool ").concat(e.account.address(),"."));s=e.asset1ID,a=e.asset1Reserves,o=e.asset2Reserves}var c=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapOutputAmount,s=t.totalFeeShare,a=t.decimals,o=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.outputAmount,s=e*n,a=BigInt(s/(n-r))-e;return a+=BigInt(1),a}({inputSupply:e,outputSupply:n,outputAmount:r}),i=function(t){var e=t.swapAmount,n=t.totalFeeShare,r=Math.floor(Number(e*BigInt(1e4)/(BigInt(1e4)-BigInt(n)))),s=BigInt(r)-e;return s}({swapAmount:o,totalFeeShare:s}),u=o+i,c=Ce({inputSupply:e,outputSupply:n,assetIn:{amount:u,decimals:a.assetIn},assetOut:{amount:r,decimals:a.assetOut}});return{swapInputAmount:u,totalFeeAmount:i,priceImpact:c}}({inputSupply:a,outputSupply:o,swapOutputAmount:i,totalFeeShare:u,decimals:r}),p=c.swapInputAmount,l=c.totalFeeAmount,d=c.priceImpact;if(i>o)throw new wn;return{assetInID:s,assetInAmount:p,assetOutID:n.id,assetOutAmount:i,swapFee:Number(l),rate:Z(r.assetOut,Number(i))/Z(r.assetIn,Number(p)),priceImpact:d}}function Nn(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapInputAmount,s=t.totalFeeShare,a=t.decimals,o=BigInt(function(t){var e=t.inputAmount,n=t.totalFeeShare;return Math.floor(Number(e*BigInt(n))/1e4)}({inputAmount:r,totalFeeShare:s})),i=function(t){var e=t.inputSupply,n=t.outputSupply,r=t.swapAmount,s=e*n,a=n-BigInt(s/(e+BigInt(r)));return a-=BigInt(1)}({inputSupply:e,outputSupply:n,swapAmount:r-o});return{swapOutputAmount:i,totalFeeAmount:o,priceImpact:Ce({inputSupply:e,outputSupply:n,assetIn:{amount:r,decimals:a.assetIn},assetOut:{amount:i,decimals:a.assetOut}})}}var Pn={getQuote:function(t,e,n,r){return t===xn.FixedInput?Sn({pool:e,assetIn:n,decimals:r}):On({pool:e,assetOut:n,decimals:r})},getFixedInputSwapQuote:Sn,getFixedOutputSwapQuote:On,generateTxns:function(t){return Dn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return En.apply(this,arguments)},calculateFixedInputSwap:Nn};function kn(t,e){var n,r,s=BigInt(t),a=e.issuedLiquidity;return a>s+BigInt(Vt)?(n=s*e.asset1/a,r=s*e.asset2/a):(n=e.asset1,r=e.asset2),{asset1OutputAmount:n,asset2OutputAmount:r}}function Ln(){return(Ln=I(m().mark((function e(n){var r,s,a,o,i,u,c,p,l,d,f,g,I,A;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.pool,a=n.poolTokenIn,o=n.initiatorAddr,i=n.minAsset1Amount,u=n.minAsset2Amount,c=n.slippage,e.next=3,r.getTransactionParams().do();case 3:if(p=e.sent,l=s.account.address(),d=s.poolTokenID){e.next=8;break}throw new Error("Pool token asset ID is missing");case 8:return f=t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:o,to:l,assetIndex:d,amount:a,suggestedParams:p}),(g=t.makeApplicationNoOpTxnFromObject({from:o,appIndex:s.validatorAppID,note:Tt.getAppCallTxnNoteWithClientName(At.V2),appArgs:[pn,t.encodeUint64(H("negative",c,i)),t.encodeUint64(H("negative",c,u))],accounts:[l],foreignAssets:[s.asset1ID,s.asset2ID],suggestedParams:p})).fee=(cn+1)*t.ALGORAND_MIN_TX_FEE,(I=[])[ln.ASSET_TRANSFER_TXN]=f,I[ln.APP_CALL_TXN]=g,A=t.assignGroupID(I),e.abrupt("return",[{txn:A[ln.ASSET_TRANSFER_TXN],signers:[o]},{txn:A[ln.APP_CALL_TXN],signers:[o]}]);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fn(){return(Fn=I(m().mark((function e(n){var r,s,a,o,i,u,c,p,l,d,f,g,I,A,x,h,T,v,y;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.pool,a=n.initiatorAddr,o=n.poolTokenIn,i=n.outputAssetId,u=n.minOutputAssetAmount,c=n.slippage,e.next=3,r.getTransactionParams().do();case 3:if(p=e.sent,l=s.asset1ID,d=s.asset2ID,f=s.account.address(),g=s.poolTokenID){e.next=9;break}throw new Error("Pool token asset ID is missing");case 9:if(I=0,A=0,x=H("negative",c,u),i!==l){e.next=17;break}I=x,A=0,e.next=23;break;case 17:if(i!==d){e.next=22;break}I=0,A=x,e.next=23;break;case 22:throw new Error("Invalid output asset id. It doesn't match with pool assets");case 23:return h=t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:f,assetIndex:g,amount:o,suggestedParams:p}),(T=t.makeApplicationNoOpTxnFromObject({from:a,appIndex:s.validatorAppID,note:Tt.getAppCallTxnNoteWithClientName(At.V2),appArgs:[pn,t.encodeUint64(I),t.encodeUint64(A)],accounts:[f],foreignAssets:[i],suggestedParams:p})).fee=(cn+1)*t.ALGORAND_MIN_TX_FEE,(v=[])[ln.ASSET_TRANSFER_TXN]=h,v[ln.APP_CALL_TXN]=T,y=t.assignGroupID(v),e.abrupt("return",[{txn:y[ln.ASSET_TRANSFER_TXN],signers:[a]},{txn:y[ln.APP_CALL_TXN],signers:[a]}]);case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Bn(){return(Bn=I(m().mark((function t(e){var n,r,s,a,o,i,u,c;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.client,s=e.txGroup,a=e.signedTxns,t.next=3,rt(r,[a]);case 3:return o=t.sent,i=O(o,1),u=i[0].txnID,t.next=8,Ae(r,s);case 8:if(t.t1=n=t.sent,t.t0=null===t.t1,t.t0){t.next=12;break}t.t0=void 0===n;case 12:if(!t.t0){t.next=16;break}t.t2=void 0,t.next=17;break;case 16:t.t2=n.map((function(t){return{assetId:t.txn.txn.xaid,amount:t.txn.txn.aamt}}));case 17:return c=t.t2,t.abrupt("return",{outputAssets:c,txnID:u});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Rn,Mn={getQuote:function(t){var e=t.pool,n=t.reserves,r=t.poolTokenIn,s=BigInt(r),a=kn(s,n),o=a.asset1OutputAmount,i=a.asset2OutputAmount;return{round:n.round,asset1Out:{assetId:e.asset1ID,amount:o},asset2Out:{assetId:e.asset2ID,amount:i},poolTokenIn:{assetId:e.poolTokenID,amount:s}}},getSingleAssetRemoveLiquidityQuote:function(t){var e,n=t.pool,r=t.reserves,s=t.poolTokenIn,a=t.assetOutID,o=t.decimals,i=BigInt(s),u=kn(i,r),c=u.asset1OutputAmount,p=u.asset2OutputAmount,l=n.totalFeeShare;if(a===n.asset1ID){var d=Pn.calculateFixedInputSwap({inputSupply:r.asset2-p,outputSupply:r.asset1-c,swapInputAmount:p,totalFeeShare:l,decimals:o}),f=d.swapOutputAmount,m=d.totalFeeAmount,g=d.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:c+f},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:f},swapFees:{assetId:n.asset2ID,amount:m},priceImpact:g}}}else{if(a!==n.asset2ID)throw new Error("assetOutID must be one of the pool assets");var I=Pn.calculateFixedInputSwap({inputSupply:r.asset1-c,outputSupply:r.asset2-p,swapInputAmount:c,totalFeeShare:l,decimals:o}),A=I.swapOutputAmount,x=I.totalFeeAmount,h=I.priceImpact;e={round:r.round,assetOut:{assetId:a,amount:p+A},poolTokenIn:{assetId:n.poolTokenID,amount:i},internalSwapQuote:{amountIn:{assetId:n.asset2ID,amount:p},amountOut:{assetId:n.asset1ID,amount:A},swapFees:{assetId:n.asset2ID,amount:x},priceImpact:h}}}return e},generateTxns:function(t){return Ln.apply(this,arguments)},generateSingleAssetOutTxns:function(t){return Fn.apply(this,arguments)},signTxns:function(t){var e=t.txGroup;return(0,t.initiatorSigner)([e])},execute:function(t){return Bn.apply(this,arguments)}},Cn=(T(Rn={},At.V1_1,An),T(Rn,At.V2,Mn),Rn),Xn=3n,jn=1000n,Vn=function(t){return t[t.FEE_TXN_INDEX=0]="FEE_TXN_INDEX",t[t.VALIDATOR_APP_CALL_TXN_INDEX=1]="VALIDATOR_APP_CALL_TXN_INDEX",t[t.ASSET_IN_TXN_INDEX=2]="ASSET_IN_TXN_INDEX",t[t.ASSET_OUT_TXN_INDEX=3]="ASSET_OUT_TXN_INDEX",t}(Vn||{});function Qn(){return(Qn=I(m().mark((function e(n){var r,s,a,o,i,u,c,p;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.pool,s=n.txGroup,a=n.initiatorSigner,e.next=3,a([s]);case 3:return o=e.sent,i=O(o,2),u=i[0],c=i[1],p=s.map((function(e,n){return n===Vn.FEE_TXN_INDEX?u:n===Vn.ASSET_IN_TXN_INDEX?c:t.signLogicSigTransactionObject(e.txn,r.account.lsig).blob})),e.abrupt("return",p);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Un(){return(Un=I(m().mark((function e(r){var s,a,o,i,u,c,p,l,d,f,g,I,A,x,h,T,v,y;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=r.client,a=r.pool,o=r.swapType,i=r.assetIn,u=r.assetOut,c=r.slippage,p=r.initiatorAddr,l=a.account.address(),(d=[a.asset1ID,a.asset2ID]).includes(i.id)&&d.includes(u.id)&&i.id!==u.id){e.next=5;break}throw new X({pool:a,assetIn:i,assetOut:u},"Input asset (#".concat(i.id,") and output asset (#").concat(u.id,") provided to generate transactions do not belong to the pool ").concat(l,"."));case 5:return e.next=7,s.getTransactionParams().do();case 7:return f=e.sent,g=[ut("swap"),o===xn.FixedInput?ut("fi"):ut("fo")],I=t.makeApplicationNoOpTxnFromObject({from:l,appIndex:a.validatorAppID,appArgs:g,accounts:[p],note:Tt.getAppCallTxnNoteWithClientName(At.V1_1),foreignAssets:a.asset2ID==ct?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:f}),A=o===xn.FixedOutput?H("positive",c,i.amount):i.amount,x=i.id===ct?t.makePaymentTxnWithSuggestedParamsFromObject({from:p,to:l,amount:A,suggestedParams:f}):t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:p,to:l,assetIndex:i.id,amount:A,suggestedParams:f}),h=o===xn.FixedInput?H("negative",c,u.amount):u.amount,T=u.id===ct?t.makePaymentTxnWithSuggestedParamsFromObject({from:l,to:p,amount:h,suggestedParams:f}):t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:l,to:p,assetIndex:u.id,amount:h,suggestedParams:f}),v=t.makePaymentTxnWithSuggestedParamsFromObject({from:p,to:l,amount:I.fee+T.fee,note:n,suggestedParams:f}),y=t.assignGroupID([v,I,x,T]),e.abrupt("return",[{txn:y[0],signers:[p]},{txn:y[1],signers:[l]},{txn:y[2],signers:[p]},{txn:y[3],signers:[l]}]);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Gn(t){var e=t.pool,n=t.reserves,r=t.assetIn,s=t.decimals;if(e.status!==Xt.READY)throw new X({pool:e,assetIn:r},"Trying to swap on a non-existent pool");var a,o,i,u=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,o=n.asset1,i=n.asset2;else{if(r.id!==e.asset2ID)throw new X({pool:e,assetIn:r},"Input asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,o=n.asset2,i=n.asset1}var c=u*Xn/jn,p=i-o*i/(o+(u-c));if(p>i)throw new wn;var l={assetIn:{amount:u,decimals:s.assetIn},assetOut:{amount:p,decimals:s.assetOut}};return{round:n.round,assetInID:r.id,assetInAmount:u,assetOutID:a,assetOutAmount:p,swapFee:Number(c),rate:Me(l),priceImpact:Ce(f({inputSupply:o,outputSupply:i},l))}}function Wn(t){return qn.apply(this,arguments)}function qn(){return(qn=I(m().mark((function t(e){var n,r,s,a,o,i,u,c,p,l,d,f,g,I,A,x;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,i=e.initiatorAddr,t.next=3,Bt({client:n,pool:r,accountAddr:i});case 3:return u=t.sent,t.next=6,rt(n,[s]);case 6:return c=t.sent,p=O(c,1),l=p[0],d=l.confirmedRound,f=l.txnID,t.next=13,Bt({client:n,pool:r,accountAddr:i});case 13:return g=t.sent,o.id===r.asset1ID?(I=u.excessAsset1,A=g.excessAsset1):(I=u.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:d,assetInID:a.id,assetInAmount:BigInt(a.amount),assetOutID:o.id,assetOutAmount:BigInt(o.amount)+x,excessAmount:{assetID:o.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:f});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function zn(t){var e=t.pool,n=t.reserves,r=t.assetOut,s=t.decimals;if(e.status!==Xt.READY)throw new X({pool:e,assetOut:r},"Trying to swap on a non-existent pool");var a,o,i,u=BigInt(r.amount);if(r.id===e.asset1ID)a=e.asset2ID,o=n.asset2,i=n.asset1;else{if(r.id!==e.asset2ID)throw new X({pool:e,assetOut:r},"Output asset (#".concat(r.id,") doesn't belong to the pool ").concat(e.account.address(),"."));a=e.asset1ID,o=n.asset1,i=n.asset2}if(u>i)throw new wn;var c=o*i/(i-u)-o,p=c*jn/(jn-Xn),l=p-c,d=Z(s.assetOut,Number(u))/Z(s.assetIn,Number(p)),f=Z(s.assetOut,Number(i))/Z(s.assetIn,Number(o)),m=tt({decimalPlaces:5},Math.abs(d/f-1));return{round:n.round,assetInID:a,assetInAmount:p,assetOutID:r.id,assetOutAmount:u,swapFee:Number(l),rate:d,priceImpact:m}}function Jn(t){return Yn.apply(this,arguments)}function Yn(){return(Yn=I(m().mark((function t(e){var n,r,s,a,o,i,u,c,p,l,d,f,g,I,A,x;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.signedTxns,a=e.assetIn,o=e.assetOut,i=e.initiatorAddr,t.next=3,Bt({client:n,pool:r,accountAddr:i});case 3:return u=t.sent,t.next=6,rt(n,[s]);case 6:return c=t.sent,p=O(c,1),l=p[0],d=l.confirmedRound,f=l.txnID,t.next=13,Bt({client:n,pool:r,accountAddr:i});case 13:return g=t.sent,a.id===r.asset1ID?(I=u.excessAsset1,A=g.excessAsset1):(I=u.excessAsset2,A=g.excessAsset2),(x=A-I)<0n&&(x=0n),t.abrupt("return",{round:d,assetInID:a.id,assetInAmount:BigInt(a.amount)-x,assetOutID:o.id,assetOutAmount:BigInt(o.amount),excessAmount:{assetID:a.id,excessAmountForSwap:x,totalExcessAmount:A},txnID:f});case 18:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Kn(){return(Kn=I(m().mark((function t(e){var n,r,s,a,o,i,u,c,p,l;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.client,r=e.pool,s=e.swapType,a=e.txGroup,o=e.signedTxns,i=e.initiatorAddr,r.status===Xt.READY){t.next=3;break}throw new X({pool:r,swapType:s,txGroup:a},"Trying to swap on a non-existent pool");case 3:if(t.prev=3,u={id:a[Vn.ASSET_IN_TXN_INDEX].txn.assetIndex||ct,amount:a[Vn.ASSET_IN_TXN_INDEX].txn.amount},c={id:a[Vn.ASSET_OUT_TXN_INDEX].txn.assetIndex||ct,amount:a[Vn.ASSET_OUT_TXN_INDEX].txn.amount},s!==xn.FixedInput){t.next=12;break}return t.next=9,Wn({client:n,pool:r,signedTxns:o,assetIn:u,assetOut:c,initiatorAddr:i});case 9:p=t.sent,t.next=15;break;case 12:return t.next=14,Jn({client:n,pool:r,signedTxns:o,assetIn:u,assetOut:c,initiatorAddr:i});case 14:p=t.sent;case 15:return t.abrupt("return",f(f({},p),{},{groupID:ot(a),fees:at(a)}));case 18:throw t.prev=18,t.t0=t.catch(3),"SlippageTolerance"===(l=new X(t.t0,"We encountered something unexpected while swapping. Try again later.")).type&&l.setMessage("The swap failed due to too much slippage in the price. Please adjust the slippage tolerance and try again."),l;case 23:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}var Hn,Zn={getQuote:function(t,e,n,r,s){return t===xn.FixedInput?Gn({pool:e,reserves:n,assetIn:r,decimals:s}):zn({pool:e,reserves:n,assetOut:r,decimals:s})},getFixedInputSwapQuote:Gn,getFixedOutputSwapQuote:zn,generateTxns:function(t){return Un.apply(this,arguments)},signTxns:function(t){return Qn.apply(this,arguments)},execute:function(t){return Kn.apply(this,arguments)},executeFixedOutputSwap:Jn},$n=4*t.ALGORAND_MIN_TX_FEE;function tr(t){return Promise.allSettled(t).then((function(t){if(t.every((function(t){return"rejected"===t.status&&t.reason instanceof wn})))throw new wn;return t.filter((function(t){return"fulfilled"===t.status&&void 0!==t.value.quote})).map((function(t){return t.value}))}))}function er(){return(er=I(m().mark((function t(e){var n,r,s,a,o,i;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetIn:{amount:a,id:Number(r.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===At.V1_1?Zn.getFixedInputSwapQuote(i):Pn.getFixedInputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,tr(o);case 4:return i=t.sent,t.abrupt("return",rr(i));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function nr(){return(nr=I(m().mark((function t(e){var n,r,s,a,o,i;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.pools,r=e.assetIn,s=e.assetOut,a=e.amount,o=n.map((function(t){return new Promise((function(e,n){var o,i={pool:t.info,assetOut:{amount:a,id:Number(s.id)},decimals:{assetIn:r.decimals,assetOut:s.decimals},reserves:t.reserves};try{o=t.info.contractVersion===At.V1_1?Zn.getFixedOutputSwapQuote(i):Pn.getFixedOutputSwapQuote(i),e({pool:t,quote:o})}catch(t){n(t)}}))})),t.next=4,tr(o);case 4:return i=t.sent,t.abrupt("return",rr(i));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function rr(t){return t.filter((function(t){return!te(t.pool.reserves)})).sort((function(t,e){return e.quote.rate-t.quote.rate}))[0]}var sr=(T(Hn={},At.V1_1,Zn),T(Hn,At.V2,Pn),T(Hn,"getQuote",(function(t){if(t.pools.every((function(t){return te(t.reserves)})))throw new Error("No pools available for swap");return t.type===xn.FixedInput?function(t){return er.apply(this,arguments)}(t):function(t){return nr.apply(this,arguments)}(t)})),T(Hn,"generateTxns",(function(t){return t.pool.contractVersion===At.V1_1?Zn.generateTxns(t):Pn.generateTxns(t)})),T(Hn,"signTxns",(function(t){return t.pool.contractVersion===At.V1_1?Zn.signTxns(t):Pn.signTxns(t)})),T(Hn,"execute",(function(t){return t.contractVersion===At.V1_1?Zn.execute(t):Pn.execute(t)})),Hn);function ar(){return(ar=I(m().mark((function t(e){var n,r,s,a,o,i,u,c,p,l;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.client,r=e.pool,s=e.txGroup,a=e.initiatorSigner,t.prev=1,t.next=4,or({txGroup:s,pool:r,initiatorSigner:a});case 4:return o=t.sent,t.next=7,rt(n,[o]);case 7:return i=t.sent,u=O(i,1),c=u[0],p=c.txnID,l=c.confirmedRound,t.abrupt("return",{fees:at(s),confirmedRound:l,txnID:p,groupID:ot(s)});case 15:throw t.prev=15,t.t0=t.catch(1),new X(t.t0,"We encountered something unexpected while redeeming. Try again later.");case 18:case"end":return t.stop()}}),t,null,[[1,15]])})))).apply(this,arguments)}function or(t){return ir.apply(this,arguments)}function ir(){return(ir=I(m().mark((function e(n){var r,s,a,o,i,u,c,p;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.txGroup,s=n.pool,a=n.initiatorSigner,e.next=3,a([r]);case 3:return o=e.sent,i=O(o,1),u=i[0],c=s.account.lsig,p=r.map((function(e,n){return 0===n?u:t.signLogicSigTransactionObject(e.txn,c).blob})),e.abrupt("return",p);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ur(){return ur=I(m().mark((function e(n){var r,s,a,o,i,u;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.data,a=n.initiatorSigner,e.prev=1,o=s.map((function(t){var e=t.txGroup,n=t.pool;return{txns:e,txnFees:at(e),groupID:ot(e),lsig:n.account.lsig}})),e.next=5,a(o.map((function(t){return t.txns})));case 5:return i=e.sent,u=Promise.all(o.map((function(e,n){return new Promise(function(){var s=I(m().mark((function s(a,o){var u,c,p,l,d,f;return m().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,u=e.txns.map((function(r,s){return 0===s?i[n]:t.signLogicSigTransactionObject(r.txn,e.lsig).blob})),s.next=4,rt(r,[u]);case 4:c=s.sent,p=O(c,1),l=p[0],d=l.txnID,f=l.confirmedRound,a({fees:e.txnFees,groupID:e.groupID,txnID:d,confirmedRound:f}),s.next=15;break;case 12:s.prev=12,s.t0=s.catch(0),o(s.t0);case 15:case"end":return s.stop()}}),s,null,[[0,12]])})));return function(t,e){return s.apply(this,arguments)}}())}))),e.abrupt("return",u);case 10:throw e.prev=10,e.t0=e.catch(1),new X(e.t0,"We encountered something unexpected while redeeming. Try again later.");case 13:case"end":return e.stop()}}),e,null,[[1,10]])}))),ur.apply(this,arguments)}function cr(){return(cr=I(m().mark((function e(r){var s,a,o,i,u,c,p,l,d,f,g;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=r.client,a=r.pool,o=r.assetID,i=r.assetOut,u=r.initiatorAddr,e.next=3,s.getTransactionParams().do();case 3:return c=e.sent,p=a.account.address(),l=t.makeApplicationNoOpTxnFromObject({from:p,appIndex:a.validatorAppID,appArgs:[ut("redeem")],note:Tt.getAppCallTxnNoteWithClientName(a.contractVersion),accounts:[u],foreignAssets:0==a.asset2ID?[a.asset1ID,a.poolTokenID]:[a.asset1ID,a.asset2ID,a.poolTokenID],suggestedParams:c}),d=0===o?t.makePaymentTxnWithSuggestedParamsFromObject({from:p,to:u,amount:BigInt(i),suggestedParams:c}):t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:p,to:u,assetIndex:o,amount:BigInt(i),suggestedParams:c}),f=t.makePaymentTxnWithSuggestedParamsFromObject({from:u,to:p,amount:l.fee+d.fee,note:n,suggestedParams:c}),g=t.assignGroupID([f,l,d]),e.abrupt("return",[{txn:g[0],signers:[u]},{txn:g[1],signers:[p]},{txn:g[2],signers:[p]}]);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pr(e){var n=e.suggestedParams,r=e.stakingAppID,s=e.initiatorAddr,a=e.liquidityAssetID,o=e.program,i=e.amount,u=t.encodeUint64(i),c=t.encodeUint64(o.id);return t.makeApplicationNoOpTxnFromObject({appIndex:r,from:s,suggestedParams:n,foreignAssets:[a],accounts:[o.accountAddress],appArgs:[ut("commit"),u],note:V([ut("tinymanStaking/v1:b"),c,t.encodeUint64(a),u])})}function lr(){return(lr=I(m().mark((function e(n){var r,s,a,o,i,u,c,p,l,d,f;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.client,s=n.stakingAppID,a=n.program,o=n.requiredAssetID,i=n.liquidityAssetID,u=n.amount,c=n.initiatorAddr,e.next=3,r.getTransactionParams().do();case 3:if(p=e.sent,l=pr({suggestedParams:p,stakingAppID:s,program:a,liquidityAssetID:i,initiatorAddr:c,amount:u}),d=[l],"number"!=typeof o){e.next=10;break}return f=t.makeApplicationNoOpTxnFromObject({appIndex:s,from:c,suggestedParams:p,foreignAssets:[o],accounts:[a.accountAddress],appArgs:[ut("log_balance")]}),d=t.assignGroupID([l,f]),e.abrupt("return",[{txn:d[0],signers:[c]},{txn:d[1],signers:[c]}]);case 10:return e.abrupt("return",[{txn:d[0],signers:[c]}]);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}exports.ALGO_ASSET=pt,exports.ALGO_ASSET_ID=ct,exports.ASSET_OPT_IN_PROCESS_TXN_COUNT=1,exports.AddLiquidity=an,exports.BASE_MINIMUM_BALANCE=r,exports.Bootstrap=Ne,exports.CONTRACT_VERSION=At,exports.MINIMUM_ADD_LIQUIDITY_AMOUNT=p,exports.MINIMUM_BALANCE_REQUIRED_PER_APP=a,exports.MINIMUM_BALANCE_REQUIRED_PER_ASSET=s,exports.MINIMUM_BALANCE_REQUIRED_PER_BYTE_SCHEMA=u,exports.MINIMUM_BALANCE_REQUIRED_PER_INT_SCHEMA_VALUE=c,exports.OPT_IN_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.OPT_OUT_VALIDATOR_APP_PROCESS_TXN_COUNT=1,exports.POOL_TOKEN_UNIT_NAME=lt,exports.PoolStatus=Xt,exports.REDEEM_PROCESS_TXN_COUNT=3,exports.RemoveLiquidity=Cn,exports.Swap=sr,exports.SwapType=xn,exports.V1_1AddLiquidityTxnIndices=Pe,exports.V1_1_ADD_LIQUIDITY_PROCESS_TXN_COUNT=5,exports.V1_1_REMOVE_LIQUIDITY_TXN_COUNT=un,exports.V2AddLiquidityTxnIndices=Fe,exports.V2AddLiquidityType=Le,exports.V2_REMOVE_LIQUIDITY_APP_CALL_INNER_TXN_COUNT=cn,exports.applySlippageToAmount=H,exports.calculateAccountMinimumRequiredBalance=Lt,exports.combineAndRegroupSignerTxns=function(){for(var e=arguments.length,n=new Array(e),r=0;r=t.minimum_required_balance},exports.isAccountOptedIntoApp=function(t){var e=t.appID;return t.accountAppsLocalState.some((function(t){return t.id===e}))},exports.poolUtils=re,exports.prepareCommitTransactions=function(t){return lr.apply(this,arguments)},exports.redeemAllExcessAsset=function(t){return ur.apply(this,arguments)},exports.redeemExcessAsset=function(t){return ar.apply(this,arguments)},exports.sendAndWaitRawTransaction=rt,exports.sumUpTxnFees=at,exports.tinymanContract_v1_1=bt,exports.tinymanContract_v2=Ot,exports.tinymanJSSDKConfig=Tt; diff --git a/dist/util/account/accountTypes.d.ts b/dist/util/account/accountTypes.d.ts index f9c0bd53..dd698e76 100644 --- a/dist/util/account/accountTypes.d.ts +++ b/dist/util/account/accountTypes.d.ts @@ -33,7 +33,7 @@ export interface AccountInformation { round: number; status: "Offline"; } -export declare type AccountInformationData = AccountInformation & { +export type AccountInformationData = AccountInformation & { minimum_required_balance: number; }; export interface AccountExcessWithinPool { diff --git a/dist/util/commonTypes.d.ts b/dist/util/commonTypes.d.ts index 2d934200..78344e16 100644 --- a/dist/util/commonTypes.d.ts +++ b/dist/util/commonTypes.d.ts @@ -8,5 +8,5 @@ export interface SignerTransaction { */ signers?: string[]; } -export declare type InitiatorSigner = (txGroupList: SignerTransaction[][]) => Promise; -export declare type SupportedNetwork = "testnet" | "mainnet"; +export type InitiatorSigner = (txGroupList: SignerTransaction[][]) => Promise; +export type SupportedNetwork = "testnet" | "mainnet"; diff --git a/dist/util/error/TinymanError.d.ts b/dist/util/error/TinymanError.d.ts index 34e611b8..9038af05 100644 --- a/dist/util/error/TinymanError.d.ts +++ b/dist/util/error/TinymanError.d.ts @@ -1,4 +1,4 @@ -declare type TinymanErrorType = "LogicError" | "SlippageTolerance" | "TransactionError" | "ExceedingExcessAmountCount" | "Unknown"; +type TinymanErrorType = "LogicError" | "SlippageTolerance" | "TransactionError" | "ExceedingExcessAmountCount" | "Unknown"; declare class TinymanError extends Error { data: any; type: TinymanErrorType; diff --git a/dist/util/pool/poolTypes.d.ts b/dist/util/pool/poolTypes.d.ts index 66902dfc..e74db690 100644 --- a/dist/util/pool/poolTypes.d.ts +++ b/dist/util/pool/poolTypes.d.ts @@ -15,7 +15,7 @@ export interface V1PoolInfo { status: PoolStatus; poolTokenID?: number; } -export declare type V2PoolInfo = V1PoolInfo & { +export type V2PoolInfo = V1PoolInfo & { issuedPoolTokens?: bigint; asset1Reserves?: bigint; asset2Reserves?: bigint; diff --git a/dist/util/typeUtils.d.ts b/dist/util/typeUtils.d.ts index c00f6b93..5f2cf2cf 100644 --- a/dist/util/typeUtils.d.ts +++ b/dist/util/typeUtils.d.ts @@ -1 +1 @@ -export declare type ValueOf = T[keyof T]; +export type ValueOf = T[keyof T]; diff --git a/rollup.config.js b/rollup.config.mjs similarity index 100% rename from rollup.config.js rename to rollup.config.mjs From 8866b3926f926a30deba0e9fadd3f733e70c79b2 Mon Sep 17 00:00:00 2001 From: edizcelik Date: Fri, 24 Mar 2023 12:04:04 -0700 Subject: [PATCH 12/14] build: Add new release Github Action --- .github/workflows/new-release.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/new-release.yml diff --git a/.github/workflows/new-release.yml b/.github/workflows/new-release.yml new file mode 100644 index 00000000..171f2699 --- /dev/null +++ b/.github/workflows/new-release.yml @@ -0,0 +1,31 @@ +name: "New Release" + +on: + push: + branches: + - main + +jobs: + publish: + if: github.repository_owner == 'tinymanorg' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 16 + - run: npm install + - run: npm run build + + - id: publish-to-npm + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} # This token should be added from repo settings + + - id: create-gh-release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ steps.publish-to-npm.outputs.version }} + release_name: ${{ steps.publish-to-npm.outputs.version }} \ No newline at end of file From 5e9d0b32248524cf8aa91705f4346d1e8f437806 Mon Sep 17 00:00:00 2001 From: edizcelik Date: Fri, 24 Mar 2023 12:08:53 -0700 Subject: [PATCH 13/14] build(release): Add test step --- .github/workflows/new-release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/new-release.yml b/.github/workflows/new-release.yml index 171f2699..623d2f19 100644 --- a/.github/workflows/new-release.yml +++ b/.github/workflows/new-release.yml @@ -10,11 +10,12 @@ jobs: if: github.repository_owner == 'tinymanorg' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: 16 - run: npm install + - run: npm test - run: npm run build - id: publish-to-npm From ebe8a6bdcdfb2aab2de1cc4da458b26a75c10761 Mon Sep 17 00:00:00 2001 From: Cem KIRAY Date: Mon, 27 Mar 2023 14:05:14 +0200 Subject: [PATCH 14/14] chore: bump up package version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index cac6d699..f1d41b09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tinymanorg/tinyman-js-sdk", - "version": "2.1.0", + "version": "2.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@tinymanorg/tinyman-js-sdk", - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "dependencies": { "algosdk": "^2.1.0", diff --git a/package.json b/package.json index f40c836c..01a33fac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tinymanorg/tinyman-js-sdk", - "version": "2.1.0", + "version": "2.1.1", "description": "Tinyman JS SDK", "author": "Tinyman Core Team", "license": "MIT",