@imtbl/sdk 1.5.3-alpha → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockchain_data.js +2 -2
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/widgets.js +2 -2
- package/dist/checkout.js +4 -4
- package/dist/config.js +1 -1
- package/dist/index.browser.js +13 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +6 -6
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +3 -3
- package/dist/x.js +2 -2
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @license BSD-3-Clause
|
|
7
7
|
* @version 11.2.5
|
|
8
8
|
*/
|
|
9
|
-
let lt=class{constructor(e=0,t=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=n,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){return e.map((e=>[e,this.get(e)]))}evict(e=!1){if(e||this.size>0){const e=this.first;delete this.items[e.key],0==--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){let t;if(this.has(e)){const n=this.items[e];this.ttl>0&&n.expiry<=Date.now()?this.delete(e):(t=n.value,this.set(e,t,!0))}return t}has(e){return e in this.items}keys(){const e=[];let t=this.first;for(;null!==t;)e.push(t.key),t=t.next;return e}set(e,t,n=!1,r=this.resetTtl){let i;if(n||this.has(e)){if(i=this.items[e],i.value=t,!1===n&&r&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==i){const e=this.last,t=i.next,n=i.prev;this.first===i&&(this.first=i.next),i.next=null,i.prev=this.last,e.next=i,null!==n&&(n.next=t),null!==t&&(t.prev=n)}}else this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1==++this.size?this.first=i:this.last.next=i;return this.last=i,this}values(e=this.keys()){return e.map((e=>this.get(e)))}};ut.LRU=lt,ut.lru=function(e=1e3,t=0,n=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof n)throw new TypeError("Invalid resetTtl value");return new lt(e,t,n)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.memorise=void 0;const t=ut,n={max:1e3};e.memorise=(e,i={})=>{const{cache:a,cacheKeyResolver:o=r,onHit:s,lruOptions:u={}}=i,l={...n,...u},c=a||(0,t.lru)(l.max,l.ttl),d=(...t)=>{const n=o(...t),r=c.get(n);if(c.has(n))return s&&s(n,r,c),r;const i=e.apply(this,t);return c.set(n,i),i};return d._cache=c,d},e.default=e.memorise;const r=(...e)=>0===e.length?"no-args":e.map((e=>void 0===e?"undefined":null===e?"null":Array.isArray(e)?`[${r(...e)}]`:"object"==typeof e?`{${r(...i(e))}}`:JSON.stringify(e))).join(","),i=e=>Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1))}(st);var ct={};Object.defineProperty(ct,"__esModule",{value:!0}),ct.clearGlobalNamespace=mt=ct.getGlobalisedValue=void 0;const dt={},ft=()=>"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:dt,pt=e=>`globalise__singleton__${e}`,ht=e=>{const t=ft(),n=pt(e);return t[n]||(t[n]={}),t[n]};var mt=ct.getGlobalisedValue=(e,t,n)=>{((e,t)=>{if("string"!=typeof e)throw"Invalid namespace key";if("string"!=typeof t)throw"Invalid item key"})(e,t);const r=((e,t)=>ht(e)[t]||void 0)(e,t);return void 0!==r?r:(((e,t,n)=>{ht(e)[t]=n})(e,t,n),n)};ct.clearGlobalNamespace=e=>{const t=ft(),n=pt(e);void 0!==t[n]&&delete t[n]};const yt=()=>"undefined"==typeof window;var gt;!function(e){e.RUNTIME_ID="rid",e.PASSPORT_CLIENT_ID="passportClientId",e.ENVIRONMENT="env",e.PUBLISHABLE_API_KEY="pak",e.IDENTITY="uid",e.DOMAIN="domain",e.SDK_VERSION="sdkVersion"}(gt||(gt={}));async function At(e,t){const n=Ue.create({baseURL:"https://api.x.immutable.com"}),r=JSON.stringify(t),i={payload:btoa(r)};return(await n.post(e,i)).data}const bt=()=>!yt()&&window.localStorage,vt=e=>`__IMX-${e}`;function wt(e){if(bt())return(e=>{if(null!==e)try{return JSON.parse(e)}catch(t){return e}})(window.localStorage.getItem(vt(e)))}const xt=(e,t)=>!!bt()&&(window.localStorage.setItem(vt(e),(e=>"string"==typeof e?e:JSON.stringify(e))(t)),!0);var Et;let Tt,Ct;!function(e){e.EVENTS="events",e.RUNTIME="runtime"}(Et||(Et={}));Tt=wt(Et.EVENTS)||[],Ct=wt(Et.RUNTIME)||{};const It=(e,t)=>{Ct={...Ct,[e]:t},xt(Et.RUNTIME,Ct)},St=e=>{const t=[];return Object.entries(e).forEach((([e,n])=>{"string"!=typeof e&&"string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n||t.push([e,n.toString()])})),t},kt="1.5.3-alpha",Ot=()=>yt()?"":window.opener||window.parent!==window?yt()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"":new URL(window.location.href).hostname;let Rt=!1;const Pt=async()=>{Rt=!0;try{const e=St((()=>{if(It(gt.SDK_VERSION,kt),yt())return{browser:"nodejs",sdkVersion:kt};const e=Ot();return e&&It(gt.DOMAIN,e),{sdkVersion:kt,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}})()),t=(e=>{if(void 0!==Ct[e])return Ct[e]})(gt.RUNTIME_ID),n={version:1,data:{runtimeDetails:e,runtimeId:t}},r=await At("/v1/sdk/initialise",n),{runtimeId:i}=r;It(gt.RUNTIME_ID,i)}catch(e){Rt=!1}};function Nt(e){return(...t)=>{try{const n=e(...t);return n instanceof Promise?n.catch((()=>{})):n}catch(e){return}}}const Lt="imtbl__metrics",Mt=(e,t)=>mt(Lt,e,t),Dt=Nt(((e,t)=>{const n=st.memorise(t,{lruOptions:{ttl:1e3,max:1e3}});return mt(Lt,e,n)})("track",((e,t,n)=>{(e=>{Tt.push(e),xt(Et.EVENTS,Tt)})({event:`${e}.${t}`,time:(new Date).toISOString(),...n&&{properties:St(n)}})}))),Ft=Nt((async()=>{if(!1===Rt)return void await Pt();const e=Tt;if(0===e.length)return;const t=e.length,n={version:1,data:{events:e,details:Ct}};var r;await At("/v1/sdk/metrics",n)instanceof Error||(r=t,Tt=Tt.slice(r),xt(Et.EVENTS,Tt))})),jt=async()=>{await Ft(),setTimeout(jt,5e3)};let Bt=!1;const _t=()=>{Bt||(Bt=!0,jt())};"undefined"!=typeof process&&void 0!==process.env.JEST_WORKER_ID||Nt(Mt("startFlushing",_t))();const zt=Nt(Mt("setEnvironment",(e=>{It(gt.ENVIRONMENT,e)})));Nt(Mt("setPassportClientId",(e=>{It(gt.PASSPORT_CLIENT_ID,e)})));var Ut;Nt(Mt("setPublishableApiKey",(e=>{It(gt.PUBLISHABLE_API_KEY,e)}))),function(e){e.PRODUCTION="production",e.SANDBOX="sandbox"}(Ut||(Ut={}));class Wt{environment;rateLimitingKey;apiKey;publishableKey;constructor(e){this.environment=e.environment,zt(e.environment),Dt("config","created_imtbl_config")}}var Ht={exports:{}},Vt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},qt=[],Gt=[],Xt="undefined"!=typeof Uint8Array?Uint8Array:Array,Zt=!1;function Yt(){Zt=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)qt[t]=e[t],Gt[e.charCodeAt(t)]=t;Gt["-".charCodeAt(0)]=62,Gt["_".charCodeAt(0)]=63}function Kt(e,t,n){for(var r,i,a=[],o=t;o<n;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],a.push(qt[(i=r)>>18&63]+qt[i>>12&63]+qt[i>>6&63]+qt[63&i]);return a.join("")}function Qt(e){var t;Zt||Yt();for(var n=e.length,r=n%3,i="",a=[],o=16383,s=0,u=n-r;s<u;s+=o)a.push(Kt(e,s,s+o>u?u:s+o));return 1===r?(t=e[n-1],i+=qt[t>>2],i+=qt[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=qt[t>>10],i+=qt[t>>4&63],i+=qt[t<<2&63],i+="="),a.push(i),a.join("")}function Jt(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<<s)-1,l=u>>1,c=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+e[t+d],d+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+d],d+=f,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=l}return(p?-1:1)*o*Math.pow(2,a-r)}function $t(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<<l)-1,d=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+d>=1?f/u:f*Math.pow(2,1-d))*u>=2&&(o++,u/=2),o+d>=c?(s=0,o=c):o+d>=1?(s=(t*u-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&s,p+=h,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=255&o,p+=h,o/=256,l-=8);e[n+p-h]|=128*m}var en={}.toString,tn=Array.isArray||function(e){return"[object Array]"==en.call(e)};on.TYPED_ARRAY_SUPPORT=void 0===Vt.TYPED_ARRAY_SUPPORT||Vt.TYPED_ARRAY_SUPPORT;var nn=rn();function rn(){return on.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function an(e,t){if(rn()<t)throw new RangeError("Invalid typed array length");return on.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=on.prototype:(null===e&&(e=new on(t)),e.length=t),e}function on(e,t,n){if(!(on.TYPED_ARRAY_SUPPORT||this instanceof on))return new on(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return ln(this,e)}return sn(this,e,t,n)}function sn(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);on.TYPED_ARRAY_SUPPORT?(e=t).__proto__=on.prototype:e=cn(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!on.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|pn(t,n);e=an(e,r);var i=e.write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(fn(t)){var n=0|dn(t.length);return 0===(e=an(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?an(e,0):cn(e,t);if("Buffer"===t.type&&tn(t.data))return cn(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function un(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function ln(e,t){if(un(t),e=an(e,t<0?0:0|dn(t)),!on.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function cn(e,t){var n=t.length<0?0:0|dn(t.length);e=an(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function dn(e){if(e>=rn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+rn().toString(16)+" bytes");return 0|e}function fn(e){return!(null==e||!e._isBuffer)}function pn(e,t){if(fn(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return zn(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Un(e).length;default:if(r)return zn(e).length;t=(""+t).toLowerCase(),r=!0}}function hn(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return On(this,t,n);case"utf8":case"utf-8":return Cn(this,t,n);case"ascii":return Sn(this,t,n);case"latin1":case"binary":return kn(this,t,n);case"base64":return Tn(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rn(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function mn(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function yn(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=on.from(t,r)),fn(t))return 0===t.length?-1:gn(e,t,n,r,i);if("number"==typeof t)return t&=255,on.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):gn(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function gn(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;a<s;a++)if(l(e,a)===l(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===u)return c*o}else-1!==c&&(a-=a-c),c=-1}else for(n+u>s&&(n=s-u),a=n;a>=0;a--){for(var d=!0,f=0;f<u;f++)if(l(e,a+f)!==l(t,f)){d=!1;break}if(d)return a}return-1}function An(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[n+o]=s}return o}function bn(e,t,n,r){return Wn(zn(t,e.length-n),e,n,r)}function vn(e,t,n,r){return Wn(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function wn(e,t,n,r){return vn(e,t,n,r)}function xn(e,t,n,r){return Wn(Un(t),e,n,r)}function En(e,t,n,r){return Wn(function(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function Tn(e,t,n){return 0===t&&n===e.length?Qt(e):Qt(e.slice(t,n))}function Cn(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a,o,s,u,l=e[i],c=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(c=l);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=In)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=In));return n}(r)}on.poolSize=8192,on._augment=function(e){return e.__proto__=on.prototype,e},on.from=function(e,t,n){return sn(null,e,t,n)},on.TYPED_ARRAY_SUPPORT&&(on.prototype.__proto__=Uint8Array.prototype,on.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&on[Symbol.species]),on.alloc=function(e,t,n){return function(e,t,n,r){return un(t),t<=0?an(e,t):void 0!==n?"string"==typeof r?an(e,t).fill(n,r):an(e,t).fill(n):an(e,t)}(null,e,t,n)},on.allocUnsafe=function(e){return ln(null,e)},on.allocUnsafeSlow=function(e){return ln(null,e)},on.isBuffer=Hn,on.compare=function(e,t){if(!fn(e)||!fn(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},on.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},on.concat=function(e,t){if(!tn(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return on.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=on.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!fn(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},on.byteLength=pn,on.prototype._isBuffer=!0,on.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)mn(this,t,t+1);return this},on.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)mn(this,t,t+3),mn(this,t+1,t+2);return this},on.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)mn(this,t,t+7),mn(this,t+1,t+6),mn(this,t+2,t+5),mn(this,t+3,t+4);return this},on.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Cn(this,0,e):hn.apply(this,arguments)},on.prototype.equals=function(e){if(!fn(e))throw new TypeError("Argument must be a Buffer");return this===e||0===on.compare(this,e)},on.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},on.prototype.compare=function(e,t,n,r,i){if(!fn(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),s=Math.min(a,o),u=this.slice(r,i),l=e.slice(t,n),c=0;c<s;++c)if(u[c]!==l[c]){a=u[c],o=l[c];break}return a<o?-1:o<a?1:0},on.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},on.prototype.indexOf=function(e,t,n){return yn(this,e,t,n,!0)},on.prototype.lastIndexOf=function(e,t,n){return yn(this,e,t,n,!1)},on.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return An(this,e,t,n);case"utf8":case"utf-8":return bn(this,e,t,n);case"ascii":return vn(this,e,t,n);case"latin1":case"binary":return wn(this,e,t,n);case"base64":return xn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return En(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},on.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var In=4096;function Sn(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function kn(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function On(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",a=t;a<n;++a)i+=_n(e[a]);return i}function Rn(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}function Pn(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function Nn(e,t,n,r,i,a){if(!fn(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function Ln(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i<a;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function Mn(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i<a;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function Dn(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Fn(e,t,n,r,i){return i||Dn(e,0,n,4),$t(e,t,n,r,23,4),n+4}function jn(e,t,n,r,i){return i||Dn(e,0,n,8),$t(e,t,n,r,52,8),n+8}on.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),on.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=on.prototype;else{var i=t-e;n=new on(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+e]}return n},on.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Pn(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},on.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Pn(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},on.prototype.readUInt8=function(e,t){return t||Pn(e,1,this.length),this[e]},on.prototype.readUInt16LE=function(e,t){return t||Pn(e,2,this.length),this[e]|this[e+1]<<8},on.prototype.readUInt16BE=function(e,t){return t||Pn(e,2,this.length),this[e]<<8|this[e+1]},on.prototype.readUInt32LE=function(e,t){return t||Pn(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},on.prototype.readUInt32BE=function(e,t){return t||Pn(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},on.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Pn(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},on.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Pn(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},on.prototype.readInt8=function(e,t){return t||Pn(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},on.prototype.readInt16LE=function(e,t){t||Pn(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},on.prototype.readInt16BE=function(e,t){t||Pn(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},on.prototype.readInt32LE=function(e,t){return t||Pn(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},on.prototype.readInt32BE=function(e,t){return t||Pn(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},on.prototype.readFloatLE=function(e,t){return t||Pn(e,4,this.length),Jt(this,e,!0,23,4)},on.prototype.readFloatBE=function(e,t){return t||Pn(e,4,this.length),Jt(this,e,!1,23,4)},on.prototype.readDoubleLE=function(e,t){return t||Pn(e,8,this.length),Jt(this,e,!0,52,8)},on.prototype.readDoubleBE=function(e,t){return t||Pn(e,8,this.length),Jt(this,e,!1,52,8)},on.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||Nn(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},on.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||Nn(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},on.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,1,255,0),on.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},on.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,2,65535,0),on.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ln(this,e,t,!0),t+2},on.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,2,65535,0),on.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ln(this,e,t,!1),t+2},on.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,4,4294967295,0),on.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Mn(this,e,t,!0),t+4},on.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,4,4294967295,0),on.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Mn(this,e,t,!1),t+4},on.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Nn(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<n&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},on.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Nn(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},on.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,1,127,-128),on.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},on.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,2,32767,-32768),on.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ln(this,e,t,!0),t+2},on.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,2,32767,-32768),on.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ln(this,e,t,!1),t+2},on.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,4,2147483647,-2147483648),on.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Mn(this,e,t,!0),t+4},on.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),on.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Mn(this,e,t,!1),t+4},on.prototype.writeFloatLE=function(e,t,n){return Fn(this,e,t,!0,n)},on.prototype.writeFloatBE=function(e,t,n){return Fn(this,e,t,!1,n)},on.prototype.writeDoubleLE=function(e,t,n){return jn(this,e,t,!0,n)},on.prototype.writeDoubleBE=function(e,t,n){return jn(this,e,t,!1,n)},on.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,a=r-n;if(this===e&&n<t&&t<r)for(i=a-1;i>=0;--i)e[i+t]=this[i+n];else if(a<1e3||!on.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},on.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!on.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var o=fn(e)?e:zn(new on(e,r).toString()),s=o.length;for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var Bn=/[^+\/0-9A-Za-z-_]/g;function _n(e){return e<16?"0"+e.toString(16):e.toString(16)}function zn(e,t){var n;t=t||1/0;for(var r=e.length,i=null,a=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function Un(e){return function(e){var t,n,r,i,a,o;Zt||Yt();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new Xt(3*s/4-a),r=a>0?s-4:s;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=Gt[e.charCodeAt(t)]<<18|Gt[e.charCodeAt(t+1)]<<12|Gt[e.charCodeAt(t+2)]<<6|Gt[e.charCodeAt(t+3)],o[u++]=i>>16&255,o[u++]=i>>8&255,o[u++]=255&i;return 2===a?(i=Gt[e.charCodeAt(t)]<<2|Gt[e.charCodeAt(t+1)]>>4,o[u++]=255&i):1===a&&(i=Gt[e.charCodeAt(t)]<<10|Gt[e.charCodeAt(t+1)]<<4|Gt[e.charCodeAt(t+2)]>>2,o[u++]=i>>8&255,o[u++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Bn,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Wn(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Hn(e){return null!=e&&(!!e._isBuffer||Vn(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Vn(e.slice(0,0))}(e))}function Vn(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var qn=Object.freeze({__proto__:null,Buffer:on,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),on.alloc(+e)},isBuffer:Hn,kMaxLength:nn}),Gn=ot(qn);!function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var a;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Gn.Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}function u(e,t,r,i){for(var a=0,o=0,s=Math.min(e.length,r),u=t;u<s;u++){var l=e.charCodeAt(u)-48;a*=i,o=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&o<i,"Invalid character"),a+=o}return a}function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===r)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,a=0,o=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,o=a%r,s=Math.min(a,a-o)+n,l=0,c=n;c<s;c+=r)l=u(e,c,c+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==o){var d=1;for(l=u(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){l(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(e){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<i|a)).toString(16);a=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),r=0!==a||o!==this.length-1?d[6-u.length]+u+r:u+r}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],c=p[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modrn(c).toString(e);r=(h=h.idivn(c)).isZero()?m+r:d[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function h(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,u=o/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var c=u>>>26,d=67108863&u,f=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=f;p++){var h=l-p|0;c+=(o=(i=0|e.words[h])*(a=0|t.words[p])+d)/67108864|0,d=67108863&o}n.words[l]=0|d,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,a);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n++]=255&o,n<e.length&&(e[n++]=o>>8&255),n<e.length&&(e[n++]=o>>16&255),6===a?(n<e.length&&(e[n++]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n--]=255&o,n>=0&&(e[n--]=o>>8&255),n>=0&&(e[n--]=o>>16&255),6===a?(n>=0&&(e[n--]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(0|n.words[a])+(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!==i&&a<n.length;a++)t=(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var a=0,o=0;o<r.length;o++)a=(t=(0|n.words[o])-(0|r.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<n.length;o++)a=(t=(0|n.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=Math.max(this.length,o),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,n){var r,i,a,o=e.words,s=t.words,u=n.words,l=0,c=0|o[0],d=8191&c,f=c>>>13,p=0|o[1],h=8191&p,m=p>>>13,y=0|o[2],g=8191&y,A=y>>>13,b=0|o[3],v=8191&b,w=b>>>13,x=0|o[4],E=8191&x,T=x>>>13,C=0|o[5],I=8191&C,S=C>>>13,k=0|o[6],O=8191&k,R=k>>>13,P=0|o[7],N=8191&P,L=P>>>13,M=0|o[8],D=8191&M,F=M>>>13,j=0|o[9],B=8191&j,_=j>>>13,z=0|s[0],U=8191&z,W=z>>>13,H=0|s[1],V=8191&H,q=H>>>13,G=0|s[2],X=8191&G,Z=G>>>13,Y=0|s[3],K=8191&Y,Q=Y>>>13,J=0|s[4],$=8191&J,ee=J>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,fe=ce>>>13,pe=0|s[9],he=8191&pe,me=pe>>>13;n.negative=e.negative^t.negative,n.length=19;var ye=(l+(r=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,W))+Math.imul(f,U)|0))<<13)|0;l=((a=Math.imul(f,W))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(h,U),i=(i=Math.imul(h,W))+Math.imul(m,U)|0,a=Math.imul(m,W);var ge=(l+(r=r+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,q)|0)+Math.imul(f,V)|0))<<13)|0;l=((a=a+Math.imul(f,q)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,U),i=(i=Math.imul(g,W))+Math.imul(A,U)|0,a=Math.imul(A,W),r=r+Math.imul(h,V)|0,i=(i=i+Math.imul(h,q)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,q)|0;var Ae=(l+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,X)|0))<<13)|0;l=((a=a+Math.imul(f,Z)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,W))+Math.imul(w,U)|0,a=Math.imul(w,W),r=r+Math.imul(g,V)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(A,V)|0,a=a+Math.imul(A,q)|0,r=r+Math.imul(h,X)|0,i=(i=i+Math.imul(h,Z)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,Z)|0;var be=(l+(r=r+Math.imul(d,K)|0)|0)+((8191&(i=(i=i+Math.imul(d,Q)|0)+Math.imul(f,K)|0))<<13)|0;l=((a=a+Math.imul(f,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,W))+Math.imul(T,U)|0,a=Math.imul(T,W),r=r+Math.imul(v,V)|0,i=(i=i+Math.imul(v,q)|0)+Math.imul(w,V)|0,a=a+Math.imul(w,q)|0,r=r+Math.imul(g,X)|0,i=(i=i+Math.imul(g,Z)|0)+Math.imul(A,X)|0,a=a+Math.imul(A,Z)|0,r=r+Math.imul(h,K)|0,i=(i=i+Math.imul(h,Q)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,Q)|0;var ve=(l+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;l=((a=a+Math.imul(f,ee)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(I,U),i=(i=Math.imul(I,W))+Math.imul(S,U)|0,a=Math.imul(S,W),r=r+Math.imul(E,V)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(T,V)|0,a=a+Math.imul(T,q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(w,X)|0,a=a+Math.imul(w,Z)|0,r=r+Math.imul(g,K)|0,i=(i=i+Math.imul(g,Q)|0)+Math.imul(A,K)|0,a=a+Math.imul(A,Q)|0,r=r+Math.imul(h,$)|0,i=(i=i+Math.imul(h,ee)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,ee)|0;var we=(l+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;l=((a=a+Math.imul(f,re)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,W))+Math.imul(R,U)|0,a=Math.imul(R,W),r=r+Math.imul(I,V)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(T,X)|0,a=a+Math.imul(T,Z)|0,r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,Q)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(A,$)|0,a=a+Math.imul(A,ee)|0,r=r+Math.imul(h,ne)|0,i=(i=i+Math.imul(h,re)|0)+Math.imul(m,ne)|0,a=a+Math.imul(m,re)|0;var xe=(l+(r=r+Math.imul(d,ae)|0)|0)+((8191&(i=(i=i+Math.imul(d,oe)|0)+Math.imul(f,ae)|0))<<13)|0;l=((a=a+Math.imul(f,oe)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,W))+Math.imul(L,U)|0,a=Math.imul(L,W),r=r+Math.imul(O,V)|0,i=(i=i+Math.imul(O,q)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,q)|0,r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,Z)|0,r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(T,K)|0,a=a+Math.imul(T,Q)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(w,$)|0,a=a+Math.imul(w,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(A,ne)|0,a=a+Math.imul(A,re)|0,r=r+Math.imul(h,ae)|0,i=(i=i+Math.imul(h,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Ee=(l+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(f,ue)|0))<<13)|0;l=((a=a+Math.imul(f,le)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(D,U),i=(i=Math.imul(D,W))+Math.imul(F,U)|0,a=Math.imul(F,W),r=r+Math.imul(N,V)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(L,V)|0,a=a+Math.imul(L,q)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,Z)|0,r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(S,K)|0,a=a+Math.imul(S,Q)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(w,ne)|0,a=a+Math.imul(w,re)|0,r=r+Math.imul(g,ae)|0,i=(i=i+Math.imul(g,oe)|0)+Math.imul(A,ae)|0,a=a+Math.imul(A,oe)|0,r=r+Math.imul(h,ue)|0,i=(i=i+Math.imul(h,le)|0)+Math.imul(m,ue)|0,a=a+Math.imul(m,le)|0;var Te=(l+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;l=((a=a+Math.imul(f,fe)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(B,U),i=(i=Math.imul(B,W))+Math.imul(_,U)|0,a=Math.imul(_,W),r=r+Math.imul(D,V)|0,i=(i=i+Math.imul(D,q)|0)+Math.imul(F,V)|0,a=a+Math.imul(F,q)|0,r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(L,X)|0,a=a+Math.imul(L,Z)|0,r=r+Math.imul(O,K)|0,i=(i=i+Math.imul(O,Q)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,Q)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(T,ne)|0,a=a+Math.imul(T,re)|0,r=r+Math.imul(v,ae)|0,i=(i=i+Math.imul(v,oe)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,oe)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,le)|0)+Math.imul(A,ue)|0,a=a+Math.imul(A,le)|0,r=r+Math.imul(h,de)|0,i=(i=i+Math.imul(h,fe)|0)+Math.imul(m,de)|0,a=a+Math.imul(m,fe)|0;var Ce=(l+(r=r+Math.imul(d,he)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(f,he)|0))<<13)|0;l=((a=a+Math.imul(f,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(_,V)|0,a=Math.imul(_,q),r=r+Math.imul(D,X)|0,i=(i=i+Math.imul(D,Z)|0)+Math.imul(F,X)|0,a=a+Math.imul(F,Z)|0,r=r+Math.imul(N,K)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(L,K)|0,a=a+Math.imul(L,Q)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(S,ne)|0,a=a+Math.imul(S,re)|0,r=r+Math.imul(E,ae)|0,i=(i=i+Math.imul(E,oe)|0)+Math.imul(T,ae)|0,a=a+Math.imul(T,oe)|0,r=r+Math.imul(v,ue)|0,i=(i=i+Math.imul(v,le)|0)+Math.imul(w,ue)|0,a=a+Math.imul(w,le)|0,r=r+Math.imul(g,de)|0,i=(i=i+Math.imul(g,fe)|0)+Math.imul(A,de)|0,a=a+Math.imul(A,fe)|0;var Ie=(l+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(m,he)|0))<<13)|0;l=((a=a+Math.imul(m,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(B,X),i=(i=Math.imul(B,Z))+Math.imul(_,X)|0,a=Math.imul(_,Z),r=r+Math.imul(D,K)|0,i=(i=i+Math.imul(D,Q)|0)+Math.imul(F,K)|0,a=a+Math.imul(F,Q)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,a=a+Math.imul(R,re)|0,r=r+Math.imul(I,ae)|0,i=(i=i+Math.imul(I,oe)|0)+Math.imul(S,ae)|0,a=a+Math.imul(S,oe)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(T,ue)|0,a=a+Math.imul(T,le)|0,r=r+Math.imul(v,de)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(w,de)|0,a=a+Math.imul(w,fe)|0;var Se=(l+(r=r+Math.imul(g,he)|0)|0)+((8191&(i=(i=i+Math.imul(g,me)|0)+Math.imul(A,he)|0))<<13)|0;l=((a=a+Math.imul(A,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(B,K),i=(i=Math.imul(B,Q))+Math.imul(_,K)|0,a=Math.imul(_,Q),r=r+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(F,$)|0,a=a+Math.imul(F,ee)|0,r=r+Math.imul(N,ne)|0,i=(i=i+Math.imul(N,re)|0)+Math.imul(L,ne)|0,a=a+Math.imul(L,re)|0,r=r+Math.imul(O,ae)|0,i=(i=i+Math.imul(O,oe)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,oe)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,le)|0)+Math.imul(S,ue)|0,a=a+Math.imul(S,le)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(T,de)|0,a=a+Math.imul(T,fe)|0;var ke=(l+(r=r+Math.imul(v,he)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(w,he)|0))<<13)|0;l=((a=a+Math.imul(w,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,ee))+Math.imul(_,$)|0,a=Math.imul(_,ee),r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul(F,ne)|0,a=a+Math.imul(F,re)|0,r=r+Math.imul(N,ae)|0,i=(i=i+Math.imul(N,oe)|0)+Math.imul(L,ae)|0,a=a+Math.imul(L,oe)|0,r=r+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,le)|0)+Math.imul(R,ue)|0,a=a+Math.imul(R,le)|0,r=r+Math.imul(I,de)|0,i=(i=i+Math.imul(I,fe)|0)+Math.imul(S,de)|0,a=a+Math.imul(S,fe)|0;var Oe=(l+(r=r+Math.imul(E,he)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(T,he)|0))<<13)|0;l=((a=a+Math.imul(T,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(B,ne),i=(i=Math.imul(B,re))+Math.imul(_,ne)|0,a=Math.imul(_,re),r=r+Math.imul(D,ae)|0,i=(i=i+Math.imul(D,oe)|0)+Math.imul(F,ae)|0,a=a+Math.imul(F,oe)|0,r=r+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(L,ue)|0,a=a+Math.imul(L,le)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,a=a+Math.imul(R,fe)|0;var Re=(l+(r=r+Math.imul(I,he)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(S,he)|0))<<13)|0;l=((a=a+Math.imul(S,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(B,ae),i=(i=Math.imul(B,oe))+Math.imul(_,ae)|0,a=Math.imul(_,oe),r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,le)|0)+Math.imul(F,ue)|0,a=a+Math.imul(F,le)|0,r=r+Math.imul(N,de)|0,i=(i=i+Math.imul(N,fe)|0)+Math.imul(L,de)|0,a=a+Math.imul(L,fe)|0;var Pe=(l+(r=r+Math.imul(O,he)|0)|0)+((8191&(i=(i=i+Math.imul(O,me)|0)+Math.imul(R,he)|0))<<13)|0;l=((a=a+Math.imul(R,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(B,ue),i=(i=Math.imul(B,le))+Math.imul(_,ue)|0,a=Math.imul(_,le),r=r+Math.imul(D,de)|0,i=(i=i+Math.imul(D,fe)|0)+Math.imul(F,de)|0,a=a+Math.imul(F,fe)|0;var Ne=(l+(r=r+Math.imul(N,he)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(L,he)|0))<<13)|0;l=((a=a+Math.imul(L,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(B,de),i=(i=Math.imul(B,fe))+Math.imul(_,de)|0,a=Math.imul(_,fe);var Le=(l+(r=r+Math.imul(D,he)|0)|0)+((8191&(i=(i=i+Math.imul(D,me)|0)+Math.imul(F,he)|0))<<13)|0;l=((a=a+Math.imul(F,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Me=(l+(r=Math.imul(B,he))|0)+((8191&(i=(i=Math.imul(B,me))+Math.imul(_,he)|0))<<13)|0;return l=((a=Math.imul(_,me))+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,u[0]=ye,u[1]=ge,u[2]=Ae,u[3]=be,u[4]=ve,u[5]=we,u[6]=xe,u[7]=Ee,u[8]=Te,u[9]=Ce,u[10]=Ie,u[11]=Se,u[12]=ke,u[13]=Oe,u[14]=Re,u[15]=Pe,u[16]=Ne,u[17]=Le,u[18]=Me,0!==l&&(u[19]=l,n.length++),n};function y(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,a=0;a<n.length-1;a++){var o=i;i=0;for(var s=67108863&r,u=Math.min(a,t.length-1),l=Math.max(0,a-e.length+1);l<=u;l++){var c=a-l,d=(0|e.words[c])*(0|t.words[l]),f=67108863&d;s=67108863&(f=f+s|0),i+=(o=(o=o+(d/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}n.words[a]=s,r=o,o=i}return 0!==r?n.words[a]=r:n.length--,n._strip()}function g(e,t,n){return y(e,t,n)}Math.imul||(m=h),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?h(this,e,t):n<1024?y(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var a=(0|this.words[i])*e,o=(67108863&a)+(67108863&r);r>>=26,r+=a/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var a=n.sqr();r<t.length;r++,a=a.sqr())0!==t[r]&&(n=n.mul(a));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<r;this.words[t]=u|o,o=s>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=r;if(i-=o,i=Math.max(0,i),u){for(var l=0;l<o;l++)u.words[l]=this.words[l];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;l>=0&&(0!==c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-a|d>>>a,c=d&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,a,o=e.length+r;this._expand(o);var s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((a-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&a}for(;i<this.length-r;i++)s=(a=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&a;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(a=-(0|this.words[i])+s)>>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),a=e,o=0|a.words[a.length-1];0!==(n=26-this._countBits(o))&&(a=a.ushln(n),r.iushln(n),o=0|a.words[a.length-1]);var s,u=r.length-a.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(a,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d=u-1;d>=0;d--){var f=67108864*(0|r.words[a.length+d])+(0|r.words[a.length+d-1]);for(f=Math.min(f/o|0,67108863),r._ishlnsubmul(a,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(a,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(a=s.div.neg()),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:a,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(a=s.div.neg()),{div:a,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,o,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return a<0||1===i&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(r*i+(0|this.words[a]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var a=(0|this.words[i])+67108864*r;this.words[i]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new i(1),o=new i(0),s=new i(0),u=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,p=1;0==(t.words[0]&p)&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var h=0,m=1;0==(r.words[0]&m)&&h<26;++h,m<<=1);if(h>0)for(r.iushrn(h);h-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s),o.isub(u)):(r.isub(t),s.isub(a),u.isub(o))}return{a:s,b:u,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,o=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(t.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(t.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s)):(r.isub(t),s.isub(o))}return(a=0===t.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(e),a},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var a=t;t=n,n=a}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new T(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var A={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function C(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(v,b),v.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(w,b),r(x,b),r(E,b),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(A[e])return A[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new x;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return A[e]=t,t},T.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},T.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},T.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},T.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},T.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,a),f=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),h=o;0!==p.cmp(s);){for(var m=p,y=0;0!==m.cmp(s);y++)m=m.redSqr();n(y<h);var g=this.pow(d,new i(1).iushln(h-y-1));f=f.redMul(g),d=g.redSqr(),p=p.redMul(d),h=y}return f},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var a=n[0],o=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var l=t.words[r],c=u-1;c>=0;c--){var d=l>>c&1;a!==n[0]&&(a=this.sqr(a)),0!==d||0!==o?(o<<=1,o|=d,(4===++s||0===r&&0===c)&&(a=this.mul(a,n[o]),s=0,o=0)):s=0}u=26}return a},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new C(e)},r(C,T),C.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},C.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},C.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(r).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},C.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,it)}(Ht);var Xn=at(Ht.exports);let Zn=!1,Yn=!1;const Kn={debug:1,default:2,info:2,warning:3,error:4,off:5};let Qn=Kn.default,Jn=null;const $n=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var er,tr;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(er||(er={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(tr||(tr={}));const nr="0123456789abcdef";let rr=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==Kn[n]&&this.throwArgumentError("invalid log level name","logLevel",e),Qn>Kn[n]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,n,r){if(Yn)return this.makeError("censored error",n,{});n||(n=e.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e<t.length;e++)n+=nr[t[e]>>4],n+=nr[15&t[e]];i.push(e+"=Uint8Array(0x"+n+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(r[e].toString()))}})),i.push(`code=${n}`),i.push(`version=${this.version}`);const a=t;let o="";switch(n){case tr.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case tr.CALL_EXCEPTION:case tr.INSUFFICIENT_FUNDS:case tr.MISSING_NEW:case tr.NONCE_EXPIRED:case tr.REPLACEMENT_UNDERPRICED:case tr.TRANSACTION_REPLACED:case tr.UNPREDICTABLE_GAS_LIMIT:o=n}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=a,s.code=n,Object.keys(r).forEach((function(e){s[e]=r[e]})),s}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(t,n,r){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:n,value:r})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(t){$n&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:$n})}checkSafeUint53(t,n){"number"==typeof t&&(null==n&&(n="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,n,r){r=r?": "+r:"",t<n&&this.throwError("missing argument"+r,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:n}),t>n&&this.throwError("too many arguments"+r,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:n})}checkNew(t,n){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}checkAbstract(t,n){t===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}static globalLogger(){return Jn||(Jn=new e("logger/5.7.0")),Jn}static setCensorship(t,n){if(!t&&n&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Zn){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Yn=!!t,Zn=!!n}static setLogLevel(t){const n=Kn[t.toLowerCase()];null!=n?Qn=n:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};rr.errors=tr,rr.levels=er;var ir=Object.freeze({__proto__:null,get ErrorCode(){return tr},get LogLevel(){return er},Logger:rr});const ar=new rr("bytes/5.7.0");function or(e){return!!e.toHexString}function sr(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return sr(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function ur(e){return mr(e)&&!(e.length%2)||cr(e)}function lr(e){return"number"==typeof e&&e==e&&e%1==0}function cr(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!lr(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const n=e[t];if(!lr(n)||n<0||n>=256)return!1}return!0}function dr(e,t){if(t||(t={}),"number"==typeof e){ar.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),sr(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),or(e)&&(e=e.toHexString()),mr(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":ar.throwArgumentError("hex data is odd-length","value",e));const r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return sr(new Uint8Array(r))}return cr(e)?sr(new Uint8Array(e)):ar.throwArgumentError("invalid arrayify value","value",e)}function fr(e){const t=e.map((e=>dr(e))),n=t.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(n);return t.reduce(((e,t)=>(r.set(t,e),e+t.length)),0),sr(r)}function pr(e){let t=dr(e);if(0===t.length)return t;let n=0;for(;n<t.length&&0===t[n];)n++;return n&&(t=t.slice(n)),t}function hr(e,t){(e=dr(e)).length>t&&ar.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(e,t-e.length),sr(n)}function mr(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const yr="0123456789abcdef";function gr(e,t){if(t||(t={}),"number"==typeof e){ar.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=yr[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),or(e))return e.toHexString();if(mr(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":ar.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(cr(e)){let t="0x";for(let n=0;n<e.length;n++){let r=e[n];t+=yr[(240&r)>>4]+yr[15&r]}return t}return ar.throwArgumentError("invalid hexlify value","value",e)}function Ar(e){if("string"!=typeof e)e=gr(e);else if(!mr(e)||e.length%2)return null;return(e.length-2)/2}function br(e,t,n){return"string"!=typeof e?e=gr(e):(!mr(e)||e.length%2)&&ar.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function vr(e){let t="0x";return e.forEach((e=>{t+=gr(e).substring(2)})),t}function wr(e){const t=xr(gr(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function xr(e){"string"!=typeof e&&(e=gr(e)),mr(e)||ar.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}function Er(e,t){for("string"!=typeof e?e=gr(e):mr(e)||ar.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&ar.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Tr(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(ur(e)){let n=dr(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=gr(n.slice(0,32)),t.s=gr(n.slice(32,64))):65===n.length?(t.r=gr(n.slice(0,32)),t.s=gr(n.slice(32,64)),t.v=n[64]):ar.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:ar.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=gr(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const n=hr(dr(t._vs),32);t._vs=gr(n);const r=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=r:t.recoveryParam!==r&&ar.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;const i=gr(n);null==t.s?t.s=i:t.s!==i&&ar.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?ar.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const n=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==n&&ar.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&mr(t.r)?t.r=Er(t.r,32):ar.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&mr(t.s)?t.s=Er(t.s,32):ar.throwArgumentError("signature missing or invalid s","signature",e);const n=dr(t.s);n[0]>=128&&ar.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(n[0]|=128);const r=gr(n);t._vs&&(mr(t._vs)||ar.throwArgumentError("signature invalid _vs","signature",e),t._vs=Er(t._vs,32)),null==t._vs?t._vs=r:t._vs!==r&&ar.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Cr(e){return gr(fr([(e=Tr(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var Ir=Object.freeze({__proto__:null,arrayify:dr,concat:fr,hexConcat:vr,hexDataLength:Ar,hexDataSlice:br,hexStripZeros:xr,hexValue:wr,hexZeroPad:Er,hexlify:gr,isBytes:cr,isBytesLike:ur,isHexString:mr,joinSignature:Cr,splitSignature:Tr,stripZeros:pr,zeroPad:hr});const Sr="bignumber/5.7.0";var kr=Xn.BN;const Or=new rr(Sr),Rr={},Pr=9007199254740991;let Nr=!1,Lr=class e{constructor(e,t){e!==Rr&&Or.throwError("cannot call constructor directly; use BigNumber.from",rr.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Dr(Fr(this).fromTwos(e))}toTwos(e){return Dr(Fr(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Dr(Fr(this).add(Fr(e)))}sub(e){return Dr(Fr(this).sub(Fr(e)))}div(t){return e.from(t).isZero()&&jr("division-by-zero","div"),Dr(Fr(this).div(Fr(t)))}mul(e){return Dr(Fr(this).mul(Fr(e)))}mod(e){const t=Fr(e);return t.isNeg()&&jr("division-by-zero","mod"),Dr(Fr(this).umod(t))}pow(e){const t=Fr(e);return t.isNeg()&&jr("negative-power","pow"),Dr(Fr(this).pow(t))}and(e){const t=Fr(e);return(this.isNegative()||t.isNeg())&&jr("unbound-bitwise-result","and"),Dr(Fr(this).and(t))}or(e){const t=Fr(e);return(this.isNegative()||t.isNeg())&&jr("unbound-bitwise-result","or"),Dr(Fr(this).or(t))}xor(e){const t=Fr(e);return(this.isNegative()||t.isNeg())&&jr("unbound-bitwise-result","xor"),Dr(Fr(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&jr("negative-width","mask"),Dr(Fr(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&jr("negative-width","shl"),Dr(Fr(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&jr("negative-width","shr"),Dr(Fr(this).shrn(e))}eq(e){return Fr(this).eq(Fr(e))}lt(e){return Fr(this).lt(Fr(e))}lte(e){return Fr(this).lte(Fr(e))}gt(e){return Fr(this).gt(Fr(e))}gte(e){return Fr(this).gte(Fr(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Fr(this).isZero()}toNumber(){try{return Fr(this).toNumber()}catch(e){jr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Or.throwError("this platform does not support BigInt",rr.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Nr||(Nr=!0,Or.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Or.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",rr.errors.UNEXPECTED_ARGUMENT,{}):Or.throwError("BigNumber.toString does not accept parameters",rr.errors.UNEXPECTED_ARGUMENT,{})),Fr(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(Rr,Mr(t)):t.match(/^-?[0-9]+$/)?new e(Rr,Mr(new kr(t))):Or.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&jr("underflow","BigNumber.from",t),(t>=Pr||t<=-Pr)&&jr("overflow","BigNumber.from",t),e.from(String(t));const n=t;if("bigint"==typeof n)return e.from(n.toString());if(cr(n))return e.from(gr(n));if(n)if(n.toHexString){const t=n.toHexString();if("string"==typeof t)return e.from(t)}else{let t=n._hex;if(null==t&&"BigNumber"===n.type&&(t=n.hex),"string"==typeof t&&(mr(t)||"-"===t[0]&&mr(t.substring(1))))return e.from(t)}return Or.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Mr(e){if("string"!=typeof e)return Mr(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Or.throwArgumentError("invalid hex","value",e),"0x00"===(e=Mr(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function Dr(e){return Lr.from(Mr(e))}function Fr(e){const t=Lr.from(e).toHexString();return"-"===t[0]?new kr("-"+t.substring(3),16):new kr(t.substring(2),16)}function jr(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),Or.throwError(e,rr.errors.NUMERIC_FAULT,r)}const Br=new rr(Sr),_r={},zr=Lr.from(0),Ur=Lr.from(-1);function Wr(e,t,n,r){const i={fault:t,operation:n};return void 0!==r&&(i.value=r),Br.throwError(e,rr.errors.NUMERIC_FAULT,i)}let Hr="0";for(;Hr.length<256;)Hr+=Hr;function Vr(e){if("number"!=typeof e)try{e=Lr.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Hr.substring(0,e):Br.throwArgumentError("invalid decimal size","decimals",e)}function qr(e,t){null==t&&(t=0);const n=Vr(t),r=(e=Lr.from(e)).lt(zr);r&&(e=e.mul(Ur));let i=e.mod(n).toString();for(;i.length<n.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(n).toString();return e=1===n.length?a:a+"."+i,r&&(e="-"+e),e}function Gr(e,t){null==t&&(t=0);const n=Vr(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Br.throwArgumentError("invalid decimal value","value",e);const r="-"===e.substring(0,1);r&&(e=e.substring(1)),"."===e&&Br.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Br.throwArgumentError("too many decimal points","value",e);let a=i[0],o=i[1];for(a||(a="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>n.length-1&&Wr("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<n.length-1;)o+="0";const s=Lr.from(a),u=Lr.from(o);let l=s.mul(n).add(u);return r&&(l=l.mul(Ur)),l}class Xr{constructor(e,t,n,r){e!==_r&&Br.throwError("cannot use FixedFormat constructor; use FixedFormat.from",rr.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=n,this.decimals=r,this.name=(t?"":"u")+"fixed"+String(n)+"x"+String(r),this._multiplier=Vr(r),Object.freeze(this)}static from(e){if(e instanceof Xr)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,n=128,r=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||Br.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],n=parseInt(i[2]),r=parseInt(i[3])}else if(e){const i=(t,n,r)=>null==e[t]?r:(typeof e[t]!==n&&Br.throwArgumentError("invalid fixed format ("+t+" not "+n+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&Br.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&Br.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new Xr(_r,t,n,r)}}class Zr{constructor(e,t,n,r){e!==_r&&Br.throwError("cannot use FixedNumber constructor; use FixedNumber.from",rr.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=t,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Br.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=Gr(this._value,this.format.decimals),n=Gr(e._value,e.format.decimals);return Zr.fromValue(t.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=Gr(this._value,this.format.decimals),n=Gr(e._value,e.format.decimals);return Zr.fromValue(t.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=Gr(this._value,this.format.decimals),n=Gr(e._value,e.format.decimals);return Zr.fromValue(t.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=Gr(this._value,this.format.decimals),n=Gr(e._value,e.format.decimals);return Zr.fromValue(t.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Zr.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(t=t.subUnsafe(Yr.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Zr.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(t=t.addUnsafe(Yr.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&Br.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const n=Zr.from("1"+Hr.substring(0,e),this.format),r=Kr.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&Br.throwArgumentError("invalid byte width","width",e);return Er(Lr.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Zr.fromString(this._value,e)}static fromValue(e,t,n){return null!=n||null==t||function(e){return null!=e&&(Lr.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||mr(e)||"bigint"==typeof e||cr(e))}(t)||(n=t,t=null),null==t&&(t=0),null==n&&(n="fixed"),Zr.fromString(qr(e,t),Xr.from(n))}static fromString(e,t){null==t&&(t="fixed");const n=Xr.from(t),r=Gr(e,n.decimals);!n.signed&&r.lt(zr)&&Wr("unsigned value cannot be negative","overflow","value",e);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=Er(i,n.width/8));const a=qr(r,n.decimals);return new Zr(_r,i,a,n)}static fromBytes(e,t){null==t&&(t="fixed");const n=Xr.from(t);if(dr(e).length>n.width/8)throw new Error("overflow");let r=Lr.from(e);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),a=qr(r,n.decimals);return new Zr(_r,i,a,n)}static from(e,t){if("string"==typeof e)return Zr.fromString(e,t);if(cr(e))return Zr.fromBytes(e,t);try{return Zr.fromValue(e,0,t)}catch(e){if(e.code!==rr.errors.INVALID_ARGUMENT)throw e}return Br.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const Yr=Zr.from(1),Kr=Zr.from("0.5");var Qr=window&&window.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((r=r.apply(e,t||[])).next())}))};const Jr=new rr("properties/5.7.0");function $r(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function ei(e,t){for(let n=0;n<32;n++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function ti(e){return Qr(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const n=e[t];return Promise.resolve(n).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function ni(e,t){e&&"object"==typeof e||Jr.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((n=>{t[n]||Jr.throwArgumentError("invalid object key - "+n,"transaction:"+n,e)}))}function ri(e){const t={};for(const n in e)t[n]=e[n];return t}const ii={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function ai(e){if(null==e||ii[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let n=0;n<t.length;n++){let r=null;try{r=e[t[n]]}catch(e){continue}if(!ai(r))return!1}return!0}return Jr.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function oi(e){if(ai(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>si(e))));if("object"==typeof e){const t={};for(const n in e){const r=e[n];void 0!==r&&$r(t,n,si(r))}return t}return Jr.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function si(e){return oi(e)}let ui=class{constructor(e){for(const t in e)this[t]=si(e[t])}};var li=Object.freeze({__proto__:null,Description:ui,checkProperties:ni,deepCopy:si,defineReadOnly:$r,getStatic:ei,resolveProperties:ti,shallowCopy:ri});const ci="abi/5.7.0",di=new rr(ci),fi={};let pi={calldata:!0,memory:!0,storage:!0},hi={calldata:!0,memory:!0};function mi(e,t){if("bytes"===e||"string"===e){if(pi[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&hi[t])return!0;return(pi[t]||"payable"===t)&&di.throwArgumentError("invalid modifier","name",t),!1}function yi(e,t){for(let n in t)$r(e,n,t[n])}const gi=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Ai=new RegExp(/^(.*)\[([0-9]*)\]$/);let bi=class e{constructor(t,n){t!==fi&&di.throwError("use fromString",rr.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),yi(this,n);let r=this.type.match(Ai);yi(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:e.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=gi.sighash),gi[e]||di.throwArgumentError("invalid format type","format",e),e===gi.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==gi.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===gi.full?", ":",")+")"):t+=this.type,e!==gi.sighash&&(!0===this.indexed&&(t+=" indexed"),e===gi.full&&this.name&&(t+=" "+this.name)),t}static from(t,n){return"string"==typeof t?e.fromString(t,n):e.fromObject(t)}static fromObject(t){return e.isParamType(t)?t:new e(fi,{name:t.name||null,type:Ri(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}static fromString(t,n){return function(t){return e.fromObject({name:t.name,type:t.type,indexed:t.indexed,components:t.components})}(function(e,t){let n=e;function r(t){di.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let n={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(n.indexed=!1),n}e=e.replace(/\s/g," ");let a={type:"",name:"",state:{allowType:!0}},o=a;for(let n=0;n<e.length;n++){let a=e[n];switch(a){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||r(n),o.state.allowType=!1,o.type=Ri(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||r(n),o.indexed=!0,o.name=""),mi(o.type,o.name)&&(o.name=""),o.type=Ri(o.type);let e=o;o=o.parent,o||r(n),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||r(n),o.indexed=!0,o.name=""),mi(o.type,o.name)&&(o.name=""),o.type=Ri(o.type);let s=i(o.parent);o.parent.components.push(s),delete o.parent,o=s;break;case" ":o.state.allowType&&""!==o.type&&(o.type=Ri(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||r(n),o.indexed&&r(n),o.indexed=!0,o.name=""):mi(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||r(n),o.type+=a,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||r(n),o.type+=a,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=a,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=a,delete o.state.allowArray):o.state.readArray?o.type+=a:r(n)}}return o.parent&&di.throwArgumentError("unexpected eof","param",e),delete a.state,"indexed"===o.name?(t||r(n.length-7),o.indexed&&r(n.length-7),o.indexed=!0,o.name=""):mi(o.type,o.name)&&(o.name=""),a.type=Ri(a.type),a}(t,!!n))}static isParamType(e){return!(null==e||!e._isParamType)}};function vi(e,t){return function(e){e=e.trim();let t=[],n="",r=0;for(let i=0;i<e.length;i++){let a=e[i];","===a&&0===r?(t.push(n),n=""):(n+=a,"("===a?r++:")"===a&&(r--,-1===r&&di.throwArgumentError("unbalanced parenthesis","value",e)))}n&&t.push(n);return t}(e).map((e=>bi.fromString(e,t)))}let wi=class e{constructor(e,t){e!==fi&&di.throwError("use a static from method",rr.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),yi(this,t),this._isFragment=!0,Object.freeze(this)}static from(t){return e.isFragment(t)?t:"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isFragment(t))return t;switch(t.type){case"function":return Si.fromObject(t);case"event":return xi.fromObject(t);case"constructor":return Ii.fromObject(t);case"error":return Oi.fromObject(t);case"fallback":case"receive":return null}return di.throwArgumentError("invalid fragment object","value",t)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?xi.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Si.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Ii.fromString(e.trim()):"error"===e.split(" ")[0]?Oi.fromString(e.substring(5).trim()):di.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}},xi=class e extends wi{format(e){if(e||(e=gi.sighash),gi[e]||di.throwArgumentError("invalid format type","format",e),e===gi.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==gi.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===gi.full?", ":",")+") ",e!==gi.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isEventFragment(t))return t;"event"!==t.type&&di.throwArgumentError("invalid event object","value",t);const n={name:Ni(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(bi.fromObject):[],type:"event"};return new e(fi,n)}static fromString(t){let n=t.match(Li);n||di.throwArgumentError("invalid event string","value",t);let r=!1;return n[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":r=!0;break;case"":break;default:di.warn("unknown modifier: "+e)}})),e.fromObject({name:n[1].trim(),anonymous:r,inputs:vi(n[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}};function Ei(e,t){t.gas=null;let n=e.split("@");return 1!==n.length?(n.length>2&&di.throwArgumentError("invalid human-readable ABI signature","value",e),n[1].match(/^[0-9]+$/)||di.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Lr.from(n[1]),n[0]):e}function Ti(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function Ci(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&di.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&di.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||di.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&di.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&di.throwArgumentError("unable to determine stateMutability","value",e),t}let Ii=class e extends wi{format(e){if(e||(e=gi.sighash),gi[e]||di.throwArgumentError("invalid format type","format",e),e===gi.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===gi.sighash&&di.throwError("cannot format a constructor for sighash",rr.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===gi.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isConstructorFragment(t))return t;"constructor"!==t.type&&di.throwArgumentError("invalid constructor object","value",t);let n=Ci(t);n.constant&&di.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(bi.fromObject):[],payable:n.payable,stateMutability:n.stateMutability,gas:t.gas?Lr.from(t.gas):null};return new e(fi,r)}static fromString(t){let n={type:"constructor"},r=(t=Ei(t,n)).match(Li);return r&&"constructor"===r[1].trim()||di.throwArgumentError("invalid constructor string","value",t),n.inputs=vi(r[2].trim(),!1),Ti(r[3].trim(),n),e.fromObject(n)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}},Si=class e extends Ii{format(e){if(e||(e=gi.sighash),gi[e]||di.throwArgumentError("invalid format type","format",e),e===gi.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==gi.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===gi.full?", ":",")+") ",e!==gi.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isFunctionFragment(t))return t;"function"!==t.type&&di.throwArgumentError("invalid function object","value",t);let n=Ci(t);const r={type:t.type,name:Ni(t.name),constant:n.constant,inputs:t.inputs?t.inputs.map(bi.fromObject):[],outputs:t.outputs?t.outputs.map(bi.fromObject):[],payable:n.payable,stateMutability:n.stateMutability,gas:t.gas?Lr.from(t.gas):null};return new e(fi,r)}static fromString(t){let n={type:"function"},r=(t=Ei(t,n)).split(" returns ");r.length>2&&di.throwArgumentError("invalid function string","value",t);let i=r[0].match(Li);if(i||di.throwArgumentError("invalid function signature","value",t),n.name=i[1].trim(),n.name&&Ni(n.name),n.inputs=vi(i[2],!1),Ti(i[3].trim(),n),r.length>1){let e=r[1].match(Li);""==e[1].trim()&&""==e[3].trim()||di.throwArgumentError("unexpected tokens","value",t),n.outputs=vi(e[2],!1)}else n.outputs=[];return e.fromObject(n)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}};function ki(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||di.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}let Oi=class e extends wi{format(e){if(e||(e=gi.sighash),gi[e]||di.throwArgumentError("invalid format type","format",e),e===gi.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==gi.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===gi.full?", ":",")+") ",t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isErrorFragment(t))return t;"error"!==t.type&&di.throwArgumentError("invalid error object","value",t);const n={type:t.type,name:Ni(t.name),inputs:t.inputs?t.inputs.map(bi.fromObject):[]};return ki(new e(fi,n))}static fromString(t){let n={type:"error"},r=t.match(Li);return r||di.throwArgumentError("invalid error signature","value",t),n.name=r[1].trim(),n.name&&Ni(n.name),n.inputs=vi(r[2],!1),ki(e.fromObject(n))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}};function Ri(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Pi=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ni(e){return e&&e.match(Pi)||di.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Li=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Mi=new rr(ci);function Di(e){const t=[],n=function(e,r){if(Array.isArray(r))for(let i in r){const a=e.slice();a.push(i);try{n(a,r[i])}catch(e){t.push({path:a,error:e})}}};return n([],e),t}let Fi=class{constructor(e,t,n,r){this.name=e,this.type=t,this.localName=n,this.dynamic=r}_throwError(e,t){Mi.throwArgumentError(e,this.localName,t)}},ji=class{constructor(e){$r(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return vr(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(fr(e._data))}writeBytes(e){let t=dr(e);const n=t.length%this.wordSize;return n&&(t=fr([t,this._padding.slice(n)])),this._writeData(t)}_getValue(e){let t=dr(Lr.from(e));return t.length>this.wordSize&&Mi.throwError("value out-of-bounds",rr.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=fr([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}};var Bi={exports:{}};
|
|
9
|
+
let lt=class{constructor(e=0,t=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=n,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){return e.map((e=>[e,this.get(e)]))}evict(e=!1){if(e||this.size>0){const e=this.first;delete this.items[e.key],0==--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){let t;if(this.has(e)){const n=this.items[e];this.ttl>0&&n.expiry<=Date.now()?this.delete(e):(t=n.value,this.set(e,t,!0))}return t}has(e){return e in this.items}keys(){const e=[];let t=this.first;for(;null!==t;)e.push(t.key),t=t.next;return e}set(e,t,n=!1,r=this.resetTtl){let i;if(n||this.has(e)){if(i=this.items[e],i.value=t,!1===n&&r&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==i){const e=this.last,t=i.next,n=i.prev;this.first===i&&(this.first=i.next),i.next=null,i.prev=this.last,e.next=i,null!==n&&(n.next=t),null!==t&&(t.prev=n)}}else this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1==++this.size?this.first=i:this.last.next=i;return this.last=i,this}values(e=this.keys()){return e.map((e=>this.get(e)))}};ut.LRU=lt,ut.lru=function(e=1e3,t=0,n=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof n)throw new TypeError("Invalid resetTtl value");return new lt(e,t,n)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.memorise=void 0;const t=ut,n={max:1e3};e.memorise=(e,i={})=>{const{cache:a,cacheKeyResolver:o=r,onHit:s,lruOptions:u={}}=i,l={...n,...u},c=a||(0,t.lru)(l.max,l.ttl),d=(...t)=>{const n=o(...t),r=c.get(n);if(c.has(n))return s&&s(n,r,c),r;const i=e.apply(this,t);return c.set(n,i),i};return d._cache=c,d},e.default=e.memorise;const r=(...e)=>0===e.length?"no-args":e.map((e=>void 0===e?"undefined":null===e?"null":Array.isArray(e)?`[${r(...e)}]`:"object"==typeof e?`{${r(...i(e))}}`:JSON.stringify(e))).join(","),i=e=>Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1))}(st);var ct={};Object.defineProperty(ct,"__esModule",{value:!0}),ct.clearGlobalNamespace=mt=ct.getGlobalisedValue=void 0;const dt={},ft=()=>"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:dt,pt=e=>`globalise__singleton__${e}`,ht=e=>{const t=ft(),n=pt(e);return t[n]||(t[n]={}),t[n]};var mt=ct.getGlobalisedValue=(e,t,n)=>{((e,t)=>{if("string"!=typeof e)throw"Invalid namespace key";if("string"!=typeof t)throw"Invalid item key"})(e,t);const r=((e,t)=>ht(e)[t]||void 0)(e,t);return void 0!==r?r:(((e,t,n)=>{ht(e)[t]=n})(e,t,n),n)};ct.clearGlobalNamespace=e=>{const t=ft(),n=pt(e);void 0!==t[n]&&delete t[n]};const yt=()=>"undefined"==typeof window;var gt;!function(e){e.RUNTIME_ID="rid",e.PASSPORT_CLIENT_ID="passportClientId",e.ENVIRONMENT="env",e.PUBLISHABLE_API_KEY="pak",e.IDENTITY="uid",e.DOMAIN="domain",e.SDK_VERSION="sdkVersion"}(gt||(gt={}));async function At(e,t){const n=Ue.create({baseURL:"https://api.x.immutable.com"}),r=JSON.stringify(t),i={payload:btoa(r)};return(await n.post(e,i)).data}const bt=()=>!yt()&&window.localStorage,vt=e=>`__IMX-${e}`;function wt(e){if(bt())return(e=>{if(null!==e)try{return JSON.parse(e)}catch(t){return e}})(window.localStorage.getItem(vt(e)))}const xt=(e,t)=>!!bt()&&(window.localStorage.setItem(vt(e),(e=>"string"==typeof e?e:JSON.stringify(e))(t)),!0);var Et;let Tt,Ct;!function(e){e.EVENTS="events",e.RUNTIME="runtime"}(Et||(Et={}));Tt=wt(Et.EVENTS)||[],Ct=wt(Et.RUNTIME)||{};const It=(e,t)=>{Ct={...Ct,[e]:t},xt(Et.RUNTIME,Ct)},St=e=>{const t=[];return Object.entries(e).forEach((([e,n])=>{"string"!=typeof e&&"string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n||t.push([e,n.toString()])})),t},kt="1.5.3",Ot=()=>yt()?"":window.opener||window.parent!==window?yt()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"":new URL(window.location.href).hostname;let Rt=!1;const Pt=async()=>{Rt=!0;try{const e=St((()=>{if(It(gt.SDK_VERSION,kt),yt())return{browser:"nodejs",sdkVersion:kt};const e=Ot();return e&&It(gt.DOMAIN,e),{sdkVersion:kt,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}})()),t=(e=>{if(void 0!==Ct[e])return Ct[e]})(gt.RUNTIME_ID),n={version:1,data:{runtimeDetails:e,runtimeId:t}},r=await At("/v1/sdk/initialise",n),{runtimeId:i}=r;It(gt.RUNTIME_ID,i)}catch(e){Rt=!1}};function Nt(e){return(...t)=>{try{const n=e(...t);return n instanceof Promise?n.catch((()=>{})):n}catch(e){return}}}const Lt="imtbl__metrics",Mt=(e,t)=>mt(Lt,e,t),Dt=Nt(((e,t)=>{const n=st.memorise(t,{lruOptions:{ttl:1e3,max:1e3}});return mt(Lt,e,n)})("track",((e,t,n)=>{(e=>{Tt.push(e),xt(Et.EVENTS,Tt)})({event:`${e}.${t}`,time:(new Date).toISOString(),...n&&{properties:St(n)}})}))),Ft=Nt((async()=>{if(!1===Rt)return void await Pt();const e=Tt;if(0===e.length)return;const t=e.length,n={version:1,data:{events:e,details:Ct}};var r;await At("/v1/sdk/metrics",n)instanceof Error||(r=t,Tt=Tt.slice(r),xt(Et.EVENTS,Tt))})),jt=async()=>{await Ft(),setTimeout(jt,5e3)};let Bt=!1;const _t=()=>{Bt||(Bt=!0,jt())};"undefined"!=typeof process&&void 0!==process.env.JEST_WORKER_ID||Nt(Mt("startFlushing",_t))();const zt=Nt(Mt("setEnvironment",(e=>{It(gt.ENVIRONMENT,e)})));Nt(Mt("setPassportClientId",(e=>{It(gt.PASSPORT_CLIENT_ID,e)})));var Ut;Nt(Mt("setPublishableApiKey",(e=>{It(gt.PUBLISHABLE_API_KEY,e)}))),function(e){e.PRODUCTION="production",e.SANDBOX="sandbox"}(Ut||(Ut={}));class Wt{environment;rateLimitingKey;apiKey;publishableKey;constructor(e){this.environment=e.environment,zt(e.environment),Dt("config","created_imtbl_config")}}var Ht={exports:{}},Vt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},qt=[],Gt=[],Xt="undefined"!=typeof Uint8Array?Uint8Array:Array,Zt=!1;function Yt(){Zt=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)qt[t]=e[t],Gt[e.charCodeAt(t)]=t;Gt["-".charCodeAt(0)]=62,Gt["_".charCodeAt(0)]=63}function Kt(e,t,n){for(var r,i,a=[],o=t;o<n;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],a.push(qt[(i=r)>>18&63]+qt[i>>12&63]+qt[i>>6&63]+qt[63&i]);return a.join("")}function Qt(e){var t;Zt||Yt();for(var n=e.length,r=n%3,i="",a=[],o=16383,s=0,u=n-r;s<u;s+=o)a.push(Kt(e,s,s+o>u?u:s+o));return 1===r?(t=e[n-1],i+=qt[t>>2],i+=qt[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=qt[t>>10],i+=qt[t>>4&63],i+=qt[t<<2&63],i+="="),a.push(i),a.join("")}function Jt(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<<s)-1,l=u>>1,c=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+e[t+d],d+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+d],d+=f,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=l}return(p?-1:1)*o*Math.pow(2,a-r)}function $t(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<<l)-1,d=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+d>=1?f/u:f*Math.pow(2,1-d))*u>=2&&(o++,u/=2),o+d>=c?(s=0,o=c):o+d>=1?(s=(t*u-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&s,p+=h,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=255&o,p+=h,o/=256,l-=8);e[n+p-h]|=128*m}var en={}.toString,tn=Array.isArray||function(e){return"[object Array]"==en.call(e)};on.TYPED_ARRAY_SUPPORT=void 0===Vt.TYPED_ARRAY_SUPPORT||Vt.TYPED_ARRAY_SUPPORT;var nn=rn();function rn(){return on.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function an(e,t){if(rn()<t)throw new RangeError("Invalid typed array length");return on.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=on.prototype:(null===e&&(e=new on(t)),e.length=t),e}function on(e,t,n){if(!(on.TYPED_ARRAY_SUPPORT||this instanceof on))return new on(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return ln(this,e)}return sn(this,e,t,n)}function sn(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);on.TYPED_ARRAY_SUPPORT?(e=t).__proto__=on.prototype:e=cn(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!on.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|pn(t,n);e=an(e,r);var i=e.write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(fn(t)){var n=0|dn(t.length);return 0===(e=an(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?an(e,0):cn(e,t);if("Buffer"===t.type&&tn(t.data))return cn(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function un(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function ln(e,t){if(un(t),e=an(e,t<0?0:0|dn(t)),!on.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function cn(e,t){var n=t.length<0?0:0|dn(t.length);e=an(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function dn(e){if(e>=rn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+rn().toString(16)+" bytes");return 0|e}function fn(e){return!(null==e||!e._isBuffer)}function pn(e,t){if(fn(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return zn(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Un(e).length;default:if(r)return zn(e).length;t=(""+t).toLowerCase(),r=!0}}function hn(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return On(this,t,n);case"utf8":case"utf-8":return Cn(this,t,n);case"ascii":return Sn(this,t,n);case"latin1":case"binary":return kn(this,t,n);case"base64":return Tn(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rn(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function mn(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function yn(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=on.from(t,r)),fn(t))return 0===t.length?-1:gn(e,t,n,r,i);if("number"==typeof t)return t&=255,on.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):gn(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function gn(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;a<s;a++)if(l(e,a)===l(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===u)return c*o}else-1!==c&&(a-=a-c),c=-1}else for(n+u>s&&(n=s-u),a=n;a>=0;a--){for(var d=!0,f=0;f<u;f++)if(l(e,a+f)!==l(t,f)){d=!1;break}if(d)return a}return-1}function An(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[n+o]=s}return o}function bn(e,t,n,r){return Wn(zn(t,e.length-n),e,n,r)}function vn(e,t,n,r){return Wn(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function wn(e,t,n,r){return vn(e,t,n,r)}function xn(e,t,n,r){return Wn(Un(t),e,n,r)}function En(e,t,n,r){return Wn(function(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function Tn(e,t,n){return 0===t&&n===e.length?Qt(e):Qt(e.slice(t,n))}function Cn(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a,o,s,u,l=e[i],c=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(c=l);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=In)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=In));return n}(r)}on.poolSize=8192,on._augment=function(e){return e.__proto__=on.prototype,e},on.from=function(e,t,n){return sn(null,e,t,n)},on.TYPED_ARRAY_SUPPORT&&(on.prototype.__proto__=Uint8Array.prototype,on.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&on[Symbol.species]),on.alloc=function(e,t,n){return function(e,t,n,r){return un(t),t<=0?an(e,t):void 0!==n?"string"==typeof r?an(e,t).fill(n,r):an(e,t).fill(n):an(e,t)}(null,e,t,n)},on.allocUnsafe=function(e){return ln(null,e)},on.allocUnsafeSlow=function(e){return ln(null,e)},on.isBuffer=Hn,on.compare=function(e,t){if(!fn(e)||!fn(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},on.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},on.concat=function(e,t){if(!tn(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return on.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=on.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!fn(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},on.byteLength=pn,on.prototype._isBuffer=!0,on.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)mn(this,t,t+1);return this},on.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)mn(this,t,t+3),mn(this,t+1,t+2);return this},on.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)mn(this,t,t+7),mn(this,t+1,t+6),mn(this,t+2,t+5),mn(this,t+3,t+4);return this},on.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Cn(this,0,e):hn.apply(this,arguments)},on.prototype.equals=function(e){if(!fn(e))throw new TypeError("Argument must be a Buffer");return this===e||0===on.compare(this,e)},on.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},on.prototype.compare=function(e,t,n,r,i){if(!fn(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),s=Math.min(a,o),u=this.slice(r,i),l=e.slice(t,n),c=0;c<s;++c)if(u[c]!==l[c]){a=u[c],o=l[c];break}return a<o?-1:o<a?1:0},on.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},on.prototype.indexOf=function(e,t,n){return yn(this,e,t,n,!0)},on.prototype.lastIndexOf=function(e,t,n){return yn(this,e,t,n,!1)},on.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return An(this,e,t,n);case"utf8":case"utf-8":return bn(this,e,t,n);case"ascii":return vn(this,e,t,n);case"latin1":case"binary":return wn(this,e,t,n);case"base64":return xn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return En(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},on.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var In=4096;function Sn(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function kn(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function On(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",a=t;a<n;++a)i+=_n(e[a]);return i}function Rn(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}function Pn(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function Nn(e,t,n,r,i,a){if(!fn(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function Ln(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i<a;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function Mn(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i<a;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function Dn(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Fn(e,t,n,r,i){return i||Dn(e,0,n,4),$t(e,t,n,r,23,4),n+4}function jn(e,t,n,r,i){return i||Dn(e,0,n,8),$t(e,t,n,r,52,8),n+8}on.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),on.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=on.prototype;else{var i=t-e;n=new on(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+e]}return n},on.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Pn(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},on.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Pn(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},on.prototype.readUInt8=function(e,t){return t||Pn(e,1,this.length),this[e]},on.prototype.readUInt16LE=function(e,t){return t||Pn(e,2,this.length),this[e]|this[e+1]<<8},on.prototype.readUInt16BE=function(e,t){return t||Pn(e,2,this.length),this[e]<<8|this[e+1]},on.prototype.readUInt32LE=function(e,t){return t||Pn(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},on.prototype.readUInt32BE=function(e,t){return t||Pn(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},on.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Pn(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},on.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Pn(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},on.prototype.readInt8=function(e,t){return t||Pn(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},on.prototype.readInt16LE=function(e,t){t||Pn(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},on.prototype.readInt16BE=function(e,t){t||Pn(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},on.prototype.readInt32LE=function(e,t){return t||Pn(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},on.prototype.readInt32BE=function(e,t){return t||Pn(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},on.prototype.readFloatLE=function(e,t){return t||Pn(e,4,this.length),Jt(this,e,!0,23,4)},on.prototype.readFloatBE=function(e,t){return t||Pn(e,4,this.length),Jt(this,e,!1,23,4)},on.prototype.readDoubleLE=function(e,t){return t||Pn(e,8,this.length),Jt(this,e,!0,52,8)},on.prototype.readDoubleBE=function(e,t){return t||Pn(e,8,this.length),Jt(this,e,!1,52,8)},on.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||Nn(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},on.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||Nn(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},on.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,1,255,0),on.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},on.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,2,65535,0),on.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ln(this,e,t,!0),t+2},on.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,2,65535,0),on.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ln(this,e,t,!1),t+2},on.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,4,4294967295,0),on.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Mn(this,e,t,!0),t+4},on.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,4,4294967295,0),on.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Mn(this,e,t,!1),t+4},on.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Nn(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<n&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},on.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);Nn(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},on.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,1,127,-128),on.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},on.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,2,32767,-32768),on.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ln(this,e,t,!0),t+2},on.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,2,32767,-32768),on.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ln(this,e,t,!1),t+2},on.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,4,2147483647,-2147483648),on.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Mn(this,e,t,!0),t+4},on.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Nn(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),on.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Mn(this,e,t,!1),t+4},on.prototype.writeFloatLE=function(e,t,n){return Fn(this,e,t,!0,n)},on.prototype.writeFloatBE=function(e,t,n){return Fn(this,e,t,!1,n)},on.prototype.writeDoubleLE=function(e,t,n){return jn(this,e,t,!0,n)},on.prototype.writeDoubleBE=function(e,t,n){return jn(this,e,t,!1,n)},on.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,a=r-n;if(this===e&&n<t&&t<r)for(i=a-1;i>=0;--i)e[i+t]=this[i+n];else if(a<1e3||!on.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},on.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!on.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var o=fn(e)?e:zn(new on(e,r).toString()),s=o.length;for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var Bn=/[^+\/0-9A-Za-z-_]/g;function _n(e){return e<16?"0"+e.toString(16):e.toString(16)}function zn(e,t){var n;t=t||1/0;for(var r=e.length,i=null,a=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function Un(e){return function(e){var t,n,r,i,a,o;Zt||Yt();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new Xt(3*s/4-a),r=a>0?s-4:s;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=Gt[e.charCodeAt(t)]<<18|Gt[e.charCodeAt(t+1)]<<12|Gt[e.charCodeAt(t+2)]<<6|Gt[e.charCodeAt(t+3)],o[u++]=i>>16&255,o[u++]=i>>8&255,o[u++]=255&i;return 2===a?(i=Gt[e.charCodeAt(t)]<<2|Gt[e.charCodeAt(t+1)]>>4,o[u++]=255&i):1===a&&(i=Gt[e.charCodeAt(t)]<<10|Gt[e.charCodeAt(t+1)]<<4|Gt[e.charCodeAt(t+2)]>>2,o[u++]=i>>8&255,o[u++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Bn,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Wn(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Hn(e){return null!=e&&(!!e._isBuffer||Vn(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Vn(e.slice(0,0))}(e))}function Vn(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var qn=Object.freeze({__proto__:null,Buffer:on,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),on.alloc(+e)},isBuffer:Hn,kMaxLength:nn}),Gn=ot(qn);!function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var a;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Gn.Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}function u(e,t,r,i){for(var a=0,o=0,s=Math.min(e.length,r),u=t;u<s;u++){var l=e.charCodeAt(u)-48;a*=i,o=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&o<i,"Invalid character"),a+=o}return a}function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===r)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,a=0,o=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,o=a%r,s=Math.min(a,a-o)+n,l=0,c=n;c<s;c+=r)l=u(e,c,c+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==o){var d=1;for(l=u(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){l(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(e){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<i|a)).toString(16);a=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),r=0!==a||o!==this.length-1?d[6-u.length]+u+r:u+r}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],c=p[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modrn(c).toString(e);r=(h=h.idivn(c)).isZero()?m+r:d[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function h(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,u=o/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var c=u>>>26,d=67108863&u,f=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=f;p++){var h=l-p|0;c+=(o=(i=0|e.words[h])*(a=0|t.words[p])+d)/67108864|0,d=67108863&o}n.words[l]=0|d,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,a);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n++]=255&o,n<e.length&&(e[n++]=o>>8&255),n<e.length&&(e[n++]=o>>16&255),6===a?(n<e.length&&(e[n++]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n--]=255&o,n>=0&&(e[n--]=o>>8&255),n>=0&&(e[n--]=o>>16&255),6===a?(n>=0&&(e[n--]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(0|n.words[a])+(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!==i&&a<n.length;a++)t=(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var a=0,o=0;o<r.length;o++)a=(t=(0|n.words[o])-(0|r.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<n.length;o++)a=(t=(0|n.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=Math.max(this.length,o),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,n){var r,i,a,o=e.words,s=t.words,u=n.words,l=0,c=0|o[0],d=8191&c,f=c>>>13,p=0|o[1],h=8191&p,m=p>>>13,y=0|o[2],g=8191&y,A=y>>>13,b=0|o[3],v=8191&b,w=b>>>13,x=0|o[4],E=8191&x,T=x>>>13,C=0|o[5],I=8191&C,S=C>>>13,k=0|o[6],O=8191&k,R=k>>>13,P=0|o[7],N=8191&P,L=P>>>13,M=0|o[8],D=8191&M,F=M>>>13,j=0|o[9],B=8191&j,_=j>>>13,z=0|s[0],U=8191&z,W=z>>>13,H=0|s[1],V=8191&H,q=H>>>13,G=0|s[2],X=8191&G,Z=G>>>13,Y=0|s[3],K=8191&Y,Q=Y>>>13,J=0|s[4],$=8191&J,ee=J>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,fe=ce>>>13,pe=0|s[9],he=8191&pe,me=pe>>>13;n.negative=e.negative^t.negative,n.length=19;var ye=(l+(r=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,W))+Math.imul(f,U)|0))<<13)|0;l=((a=Math.imul(f,W))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(h,U),i=(i=Math.imul(h,W))+Math.imul(m,U)|0,a=Math.imul(m,W);var ge=(l+(r=r+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,q)|0)+Math.imul(f,V)|0))<<13)|0;l=((a=a+Math.imul(f,q)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,U),i=(i=Math.imul(g,W))+Math.imul(A,U)|0,a=Math.imul(A,W),r=r+Math.imul(h,V)|0,i=(i=i+Math.imul(h,q)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,q)|0;var Ae=(l+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,X)|0))<<13)|0;l=((a=a+Math.imul(f,Z)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,W))+Math.imul(w,U)|0,a=Math.imul(w,W),r=r+Math.imul(g,V)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(A,V)|0,a=a+Math.imul(A,q)|0,r=r+Math.imul(h,X)|0,i=(i=i+Math.imul(h,Z)|0)+Math.imul(m,X)|0,a=a+Math.imul(m,Z)|0;var be=(l+(r=r+Math.imul(d,K)|0)|0)+((8191&(i=(i=i+Math.imul(d,Q)|0)+Math.imul(f,K)|0))<<13)|0;l=((a=a+Math.imul(f,Q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,W))+Math.imul(T,U)|0,a=Math.imul(T,W),r=r+Math.imul(v,V)|0,i=(i=i+Math.imul(v,q)|0)+Math.imul(w,V)|0,a=a+Math.imul(w,q)|0,r=r+Math.imul(g,X)|0,i=(i=i+Math.imul(g,Z)|0)+Math.imul(A,X)|0,a=a+Math.imul(A,Z)|0,r=r+Math.imul(h,K)|0,i=(i=i+Math.imul(h,Q)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,Q)|0;var ve=(l+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,$)|0))<<13)|0;l=((a=a+Math.imul(f,ee)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(I,U),i=(i=Math.imul(I,W))+Math.imul(S,U)|0,a=Math.imul(S,W),r=r+Math.imul(E,V)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(T,V)|0,a=a+Math.imul(T,q)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(w,X)|0,a=a+Math.imul(w,Z)|0,r=r+Math.imul(g,K)|0,i=(i=i+Math.imul(g,Q)|0)+Math.imul(A,K)|0,a=a+Math.imul(A,Q)|0,r=r+Math.imul(h,$)|0,i=(i=i+Math.imul(h,ee)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,ee)|0;var we=(l+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;l=((a=a+Math.imul(f,re)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,W))+Math.imul(R,U)|0,a=Math.imul(R,W),r=r+Math.imul(I,V)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,q)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(T,X)|0,a=a+Math.imul(T,Z)|0,r=r+Math.imul(v,K)|0,i=(i=i+Math.imul(v,Q)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,Q)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(A,$)|0,a=a+Math.imul(A,ee)|0,r=r+Math.imul(h,ne)|0,i=(i=i+Math.imul(h,re)|0)+Math.imul(m,ne)|0,a=a+Math.imul(m,re)|0;var xe=(l+(r=r+Math.imul(d,ae)|0)|0)+((8191&(i=(i=i+Math.imul(d,oe)|0)+Math.imul(f,ae)|0))<<13)|0;l=((a=a+Math.imul(f,oe)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,W))+Math.imul(L,U)|0,a=Math.imul(L,W),r=r+Math.imul(O,V)|0,i=(i=i+Math.imul(O,q)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,q)|0,r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(S,X)|0,a=a+Math.imul(S,Z)|0,r=r+Math.imul(E,K)|0,i=(i=i+Math.imul(E,Q)|0)+Math.imul(T,K)|0,a=a+Math.imul(T,Q)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(w,$)|0,a=a+Math.imul(w,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(A,ne)|0,a=a+Math.imul(A,re)|0,r=r+Math.imul(h,ae)|0,i=(i=i+Math.imul(h,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Ee=(l+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(f,ue)|0))<<13)|0;l=((a=a+Math.imul(f,le)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(D,U),i=(i=Math.imul(D,W))+Math.imul(F,U)|0,a=Math.imul(F,W),r=r+Math.imul(N,V)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(L,V)|0,a=a+Math.imul(L,q)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(R,X)|0,a=a+Math.imul(R,Z)|0,r=r+Math.imul(I,K)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(S,K)|0,a=a+Math.imul(S,Q)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(w,ne)|0,a=a+Math.imul(w,re)|0,r=r+Math.imul(g,ae)|0,i=(i=i+Math.imul(g,oe)|0)+Math.imul(A,ae)|0,a=a+Math.imul(A,oe)|0,r=r+Math.imul(h,ue)|0,i=(i=i+Math.imul(h,le)|0)+Math.imul(m,ue)|0,a=a+Math.imul(m,le)|0;var Te=(l+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;l=((a=a+Math.imul(f,fe)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(B,U),i=(i=Math.imul(B,W))+Math.imul(_,U)|0,a=Math.imul(_,W),r=r+Math.imul(D,V)|0,i=(i=i+Math.imul(D,q)|0)+Math.imul(F,V)|0,a=a+Math.imul(F,q)|0,r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(L,X)|0,a=a+Math.imul(L,Z)|0,r=r+Math.imul(O,K)|0,i=(i=i+Math.imul(O,Q)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,Q)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(T,ne)|0,a=a+Math.imul(T,re)|0,r=r+Math.imul(v,ae)|0,i=(i=i+Math.imul(v,oe)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,oe)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,le)|0)+Math.imul(A,ue)|0,a=a+Math.imul(A,le)|0,r=r+Math.imul(h,de)|0,i=(i=i+Math.imul(h,fe)|0)+Math.imul(m,de)|0,a=a+Math.imul(m,fe)|0;var Ce=(l+(r=r+Math.imul(d,he)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(f,he)|0))<<13)|0;l=((a=a+Math.imul(f,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,q))+Math.imul(_,V)|0,a=Math.imul(_,q),r=r+Math.imul(D,X)|0,i=(i=i+Math.imul(D,Z)|0)+Math.imul(F,X)|0,a=a+Math.imul(F,Z)|0,r=r+Math.imul(N,K)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(L,K)|0,a=a+Math.imul(L,Q)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(S,ne)|0,a=a+Math.imul(S,re)|0,r=r+Math.imul(E,ae)|0,i=(i=i+Math.imul(E,oe)|0)+Math.imul(T,ae)|0,a=a+Math.imul(T,oe)|0,r=r+Math.imul(v,ue)|0,i=(i=i+Math.imul(v,le)|0)+Math.imul(w,ue)|0,a=a+Math.imul(w,le)|0,r=r+Math.imul(g,de)|0,i=(i=i+Math.imul(g,fe)|0)+Math.imul(A,de)|0,a=a+Math.imul(A,fe)|0;var Ie=(l+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(m,he)|0))<<13)|0;l=((a=a+Math.imul(m,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(B,X),i=(i=Math.imul(B,Z))+Math.imul(_,X)|0,a=Math.imul(_,Z),r=r+Math.imul(D,K)|0,i=(i=i+Math.imul(D,Q)|0)+Math.imul(F,K)|0,a=a+Math.imul(F,Q)|0,r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(R,ne)|0,a=a+Math.imul(R,re)|0,r=r+Math.imul(I,ae)|0,i=(i=i+Math.imul(I,oe)|0)+Math.imul(S,ae)|0,a=a+Math.imul(S,oe)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(T,ue)|0,a=a+Math.imul(T,le)|0,r=r+Math.imul(v,de)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(w,de)|0,a=a+Math.imul(w,fe)|0;var Se=(l+(r=r+Math.imul(g,he)|0)|0)+((8191&(i=(i=i+Math.imul(g,me)|0)+Math.imul(A,he)|0))<<13)|0;l=((a=a+Math.imul(A,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(B,K),i=(i=Math.imul(B,Q))+Math.imul(_,K)|0,a=Math.imul(_,Q),r=r+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(F,$)|0,a=a+Math.imul(F,ee)|0,r=r+Math.imul(N,ne)|0,i=(i=i+Math.imul(N,re)|0)+Math.imul(L,ne)|0,a=a+Math.imul(L,re)|0,r=r+Math.imul(O,ae)|0,i=(i=i+Math.imul(O,oe)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,oe)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,le)|0)+Math.imul(S,ue)|0,a=a+Math.imul(S,le)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(T,de)|0,a=a+Math.imul(T,fe)|0;var ke=(l+(r=r+Math.imul(v,he)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(w,he)|0))<<13)|0;l=((a=a+Math.imul(w,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,ee))+Math.imul(_,$)|0,a=Math.imul(_,ee),r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul(F,ne)|0,a=a+Math.imul(F,re)|0,r=r+Math.imul(N,ae)|0,i=(i=i+Math.imul(N,oe)|0)+Math.imul(L,ae)|0,a=a+Math.imul(L,oe)|0,r=r+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,le)|0)+Math.imul(R,ue)|0,a=a+Math.imul(R,le)|0,r=r+Math.imul(I,de)|0,i=(i=i+Math.imul(I,fe)|0)+Math.imul(S,de)|0,a=a+Math.imul(S,fe)|0;var Oe=(l+(r=r+Math.imul(E,he)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(T,he)|0))<<13)|0;l=((a=a+Math.imul(T,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(B,ne),i=(i=Math.imul(B,re))+Math.imul(_,ne)|0,a=Math.imul(_,re),r=r+Math.imul(D,ae)|0,i=(i=i+Math.imul(D,oe)|0)+Math.imul(F,ae)|0,a=a+Math.imul(F,oe)|0,r=r+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(L,ue)|0,a=a+Math.imul(L,le)|0,r=r+Math.imul(O,de)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,de)|0,a=a+Math.imul(R,fe)|0;var Re=(l+(r=r+Math.imul(I,he)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(S,he)|0))<<13)|0;l=((a=a+Math.imul(S,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(B,ae),i=(i=Math.imul(B,oe))+Math.imul(_,ae)|0,a=Math.imul(_,oe),r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,le)|0)+Math.imul(F,ue)|0,a=a+Math.imul(F,le)|0,r=r+Math.imul(N,de)|0,i=(i=i+Math.imul(N,fe)|0)+Math.imul(L,de)|0,a=a+Math.imul(L,fe)|0;var Pe=(l+(r=r+Math.imul(O,he)|0)|0)+((8191&(i=(i=i+Math.imul(O,me)|0)+Math.imul(R,he)|0))<<13)|0;l=((a=a+Math.imul(R,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(B,ue),i=(i=Math.imul(B,le))+Math.imul(_,ue)|0,a=Math.imul(_,le),r=r+Math.imul(D,de)|0,i=(i=i+Math.imul(D,fe)|0)+Math.imul(F,de)|0,a=a+Math.imul(F,fe)|0;var Ne=(l+(r=r+Math.imul(N,he)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(L,he)|0))<<13)|0;l=((a=a+Math.imul(L,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(B,de),i=(i=Math.imul(B,fe))+Math.imul(_,de)|0,a=Math.imul(_,fe);var Le=(l+(r=r+Math.imul(D,he)|0)|0)+((8191&(i=(i=i+Math.imul(D,me)|0)+Math.imul(F,he)|0))<<13)|0;l=((a=a+Math.imul(F,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Me=(l+(r=Math.imul(B,he))|0)+((8191&(i=(i=Math.imul(B,me))+Math.imul(_,he)|0))<<13)|0;return l=((a=Math.imul(_,me))+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,u[0]=ye,u[1]=ge,u[2]=Ae,u[3]=be,u[4]=ve,u[5]=we,u[6]=xe,u[7]=Ee,u[8]=Te,u[9]=Ce,u[10]=Ie,u[11]=Se,u[12]=ke,u[13]=Oe,u[14]=Re,u[15]=Pe,u[16]=Ne,u[17]=Le,u[18]=Me,0!==l&&(u[19]=l,n.length++),n};function y(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,a=0;a<n.length-1;a++){var o=i;i=0;for(var s=67108863&r,u=Math.min(a,t.length-1),l=Math.max(0,a-e.length+1);l<=u;l++){var c=a-l,d=(0|e.words[c])*(0|t.words[l]),f=67108863&d;s=67108863&(f=f+s|0),i+=(o=(o=o+(d/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}n.words[a]=s,r=o,o=i}return 0!==r?n.words[a]=r:n.length--,n._strip()}function g(e,t,n){return y(e,t,n)}Math.imul||(m=h),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?h(this,e,t):n<1024?y(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var a=(0|this.words[i])*e,o=(67108863&a)+(67108863&r);r>>=26,r+=a/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var a=n.sqr();r<t.length;r++,a=a.sqr())0!==t[r]&&(n=n.mul(a));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<r;this.words[t]=u|o,o=s>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=r;if(i-=o,i=Math.max(0,i),u){for(var l=0;l<o;l++)u.words[l]=this.words[l];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;l>=0&&(0!==c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-a|d>>>a,c=d&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,a,o=e.length+r;this._expand(o);var s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((a-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&a}for(;i<this.length-r;i++)s=(a=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&a;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(a=-(0|this.words[i])+s)>>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),a=e,o=0|a.words[a.length-1];0!==(n=26-this._countBits(o))&&(a=a.ushln(n),r.iushln(n),o=0|a.words[a.length-1]);var s,u=r.length-a.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(a,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d=u-1;d>=0;d--){var f=67108864*(0|r.words[a.length+d])+(0|r.words[a.length+d-1]);for(f=Math.min(f/o|0,67108863),r._ishlnsubmul(a,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(a,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(a=s.div.neg()),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:a,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(a=s.div.neg()),{div:a,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,o,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return a<0||1===i&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(r*i+(0|this.words[a]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var a=(0|this.words[i])+67108864*r;this.words[i]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new i(1),o=new i(0),s=new i(0),u=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,p=1;0==(t.words[0]&p)&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var h=0,m=1;0==(r.words[0]&m)&&h<26;++h,m<<=1);if(h>0)for(r.iushrn(h);h-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s),o.isub(u)):(r.isub(t),s.isub(a),u.isub(o))}return{a:s,b:u,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,o=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(t.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(t.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s)):(r.isub(t),s.isub(o))}return(a=0===t.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(e),a},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var a=t;t=n,n=a}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new T(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var A={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function C(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(v,b),v.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(w,b),r(x,b),r(E,b),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(A[e])return A[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new x;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return A[e]=t,t},T.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},T.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},T.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},T.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},T.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,a),f=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),h=o;0!==p.cmp(s);){for(var m=p,y=0;0!==m.cmp(s);y++)m=m.redSqr();n(y<h);var g=this.pow(d,new i(1).iushln(h-y-1));f=f.redMul(g),d=g.redSqr(),p=p.redMul(d),h=y}return f},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var a=n[0],o=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var l=t.words[r],c=u-1;c>=0;c--){var d=l>>c&1;a!==n[0]&&(a=this.sqr(a)),0!==d||0!==o?(o<<=1,o|=d,(4===++s||0===r&&0===c)&&(a=this.mul(a,n[o]),s=0,o=0)):s=0}u=26}return a},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new C(e)},r(C,T),C.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},C.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},C.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(r).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},C.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,it)}(Ht);var Xn=at(Ht.exports);let Zn=!1,Yn=!1;const Kn={debug:1,default:2,info:2,warning:3,error:4,off:5};let Qn=Kn.default,Jn=null;const $n=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var er,tr;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(er||(er={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(tr||(tr={}));const nr="0123456789abcdef";let rr=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==Kn[n]&&this.throwArgumentError("invalid log level name","logLevel",e),Qn>Kn[n]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,n,r){if(Yn)return this.makeError("censored error",n,{});n||(n=e.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e<t.length;e++)n+=nr[t[e]>>4],n+=nr[15&t[e]];i.push(e+"=Uint8Array(0x"+n+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(r[e].toString()))}})),i.push(`code=${n}`),i.push(`version=${this.version}`);const a=t;let o="";switch(n){case tr.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case tr.CALL_EXCEPTION:case tr.INSUFFICIENT_FUNDS:case tr.MISSING_NEW:case tr.NONCE_EXPIRED:case tr.REPLACEMENT_UNDERPRICED:case tr.TRANSACTION_REPLACED:case tr.UNPREDICTABLE_GAS_LIMIT:o=n}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=a,s.code=n,Object.keys(r).forEach((function(e){s[e]=r[e]})),s}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(t,n,r){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:n,value:r})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(t){$n&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:$n})}checkSafeUint53(t,n){"number"==typeof t&&(null==n&&(n="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,n,r){r=r?": "+r:"",t<n&&this.throwError("missing argument"+r,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:n}),t>n&&this.throwError("too many arguments"+r,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:n})}checkNew(t,n){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}checkAbstract(t,n){t===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}static globalLogger(){return Jn||(Jn=new e("logger/5.7.0")),Jn}static setCensorship(t,n){if(!t&&n&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Zn){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Yn=!!t,Zn=!!n}static setLogLevel(t){const n=Kn[t.toLowerCase()];null!=n?Qn=n:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};rr.errors=tr,rr.levels=er;var ir=Object.freeze({__proto__:null,get ErrorCode(){return tr},get LogLevel(){return er},Logger:rr});const ar=new rr("bytes/5.7.0");function or(e){return!!e.toHexString}function sr(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return sr(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function ur(e){return mr(e)&&!(e.length%2)||cr(e)}function lr(e){return"number"==typeof e&&e==e&&e%1==0}function cr(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!lr(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const n=e[t];if(!lr(n)||n<0||n>=256)return!1}return!0}function dr(e,t){if(t||(t={}),"number"==typeof e){ar.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),sr(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),or(e)&&(e=e.toHexString()),mr(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":ar.throwArgumentError("hex data is odd-length","value",e));const r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return sr(new Uint8Array(r))}return cr(e)?sr(new Uint8Array(e)):ar.throwArgumentError("invalid arrayify value","value",e)}function fr(e){const t=e.map((e=>dr(e))),n=t.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(n);return t.reduce(((e,t)=>(r.set(t,e),e+t.length)),0),sr(r)}function pr(e){let t=dr(e);if(0===t.length)return t;let n=0;for(;n<t.length&&0===t[n];)n++;return n&&(t=t.slice(n)),t}function hr(e,t){(e=dr(e)).length>t&&ar.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(e,t-e.length),sr(n)}function mr(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const yr="0123456789abcdef";function gr(e,t){if(t||(t={}),"number"==typeof e){ar.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=yr[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),or(e))return e.toHexString();if(mr(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":ar.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(cr(e)){let t="0x";for(let n=0;n<e.length;n++){let r=e[n];t+=yr[(240&r)>>4]+yr[15&r]}return t}return ar.throwArgumentError("invalid hexlify value","value",e)}function Ar(e){if("string"!=typeof e)e=gr(e);else if(!mr(e)||e.length%2)return null;return(e.length-2)/2}function br(e,t,n){return"string"!=typeof e?e=gr(e):(!mr(e)||e.length%2)&&ar.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function vr(e){let t="0x";return e.forEach((e=>{t+=gr(e).substring(2)})),t}function wr(e){const t=xr(gr(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function xr(e){"string"!=typeof e&&(e=gr(e)),mr(e)||ar.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}function Er(e,t){for("string"!=typeof e?e=gr(e):mr(e)||ar.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&ar.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Tr(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(ur(e)){let n=dr(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=gr(n.slice(0,32)),t.s=gr(n.slice(32,64))):65===n.length?(t.r=gr(n.slice(0,32)),t.s=gr(n.slice(32,64)),t.v=n[64]):ar.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:ar.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=gr(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const n=hr(dr(t._vs),32);t._vs=gr(n);const r=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=r:t.recoveryParam!==r&&ar.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;const i=gr(n);null==t.s?t.s=i:t.s!==i&&ar.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?ar.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const n=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==n&&ar.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&mr(t.r)?t.r=Er(t.r,32):ar.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&mr(t.s)?t.s=Er(t.s,32):ar.throwArgumentError("signature missing or invalid s","signature",e);const n=dr(t.s);n[0]>=128&&ar.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(n[0]|=128);const r=gr(n);t._vs&&(mr(t._vs)||ar.throwArgumentError("signature invalid _vs","signature",e),t._vs=Er(t._vs,32)),null==t._vs?t._vs=r:t._vs!==r&&ar.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Cr(e){return gr(fr([(e=Tr(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var Ir=Object.freeze({__proto__:null,arrayify:dr,concat:fr,hexConcat:vr,hexDataLength:Ar,hexDataSlice:br,hexStripZeros:xr,hexValue:wr,hexZeroPad:Er,hexlify:gr,isBytes:cr,isBytesLike:ur,isHexString:mr,joinSignature:Cr,splitSignature:Tr,stripZeros:pr,zeroPad:hr});const Sr="bignumber/5.7.0";var kr=Xn.BN;const Or=new rr(Sr),Rr={},Pr=9007199254740991;let Nr=!1,Lr=class e{constructor(e,t){e!==Rr&&Or.throwError("cannot call constructor directly; use BigNumber.from",rr.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Dr(Fr(this).fromTwos(e))}toTwos(e){return Dr(Fr(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Dr(Fr(this).add(Fr(e)))}sub(e){return Dr(Fr(this).sub(Fr(e)))}div(t){return e.from(t).isZero()&&jr("division-by-zero","div"),Dr(Fr(this).div(Fr(t)))}mul(e){return Dr(Fr(this).mul(Fr(e)))}mod(e){const t=Fr(e);return t.isNeg()&&jr("division-by-zero","mod"),Dr(Fr(this).umod(t))}pow(e){const t=Fr(e);return t.isNeg()&&jr("negative-power","pow"),Dr(Fr(this).pow(t))}and(e){const t=Fr(e);return(this.isNegative()||t.isNeg())&&jr("unbound-bitwise-result","and"),Dr(Fr(this).and(t))}or(e){const t=Fr(e);return(this.isNegative()||t.isNeg())&&jr("unbound-bitwise-result","or"),Dr(Fr(this).or(t))}xor(e){const t=Fr(e);return(this.isNegative()||t.isNeg())&&jr("unbound-bitwise-result","xor"),Dr(Fr(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&jr("negative-width","mask"),Dr(Fr(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&jr("negative-width","shl"),Dr(Fr(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&jr("negative-width","shr"),Dr(Fr(this).shrn(e))}eq(e){return Fr(this).eq(Fr(e))}lt(e){return Fr(this).lt(Fr(e))}lte(e){return Fr(this).lte(Fr(e))}gt(e){return Fr(this).gt(Fr(e))}gte(e){return Fr(this).gte(Fr(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Fr(this).isZero()}toNumber(){try{return Fr(this).toNumber()}catch(e){jr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Or.throwError("this platform does not support BigInt",rr.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Nr||(Nr=!0,Or.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Or.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",rr.errors.UNEXPECTED_ARGUMENT,{}):Or.throwError("BigNumber.toString does not accept parameters",rr.errors.UNEXPECTED_ARGUMENT,{})),Fr(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(Rr,Mr(t)):t.match(/^-?[0-9]+$/)?new e(Rr,Mr(new kr(t))):Or.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&jr("underflow","BigNumber.from",t),(t>=Pr||t<=-Pr)&&jr("overflow","BigNumber.from",t),e.from(String(t));const n=t;if("bigint"==typeof n)return e.from(n.toString());if(cr(n))return e.from(gr(n));if(n)if(n.toHexString){const t=n.toHexString();if("string"==typeof t)return e.from(t)}else{let t=n._hex;if(null==t&&"BigNumber"===n.type&&(t=n.hex),"string"==typeof t&&(mr(t)||"-"===t[0]&&mr(t.substring(1))))return e.from(t)}return Or.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Mr(e){if("string"!=typeof e)return Mr(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Or.throwArgumentError("invalid hex","value",e),"0x00"===(e=Mr(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function Dr(e){return Lr.from(Mr(e))}function Fr(e){const t=Lr.from(e).toHexString();return"-"===t[0]?new kr("-"+t.substring(3),16):new kr(t.substring(2),16)}function jr(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),Or.throwError(e,rr.errors.NUMERIC_FAULT,r)}const Br=new rr(Sr),_r={},zr=Lr.from(0),Ur=Lr.from(-1);function Wr(e,t,n,r){const i={fault:t,operation:n};return void 0!==r&&(i.value=r),Br.throwError(e,rr.errors.NUMERIC_FAULT,i)}let Hr="0";for(;Hr.length<256;)Hr+=Hr;function Vr(e){if("number"!=typeof e)try{e=Lr.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Hr.substring(0,e):Br.throwArgumentError("invalid decimal size","decimals",e)}function qr(e,t){null==t&&(t=0);const n=Vr(t),r=(e=Lr.from(e)).lt(zr);r&&(e=e.mul(Ur));let i=e.mod(n).toString();for(;i.length<n.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(n).toString();return e=1===n.length?a:a+"."+i,r&&(e="-"+e),e}function Gr(e,t){null==t&&(t=0);const n=Vr(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Br.throwArgumentError("invalid decimal value","value",e);const r="-"===e.substring(0,1);r&&(e=e.substring(1)),"."===e&&Br.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Br.throwArgumentError("too many decimal points","value",e);let a=i[0],o=i[1];for(a||(a="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>n.length-1&&Wr("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<n.length-1;)o+="0";const s=Lr.from(a),u=Lr.from(o);let l=s.mul(n).add(u);return r&&(l=l.mul(Ur)),l}class Xr{constructor(e,t,n,r){e!==_r&&Br.throwError("cannot use FixedFormat constructor; use FixedFormat.from",rr.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=n,this.decimals=r,this.name=(t?"":"u")+"fixed"+String(n)+"x"+String(r),this._multiplier=Vr(r),Object.freeze(this)}static from(e){if(e instanceof Xr)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,n=128,r=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||Br.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],n=parseInt(i[2]),r=parseInt(i[3])}else if(e){const i=(t,n,r)=>null==e[t]?r:(typeof e[t]!==n&&Br.throwArgumentError("invalid fixed format ("+t+" not "+n+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&Br.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&Br.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new Xr(_r,t,n,r)}}class Zr{constructor(e,t,n,r){e!==_r&&Br.throwError("cannot use FixedNumber constructor; use FixedNumber.from",rr.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=t,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Br.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=Gr(this._value,this.format.decimals),n=Gr(e._value,e.format.decimals);return Zr.fromValue(t.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=Gr(this._value,this.format.decimals),n=Gr(e._value,e.format.decimals);return Zr.fromValue(t.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=Gr(this._value,this.format.decimals),n=Gr(e._value,e.format.decimals);return Zr.fromValue(t.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=Gr(this._value,this.format.decimals),n=Gr(e._value,e.format.decimals);return Zr.fromValue(t.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Zr.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(t=t.subUnsafe(Yr.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Zr.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(t=t.addUnsafe(Yr.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&Br.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const n=Zr.from("1"+Hr.substring(0,e),this.format),r=Kr.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&Br.throwArgumentError("invalid byte width","width",e);return Er(Lr.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Zr.fromString(this._value,e)}static fromValue(e,t,n){return null!=n||null==t||function(e){return null!=e&&(Lr.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||mr(e)||"bigint"==typeof e||cr(e))}(t)||(n=t,t=null),null==t&&(t=0),null==n&&(n="fixed"),Zr.fromString(qr(e,t),Xr.from(n))}static fromString(e,t){null==t&&(t="fixed");const n=Xr.from(t),r=Gr(e,n.decimals);!n.signed&&r.lt(zr)&&Wr("unsigned value cannot be negative","overflow","value",e);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=Er(i,n.width/8));const a=qr(r,n.decimals);return new Zr(_r,i,a,n)}static fromBytes(e,t){null==t&&(t="fixed");const n=Xr.from(t);if(dr(e).length>n.width/8)throw new Error("overflow");let r=Lr.from(e);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),a=qr(r,n.decimals);return new Zr(_r,i,a,n)}static from(e,t){if("string"==typeof e)return Zr.fromString(e,t);if(cr(e))return Zr.fromBytes(e,t);try{return Zr.fromValue(e,0,t)}catch(e){if(e.code!==rr.errors.INVALID_ARGUMENT)throw e}return Br.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const Yr=Zr.from(1),Kr=Zr.from("0.5");var Qr=window&&window.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((r=r.apply(e,t||[])).next())}))};const Jr=new rr("properties/5.7.0");function $r(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function ei(e,t){for(let n=0;n<32;n++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function ti(e){return Qr(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const n=e[t];return Promise.resolve(n).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function ni(e,t){e&&"object"==typeof e||Jr.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((n=>{t[n]||Jr.throwArgumentError("invalid object key - "+n,"transaction:"+n,e)}))}function ri(e){const t={};for(const n in e)t[n]=e[n];return t}const ii={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function ai(e){if(null==e||ii[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let n=0;n<t.length;n++){let r=null;try{r=e[t[n]]}catch(e){continue}if(!ai(r))return!1}return!0}return Jr.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function oi(e){if(ai(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>si(e))));if("object"==typeof e){const t={};for(const n in e){const r=e[n];void 0!==r&&$r(t,n,si(r))}return t}return Jr.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function si(e){return oi(e)}let ui=class{constructor(e){for(const t in e)this[t]=si(e[t])}};var li=Object.freeze({__proto__:null,Description:ui,checkProperties:ni,deepCopy:si,defineReadOnly:$r,getStatic:ei,resolveProperties:ti,shallowCopy:ri});const ci="abi/5.7.0",di=new rr(ci),fi={};let pi={calldata:!0,memory:!0,storage:!0},hi={calldata:!0,memory:!0};function mi(e,t){if("bytes"===e||"string"===e){if(pi[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&hi[t])return!0;return(pi[t]||"payable"===t)&&di.throwArgumentError("invalid modifier","name",t),!1}function yi(e,t){for(let n in t)$r(e,n,t[n])}const gi=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Ai=new RegExp(/^(.*)\[([0-9]*)\]$/);let bi=class e{constructor(t,n){t!==fi&&di.throwError("use fromString",rr.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),yi(this,n);let r=this.type.match(Ai);yi(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:e.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=gi.sighash),gi[e]||di.throwArgumentError("invalid format type","format",e),e===gi.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==gi.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===gi.full?", ":",")+")"):t+=this.type,e!==gi.sighash&&(!0===this.indexed&&(t+=" indexed"),e===gi.full&&this.name&&(t+=" "+this.name)),t}static from(t,n){return"string"==typeof t?e.fromString(t,n):e.fromObject(t)}static fromObject(t){return e.isParamType(t)?t:new e(fi,{name:t.name||null,type:Ri(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}static fromString(t,n){return function(t){return e.fromObject({name:t.name,type:t.type,indexed:t.indexed,components:t.components})}(function(e,t){let n=e;function r(t){di.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let n={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(n.indexed=!1),n}e=e.replace(/\s/g," ");let a={type:"",name:"",state:{allowType:!0}},o=a;for(let n=0;n<e.length;n++){let a=e[n];switch(a){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||r(n),o.state.allowType=!1,o.type=Ri(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||r(n),o.indexed=!0,o.name=""),mi(o.type,o.name)&&(o.name=""),o.type=Ri(o.type);let e=o;o=o.parent,o||r(n),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||r(n),o.indexed=!0,o.name=""),mi(o.type,o.name)&&(o.name=""),o.type=Ri(o.type);let s=i(o.parent);o.parent.components.push(s),delete o.parent,o=s;break;case" ":o.state.allowType&&""!==o.type&&(o.type=Ri(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||r(n),o.indexed&&r(n),o.indexed=!0,o.name=""):mi(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||r(n),o.type+=a,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||r(n),o.type+=a,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=a,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=a,delete o.state.allowArray):o.state.readArray?o.type+=a:r(n)}}return o.parent&&di.throwArgumentError("unexpected eof","param",e),delete a.state,"indexed"===o.name?(t||r(n.length-7),o.indexed&&r(n.length-7),o.indexed=!0,o.name=""):mi(o.type,o.name)&&(o.name=""),a.type=Ri(a.type),a}(t,!!n))}static isParamType(e){return!(null==e||!e._isParamType)}};function vi(e,t){return function(e){e=e.trim();let t=[],n="",r=0;for(let i=0;i<e.length;i++){let a=e[i];","===a&&0===r?(t.push(n),n=""):(n+=a,"("===a?r++:")"===a&&(r--,-1===r&&di.throwArgumentError("unbalanced parenthesis","value",e)))}n&&t.push(n);return t}(e).map((e=>bi.fromString(e,t)))}let wi=class e{constructor(e,t){e!==fi&&di.throwError("use a static from method",rr.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),yi(this,t),this._isFragment=!0,Object.freeze(this)}static from(t){return e.isFragment(t)?t:"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isFragment(t))return t;switch(t.type){case"function":return Si.fromObject(t);case"event":return xi.fromObject(t);case"constructor":return Ii.fromObject(t);case"error":return Oi.fromObject(t);case"fallback":case"receive":return null}return di.throwArgumentError("invalid fragment object","value",t)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?xi.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Si.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Ii.fromString(e.trim()):"error"===e.split(" ")[0]?Oi.fromString(e.substring(5).trim()):di.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}},xi=class e extends wi{format(e){if(e||(e=gi.sighash),gi[e]||di.throwArgumentError("invalid format type","format",e),e===gi.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==gi.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===gi.full?", ":",")+") ",e!==gi.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isEventFragment(t))return t;"event"!==t.type&&di.throwArgumentError("invalid event object","value",t);const n={name:Ni(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(bi.fromObject):[],type:"event"};return new e(fi,n)}static fromString(t){let n=t.match(Li);n||di.throwArgumentError("invalid event string","value",t);let r=!1;return n[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":r=!0;break;case"":break;default:di.warn("unknown modifier: "+e)}})),e.fromObject({name:n[1].trim(),anonymous:r,inputs:vi(n[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}};function Ei(e,t){t.gas=null;let n=e.split("@");return 1!==n.length?(n.length>2&&di.throwArgumentError("invalid human-readable ABI signature","value",e),n[1].match(/^[0-9]+$/)||di.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Lr.from(n[1]),n[0]):e}function Ti(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function Ci(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&di.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&di.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||di.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&di.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&di.throwArgumentError("unable to determine stateMutability","value",e),t}let Ii=class e extends wi{format(e){if(e||(e=gi.sighash),gi[e]||di.throwArgumentError("invalid format type","format",e),e===gi.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===gi.sighash&&di.throwError("cannot format a constructor for sighash",rr.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===gi.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isConstructorFragment(t))return t;"constructor"!==t.type&&di.throwArgumentError("invalid constructor object","value",t);let n=Ci(t);n.constant&&di.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(bi.fromObject):[],payable:n.payable,stateMutability:n.stateMutability,gas:t.gas?Lr.from(t.gas):null};return new e(fi,r)}static fromString(t){let n={type:"constructor"},r=(t=Ei(t,n)).match(Li);return r&&"constructor"===r[1].trim()||di.throwArgumentError("invalid constructor string","value",t),n.inputs=vi(r[2].trim(),!1),Ti(r[3].trim(),n),e.fromObject(n)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}},Si=class e extends Ii{format(e){if(e||(e=gi.sighash),gi[e]||di.throwArgumentError("invalid format type","format",e),e===gi.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==gi.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===gi.full?", ":",")+") ",e!==gi.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isFunctionFragment(t))return t;"function"!==t.type&&di.throwArgumentError("invalid function object","value",t);let n=Ci(t);const r={type:t.type,name:Ni(t.name),constant:n.constant,inputs:t.inputs?t.inputs.map(bi.fromObject):[],outputs:t.outputs?t.outputs.map(bi.fromObject):[],payable:n.payable,stateMutability:n.stateMutability,gas:t.gas?Lr.from(t.gas):null};return new e(fi,r)}static fromString(t){let n={type:"function"},r=(t=Ei(t,n)).split(" returns ");r.length>2&&di.throwArgumentError("invalid function string","value",t);let i=r[0].match(Li);if(i||di.throwArgumentError("invalid function signature","value",t),n.name=i[1].trim(),n.name&&Ni(n.name),n.inputs=vi(i[2],!1),Ti(i[3].trim(),n),r.length>1){let e=r[1].match(Li);""==e[1].trim()&&""==e[3].trim()||di.throwArgumentError("unexpected tokens","value",t),n.outputs=vi(e[2],!1)}else n.outputs=[];return e.fromObject(n)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}};function ki(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||di.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}let Oi=class e extends wi{format(e){if(e||(e=gi.sighash),gi[e]||di.throwArgumentError("invalid format type","format",e),e===gi.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==gi.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===gi.full?", ":",")+") ",t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isErrorFragment(t))return t;"error"!==t.type&&di.throwArgumentError("invalid error object","value",t);const n={type:t.type,name:Ni(t.name),inputs:t.inputs?t.inputs.map(bi.fromObject):[]};return ki(new e(fi,n))}static fromString(t){let n={type:"error"},r=t.match(Li);return r||di.throwArgumentError("invalid error signature","value",t),n.name=r[1].trim(),n.name&&Ni(n.name),n.inputs=vi(r[2],!1),ki(e.fromObject(n))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}};function Ri(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Pi=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ni(e){return e&&e.match(Pi)||di.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Li=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Mi=new rr(ci);function Di(e){const t=[],n=function(e,r){if(Array.isArray(r))for(let i in r){const a=e.slice();a.push(i);try{n(a,r[i])}catch(e){t.push({path:a,error:e})}}};return n([],e),t}let Fi=class{constructor(e,t,n,r){this.name=e,this.type=t,this.localName=n,this.dynamic=r}_throwError(e,t){Mi.throwArgumentError(e,this.localName,t)}},ji=class{constructor(e){$r(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return vr(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(fr(e._data))}writeBytes(e){let t=dr(e);const n=t.length%this.wordSize;return n&&(t=fr([t,this._padding.slice(n)])),this._writeData(t)}_getValue(e){let t=dr(Lr.from(e));return t.length>this.wordSize&&Mi.throwError("value out-of-bounds",rr.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=fr([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}};var Bi={exports:{}};
|
|
10
10
|
/**
|
|
11
11
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
12
12
|
*
|
|
@@ -30,7 +30,7 @@ let lt=class{constructor(e=0,t=0,n=!1){this.first=null,this.items=Object.create(
|
|
|
30
30
|
* @license BSD-3-Clause
|
|
31
31
|
* @version 11.2.5
|
|
32
32
|
*/
|
|
33
|
-
class kv{constructor(e=0,t=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=n,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){return e.map((e=>[e,this.get(e)]))}evict(e=!1){if(e||this.size>0){const e=this.first;delete this.items[e.key],0==--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){let t;if(this.has(e)){const n=this.items[e];this.ttl>0&&n.expiry<=Date.now()?this.delete(e):(t=n.value,this.set(e,t,!0))}return t}has(e){return e in this.items}keys(){const e=[];let t=this.first;for(;null!==t;)e.push(t.key),t=t.next;return e}set(e,t,n=!1,r=this.resetTtl){let i;if(n||this.has(e)){if(i=this.items[e],i.value=t,!1===n&&r&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==i){const e=this.last,t=i.next,n=i.prev;this.first===i&&(this.first=i.next),i.next=null,i.prev=this.last,e.next=i,null!==n&&(n.next=t),null!==t&&(t.prev=n)}}else this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1==++this.size?this.first=i:this.last.next=i;return this.last=i,this}values(e=this.keys()){return e.map((e=>this.get(e)))}}Sv.LRU=kv,Sv.lru=function(e=1e3,t=0,n=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof n)throw new TypeError("Invalid resetTtl value");return new kv(e,t,n)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.memorise=void 0;const t=Sv,n={max:1e3};e.memorise=(e,i={})=>{const{cache:a,cacheKeyResolver:o=r,onHit:s,lruOptions:u={}}=i,l={...n,...u},c=a||(0,t.lru)(l.max,l.ttl),d=(...t)=>{const n=o(...t),r=c.get(n);if(c.has(n))return s&&s(n,r,c),r;const i=e.apply(this,t);return c.set(n,i),i};return d._cache=c,d},e.default=e.memorise;const r=(...e)=>0===e.length?"no-args":e.map((e=>void 0===e?"undefined":null===e?"null":Array.isArray(e)?`[${r(...e)}]`:"object"==typeof e?`{${r(...i(e))}}`:JSON.stringify(e))).join(","),i=e=>Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1))}(Iv);var Ov={};Object.defineProperty(Ov,"__esModule",{value:!0}),Ov.clearGlobalNamespace=Mv=Ov.getGlobalisedValue=void 0;const Rv={},Pv=()=>"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:Rv,Nv=e=>`globalise__singleton__${e}`,Lv=e=>{const t=Pv(),n=Nv(e);return t[n]||(t[n]={}),t[n]};var Mv=Ov.getGlobalisedValue=(e,t,n)=>{((e,t)=>{if("string"!=typeof e)throw"Invalid namespace key";if("string"!=typeof t)throw"Invalid item key"})(e,t);const r=((e,t)=>Lv(e)[t]||void 0)(e,t);return void 0!==r?r:(((e,t,n)=>{Lv(e)[t]=n})(e,t,n),n)};Ov.clearGlobalNamespace=e=>{const t=Pv(),n=Nv(e);void 0!==t[n]&&delete t[n]};const Dv=()=>"undefined"==typeof window;var Fv;!function(e){e.RUNTIME_ID="rid",e.PASSPORT_CLIENT_ID="passportClientId",e.ENVIRONMENT="env",e.PUBLISHABLE_API_KEY="pak",e.IDENTITY="uid",e.DOMAIN="domain",e.SDK_VERSION="sdkVersion"}(Fv||(Fv={}));async function jv(e,t){const n=tg.create({baseURL:"https://api.x.immutable.com"}),r=JSON.stringify(t),i={payload:btoa(r)};return(await n.post(e,i)).data}const Bv=()=>!Dv()&&window.localStorage,_v=e=>`__IMX-${e}`;function zv(e){if(Bv())return(e=>{if(null!==e)try{return JSON.parse(e)}catch(t){return e}})(window.localStorage.getItem(_v(e)))}const Uv=(e,t)=>!!Bv()&&(window.localStorage.setItem(_v(e),(e=>"string"==typeof e?e:JSON.stringify(e))(t)),!0);var Wv;let Hv,Vv;!function(e){e.EVENTS="events",e.RUNTIME="runtime"}(Wv||(Wv={}));Hv=zv(Wv.EVENTS)||[],Vv=zv(Wv.RUNTIME)||{};const qv=(e,t)=>{Vv={...Vv,[e]:t},Uv(Wv.RUNTIME,Vv)},Gv=e=>{const t=[];return Object.entries(e).forEach((([e,n])=>{"string"!=typeof e&&"string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n||t.push([e,n.toString()])})),t},Xv="1.5.3-alpha",Zv=()=>Dv()?"":window.opener||window.parent!==window?Dv()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"":new URL(window.location.href).hostname;let Yv=!1;const Kv=async()=>{Yv=!0;try{const e=Gv((()=>{if(qv(Fv.SDK_VERSION,Xv),Dv())return{browser:"nodejs",sdkVersion:Xv};const e=Zv();return e&&qv(Fv.DOMAIN,e),{sdkVersion:Xv,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}})()),t=(e=>{if(void 0!==Vv[e])return Vv[e]})(Fv.RUNTIME_ID),n={version:1,data:{runtimeDetails:e,runtimeId:t}},r=await jv("/v1/sdk/initialise",n),{runtimeId:i}=r;qv(Fv.RUNTIME_ID,i)}catch(e){Yv=!1}};function Qv(e){return(...t)=>{try{const n=e(...t);return n instanceof Promise?n.catch((()=>{})):n}catch(e){return}}}const Jv="imtbl__metrics",$v=(e,t)=>Mv(Jv,e,t);Qv(((e,t)=>{const n=Iv.memorise(t,{lruOptions:{ttl:1e3,max:1e3}});return Mv(Jv,e,n)})("track",((e,t,n)=>{(e=>{Hv.push(e),Uv(Wv.EVENTS,Hv)})({event:`${e}.${t}`,time:(new Date).toISOString(),...n&&{properties:Gv(n)}})})));const ew=Qv((async()=>{if(!1===Yv)return void await Kv();const e=Hv;if(0===e.length)return;const t=e.length,n={version:1,data:{events:e,details:Vv}};var r;await jv("/v1/sdk/metrics",n)instanceof Error||(r=t,Hv=Hv.slice(r),Uv(Wv.EVENTS,Hv))})),tw=async()=>{await ew(),setTimeout(tw,5e3)};let nw=!1;const rw=()=>{nw||(nw=!0,tw())};"undefined"!=typeof process&&void 0!==process.env.JEST_WORKER_ID||Qv($v("startFlushing",rw))();Qv($v("setEnvironment",(e=>{qv(Fv.ENVIRONMENT,e)})));Qv($v("setPassportClientId",(e=>{qv(Fv.PASSPORT_CLIENT_ID,e)})));var iw;Qv($v("setPublishableApiKey",(e=>{qv(Fv.PUBLISHABLE_API_KEY,e)}))),function(e){e.PRODUCTION="production",e.SANDBOX="sandbox"}(iw||(iw={}));const aw=[tv,nv],ow=[rv],sw={[iw.SANDBOX]:aw,[iw.PRODUCTION]:ow},uw=(new Map).set(tv,{rootERC20BridgeFlowRate:"0x0",childERC20Bridge:"0x0",rootChainIMX:"0x0",rootChainWrappedETH:"0x0",childChainWrappedETH:"0x0",childChainWrappedIMX:"0x0"}).set(nv,{rootERC20BridgeFlowRate:"0x0D3C59c779Fd552C27b23F723E80246c840100F5",childERC20Bridge:"0x0D3C59c779Fd552C27b23F723E80246c840100F5",rootChainIMX:"0xe2629e08f4125d14e446660028bD98ee60EE69F2",rootChainWrappedETH:"0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",childChainWrappedETH:"0xe9E96d1aad82562b7588F03f49aD34186f996478",childChainWrappedIMX:"0x1CcCa691501174B4A623CeDA58cC8f1a76dc3439"}).set(rv,{rootERC20BridgeFlowRate:"0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",childERC20Bridge:"0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",rootChainIMX:"0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF",rootChainWrappedETH:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",childChainWrappedETH:"0x52a6c53869ce09a731cd772f245b97a4401d3348",childChainWrappedIMX:"0x3a0c2ba54d6cbd3121f01b96dfd20e99d1696c9d"});class lw{baseConfig;bridgeInstance;bridgeContracts;rootProvider;childProvider;constructor({bridgeInstance:e,rootProvider:t,childProvider:n,baseConfig:r,overrides:i}){if(this.baseConfig=r,this.bridgeInstance=e,this.rootProvider=t,this.childProvider=n,i)return void(this.bridgeContracts=i.bridgeContracts);if(!sw[r.environment].includes(e))throw new Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${r.environment}`);if(!uw.has(e))throw new Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${r.environment}`);const a=uw.get(e);if(!a)throw new Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${r.environment}`);this.bridgeContracts=a}}var cw={exports:{}};!function(e,t){e.exports=function(){var e=Math.imul,t=Math.clz32,n=Math.abs,r=Math.max,i=Math.floor;class a extends Array{constructor(e,t){if(super(e),this.sign=t,e>a.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt(e){var t=Number.isFinite;if("number"==typeof e){if(0===e)return a.__zero();if(a.__isOneDigitInt(e))return 0>e?a.__oneDigit(-e,!0):a.__oneDigit(e,!1);if(!t(e)||i(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return a.__fromDouble(e)}if("string"==typeof e){const t=a.__fromString(e);if(null===t)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return t}if("boolean"==typeof e)return!0===e?a.__oneDigit(1,!1):a.__zero();if("object"==typeof e){if(e.constructor===a)return e;const t=a.__toPrimitive(e);return a.BigInt(t)}throw new TypeError("Cannot convert "+e+" to a BigInt")}toDebugString(){const e=["BigInt["];for(const t of this)e.push((t?(t>>>0).toString(16):t)+", ");return e.push("]"),e.join("")}toString(e=10){if(2>e||36<e)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":0==(e&e-1)?a.__toStringBasePowerOfTwo(this,e):a.__toStringGeneric(this,e,!1)}static toNumber(e){const t=e.length;if(0===t)return 0;if(1===t){const t=e.__unsignedDigit(0);return e.sign?-t:t}const n=e.__digit(t-1),r=a.__clz30(n),i=30*t-r;if(1024<i)return e.sign?-1/0:1/0;let o=i-1,s=n,u=t-1;const l=r+3;let c=32===l?0:s<<l;c>>>=12;const d=l-12;let f=12<=l?0:s<<20+l,p=20+l;for(0<d&&0<u&&(u--,s=e.__digit(u),c|=s>>>30-d,f=s<<d+2,p=d+2);0<p&&0<u;)u--,s=e.__digit(u),f|=30<=p?s<<p-30:s>>>30-p,p-=30;const h=a.__decideRounding(e,p,u,s);if((1===h||0===h&&1==(1&f))&&(f=f+1>>>0,0===f&&(c++,0!=c>>>20&&(c=0,o++,1023<o))))return e.sign?-1/0:1/0;const m=e.sign?-2147483648:0;return o=o+1023<<20,a.__kBitConversionInts[1]=m|o|c,a.__kBitConversionInts[0]=f,a.__kBitConversionDouble[0]}static unaryMinus(e){if(0===e.length)return e;const t=e.__copy();return t.sign=!e.sign,t}static bitwiseNot(e){return e.sign?a.__absoluteSubOne(e).__trim():a.__absoluteAddOne(e,!0)}static exponentiate(e,t){if(t.sign)throw new RangeError("Exponent must be positive");if(0===t.length)return a.__oneDigit(1,!1);if(0===e.length)return e;if(1===e.length&&1===e.__digit(0))return e.sign&&0==(1&t.__digit(0))?a.unaryMinus(e):e;if(1<t.length)throw new RangeError("BigInt too big");let n=t.__unsignedDigit(0);if(1===n)return e;if(n>=a.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===e.length&&2===e.__digit(0)){const t=1+(0|n/30),r=e.sign&&0!=(1&n),i=new a(t,r);i.__initializeDigits();const o=1<<n%30;return i.__setDigit(t-1,o),i}let r=null,i=e;for(0!=(1&n)&&(r=e),n>>=1;0!==n;n>>=1)i=a.multiply(i,i),0!=(1&n)&&(r=null===r?i:a.multiply(r,i));return r}static multiply(e,t){if(0===e.length)return e;if(0===t.length)return t;let n=e.length+t.length;30<=e.__clzmsd()+t.__clzmsd()&&n--;const r=new a(n,e.sign!==t.sign);r.__initializeDigits();for(let n=0;n<e.length;n++)a.__multiplyAccumulate(t,e.__digit(n),r,n);return r.__trim()}static divide(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>a.__absoluteCompare(e,t))return a.__zero();const n=e.sign!==t.sign,r=t.__unsignedDigit(0);let i;if(1===t.length&&32767>=r){if(1===r)return n===e.sign?e:a.unaryMinus(e);i=a.__absoluteDivSmall(e,r,null)}else i=a.__absoluteDivLarge(e,t,!0,!1);return i.sign=n,i.__trim()}static remainder(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>a.__absoluteCompare(e,t))return e;const n=t.__unsignedDigit(0);if(1===t.length&&32767>=n){if(1===n)return a.__zero();const t=a.__absoluteModSmall(e,n);return 0===t?a.__zero():a.__oneDigit(t,e.sign)}const r=a.__absoluteDivLarge(e,t,!1,!0);return r.sign=e.sign,r.__trim()}static add(e,t){const n=e.sign;return n===t.sign?a.__absoluteAdd(e,t,n):0<=a.__absoluteCompare(e,t)?a.__absoluteSub(e,t,n):a.__absoluteSub(t,e,!n)}static subtract(e,t){const n=e.sign;return n===t.sign?0<=a.__absoluteCompare(e,t)?a.__absoluteSub(e,t,n):a.__absoluteSub(t,e,!n):a.__absoluteAdd(e,t,n)}static leftShift(e,t){return 0===t.length||0===e.length?e:t.sign?a.__rightShiftByAbsolute(e,t):a.__leftShiftByAbsolute(e,t)}static signedRightShift(e,t){return 0===t.length||0===e.length?e:t.sign?a.__leftShiftByAbsolute(e,t):a.__rightShiftByAbsolute(e,t)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(e,t){return 0>a.__compareToBigInt(e,t)}static lessThanOrEqual(e,t){return 0>=a.__compareToBigInt(e,t)}static greaterThan(e,t){return 0<a.__compareToBigInt(e,t)}static greaterThanOrEqual(e,t){return 0<=a.__compareToBigInt(e,t)}static equal(e,t){if(e.sign!==t.sign)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e.__digit(n)!==t.__digit(n))return!1;return!0}static notEqual(e,t){return!a.equal(e,t)}static bitwiseAnd(e,t){if(!e.sign&&!t.sign)return a.__absoluteAnd(e,t).__trim();if(e.sign&&t.sign){const n=r(e.length,t.length)+1;let i=a.__absoluteSubOne(e,n);const o=a.__absoluteSubOne(t);return i=a.__absoluteOr(i,o,i),a.__absoluteAddOne(i,!0,i).__trim()}return e.sign&&([e,t]=[t,e]),a.__absoluteAndNot(e,a.__absoluteSubOne(t)).__trim()}static bitwiseXor(e,t){if(!e.sign&&!t.sign)return a.__absoluteXor(e,t).__trim();if(e.sign&&t.sign){const n=r(e.length,t.length),i=a.__absoluteSubOne(e,n),o=a.__absoluteSubOne(t);return a.__absoluteXor(i,o,i).__trim()}const n=r(e.length,t.length)+1;e.sign&&([e,t]=[t,e]);let i=a.__absoluteSubOne(t,n);return i=a.__absoluteXor(i,e,i),a.__absoluteAddOne(i,!0,i).__trim()}static bitwiseOr(e,t){const n=r(e.length,t.length);if(!e.sign&&!t.sign)return a.__absoluteOr(e,t).__trim();if(e.sign&&t.sign){let r=a.__absoluteSubOne(e,n);const i=a.__absoluteSubOne(t);return r=a.__absoluteAnd(r,i,r),a.__absoluteAddOne(r,!0,r).__trim()}e.sign&&([e,t]=[t,e]);let i=a.__absoluteSubOne(t,n);return i=a.__absoluteAndNot(i,e,i),a.__absoluteAddOne(i,!0,i).__trim()}static asIntN(e,t){if(0===t.length)return t;if(0>(e=i(e)))throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===e)return a.__zero();if(e>=a.__kMaxLengthBits)return t;const n=0|(e+29)/30;if(t.length<n)return t;const r=t.__unsignedDigit(n-1),o=1<<(e-1)%30;if(t.length===n&&r<o)return t;if((r&o)!==o)return a.__truncateToNBits(e,t);if(!t.sign)return a.__truncateAndSubFromPowerOfTwo(e,t,!0);if(0==(r&o-1)){for(let r=n-2;0<=r;r--)if(0!==t.__digit(r))return a.__truncateAndSubFromPowerOfTwo(e,t,!1);return t.length===n&&r===o?t:a.__truncateToNBits(e,t)}return a.__truncateAndSubFromPowerOfTwo(e,t,!1)}static asUintN(e,t){if(0===t.length)return t;if(0>(e=i(e)))throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===e)return a.__zero();if(t.sign){if(e>a.__kMaxLengthBits)throw new RangeError("BigInt too big");return a.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=a.__kMaxLengthBits)return t;const n=0|(e+29)/30;if(t.length<n)return t;const r=e%30;if(t.length==n){if(0===r)return t;if(0==t.__digit(n-1)>>>r)return t}return a.__truncateToNBits(e,t)}static ADD(e,t){if(e=a.__toPrimitive(e),t=a.__toPrimitive(t),"string"==typeof e)return"string"!=typeof t&&(t=t.toString()),e+t;if("string"==typeof t)return e.toString()+t;if(e=a.__toNumeric(e),t=a.__toNumeric(t),a.__isBigInt(e)&&a.__isBigInt(t))return a.add(e,t);if("number"==typeof e&&"number"==typeof t)return e+t;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(e,t){return a.__compare(e,t,0)}static LE(e,t){return a.__compare(e,t,1)}static GT(e,t){return a.__compare(e,t,2)}static GE(e,t){return a.__compare(e,t,3)}static EQ(e,t){for(;;){if(a.__isBigInt(e))return a.__isBigInt(t)?a.equal(e,t):a.EQ(t,e);if("number"==typeof e){if(a.__isBigInt(t))return a.__equalToNumber(t,e);if("object"!=typeof t)return e==t;t=a.__toPrimitive(t)}else if("string"==typeof e){if(a.__isBigInt(t))return null!==(e=a.__fromString(e))&&a.equal(e,t);if("object"!=typeof t)return e==t;t=a.__toPrimitive(t)}else if("boolean"==typeof e){if(a.__isBigInt(t))return a.__equalToNumber(t,+e);if("object"!=typeof t)return e==t;t=a.__toPrimitive(t)}else if("symbol"==typeof e){if(a.__isBigInt(t))return!1;if("object"!=typeof t)return e==t;t=a.__toPrimitive(t)}else{if("object"!=typeof e)return e==t;if("object"==typeof t&&t.constructor!==a)return e==t;e=a.__toPrimitive(e)}}}static NE(e,t){return!a.EQ(e,t)}static __zero(){return new a(0,!1)}static __oneDigit(e,t){const n=new a(1,t);return n.__setDigit(0,e),n}__copy(){const e=new a(this.length,this.sign);for(let t=0;t<this.length;t++)e[t]=this[t];return e}__trim(){let e=this.length,t=this[e-1];for(;0===t;)e--,t=this[e-1],this.pop();return 0===e&&(this.sign=!1),this}__initializeDigits(){for(let e=0;e<this.length;e++)this[e]=0}static __decideRounding(e,t,n,r){if(0<t)return-1;let i;if(0>t)i=-t-1;else{if(0===n)return-1;n--,r=e.__digit(n),i=29}let a=1<<i;if(0==(r&a))return-1;if(a-=1,0!=(r&a))return 1;for(;0<n;)if(n--,0!==e.__digit(n))return 1;return 0}static __fromDouble(e){a.__kBitConversionDouble[0]=e;const t=(2047&a.__kBitConversionInts[1]>>>20)-1023,n=1+(0|t/30),r=new a(n,0>e);let i=1048575&a.__kBitConversionInts[1]|1048576,o=a.__kBitConversionInts[0];const s=20,u=t%30;let l,c=0;if(20>u){const e=s-u;c=e+32,l=i>>>e,i=i<<32-e|o>>>e,o<<=32-e}else if(20===u)c=32,l=i,i=o,o=0;else{const e=u-s;c=32-e,l=i<<e|o>>>32-e,i=o<<e,o=0}r.__setDigit(n-1,l);for(let e=n-2;0<=e;e--)0<c?(c-=30,l=i>>>2,i=i<<30|o>>>2,o<<=30):l=0,r.__setDigit(e,l);return r.__trim()}static __isWhitespace(e){return!!(13>=e&&9<=e)||(159>=e?32==e:131071>=e?160==e||5760==e:196607>=e?10>=(e&=131071)||40==e||41==e||47==e||95==e||4096==e:65279==e)}static __fromString(e,t=0){let n=0;const r=e.length;let i=0;if(i===r)return a.__zero();let o=e.charCodeAt(i);for(;a.__isWhitespace(o);){if(++i===r)return a.__zero();o=e.charCodeAt(i)}if(43===o){if(++i===r)return null;o=e.charCodeAt(i),n=1}else if(45===o){if(++i===r)return null;o=e.charCodeAt(i),n=-1}if(0===t){if(t=10,48===o){if(++i===r)return a.__zero();if(o=e.charCodeAt(i),88===o||120===o){if(t=16,++i===r)return null;o=e.charCodeAt(i)}else if(79===o||111===o){if(t=8,++i===r)return null;o=e.charCodeAt(i)}else if(66===o||98===o){if(t=2,++i===r)return null;o=e.charCodeAt(i)}}}else if(16===t&&48===o){if(++i===r)return a.__zero();if(o=e.charCodeAt(i),88===o||120===o){if(++i===r)return null;o=e.charCodeAt(i)}}if(0!=n&&10!==t)return null;for(;48===o;){if(++i===r)return a.__zero();o=e.charCodeAt(i)}const s=r-i;let u=a.__kMaxBitsPerChar[t],l=a.__kBitsPerCharTableMultiplier-1;if(s>1073741824/u)return null;const c=u*s+l>>>a.__kBitsPerCharTableShift,d=new a(0|(c+29)/30,!1),f=10>t?t:10,p=10<t?t-10:0;if(0==(t&t-1)){u>>=a.__kBitsPerCharTableShift;const t=[],n=[];let s=!1;do{let a=0,l=0;for(;;){let t;if(o-48>>>0<f)t=o-48;else{if(!((32|o)-97>>>0<p)){s=!0;break}t=(32|o)-87}if(l+=u,a=a<<u|t,++i===r){s=!0;break}if(o=e.charCodeAt(i),30<l+u)break}t.push(a),n.push(l)}while(!s);a.__fillFromParts(d,t,n)}else{d.__initializeDigits();let n=!1,s=0;do{let c=0,h=1;for(;;){let a;if(o-48>>>0<f)a=o-48;else{if(!((32|o)-97>>>0<p)){n=!0;break}a=(32|o)-87}const u=h*t;if(1073741823<u)break;if(h=u,c=c*t+a,s++,++i===r){n=!0;break}o=e.charCodeAt(i)}l=30*a.__kBitsPerCharTableMultiplier-1;const m=0|(u*s+l>>>a.__kBitsPerCharTableShift)/30;d.__inplaceMultiplyAdd(h,c,m)}while(!n)}if(i!==r){if(!a.__isWhitespace(o))return null;for(i++;i<r;i++)if(o=e.charCodeAt(i),!a.__isWhitespace(o))return null}return d.sign=-1==n,d.__trim()}static __fillFromParts(e,t,n){let r=0,i=0,a=0;for(let o=t.length-1;0<=o;o--){const s=t[o],u=n[o];i|=s<<a,a+=u,30===a?(e.__setDigit(r++,i),a=0,i=0):30<a&&(e.__setDigit(r++,1073741823&i),a-=30,i=s>>>u-a)}if(0!==i){if(r>=e.length)throw new Error("implementation bug");e.__setDigit(r++,i)}for(;r<e.length;r++)e.__setDigit(r,0)}static __toStringBasePowerOfTwo(e,t){const n=e.length;let r=t-1;r=(85&r>>>1)+(85&r),r=(51&r>>>2)+(51&r),r=(15&r>>>4)+(15&r);const i=r,o=t-1,s=e.__digit(n-1);let u=0|(30*n-a.__clz30(s)+i-1)/i;if(e.sign&&u++,268435456<u)throw new Error("string too long");const l=Array(u);let c=u-1,d=0,f=0;for(let t=0;t<n-1;t++){const n=e.__digit(t),r=(d|n<<f)&o;l[c--]=a.__kConversionChars[r];const s=i-f;for(d=n>>>s,f=30-s;f>=i;)l[c--]=a.__kConversionChars[d&o],d>>>=i,f-=i}const p=(d|s<<f)&o;for(l[c--]=a.__kConversionChars[p],d=s>>>i-f;0!==d;)l[c--]=a.__kConversionChars[d&o],d>>>=i;if(e.sign&&(l[c--]="-"),-1!=c)throw new Error("implementation bug");return l.join("")}static __toStringGeneric(e,t,n){const r=e.length;if(0===r)return"";if(1===r){let r=e.__unsignedDigit(0).toString(t);return!1===n&&e.sign&&(r="-"+r),r}const i=30*r-a.__clz30(e.__digit(r-1)),o=a.__kMaxBitsPerChar[t]-1;let s=i*a.__kBitsPerCharTableMultiplier;s+=o-1,s=0|s/o;const u=s+1>>1,l=a.exponentiate(a.__oneDigit(t,!1),a.__oneDigit(u,!1));let c,d;const f=l.__unsignedDigit(0);if(1===l.length&&32767>=f){c=new a(e.length,!1),c.__initializeDigits();let n=0;for(let t=2*e.length-1;0<=t;t--){const r=n<<15|e.__halfDigit(t);c.__setHalfDigit(t,0|r/f),n=0|r%f}d=n.toString(t)}else{const n=a.__absoluteDivLarge(e,l,!0,!0);c=n.quotient;const r=n.remainder.__trim();d=a.__toStringGeneric(r,t,!0)}c.__trim();let p=a.__toStringGeneric(c,t,!0);for(;d.length<u;)d="0"+d;return!1===n&&e.sign&&(p="-"+p),p+d}static __unequalSign(e){return e?-1:1}static __absoluteGreater(e){return e?-1:1}static __absoluteLess(e){return e?1:-1}static __compareToBigInt(e,t){const n=e.sign;if(n!==t.sign)return a.__unequalSign(n);const r=a.__absoluteCompare(e,t);return 0<r?a.__absoluteGreater(n):0>r?a.__absoluteLess(n):0}static __compareToNumber(e,t){if(a.__isOneDigitInt(t)){const r=e.sign,i=0>t;if(r!==i)return a.__unequalSign(r);if(0===e.length){if(i)throw new Error("implementation bug");return 0===t?0:-1}if(1<e.length)return a.__absoluteGreater(r);const o=n(t),s=e.__unsignedDigit(0);return s>o?a.__absoluteGreater(r):s<o?a.__absoluteLess(r):0}return a.__compareToDouble(e,t)}static __compareToDouble(e,t){if(t!=t)return t;if(t===1/0)return-1;if(t===-1/0)return 1;const n=e.sign;if(n!==0>t)return a.__unequalSign(n);if(0===t)throw new Error("implementation bug: should be handled elsewhere");if(0===e.length)return-1;a.__kBitConversionDouble[0]=t;const r=2047&a.__kBitConversionInts[1]>>>20;if(2047==r)throw new Error("implementation bug: handled elsewhere");const i=r-1023;if(0>i)return a.__absoluteGreater(n);const o=e.length;let s=e.__digit(o-1);const u=a.__clz30(s),l=30*o-u,c=i+1;if(l<c)return a.__absoluteLess(n);if(l>c)return a.__absoluteGreater(n);let d=1048576|1048575&a.__kBitConversionInts[1],f=a.__kBitConversionInts[0];const p=20,h=29-u;if(h!==(0|(l-1)%30))throw new Error("implementation bug");let m,y=0;if(20>h){const e=p-h;y=e+32,m=d>>>e,d=d<<32-e|f>>>e,f<<=32-e}else if(20===h)y=32,m=d,d=f,f=0;else{const e=h-p;y=32-e,m=d<<e|f>>>32-e,d=f<<e,f=0}if(s>>>=0,m>>>=0,s>m)return a.__absoluteGreater(n);if(s<m)return a.__absoluteLess(n);for(let t=o-2;0<=t;t--){0<y?(y-=30,m=d>>>2,d=d<<30|f>>>2,f<<=30):m=0;const r=e.__unsignedDigit(t);if(r>m)return a.__absoluteGreater(n);if(r<m)return a.__absoluteLess(n)}if(0!==d||0!==f){if(0===y)throw new Error("implementation bug");return a.__absoluteLess(n)}return 0}static __equalToNumber(e,t){return a.__isOneDigitInt(t)?0===t?0===e.length:1===e.length&&e.sign===0>t&&e.__unsignedDigit(0)===n(t):0===a.__compareToDouble(e,t)}static __comparisonResultToBool(e,t){return 0===t?0>e:1===t?0>=e:2===t?0<e:3===t?0<=e:void 0}static __compare(e,t,n){if(e=a.__toPrimitive(e),t=a.__toPrimitive(t),"string"==typeof e&&"string"==typeof t)switch(n){case 0:return e<t;case 1:return e<=t;case 2:return e>t;case 3:return e>=t}if(a.__isBigInt(e)&&"string"==typeof t)return null!==(t=a.__fromString(t))&&a.__comparisonResultToBool(a.__compareToBigInt(e,t),n);if("string"==typeof e&&a.__isBigInt(t))return null!==(e=a.__fromString(e))&&a.__comparisonResultToBool(a.__compareToBigInt(e,t),n);if(e=a.__toNumeric(e),t=a.__toNumeric(t),a.__isBigInt(e)){if(a.__isBigInt(t))return a.__comparisonResultToBool(a.__compareToBigInt(e,t),n);if("number"!=typeof t)throw new Error("implementation bug");return a.__comparisonResultToBool(a.__compareToNumber(e,t),n)}if("number"!=typeof e)throw new Error("implementation bug");if(a.__isBigInt(t))return a.__comparisonResultToBool(a.__compareToNumber(t,e),2^n);if("number"!=typeof t)throw new Error("implementation bug");return 0===n?e<t:1===n?e<=t:2===n?e>t:3===n?e>=t:void 0}__clzmsd(){return a.__clz30(this.__digit(this.length-1))}static __absoluteAdd(e,t,n){if(e.length<t.length)return a.__absoluteAdd(t,e,n);if(0===e.length)return e;if(0===t.length)return e.sign===n?e:a.unaryMinus(e);let r=e.length;(0===e.__clzmsd()||t.length===e.length&&0===t.__clzmsd())&&r++;const i=new a(r,n);let o=0,s=0;for(;s<t.length;s++){const n=e.__digit(s)+t.__digit(s)+o;o=n>>>30,i.__setDigit(s,1073741823&n)}for(;s<e.length;s++){const t=e.__digit(s)+o;o=t>>>30,i.__setDigit(s,1073741823&t)}return s<i.length&&i.__setDigit(s,o),i.__trim()}static __absoluteSub(e,t,n){if(0===e.length)return e;if(0===t.length)return e.sign===n?e:a.unaryMinus(e);const r=new a(e.length,n);let i=0,o=0;for(;o<t.length;o++){const n=e.__digit(o)-t.__digit(o)-i;i=1&n>>>30,r.__setDigit(o,1073741823&n)}for(;o<e.length;o++){const t=e.__digit(o)-i;i=1&t>>>30,r.__setDigit(o,1073741823&t)}return r.__trim()}static __absoluteAddOne(e,t,n=null){const r=e.length;null===n?n=new a(r,t):n.sign=t;let i=1;for(let t=0;t<r;t++){const r=e.__digit(t)+i;i=r>>>30,n.__setDigit(t,1073741823&r)}return 0!=i&&n.__setDigitGrow(r,1),n}static __absoluteSubOne(e,t){const n=e.length,r=new a(t=t||n,!1);let i=1;for(let t=0;t<n;t++){const n=e.__digit(t)-i;i=1&n>>>30,r.__setDigit(t,1073741823&n)}if(0!=i)throw new Error("implementation bug");for(let e=n;e<t;e++)r.__setDigit(e,0);return r}static __absoluteAnd(e,t,n=null){let r=e.length,i=t.length,o=i;if(r<i){o=r;const n=e,a=r;e=t,r=i,t=n,i=a}let s=o;null===n?n=new a(s,!1):s=n.length;let u=0;for(;u<o;u++)n.__setDigit(u,e.__digit(u)&t.__digit(u));for(;u<s;u++)n.__setDigit(u,0);return n}static __absoluteAndNot(e,t,n=null){const r=e.length,i=t.length;let o=i;r<i&&(o=r);let s=r;null===n?n=new a(s,!1):s=n.length;let u=0;for(;u<o;u++)n.__setDigit(u,e.__digit(u)&~t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<s;u++)n.__setDigit(u,0);return n}static __absoluteOr(e,t,n=null){let r=e.length,i=t.length,o=i;if(r<i){o=r;const n=e,a=r;e=t,r=i,t=n,i=a}let s=r;null===n?n=new a(s,!1):s=n.length;let u=0;for(;u<o;u++)n.__setDigit(u,e.__digit(u)|t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<s;u++)n.__setDigit(u,0);return n}static __absoluteXor(e,t,n=null){let r=e.length,i=t.length,o=i;if(r<i){o=r;const n=e,a=r;e=t,r=i,t=n,i=a}let s=r;null===n?n=new a(s,!1):s=n.length;let u=0;for(;u<o;u++)n.__setDigit(u,e.__digit(u)^t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<s;u++)n.__setDigit(u,0);return n}static __absoluteCompare(e,t){const n=e.length-t.length;if(0!=n)return n;let r=e.length-1;for(;0<=r&&e.__digit(r)===t.__digit(r);)r--;return 0>r?0:e.__unsignedDigit(r)>t.__unsignedDigit(r)?1:-1}static __multiplyAccumulate(e,t,n,r){if(0===t)return;const i=32767&t,o=t>>>15;let s=0,u=0;for(let t,l=0;l<e.length;l++,r++){t=n.__digit(r);const c=e.__digit(l),d=32767&c,f=c>>>15,p=a.__imul(d,i),h=a.__imul(d,o),m=a.__imul(f,i);t+=u+p+s,s=t>>>30,t&=1073741823,t+=((32767&h)<<15)+((32767&m)<<15),s+=t>>>30,u=a.__imul(f,o)+(h>>>15)+(m>>>15),n.__setDigit(r,1073741823&t)}for(;0!=s||0!==u;r++){let e=n.__digit(r);e+=s+u,u=0,s=e>>>30,n.__setDigit(r,1073741823&e)}}static __internalMultiplyAdd(e,t,n,r,i){let o=n,s=0;for(let n=0;n<r;n++){const r=e.__digit(n),u=a.__imul(32767&r,t),l=a.__imul(r>>>15,t),c=u+((32767&l)<<15)+s+o;o=c>>>30,s=l>>>15,i.__setDigit(n,1073741823&c)}if(i.length>r)for(i.__setDigit(r++,o+s);r<i.length;)i.__setDigit(r++,0);else if(0!==o+s)throw new Error("implementation bug")}__inplaceMultiplyAdd(e,t,n){n>this.length&&(n=this.length);const r=32767&e,i=e>>>15;let o=0,s=t;for(let e=0;e<n;e++){const t=this.__digit(e),n=32767&t,u=t>>>15,l=a.__imul(n,r),c=a.__imul(n,i),d=a.__imul(u,r);let f=s+l+o;o=f>>>30,f&=1073741823,f+=((32767&c)<<15)+((32767&d)<<15),o+=f>>>30,s=a.__imul(u,i)+(c>>>15)+(d>>>15),this.__setDigit(e,1073741823&f)}if(0!=o||0!==s)throw new Error("implementation bug")}static __absoluteDivSmall(e,t,n=null){null===n&&(n=new a(e.length,!1));let r=0;for(let i,a=2*e.length-1;0<=a;a-=2){i=(r<<15|e.__halfDigit(a))>>>0;const o=0|i/t;r=0|i%t,i=(r<<15|e.__halfDigit(a-1))>>>0;const s=0|i/t;r=0|i%t,n.__setDigit(a>>>1,o<<15|s)}return n}static __absoluteModSmall(e,t){let n=0;for(let r=2*e.length-1;0<=r;r--)n=0|((n<<15|e.__halfDigit(r))>>>0)%t;return n}static __absoluteDivLarge(e,t,n,r){const i=t.__halfDigitLength(),o=t.length,s=e.__halfDigitLength()-i;let u=null;n&&(u=new a(s+2>>>1,!1),u.__initializeDigits());const l=new a(i+2>>>1,!1);l.__initializeDigits();const c=a.__clz15(t.__halfDigit(i-1));0<c&&(t=a.__specialLeftShift(t,c,0));const d=a.__specialLeftShift(e,c,1),f=t.__halfDigit(i-1);let p=0;for(let e,r=s;0<=r;r--){e=32767;const s=d.__halfDigit(r+i);if(s!==f){const n=(s<<15|d.__halfDigit(r+i-1))>>>0;e=0|n/f;let o=0|n%f;const u=t.__halfDigit(i-2),l=d.__halfDigit(r+i-2);for(;a.__imul(e,u)>>>0>(o<<16|l)>>>0&&(e--,o+=f,!(32767<o)););}a.__internalMultiplyAdd(t,e,0,o,l);let c=d.__inplaceSub(l,r,i+1);0!==c&&(c=d.__inplaceAdd(t,r,i),d.__setHalfDigit(r+i,32767&d.__halfDigit(r+i)+c),e--),n&&(1&r?p=e<<15:u.__setDigit(r>>>1,p|e))}if(r)return d.__inplaceRightShift(c),n?{quotient:u,remainder:d}:d;if(n)return u;throw new Error("unreachable")}static __clz15(e){return a.__clz30(e)-15}__inplaceAdd(e,t,n){let r=0;for(let i=0;i<n;i++){const n=this.__halfDigit(t+i)+e.__halfDigit(i)+r;r=n>>>15,this.__setHalfDigit(t+i,32767&n)}return r}__inplaceSub(e,t,n){let r=0;if(1&t){t>>=1;let i=this.__digit(t),a=32767&i,o=0;for(;o<n-1>>>1;o++){const n=e.__digit(o),s=(i>>>15)-(32767&n)-r;r=1&s>>>15,this.__setDigit(t+o,(32767&s)<<15|32767&a),i=this.__digit(t+o+1),a=(32767&i)-(n>>>15)-r,r=1&a>>>15}const s=e.__digit(o),u=(i>>>15)-(32767&s)-r;if(r=1&u>>>15,this.__setDigit(t+o,(32767&u)<<15|32767&a),t+o+1>=this.length)throw new RangeError("out of bounds");0==(1&n)&&(i=this.__digit(t+o+1),a=(32767&i)-(s>>>15)-r,r=1&a>>>15,this.__setDigit(t+e.length,1073709056&i|32767&a))}else{t>>=1;let i=0;for(;i<e.length-1;i++){const n=this.__digit(t+i),a=e.__digit(i),o=(32767&n)-(32767&a)-r;r=1&o>>>15;const s=(n>>>15)-(a>>>15)-r;r=1&s>>>15,this.__setDigit(t+i,(32767&s)<<15|32767&o)}const a=this.__digit(t+i),o=e.__digit(i),s=(32767&a)-(32767&o)-r;r=1&s>>>15;let u=0;0==(1&n)&&(u=(a>>>15)-(o>>>15)-r,r=1&u>>>15),this.__setDigit(t+i,(32767&u)<<15|32767&s)}return r}__inplaceRightShift(e){if(0===e)return;let t=this.__digit(0)>>>e;const n=this.length-1;for(let r=0;r<n;r++){const n=this.__digit(r+1);this.__setDigit(r,1073741823&n<<30-e|t),t=n>>>e}this.__setDigit(n,t)}static __specialLeftShift(e,t,n){const r=e.length,i=new a(r+n,!1);if(0===t){for(let t=0;t<r;t++)i.__setDigit(t,e.__digit(t));return 0<n&&i.__setDigit(r,0),i}let o=0;for(let n=0;n<r;n++){const r=e.__digit(n);i.__setDigit(n,1073741823&r<<t|o),o=r>>>30-t}return 0<n&&i.__setDigit(r,o),i}static __leftShiftByAbsolute(e,t){const n=a.__toShiftAmount(t);if(0>n)throw new RangeError("BigInt too big");const r=0|n/30,i=n%30,o=e.length,s=0!==i&&0!=e.__digit(o-1)>>>30-i,u=o+r+(s?1:0),l=new a(u,e.sign);if(0===i){let t=0;for(;t<r;t++)l.__setDigit(t,0);for(;t<u;t++)l.__setDigit(t,e.__digit(t-r))}else{let t=0;for(let e=0;e<r;e++)l.__setDigit(e,0);for(let n=0;n<o;n++){const a=e.__digit(n);l.__setDigit(n+r,1073741823&a<<i|t),t=a>>>30-i}if(s)l.__setDigit(o+r,t);else if(0!==t)throw new Error("implementation bug")}return l.__trim()}static __rightShiftByAbsolute(e,t){const n=e.length,r=e.sign,i=a.__toShiftAmount(t);if(0>i)return a.__rightShiftByMaximum(r);const o=0|i/30,s=i%30;let u=n-o;if(0>=u)return a.__rightShiftByMaximum(r);let l=!1;if(r)if(0!=(e.__digit(o)&(1<<s)-1))l=!0;else for(let t=0;t<o;t++)if(0!==e.__digit(t)){l=!0;break}l&&0===s&&0==~e.__digit(n-1)&&u++;let c=new a(u,r);if(0===s){c.__setDigit(u-1,0);for(let t=o;t<n;t++)c.__setDigit(t-o,e.__digit(t))}else{let t=e.__digit(o)>>>s;const r=n-o-1;for(let n=0;n<r;n++){const r=e.__digit(n+o+1);c.__setDigit(n,1073741823&r<<30-s|t),t=r>>>s}c.__setDigit(r,t)}return l&&(c=a.__absoluteAddOne(c,!0,c)),c.__trim()}static __rightShiftByMaximum(e){return e?a.__oneDigit(1,!0):a.__zero()}static __toShiftAmount(e){if(1<e.length)return-1;const t=e.__unsignedDigit(0);return t>a.__kMaxLengthBits?-1:t}static __toPrimitive(e,t="default"){if("object"!=typeof e)return e;if(e.constructor===a)return e;if("undefined"!=typeof Symbol&&"symbol"==typeof Symbol.toPrimitive){const n=e[Symbol.toPrimitive];if(n){const e=n(t);if("object"!=typeof e)return e;throw new TypeError("Cannot convert object to primitive value")}}const n=e.valueOf;if(n){const t=n.call(e);if("object"!=typeof t)return t}const r=e.toString;if(r){const t=r.call(e);if("object"!=typeof t)return t}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(e){return a.__isBigInt(e)?e:+e}static __isBigInt(e){return"object"==typeof e&&null!==e&&e.constructor===a}static __truncateToNBits(e,t){const n=0|(e+29)/30,r=new a(n,t.sign),i=n-1;for(let e=0;e<i;e++)r.__setDigit(e,t.__digit(e));let o=t.__digit(i);if(0!=e%30){const t=32-e%30;o=o<<t>>>t}return r.__setDigit(i,o),r.__trim()}static __truncateAndSubFromPowerOfTwo(e,t,n){var r=Math.min;const i=0|(e+29)/30,o=new a(i,n);let s=0;const u=i-1;let l=0;for(const e=r(u,t.length);s<e;s++){const e=0-t.__digit(s)-l;l=1&e>>>30,o.__setDigit(s,1073741823&e)}for(;s<u;s++)o.__setDigit(s,0|1073741823&-l);let c=u<t.length?t.__digit(u):0;const d=e%30;let f;if(0==d)f=0-c-l,f&=1073741823;else{const e=32-d;c=c<<e>>>e;const t=1<<32-e;f=t-c-l,f&=t-1}return o.__setDigit(u,f),o.__trim()}__digit(e){return this[e]}__unsignedDigit(e){return this[e]>>>0}__setDigit(e,t){this[e]=0|t}__setDigitGrow(e,t){this[e]=0|t}__halfDigitLength(){const e=this.length;return 32767>=this.__unsignedDigit(e-1)?2*e-1:2*e}__halfDigit(e){return 32767&this[e>>>1]>>>15*(1&e)}__setHalfDigit(e,t){const n=e>>>1,r=this.__digit(n),i=1&e?32767&r|t<<15:1073709056&r|32767&t;this.__setDigit(n,i)}static __digitPow(e,t){let n=1;for(;0<t;)1&t&&(n*=e),t>>>=1,e*=e;return n}static __isOneDigitInt(e){return(1073741823&e)===e}}return a.__kMaxLength=33554432,a.__kMaxLengthBits=a.__kMaxLength<<5,a.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],a.__kBitsPerCharTableShift=5,a.__kBitsPerCharTableMultiplier=1<<a.__kBitsPerCharTableShift,a.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],a.__kBitConversionBuffer=new ArrayBuffer(8),a.__kBitConversionDouble=new Float64Array(a.__kBitConversionBuffer),a.__kBitConversionInts=new Int32Array(a.__kBitConversionBuffer),a.__clz30=t?function(e){return t(e)-2}:function(e){var t=Math.LN2,n=Math.log;return 0===e?30:0|29-(0|n(e>>>0)/t)},a.__imul=e||function(e,t){return 0|e*t},a}()}(cw);var dw=cw.exports,fw=at(dw),pw="Invariant failed";function hw(e,t){if(!e)throw new Error(pw)}var mw={exports:{}};
|
|
33
|
+
class kv{constructor(e=0,t=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=n,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){return e.map((e=>[e,this.get(e)]))}evict(e=!1){if(e||this.size>0){const e=this.first;delete this.items[e.key],0==--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){let t;if(this.has(e)){const n=this.items[e];this.ttl>0&&n.expiry<=Date.now()?this.delete(e):(t=n.value,this.set(e,t,!0))}return t}has(e){return e in this.items}keys(){const e=[];let t=this.first;for(;null!==t;)e.push(t.key),t=t.next;return e}set(e,t,n=!1,r=this.resetTtl){let i;if(n||this.has(e)){if(i=this.items[e],i.value=t,!1===n&&r&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==i){const e=this.last,t=i.next,n=i.prev;this.first===i&&(this.first=i.next),i.next=null,i.prev=this.last,e.next=i,null!==n&&(n.next=t),null!==t&&(t.prev=n)}}else this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1==++this.size?this.first=i:this.last.next=i;return this.last=i,this}values(e=this.keys()){return e.map((e=>this.get(e)))}}Sv.LRU=kv,Sv.lru=function(e=1e3,t=0,n=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof n)throw new TypeError("Invalid resetTtl value");return new kv(e,t,n)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.memorise=void 0;const t=Sv,n={max:1e3};e.memorise=(e,i={})=>{const{cache:a,cacheKeyResolver:o=r,onHit:s,lruOptions:u={}}=i,l={...n,...u},c=a||(0,t.lru)(l.max,l.ttl),d=(...t)=>{const n=o(...t),r=c.get(n);if(c.has(n))return s&&s(n,r,c),r;const i=e.apply(this,t);return c.set(n,i),i};return d._cache=c,d},e.default=e.memorise;const r=(...e)=>0===e.length?"no-args":e.map((e=>void 0===e?"undefined":null===e?"null":Array.isArray(e)?`[${r(...e)}]`:"object"==typeof e?`{${r(...i(e))}}`:JSON.stringify(e))).join(","),i=e=>Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1))}(Iv);var Ov={};Object.defineProperty(Ov,"__esModule",{value:!0}),Ov.clearGlobalNamespace=Mv=Ov.getGlobalisedValue=void 0;const Rv={},Pv=()=>"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:Rv,Nv=e=>`globalise__singleton__${e}`,Lv=e=>{const t=Pv(),n=Nv(e);return t[n]||(t[n]={}),t[n]};var Mv=Ov.getGlobalisedValue=(e,t,n)=>{((e,t)=>{if("string"!=typeof e)throw"Invalid namespace key";if("string"!=typeof t)throw"Invalid item key"})(e,t);const r=((e,t)=>Lv(e)[t]||void 0)(e,t);return void 0!==r?r:(((e,t,n)=>{Lv(e)[t]=n})(e,t,n),n)};Ov.clearGlobalNamespace=e=>{const t=Pv(),n=Nv(e);void 0!==t[n]&&delete t[n]};const Dv=()=>"undefined"==typeof window;var Fv;!function(e){e.RUNTIME_ID="rid",e.PASSPORT_CLIENT_ID="passportClientId",e.ENVIRONMENT="env",e.PUBLISHABLE_API_KEY="pak",e.IDENTITY="uid",e.DOMAIN="domain",e.SDK_VERSION="sdkVersion"}(Fv||(Fv={}));async function jv(e,t){const n=tg.create({baseURL:"https://api.x.immutable.com"}),r=JSON.stringify(t),i={payload:btoa(r)};return(await n.post(e,i)).data}const Bv=()=>!Dv()&&window.localStorage,_v=e=>`__IMX-${e}`;function zv(e){if(Bv())return(e=>{if(null!==e)try{return JSON.parse(e)}catch(t){return e}})(window.localStorage.getItem(_v(e)))}const Uv=(e,t)=>!!Bv()&&(window.localStorage.setItem(_v(e),(e=>"string"==typeof e?e:JSON.stringify(e))(t)),!0);var Wv;let Hv,Vv;!function(e){e.EVENTS="events",e.RUNTIME="runtime"}(Wv||(Wv={}));Hv=zv(Wv.EVENTS)||[],Vv=zv(Wv.RUNTIME)||{};const qv=(e,t)=>{Vv={...Vv,[e]:t},Uv(Wv.RUNTIME,Vv)},Gv=e=>{const t=[];return Object.entries(e).forEach((([e,n])=>{"string"!=typeof e&&"string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n||t.push([e,n.toString()])})),t},Xv="1.5.3",Zv=()=>Dv()?"":window.opener||window.parent!==window?Dv()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"":new URL(window.location.href).hostname;let Yv=!1;const Kv=async()=>{Yv=!0;try{const e=Gv((()=>{if(qv(Fv.SDK_VERSION,Xv),Dv())return{browser:"nodejs",sdkVersion:Xv};const e=Zv();return e&&qv(Fv.DOMAIN,e),{sdkVersion:Xv,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}})()),t=(e=>{if(void 0!==Vv[e])return Vv[e]})(Fv.RUNTIME_ID),n={version:1,data:{runtimeDetails:e,runtimeId:t}},r=await jv("/v1/sdk/initialise",n),{runtimeId:i}=r;qv(Fv.RUNTIME_ID,i)}catch(e){Yv=!1}};function Qv(e){return(...t)=>{try{const n=e(...t);return n instanceof Promise?n.catch((()=>{})):n}catch(e){return}}}const Jv="imtbl__metrics",$v=(e,t)=>Mv(Jv,e,t);Qv(((e,t)=>{const n=Iv.memorise(t,{lruOptions:{ttl:1e3,max:1e3}});return Mv(Jv,e,n)})("track",((e,t,n)=>{(e=>{Hv.push(e),Uv(Wv.EVENTS,Hv)})({event:`${e}.${t}`,time:(new Date).toISOString(),...n&&{properties:Gv(n)}})})));const ew=Qv((async()=>{if(!1===Yv)return void await Kv();const e=Hv;if(0===e.length)return;const t=e.length,n={version:1,data:{events:e,details:Vv}};var r;await jv("/v1/sdk/metrics",n)instanceof Error||(r=t,Hv=Hv.slice(r),Uv(Wv.EVENTS,Hv))})),tw=async()=>{await ew(),setTimeout(tw,5e3)};let nw=!1;const rw=()=>{nw||(nw=!0,tw())};"undefined"!=typeof process&&void 0!==process.env.JEST_WORKER_ID||Qv($v("startFlushing",rw))();Qv($v("setEnvironment",(e=>{qv(Fv.ENVIRONMENT,e)})));Qv($v("setPassportClientId",(e=>{qv(Fv.PASSPORT_CLIENT_ID,e)})));var iw;Qv($v("setPublishableApiKey",(e=>{qv(Fv.PUBLISHABLE_API_KEY,e)}))),function(e){e.PRODUCTION="production",e.SANDBOX="sandbox"}(iw||(iw={}));const aw=[tv,nv],ow=[rv],sw={[iw.SANDBOX]:aw,[iw.PRODUCTION]:ow},uw=(new Map).set(tv,{rootERC20BridgeFlowRate:"0x0",childERC20Bridge:"0x0",rootChainIMX:"0x0",rootChainWrappedETH:"0x0",childChainWrappedETH:"0x0",childChainWrappedIMX:"0x0"}).set(nv,{rootERC20BridgeFlowRate:"0x0D3C59c779Fd552C27b23F723E80246c840100F5",childERC20Bridge:"0x0D3C59c779Fd552C27b23F723E80246c840100F5",rootChainIMX:"0xe2629e08f4125d14e446660028bD98ee60EE69F2",rootChainWrappedETH:"0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",childChainWrappedETH:"0xe9E96d1aad82562b7588F03f49aD34186f996478",childChainWrappedIMX:"0x1CcCa691501174B4A623CeDA58cC8f1a76dc3439"}).set(rv,{rootERC20BridgeFlowRate:"0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",childERC20Bridge:"0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",rootChainIMX:"0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF",rootChainWrappedETH:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",childChainWrappedETH:"0x52a6c53869ce09a731cd772f245b97a4401d3348",childChainWrappedIMX:"0x3a0c2ba54d6cbd3121f01b96dfd20e99d1696c9d"});class lw{baseConfig;bridgeInstance;bridgeContracts;rootProvider;childProvider;constructor({bridgeInstance:e,rootProvider:t,childProvider:n,baseConfig:r,overrides:i}){if(this.baseConfig=r,this.bridgeInstance=e,this.rootProvider=t,this.childProvider=n,i)return void(this.bridgeContracts=i.bridgeContracts);if(!sw[r.environment].includes(e))throw new Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${r.environment}`);if(!uw.has(e))throw new Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${r.environment}`);const a=uw.get(e);if(!a)throw new Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${r.environment}`);this.bridgeContracts=a}}var cw={exports:{}};!function(e,t){e.exports=function(){var e=Math.imul,t=Math.clz32,n=Math.abs,r=Math.max,i=Math.floor;class a extends Array{constructor(e,t){if(super(e),this.sign=t,e>a.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt(e){var t=Number.isFinite;if("number"==typeof e){if(0===e)return a.__zero();if(a.__isOneDigitInt(e))return 0>e?a.__oneDigit(-e,!0):a.__oneDigit(e,!1);if(!t(e)||i(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return a.__fromDouble(e)}if("string"==typeof e){const t=a.__fromString(e);if(null===t)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return t}if("boolean"==typeof e)return!0===e?a.__oneDigit(1,!1):a.__zero();if("object"==typeof e){if(e.constructor===a)return e;const t=a.__toPrimitive(e);return a.BigInt(t)}throw new TypeError("Cannot convert "+e+" to a BigInt")}toDebugString(){const e=["BigInt["];for(const t of this)e.push((t?(t>>>0).toString(16):t)+", ");return e.push("]"),e.join("")}toString(e=10){if(2>e||36<e)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":0==(e&e-1)?a.__toStringBasePowerOfTwo(this,e):a.__toStringGeneric(this,e,!1)}static toNumber(e){const t=e.length;if(0===t)return 0;if(1===t){const t=e.__unsignedDigit(0);return e.sign?-t:t}const n=e.__digit(t-1),r=a.__clz30(n),i=30*t-r;if(1024<i)return e.sign?-1/0:1/0;let o=i-1,s=n,u=t-1;const l=r+3;let c=32===l?0:s<<l;c>>>=12;const d=l-12;let f=12<=l?0:s<<20+l,p=20+l;for(0<d&&0<u&&(u--,s=e.__digit(u),c|=s>>>30-d,f=s<<d+2,p=d+2);0<p&&0<u;)u--,s=e.__digit(u),f|=30<=p?s<<p-30:s>>>30-p,p-=30;const h=a.__decideRounding(e,p,u,s);if((1===h||0===h&&1==(1&f))&&(f=f+1>>>0,0===f&&(c++,0!=c>>>20&&(c=0,o++,1023<o))))return e.sign?-1/0:1/0;const m=e.sign?-2147483648:0;return o=o+1023<<20,a.__kBitConversionInts[1]=m|o|c,a.__kBitConversionInts[0]=f,a.__kBitConversionDouble[0]}static unaryMinus(e){if(0===e.length)return e;const t=e.__copy();return t.sign=!e.sign,t}static bitwiseNot(e){return e.sign?a.__absoluteSubOne(e).__trim():a.__absoluteAddOne(e,!0)}static exponentiate(e,t){if(t.sign)throw new RangeError("Exponent must be positive");if(0===t.length)return a.__oneDigit(1,!1);if(0===e.length)return e;if(1===e.length&&1===e.__digit(0))return e.sign&&0==(1&t.__digit(0))?a.unaryMinus(e):e;if(1<t.length)throw new RangeError("BigInt too big");let n=t.__unsignedDigit(0);if(1===n)return e;if(n>=a.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===e.length&&2===e.__digit(0)){const t=1+(0|n/30),r=e.sign&&0!=(1&n),i=new a(t,r);i.__initializeDigits();const o=1<<n%30;return i.__setDigit(t-1,o),i}let r=null,i=e;for(0!=(1&n)&&(r=e),n>>=1;0!==n;n>>=1)i=a.multiply(i,i),0!=(1&n)&&(r=null===r?i:a.multiply(r,i));return r}static multiply(e,t){if(0===e.length)return e;if(0===t.length)return t;let n=e.length+t.length;30<=e.__clzmsd()+t.__clzmsd()&&n--;const r=new a(n,e.sign!==t.sign);r.__initializeDigits();for(let n=0;n<e.length;n++)a.__multiplyAccumulate(t,e.__digit(n),r,n);return r.__trim()}static divide(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>a.__absoluteCompare(e,t))return a.__zero();const n=e.sign!==t.sign,r=t.__unsignedDigit(0);let i;if(1===t.length&&32767>=r){if(1===r)return n===e.sign?e:a.unaryMinus(e);i=a.__absoluteDivSmall(e,r,null)}else i=a.__absoluteDivLarge(e,t,!0,!1);return i.sign=n,i.__trim()}static remainder(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>a.__absoluteCompare(e,t))return e;const n=t.__unsignedDigit(0);if(1===t.length&&32767>=n){if(1===n)return a.__zero();const t=a.__absoluteModSmall(e,n);return 0===t?a.__zero():a.__oneDigit(t,e.sign)}const r=a.__absoluteDivLarge(e,t,!1,!0);return r.sign=e.sign,r.__trim()}static add(e,t){const n=e.sign;return n===t.sign?a.__absoluteAdd(e,t,n):0<=a.__absoluteCompare(e,t)?a.__absoluteSub(e,t,n):a.__absoluteSub(t,e,!n)}static subtract(e,t){const n=e.sign;return n===t.sign?0<=a.__absoluteCompare(e,t)?a.__absoluteSub(e,t,n):a.__absoluteSub(t,e,!n):a.__absoluteAdd(e,t,n)}static leftShift(e,t){return 0===t.length||0===e.length?e:t.sign?a.__rightShiftByAbsolute(e,t):a.__leftShiftByAbsolute(e,t)}static signedRightShift(e,t){return 0===t.length||0===e.length?e:t.sign?a.__leftShiftByAbsolute(e,t):a.__rightShiftByAbsolute(e,t)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(e,t){return 0>a.__compareToBigInt(e,t)}static lessThanOrEqual(e,t){return 0>=a.__compareToBigInt(e,t)}static greaterThan(e,t){return 0<a.__compareToBigInt(e,t)}static greaterThanOrEqual(e,t){return 0<=a.__compareToBigInt(e,t)}static equal(e,t){if(e.sign!==t.sign)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e.__digit(n)!==t.__digit(n))return!1;return!0}static notEqual(e,t){return!a.equal(e,t)}static bitwiseAnd(e,t){if(!e.sign&&!t.sign)return a.__absoluteAnd(e,t).__trim();if(e.sign&&t.sign){const n=r(e.length,t.length)+1;let i=a.__absoluteSubOne(e,n);const o=a.__absoluteSubOne(t);return i=a.__absoluteOr(i,o,i),a.__absoluteAddOne(i,!0,i).__trim()}return e.sign&&([e,t]=[t,e]),a.__absoluteAndNot(e,a.__absoluteSubOne(t)).__trim()}static bitwiseXor(e,t){if(!e.sign&&!t.sign)return a.__absoluteXor(e,t).__trim();if(e.sign&&t.sign){const n=r(e.length,t.length),i=a.__absoluteSubOne(e,n),o=a.__absoluteSubOne(t);return a.__absoluteXor(i,o,i).__trim()}const n=r(e.length,t.length)+1;e.sign&&([e,t]=[t,e]);let i=a.__absoluteSubOne(t,n);return i=a.__absoluteXor(i,e,i),a.__absoluteAddOne(i,!0,i).__trim()}static bitwiseOr(e,t){const n=r(e.length,t.length);if(!e.sign&&!t.sign)return a.__absoluteOr(e,t).__trim();if(e.sign&&t.sign){let r=a.__absoluteSubOne(e,n);const i=a.__absoluteSubOne(t);return r=a.__absoluteAnd(r,i,r),a.__absoluteAddOne(r,!0,r).__trim()}e.sign&&([e,t]=[t,e]);let i=a.__absoluteSubOne(t,n);return i=a.__absoluteAndNot(i,e,i),a.__absoluteAddOne(i,!0,i).__trim()}static asIntN(e,t){if(0===t.length)return t;if(0>(e=i(e)))throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===e)return a.__zero();if(e>=a.__kMaxLengthBits)return t;const n=0|(e+29)/30;if(t.length<n)return t;const r=t.__unsignedDigit(n-1),o=1<<(e-1)%30;if(t.length===n&&r<o)return t;if((r&o)!==o)return a.__truncateToNBits(e,t);if(!t.sign)return a.__truncateAndSubFromPowerOfTwo(e,t,!0);if(0==(r&o-1)){for(let r=n-2;0<=r;r--)if(0!==t.__digit(r))return a.__truncateAndSubFromPowerOfTwo(e,t,!1);return t.length===n&&r===o?t:a.__truncateToNBits(e,t)}return a.__truncateAndSubFromPowerOfTwo(e,t,!1)}static asUintN(e,t){if(0===t.length)return t;if(0>(e=i(e)))throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===e)return a.__zero();if(t.sign){if(e>a.__kMaxLengthBits)throw new RangeError("BigInt too big");return a.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=a.__kMaxLengthBits)return t;const n=0|(e+29)/30;if(t.length<n)return t;const r=e%30;if(t.length==n){if(0===r)return t;if(0==t.__digit(n-1)>>>r)return t}return a.__truncateToNBits(e,t)}static ADD(e,t){if(e=a.__toPrimitive(e),t=a.__toPrimitive(t),"string"==typeof e)return"string"!=typeof t&&(t=t.toString()),e+t;if("string"==typeof t)return e.toString()+t;if(e=a.__toNumeric(e),t=a.__toNumeric(t),a.__isBigInt(e)&&a.__isBigInt(t))return a.add(e,t);if("number"==typeof e&&"number"==typeof t)return e+t;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(e,t){return a.__compare(e,t,0)}static LE(e,t){return a.__compare(e,t,1)}static GT(e,t){return a.__compare(e,t,2)}static GE(e,t){return a.__compare(e,t,3)}static EQ(e,t){for(;;){if(a.__isBigInt(e))return a.__isBigInt(t)?a.equal(e,t):a.EQ(t,e);if("number"==typeof e){if(a.__isBigInt(t))return a.__equalToNumber(t,e);if("object"!=typeof t)return e==t;t=a.__toPrimitive(t)}else if("string"==typeof e){if(a.__isBigInt(t))return null!==(e=a.__fromString(e))&&a.equal(e,t);if("object"!=typeof t)return e==t;t=a.__toPrimitive(t)}else if("boolean"==typeof e){if(a.__isBigInt(t))return a.__equalToNumber(t,+e);if("object"!=typeof t)return e==t;t=a.__toPrimitive(t)}else if("symbol"==typeof e){if(a.__isBigInt(t))return!1;if("object"!=typeof t)return e==t;t=a.__toPrimitive(t)}else{if("object"!=typeof e)return e==t;if("object"==typeof t&&t.constructor!==a)return e==t;e=a.__toPrimitive(e)}}}static NE(e,t){return!a.EQ(e,t)}static __zero(){return new a(0,!1)}static __oneDigit(e,t){const n=new a(1,t);return n.__setDigit(0,e),n}__copy(){const e=new a(this.length,this.sign);for(let t=0;t<this.length;t++)e[t]=this[t];return e}__trim(){let e=this.length,t=this[e-1];for(;0===t;)e--,t=this[e-1],this.pop();return 0===e&&(this.sign=!1),this}__initializeDigits(){for(let e=0;e<this.length;e++)this[e]=0}static __decideRounding(e,t,n,r){if(0<t)return-1;let i;if(0>t)i=-t-1;else{if(0===n)return-1;n--,r=e.__digit(n),i=29}let a=1<<i;if(0==(r&a))return-1;if(a-=1,0!=(r&a))return 1;for(;0<n;)if(n--,0!==e.__digit(n))return 1;return 0}static __fromDouble(e){a.__kBitConversionDouble[0]=e;const t=(2047&a.__kBitConversionInts[1]>>>20)-1023,n=1+(0|t/30),r=new a(n,0>e);let i=1048575&a.__kBitConversionInts[1]|1048576,o=a.__kBitConversionInts[0];const s=20,u=t%30;let l,c=0;if(20>u){const e=s-u;c=e+32,l=i>>>e,i=i<<32-e|o>>>e,o<<=32-e}else if(20===u)c=32,l=i,i=o,o=0;else{const e=u-s;c=32-e,l=i<<e|o>>>32-e,i=o<<e,o=0}r.__setDigit(n-1,l);for(let e=n-2;0<=e;e--)0<c?(c-=30,l=i>>>2,i=i<<30|o>>>2,o<<=30):l=0,r.__setDigit(e,l);return r.__trim()}static __isWhitespace(e){return!!(13>=e&&9<=e)||(159>=e?32==e:131071>=e?160==e||5760==e:196607>=e?10>=(e&=131071)||40==e||41==e||47==e||95==e||4096==e:65279==e)}static __fromString(e,t=0){let n=0;const r=e.length;let i=0;if(i===r)return a.__zero();let o=e.charCodeAt(i);for(;a.__isWhitespace(o);){if(++i===r)return a.__zero();o=e.charCodeAt(i)}if(43===o){if(++i===r)return null;o=e.charCodeAt(i),n=1}else if(45===o){if(++i===r)return null;o=e.charCodeAt(i),n=-1}if(0===t){if(t=10,48===o){if(++i===r)return a.__zero();if(o=e.charCodeAt(i),88===o||120===o){if(t=16,++i===r)return null;o=e.charCodeAt(i)}else if(79===o||111===o){if(t=8,++i===r)return null;o=e.charCodeAt(i)}else if(66===o||98===o){if(t=2,++i===r)return null;o=e.charCodeAt(i)}}}else if(16===t&&48===o){if(++i===r)return a.__zero();if(o=e.charCodeAt(i),88===o||120===o){if(++i===r)return null;o=e.charCodeAt(i)}}if(0!=n&&10!==t)return null;for(;48===o;){if(++i===r)return a.__zero();o=e.charCodeAt(i)}const s=r-i;let u=a.__kMaxBitsPerChar[t],l=a.__kBitsPerCharTableMultiplier-1;if(s>1073741824/u)return null;const c=u*s+l>>>a.__kBitsPerCharTableShift,d=new a(0|(c+29)/30,!1),f=10>t?t:10,p=10<t?t-10:0;if(0==(t&t-1)){u>>=a.__kBitsPerCharTableShift;const t=[],n=[];let s=!1;do{let a=0,l=0;for(;;){let t;if(o-48>>>0<f)t=o-48;else{if(!((32|o)-97>>>0<p)){s=!0;break}t=(32|o)-87}if(l+=u,a=a<<u|t,++i===r){s=!0;break}if(o=e.charCodeAt(i),30<l+u)break}t.push(a),n.push(l)}while(!s);a.__fillFromParts(d,t,n)}else{d.__initializeDigits();let n=!1,s=0;do{let c=0,h=1;for(;;){let a;if(o-48>>>0<f)a=o-48;else{if(!((32|o)-97>>>0<p)){n=!0;break}a=(32|o)-87}const u=h*t;if(1073741823<u)break;if(h=u,c=c*t+a,s++,++i===r){n=!0;break}o=e.charCodeAt(i)}l=30*a.__kBitsPerCharTableMultiplier-1;const m=0|(u*s+l>>>a.__kBitsPerCharTableShift)/30;d.__inplaceMultiplyAdd(h,c,m)}while(!n)}if(i!==r){if(!a.__isWhitespace(o))return null;for(i++;i<r;i++)if(o=e.charCodeAt(i),!a.__isWhitespace(o))return null}return d.sign=-1==n,d.__trim()}static __fillFromParts(e,t,n){let r=0,i=0,a=0;for(let o=t.length-1;0<=o;o--){const s=t[o],u=n[o];i|=s<<a,a+=u,30===a?(e.__setDigit(r++,i),a=0,i=0):30<a&&(e.__setDigit(r++,1073741823&i),a-=30,i=s>>>u-a)}if(0!==i){if(r>=e.length)throw new Error("implementation bug");e.__setDigit(r++,i)}for(;r<e.length;r++)e.__setDigit(r,0)}static __toStringBasePowerOfTwo(e,t){const n=e.length;let r=t-1;r=(85&r>>>1)+(85&r),r=(51&r>>>2)+(51&r),r=(15&r>>>4)+(15&r);const i=r,o=t-1,s=e.__digit(n-1);let u=0|(30*n-a.__clz30(s)+i-1)/i;if(e.sign&&u++,268435456<u)throw new Error("string too long");const l=Array(u);let c=u-1,d=0,f=0;for(let t=0;t<n-1;t++){const n=e.__digit(t),r=(d|n<<f)&o;l[c--]=a.__kConversionChars[r];const s=i-f;for(d=n>>>s,f=30-s;f>=i;)l[c--]=a.__kConversionChars[d&o],d>>>=i,f-=i}const p=(d|s<<f)&o;for(l[c--]=a.__kConversionChars[p],d=s>>>i-f;0!==d;)l[c--]=a.__kConversionChars[d&o],d>>>=i;if(e.sign&&(l[c--]="-"),-1!=c)throw new Error("implementation bug");return l.join("")}static __toStringGeneric(e,t,n){const r=e.length;if(0===r)return"";if(1===r){let r=e.__unsignedDigit(0).toString(t);return!1===n&&e.sign&&(r="-"+r),r}const i=30*r-a.__clz30(e.__digit(r-1)),o=a.__kMaxBitsPerChar[t]-1;let s=i*a.__kBitsPerCharTableMultiplier;s+=o-1,s=0|s/o;const u=s+1>>1,l=a.exponentiate(a.__oneDigit(t,!1),a.__oneDigit(u,!1));let c,d;const f=l.__unsignedDigit(0);if(1===l.length&&32767>=f){c=new a(e.length,!1),c.__initializeDigits();let n=0;for(let t=2*e.length-1;0<=t;t--){const r=n<<15|e.__halfDigit(t);c.__setHalfDigit(t,0|r/f),n=0|r%f}d=n.toString(t)}else{const n=a.__absoluteDivLarge(e,l,!0,!0);c=n.quotient;const r=n.remainder.__trim();d=a.__toStringGeneric(r,t,!0)}c.__trim();let p=a.__toStringGeneric(c,t,!0);for(;d.length<u;)d="0"+d;return!1===n&&e.sign&&(p="-"+p),p+d}static __unequalSign(e){return e?-1:1}static __absoluteGreater(e){return e?-1:1}static __absoluteLess(e){return e?1:-1}static __compareToBigInt(e,t){const n=e.sign;if(n!==t.sign)return a.__unequalSign(n);const r=a.__absoluteCompare(e,t);return 0<r?a.__absoluteGreater(n):0>r?a.__absoluteLess(n):0}static __compareToNumber(e,t){if(a.__isOneDigitInt(t)){const r=e.sign,i=0>t;if(r!==i)return a.__unequalSign(r);if(0===e.length){if(i)throw new Error("implementation bug");return 0===t?0:-1}if(1<e.length)return a.__absoluteGreater(r);const o=n(t),s=e.__unsignedDigit(0);return s>o?a.__absoluteGreater(r):s<o?a.__absoluteLess(r):0}return a.__compareToDouble(e,t)}static __compareToDouble(e,t){if(t!=t)return t;if(t===1/0)return-1;if(t===-1/0)return 1;const n=e.sign;if(n!==0>t)return a.__unequalSign(n);if(0===t)throw new Error("implementation bug: should be handled elsewhere");if(0===e.length)return-1;a.__kBitConversionDouble[0]=t;const r=2047&a.__kBitConversionInts[1]>>>20;if(2047==r)throw new Error("implementation bug: handled elsewhere");const i=r-1023;if(0>i)return a.__absoluteGreater(n);const o=e.length;let s=e.__digit(o-1);const u=a.__clz30(s),l=30*o-u,c=i+1;if(l<c)return a.__absoluteLess(n);if(l>c)return a.__absoluteGreater(n);let d=1048576|1048575&a.__kBitConversionInts[1],f=a.__kBitConversionInts[0];const p=20,h=29-u;if(h!==(0|(l-1)%30))throw new Error("implementation bug");let m,y=0;if(20>h){const e=p-h;y=e+32,m=d>>>e,d=d<<32-e|f>>>e,f<<=32-e}else if(20===h)y=32,m=d,d=f,f=0;else{const e=h-p;y=32-e,m=d<<e|f>>>32-e,d=f<<e,f=0}if(s>>>=0,m>>>=0,s>m)return a.__absoluteGreater(n);if(s<m)return a.__absoluteLess(n);for(let t=o-2;0<=t;t--){0<y?(y-=30,m=d>>>2,d=d<<30|f>>>2,f<<=30):m=0;const r=e.__unsignedDigit(t);if(r>m)return a.__absoluteGreater(n);if(r<m)return a.__absoluteLess(n)}if(0!==d||0!==f){if(0===y)throw new Error("implementation bug");return a.__absoluteLess(n)}return 0}static __equalToNumber(e,t){return a.__isOneDigitInt(t)?0===t?0===e.length:1===e.length&&e.sign===0>t&&e.__unsignedDigit(0)===n(t):0===a.__compareToDouble(e,t)}static __comparisonResultToBool(e,t){return 0===t?0>e:1===t?0>=e:2===t?0<e:3===t?0<=e:void 0}static __compare(e,t,n){if(e=a.__toPrimitive(e),t=a.__toPrimitive(t),"string"==typeof e&&"string"==typeof t)switch(n){case 0:return e<t;case 1:return e<=t;case 2:return e>t;case 3:return e>=t}if(a.__isBigInt(e)&&"string"==typeof t)return null!==(t=a.__fromString(t))&&a.__comparisonResultToBool(a.__compareToBigInt(e,t),n);if("string"==typeof e&&a.__isBigInt(t))return null!==(e=a.__fromString(e))&&a.__comparisonResultToBool(a.__compareToBigInt(e,t),n);if(e=a.__toNumeric(e),t=a.__toNumeric(t),a.__isBigInt(e)){if(a.__isBigInt(t))return a.__comparisonResultToBool(a.__compareToBigInt(e,t),n);if("number"!=typeof t)throw new Error("implementation bug");return a.__comparisonResultToBool(a.__compareToNumber(e,t),n)}if("number"!=typeof e)throw new Error("implementation bug");if(a.__isBigInt(t))return a.__comparisonResultToBool(a.__compareToNumber(t,e),2^n);if("number"!=typeof t)throw new Error("implementation bug");return 0===n?e<t:1===n?e<=t:2===n?e>t:3===n?e>=t:void 0}__clzmsd(){return a.__clz30(this.__digit(this.length-1))}static __absoluteAdd(e,t,n){if(e.length<t.length)return a.__absoluteAdd(t,e,n);if(0===e.length)return e;if(0===t.length)return e.sign===n?e:a.unaryMinus(e);let r=e.length;(0===e.__clzmsd()||t.length===e.length&&0===t.__clzmsd())&&r++;const i=new a(r,n);let o=0,s=0;for(;s<t.length;s++){const n=e.__digit(s)+t.__digit(s)+o;o=n>>>30,i.__setDigit(s,1073741823&n)}for(;s<e.length;s++){const t=e.__digit(s)+o;o=t>>>30,i.__setDigit(s,1073741823&t)}return s<i.length&&i.__setDigit(s,o),i.__trim()}static __absoluteSub(e,t,n){if(0===e.length)return e;if(0===t.length)return e.sign===n?e:a.unaryMinus(e);const r=new a(e.length,n);let i=0,o=0;for(;o<t.length;o++){const n=e.__digit(o)-t.__digit(o)-i;i=1&n>>>30,r.__setDigit(o,1073741823&n)}for(;o<e.length;o++){const t=e.__digit(o)-i;i=1&t>>>30,r.__setDigit(o,1073741823&t)}return r.__trim()}static __absoluteAddOne(e,t,n=null){const r=e.length;null===n?n=new a(r,t):n.sign=t;let i=1;for(let t=0;t<r;t++){const r=e.__digit(t)+i;i=r>>>30,n.__setDigit(t,1073741823&r)}return 0!=i&&n.__setDigitGrow(r,1),n}static __absoluteSubOne(e,t){const n=e.length,r=new a(t=t||n,!1);let i=1;for(let t=0;t<n;t++){const n=e.__digit(t)-i;i=1&n>>>30,r.__setDigit(t,1073741823&n)}if(0!=i)throw new Error("implementation bug");for(let e=n;e<t;e++)r.__setDigit(e,0);return r}static __absoluteAnd(e,t,n=null){let r=e.length,i=t.length,o=i;if(r<i){o=r;const n=e,a=r;e=t,r=i,t=n,i=a}let s=o;null===n?n=new a(s,!1):s=n.length;let u=0;for(;u<o;u++)n.__setDigit(u,e.__digit(u)&t.__digit(u));for(;u<s;u++)n.__setDigit(u,0);return n}static __absoluteAndNot(e,t,n=null){const r=e.length,i=t.length;let o=i;r<i&&(o=r);let s=r;null===n?n=new a(s,!1):s=n.length;let u=0;for(;u<o;u++)n.__setDigit(u,e.__digit(u)&~t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<s;u++)n.__setDigit(u,0);return n}static __absoluteOr(e,t,n=null){let r=e.length,i=t.length,o=i;if(r<i){o=r;const n=e,a=r;e=t,r=i,t=n,i=a}let s=r;null===n?n=new a(s,!1):s=n.length;let u=0;for(;u<o;u++)n.__setDigit(u,e.__digit(u)|t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<s;u++)n.__setDigit(u,0);return n}static __absoluteXor(e,t,n=null){let r=e.length,i=t.length,o=i;if(r<i){o=r;const n=e,a=r;e=t,r=i,t=n,i=a}let s=r;null===n?n=new a(s,!1):s=n.length;let u=0;for(;u<o;u++)n.__setDigit(u,e.__digit(u)^t.__digit(u));for(;u<r;u++)n.__setDigit(u,e.__digit(u));for(;u<s;u++)n.__setDigit(u,0);return n}static __absoluteCompare(e,t){const n=e.length-t.length;if(0!=n)return n;let r=e.length-1;for(;0<=r&&e.__digit(r)===t.__digit(r);)r--;return 0>r?0:e.__unsignedDigit(r)>t.__unsignedDigit(r)?1:-1}static __multiplyAccumulate(e,t,n,r){if(0===t)return;const i=32767&t,o=t>>>15;let s=0,u=0;for(let t,l=0;l<e.length;l++,r++){t=n.__digit(r);const c=e.__digit(l),d=32767&c,f=c>>>15,p=a.__imul(d,i),h=a.__imul(d,o),m=a.__imul(f,i);t+=u+p+s,s=t>>>30,t&=1073741823,t+=((32767&h)<<15)+((32767&m)<<15),s+=t>>>30,u=a.__imul(f,o)+(h>>>15)+(m>>>15),n.__setDigit(r,1073741823&t)}for(;0!=s||0!==u;r++){let e=n.__digit(r);e+=s+u,u=0,s=e>>>30,n.__setDigit(r,1073741823&e)}}static __internalMultiplyAdd(e,t,n,r,i){let o=n,s=0;for(let n=0;n<r;n++){const r=e.__digit(n),u=a.__imul(32767&r,t),l=a.__imul(r>>>15,t),c=u+((32767&l)<<15)+s+o;o=c>>>30,s=l>>>15,i.__setDigit(n,1073741823&c)}if(i.length>r)for(i.__setDigit(r++,o+s);r<i.length;)i.__setDigit(r++,0);else if(0!==o+s)throw new Error("implementation bug")}__inplaceMultiplyAdd(e,t,n){n>this.length&&(n=this.length);const r=32767&e,i=e>>>15;let o=0,s=t;for(let e=0;e<n;e++){const t=this.__digit(e),n=32767&t,u=t>>>15,l=a.__imul(n,r),c=a.__imul(n,i),d=a.__imul(u,r);let f=s+l+o;o=f>>>30,f&=1073741823,f+=((32767&c)<<15)+((32767&d)<<15),o+=f>>>30,s=a.__imul(u,i)+(c>>>15)+(d>>>15),this.__setDigit(e,1073741823&f)}if(0!=o||0!==s)throw new Error("implementation bug")}static __absoluteDivSmall(e,t,n=null){null===n&&(n=new a(e.length,!1));let r=0;for(let i,a=2*e.length-1;0<=a;a-=2){i=(r<<15|e.__halfDigit(a))>>>0;const o=0|i/t;r=0|i%t,i=(r<<15|e.__halfDigit(a-1))>>>0;const s=0|i/t;r=0|i%t,n.__setDigit(a>>>1,o<<15|s)}return n}static __absoluteModSmall(e,t){let n=0;for(let r=2*e.length-1;0<=r;r--)n=0|((n<<15|e.__halfDigit(r))>>>0)%t;return n}static __absoluteDivLarge(e,t,n,r){const i=t.__halfDigitLength(),o=t.length,s=e.__halfDigitLength()-i;let u=null;n&&(u=new a(s+2>>>1,!1),u.__initializeDigits());const l=new a(i+2>>>1,!1);l.__initializeDigits();const c=a.__clz15(t.__halfDigit(i-1));0<c&&(t=a.__specialLeftShift(t,c,0));const d=a.__specialLeftShift(e,c,1),f=t.__halfDigit(i-1);let p=0;for(let e,r=s;0<=r;r--){e=32767;const s=d.__halfDigit(r+i);if(s!==f){const n=(s<<15|d.__halfDigit(r+i-1))>>>0;e=0|n/f;let o=0|n%f;const u=t.__halfDigit(i-2),l=d.__halfDigit(r+i-2);for(;a.__imul(e,u)>>>0>(o<<16|l)>>>0&&(e--,o+=f,!(32767<o)););}a.__internalMultiplyAdd(t,e,0,o,l);let c=d.__inplaceSub(l,r,i+1);0!==c&&(c=d.__inplaceAdd(t,r,i),d.__setHalfDigit(r+i,32767&d.__halfDigit(r+i)+c),e--),n&&(1&r?p=e<<15:u.__setDigit(r>>>1,p|e))}if(r)return d.__inplaceRightShift(c),n?{quotient:u,remainder:d}:d;if(n)return u;throw new Error("unreachable")}static __clz15(e){return a.__clz30(e)-15}__inplaceAdd(e,t,n){let r=0;for(let i=0;i<n;i++){const n=this.__halfDigit(t+i)+e.__halfDigit(i)+r;r=n>>>15,this.__setHalfDigit(t+i,32767&n)}return r}__inplaceSub(e,t,n){let r=0;if(1&t){t>>=1;let i=this.__digit(t),a=32767&i,o=0;for(;o<n-1>>>1;o++){const n=e.__digit(o),s=(i>>>15)-(32767&n)-r;r=1&s>>>15,this.__setDigit(t+o,(32767&s)<<15|32767&a),i=this.__digit(t+o+1),a=(32767&i)-(n>>>15)-r,r=1&a>>>15}const s=e.__digit(o),u=(i>>>15)-(32767&s)-r;if(r=1&u>>>15,this.__setDigit(t+o,(32767&u)<<15|32767&a),t+o+1>=this.length)throw new RangeError("out of bounds");0==(1&n)&&(i=this.__digit(t+o+1),a=(32767&i)-(s>>>15)-r,r=1&a>>>15,this.__setDigit(t+e.length,1073709056&i|32767&a))}else{t>>=1;let i=0;for(;i<e.length-1;i++){const n=this.__digit(t+i),a=e.__digit(i),o=(32767&n)-(32767&a)-r;r=1&o>>>15;const s=(n>>>15)-(a>>>15)-r;r=1&s>>>15,this.__setDigit(t+i,(32767&s)<<15|32767&o)}const a=this.__digit(t+i),o=e.__digit(i),s=(32767&a)-(32767&o)-r;r=1&s>>>15;let u=0;0==(1&n)&&(u=(a>>>15)-(o>>>15)-r,r=1&u>>>15),this.__setDigit(t+i,(32767&u)<<15|32767&s)}return r}__inplaceRightShift(e){if(0===e)return;let t=this.__digit(0)>>>e;const n=this.length-1;for(let r=0;r<n;r++){const n=this.__digit(r+1);this.__setDigit(r,1073741823&n<<30-e|t),t=n>>>e}this.__setDigit(n,t)}static __specialLeftShift(e,t,n){const r=e.length,i=new a(r+n,!1);if(0===t){for(let t=0;t<r;t++)i.__setDigit(t,e.__digit(t));return 0<n&&i.__setDigit(r,0),i}let o=0;for(let n=0;n<r;n++){const r=e.__digit(n);i.__setDigit(n,1073741823&r<<t|o),o=r>>>30-t}return 0<n&&i.__setDigit(r,o),i}static __leftShiftByAbsolute(e,t){const n=a.__toShiftAmount(t);if(0>n)throw new RangeError("BigInt too big");const r=0|n/30,i=n%30,o=e.length,s=0!==i&&0!=e.__digit(o-1)>>>30-i,u=o+r+(s?1:0),l=new a(u,e.sign);if(0===i){let t=0;for(;t<r;t++)l.__setDigit(t,0);for(;t<u;t++)l.__setDigit(t,e.__digit(t-r))}else{let t=0;for(let e=0;e<r;e++)l.__setDigit(e,0);for(let n=0;n<o;n++){const a=e.__digit(n);l.__setDigit(n+r,1073741823&a<<i|t),t=a>>>30-i}if(s)l.__setDigit(o+r,t);else if(0!==t)throw new Error("implementation bug")}return l.__trim()}static __rightShiftByAbsolute(e,t){const n=e.length,r=e.sign,i=a.__toShiftAmount(t);if(0>i)return a.__rightShiftByMaximum(r);const o=0|i/30,s=i%30;let u=n-o;if(0>=u)return a.__rightShiftByMaximum(r);let l=!1;if(r)if(0!=(e.__digit(o)&(1<<s)-1))l=!0;else for(let t=0;t<o;t++)if(0!==e.__digit(t)){l=!0;break}l&&0===s&&0==~e.__digit(n-1)&&u++;let c=new a(u,r);if(0===s){c.__setDigit(u-1,0);for(let t=o;t<n;t++)c.__setDigit(t-o,e.__digit(t))}else{let t=e.__digit(o)>>>s;const r=n-o-1;for(let n=0;n<r;n++){const r=e.__digit(n+o+1);c.__setDigit(n,1073741823&r<<30-s|t),t=r>>>s}c.__setDigit(r,t)}return l&&(c=a.__absoluteAddOne(c,!0,c)),c.__trim()}static __rightShiftByMaximum(e){return e?a.__oneDigit(1,!0):a.__zero()}static __toShiftAmount(e){if(1<e.length)return-1;const t=e.__unsignedDigit(0);return t>a.__kMaxLengthBits?-1:t}static __toPrimitive(e,t="default"){if("object"!=typeof e)return e;if(e.constructor===a)return e;if("undefined"!=typeof Symbol&&"symbol"==typeof Symbol.toPrimitive){const n=e[Symbol.toPrimitive];if(n){const e=n(t);if("object"!=typeof e)return e;throw new TypeError("Cannot convert object to primitive value")}}const n=e.valueOf;if(n){const t=n.call(e);if("object"!=typeof t)return t}const r=e.toString;if(r){const t=r.call(e);if("object"!=typeof t)return t}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(e){return a.__isBigInt(e)?e:+e}static __isBigInt(e){return"object"==typeof e&&null!==e&&e.constructor===a}static __truncateToNBits(e,t){const n=0|(e+29)/30,r=new a(n,t.sign),i=n-1;for(let e=0;e<i;e++)r.__setDigit(e,t.__digit(e));let o=t.__digit(i);if(0!=e%30){const t=32-e%30;o=o<<t>>>t}return r.__setDigit(i,o),r.__trim()}static __truncateAndSubFromPowerOfTwo(e,t,n){var r=Math.min;const i=0|(e+29)/30,o=new a(i,n);let s=0;const u=i-1;let l=0;for(const e=r(u,t.length);s<e;s++){const e=0-t.__digit(s)-l;l=1&e>>>30,o.__setDigit(s,1073741823&e)}for(;s<u;s++)o.__setDigit(s,0|1073741823&-l);let c=u<t.length?t.__digit(u):0;const d=e%30;let f;if(0==d)f=0-c-l,f&=1073741823;else{const e=32-d;c=c<<e>>>e;const t=1<<32-e;f=t-c-l,f&=t-1}return o.__setDigit(u,f),o.__trim()}__digit(e){return this[e]}__unsignedDigit(e){return this[e]>>>0}__setDigit(e,t){this[e]=0|t}__setDigitGrow(e,t){this[e]=0|t}__halfDigitLength(){const e=this.length;return 32767>=this.__unsignedDigit(e-1)?2*e-1:2*e}__halfDigit(e){return 32767&this[e>>>1]>>>15*(1&e)}__setHalfDigit(e,t){const n=e>>>1,r=this.__digit(n),i=1&e?32767&r|t<<15:1073709056&r|32767&t;this.__setDigit(n,i)}static __digitPow(e,t){let n=1;for(;0<t;)1&t&&(n*=e),t>>>=1,e*=e;return n}static __isOneDigitInt(e){return(1073741823&e)===e}}return a.__kMaxLength=33554432,a.__kMaxLengthBits=a.__kMaxLength<<5,a.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],a.__kBitsPerCharTableShift=5,a.__kBitsPerCharTableMultiplier=1<<a.__kBitsPerCharTableShift,a.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],a.__kBitConversionBuffer=new ArrayBuffer(8),a.__kBitConversionDouble=new Float64Array(a.__kBitConversionBuffer),a.__kBitConversionInts=new Int32Array(a.__kBitConversionBuffer),a.__clz30=t?function(e){return t(e)-2}:function(e){var t=Math.LN2,n=Math.log;return 0===e?30:0|29-(0|n(e>>>0)/t)},a.__imul=e||function(e,t){return 0|e*t},a}()}(cw);var dw=cw.exports,fw=at(dw),pw="Invariant failed";function hw(e,t){if(!e)throw new Error(pw)}var mw={exports:{}};
|
|
34
34
|
/*! decimal.js-light v2.5.1 https://github.com/MikeMcl/decimal.js-light/LICENCE */!function(e){!function(t){var n,r=1e9,i={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},a=!0,o="[DecimalError] ",s=o+"Invalid argument: ",u=o+"Exponent out of range: ",l=Math.floor,c=Math.pow,d=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,f=1e7,p=7,h=9007199254740991,m=l(h/p),y={};function g(e,t){var n,r,i,o,s,u,l,c,d=e.constructor,h=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),a?S(t,h):t;if(l=e.d,c=t.d,s=e.e,i=t.e,l=l.slice(),o=s-i){for(o<0?(r=l,o=-o,u=c.length):(r=c,i=s,u=l.length),o>(u=(s=Math.ceil(h/p))>u?s+1:u+1)&&(o=u,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for((u=l.length)-(o=c.length)<0&&(o=u,r=c,c=l,l=r),n=0;o;)n=(l[--o]=l[o]+c[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++i),u=l.length;0==l[--u];)l.pop();return t.d=l,t.e=i,a?S(t,h):t}function A(e,t,n){if(e!==~~e||e<t||e>n)throw Error(s+e)}function b(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)r=e[t]+"",(n=p-r.length)&&(a+=T(n)),a+=r;o=e[t],(n=p-(r=o+"").length)&&(a+=T(n))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}y.absoluteValue=y.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e},y.comparedTo=y.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(t=0,n=(r=a.d.length)<(i=e.d.length)?r:i;t<n;++t)if(a.d[t]!==e.d[t])return a.d[t]>e.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},y.decimalPlaces=y.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t])for(;t%10==0;t/=10)n--;return n<0?0:n},y.dividedBy=y.div=function(e){return v(this,new this.constructor(e))},y.dividedToIntegerBy=y.idiv=function(e){var t=this.constructor;return S(v(this,new t(e),0,1),t.precision)},y.equals=y.eq=function(e){return!this.cmp(e)},y.exponent=function(){return x(this)},y.greaterThan=y.gt=function(e){return this.cmp(e)>0},y.greaterThanOrEqualTo=y.gte=function(e){return this.cmp(e)>=0},y.isInteger=y.isint=function(){return this.e>this.d.length-2},y.isNegative=y.isneg=function(){return this.s<0},y.isPositive=y.ispos=function(){return this.s>0},y.isZero=function(){return 0===this.s},y.lessThan=y.lt=function(e){return this.cmp(e)<0},y.lessThanOrEqualTo=y.lte=function(e){return this.cmp(e)<1},y.logarithm=y.log=function(e){var t,r=this,i=r.constructor,s=i.precision,u=s+5;if(void 0===e)e=new i(10);else if((e=new i(e)).s<1||e.eq(n))throw Error(o+"NaN");if(r.s<1)throw Error(o+(r.s?"NaN":"-Infinity"));return r.eq(n)?new i(0):(a=!1,t=v(C(r,u),C(e,u),u),a=!0,S(t,s))},y.minus=y.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?k(t,e):g(t,(e.s=-e.s,e))},y.modulo=y.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(!(e=new r(e)).s)throw Error(o+"NaN");return n.s?(a=!1,t=v(n,e,0,1).times(e),a=!0,n.minus(t)):S(new r(n),i)},y.naturalExponential=y.exp=function(){return w(this)},y.naturalLogarithm=y.ln=function(){return C(this)},y.negated=y.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},y.plus=y.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?g(t,e):k(t,(e.s=-e.s,e))},y.precision=y.sd=function(e){var t,n,r,i=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(s+e);if(t=x(i)+1,n=(r=i.d.length-1)*p+1,r=i.d[r]){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},y.squareRoot=y.sqrt=function(){var e,t,n,r,i,s,u,c=this,d=c.constructor;if(c.s<1){if(!c.s)return new d(0);throw Error(o+"NaN")}for(e=x(c),a=!1,0==(i=Math.sqrt(+c))||i==1/0?(((t=b(c.d)).length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=l((e+1)/2)-(e<0||e%2),r=new d(t=i==1/0?"5e"+e:(t=i.toExponential()).slice(0,t.indexOf("e")+1)+e)):r=new d(i.toString()),i=u=(n=d.precision)+3;;)if(r=(s=r).plus(v(c,s,u+2)).times(.5),b(s.d).slice(0,u)===(t=b(r.d)).slice(0,u)){if(t=t.slice(u-3,u+1),i==u&&"4999"==t){if(S(s,n+1,0),s.times(s).eq(c)){r=s;break}}else if("9999"!=t)break;u+=4}return a=!0,S(r,n)},y.times=y.mul=function(e){var t,n,r,i,o,s,u,l,c,d=this,p=d.constructor,h=d.d,m=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,(l=h.length)<(c=m.length)&&(o=h,h=m,m=o,s=l,l=c,c=s),o=[],r=s=l+c;r--;)o.push(0);for(r=c;--r>=0;){for(t=0,i=l+r;i>r;)u=o[i]+m[r]*h[i-r-1]+t,o[i--]=u%f|0,t=u/f|0;o[i]=(o[i]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,a?S(e,p.precision):e},y.toDecimalPlaces=y.todp=function(e,t){var n=this,i=n.constructor;return n=new i(n),void 0===e?n:(A(e,0,r),void 0===t?t=i.rounding:A(t,0,8),S(n,e+x(n)+1,t))},y.toExponential=function(e,t){var n,i=this,a=i.constructor;return void 0===e?n=O(i,!0):(A(e,0,r),void 0===t?t=a.rounding:A(t,0,8),n=O(i=S(new a(i),e+1,t),!0,e+1)),n},y.toFixed=function(e,t){var n,i,a=this,o=a.constructor;return void 0===e?O(a):(A(e,0,r),void 0===t?t=o.rounding:A(t,0,8),n=O((i=S(new o(a),e+x(a)+1,t)).abs(),!1,e+x(i)+1),a.isneg()&&!a.isZero()?"-"+n:n)},y.toInteger=y.toint=function(){var e=this,t=e.constructor;return S(new t(e),x(e)+1,t.rounding)},y.toNumber=function(){return+this},y.toPower=y.pow=function(e){var t,r,i,s,u,c,d=this,f=d.constructor,m=+(e=new f(e));if(!e.s)return new f(n);if(!(d=new f(d)).s){if(e.s<1)throw Error(o+"Infinity");return d}if(d.eq(n))return d;if(i=f.precision,e.eq(n))return S(d,i);if(c=(t=e.e)>=(r=e.d.length-1),u=d.s,c){if((r=m<0?-m:m)<=h){for(s=new f(n),t=Math.ceil(i/p+4),a=!1;r%2&&R((s=s.times(d)).d,t),0!==(r=l(r/2));)R((d=d.times(d)).d,t);return a=!0,e.s<0?new f(n).div(s):S(s,i)}}else if(u<0)throw Error(o+"NaN");return u=u<0&&1&e.d[Math.max(t,r)]?-1:1,d.s=1,a=!1,s=e.times(C(d,i+12)),a=!0,(s=w(s)).s=u,s},y.toPrecision=function(e,t){var n,i,a=this,o=a.constructor;return void 0===e?i=O(a,(n=x(a))<=o.toExpNeg||n>=o.toExpPos):(A(e,1,r),void 0===t?t=o.rounding:A(t,0,8),i=O(a=S(new o(a),e,t),e<=(n=x(a))||n<=o.toExpNeg,e)),i},y.toSignificantDigits=y.tosd=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(A(e,1,r),void 0===t?t=n.rounding:A(t,0,8)),S(new n(this),e,t)},y.toString=y.valueOf=y.val=y.toJSON=function(){var e=this,t=x(e),n=e.constructor;return O(e,t<=n.toExpNeg||t>=n.toExpPos)};var v=function(){function e(e,t){var n,r=0,i=e.length;for(e=e.slice();i--;)n=e[i]*t+r,e[i]=n%f|0,r=n/f|0;return r&&e.unshift(r),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=e[n]<t[n]?1:0,e[n]=r*f+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,a,s){var u,l,c,d,h,m,y,g,A,b,v,w,E,T,C,I,k,O,R=r.constructor,P=r.s==i.s?1:-1,N=r.d,L=i.d;if(!r.s)return new R(r);if(!i.s)throw Error(o+"Division by zero");for(l=r.e-i.e,k=L.length,C=N.length,g=(y=new R(P)).d=[],c=0;L[c]==(N[c]||0);)++c;if(L[c]>(N[c]||0)&&--l,(w=null==a?a=R.precision:s?a+(x(r)-x(i))+1:a)<0)return new R(0);if(w=w/p+2|0,c=0,1==k)for(d=0,L=L[0],w++;(c<C||d)&&w--;c++)E=d*f+(N[c]||0),g[c]=E/L|0,d=E%L|0;else{for((d=f/(L[0]+1)|0)>1&&(L=e(L,d),N=e(N,d),k=L.length,C=N.length),T=k,b=(A=N.slice(0,k)).length;b<k;)A[b++]=0;(O=L.slice()).unshift(0),I=L[0],L[1]>=f/2&&++I;do{d=0,(u=t(L,A,k,b))<0?(v=A[0],k!=b&&(v=v*f+(A[1]||0)),(d=v/I|0)>1?(d>=f&&(d=f-1),1==(u=t(h=e(L,d),A,m=h.length,b=A.length))&&(d--,n(h,k<m?O:L,m))):(0==d&&(u=d=1),h=L.slice()),(m=h.length)<b&&h.unshift(0),n(A,h,b),-1==u&&(u=t(L,A,k,b=A.length))<1&&(d++,n(A,k<b?O:L,b)),b=A.length):0===u&&(d++,A=[0]),g[c++]=d,u&&A[0]?A[b++]=N[T]||0:(A=[N[T]],b=1)}while((T++<C||void 0!==A[0])&&w--)}return g[0]||g.shift(),y.e=l,S(y,s?a+x(y)+1:a)}}();function w(e,t){var r,i,o,s,l,d=0,f=0,p=e.constructor,h=p.precision;if(x(e)>16)throw Error(u+x(e));if(!e.s)return new p(n);for(null==t?(a=!1,l=h):l=t,s=new p(.03125);e.abs().gte(.1);)e=e.times(s),f+=5;for(l+=Math.log(c(2,f))/Math.LN10*2+5|0,r=i=o=new p(n),p.precision=l;;){if(i=S(i.times(e),l),r=r.times(++d),b((s=o.plus(v(i,r,l))).d).slice(0,l)===b(o.d).slice(0,l)){for(;f--;)o=S(o.times(o),l);return p.precision=h,null==t?(a=!0,S(o,h)):o}o=s}}function x(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function E(e,t,n){if(t>e.LN10.sd())throw a=!0,n&&(e.precision=n),Error(o+"LN10 precision limit exceeded");return S(new e(e.LN10),t)}function T(e){for(var t="";e--;)t+="0";return t}function C(e,t){var r,i,s,u,l,c,d,f,p,h=1,m=e,y=m.d,g=m.constructor,A=g.precision;if(m.s<1)throw Error(o+(m.s?"NaN":"-Infinity"));if(m.eq(n))return new g(0);if(null==t?(a=!1,f=A):f=t,m.eq(10))return null==t&&(a=!0),E(g,f);if(f+=10,g.precision=f,i=(r=b(y)).charAt(0),u=x(m),!(Math.abs(u)<15e14))return d=E(g,f+2,A).times(u+""),m=C(new g(i+"."+r.slice(1)),f-10).plus(d),g.precision=A,null==t?(a=!0,S(m,A)):m;for(;i<7&&1!=i||1==i&&r.charAt(1)>3;)i=(r=b((m=m.times(e)).d)).charAt(0),h++;for(u=x(m),i>1?(m=new g("0."+r),u++):m=new g(i+"."+r.slice(1)),c=l=m=v(m.minus(n),m.plus(n),f),p=S(m.times(m),f),s=3;;){if(l=S(l.times(p),f),b((d=c.plus(v(l,new g(s),f))).d).slice(0,f)===b(c.d).slice(0,f))return c=c.times(2),0!==u&&(c=c.plus(E(g,f+2,A).times(u+""))),c=v(c,new g(h),f),g.precision=A,null==t?(a=!0,S(c,A)):c;c=d,s+=2}}function I(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);)++r;for(i=t.length;48===t.charCodeAt(i-1);)--i;if(t=t.slice(r,i)){if(i-=r,n=n-r-1,e.e=l(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=p;r<i;)e.d.push(+t.slice(r,r+=p));t=t.slice(r),r=p-t.length}else r-=i;for(;r--;)t+="0";if(e.d.push(+t),a&&(e.e>m||e.e<-m))throw Error(u+n)}else e.s=0,e.e=0,e.d=[0];return e}function S(e,t,n){var r,i,o,s,d,h,y,g,A=e.d;for(s=1,o=A[0];o>=10;o/=10)s++;if((r=t-s)<0)r+=p,i=t,y=A[g=0];else{if((g=Math.ceil((r+1)/p))>=(o=A.length))return e;for(y=o=A[g],s=1;o>=10;o/=10)s++;i=(r%=p)-p+s}if(void 0!==n&&(d=y/(o=c(10,s-i-1))%10|0,h=t<0||void 0!==A[g+1]||y%o,h=n<4?(d||h)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||h||6==n&&(r>0?i>0?y/c(10,s-i):0:A[g-1])%10&1||n==(e.s<0?8:7))),t<1||!A[0])return h?(o=x(e),A.length=1,t=t-o-1,A[0]=c(10,(p-t%p)%p),e.e=l(-t/p)||0):(A.length=1,A[0]=e.e=e.s=0),e;if(0==r?(A.length=g,o=1,g--):(A.length=g+1,o=c(10,p-r),A[g]=i>0?(y/c(10,s-i)%c(10,i)|0)*o:0),h)for(;;){if(0==g){(A[0]+=o)==f&&(A[0]=1,++e.e);break}if(A[g]+=o,A[g]!=f)break;A[g--]=0,o=1}for(r=A.length;0===A[--r];)A.pop();if(a&&(e.e>m||e.e<-m))throw Error(u+x(e));return e}function k(e,t){var n,r,i,o,s,u,l,c,d,h,m=e.constructor,y=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),a?S(t,y):t;if(l=e.d,h=t.d,r=t.e,c=e.e,l=l.slice(),s=c-r){for((d=s<0)?(n=l,s=-s,u=h.length):(n=h,r=c,u=l.length),s>(i=Math.max(Math.ceil(y/p),u)+2)&&(s=i,n.length=1),n.reverse(),i=s;i--;)n.push(0);n.reverse()}else{for((d=(i=l.length)<(u=h.length))&&(u=i),i=0;i<u;i++)if(l[i]!=h[i]){d=l[i]<h[i];break}s=0}for(d&&(n=l,l=h,h=n,t.s=-t.s),u=l.length,i=h.length-u;i>0;--i)l[u++]=0;for(i=h.length;i>s;){if(l[--i]<h[i]){for(o=i;o&&0===l[--o];)l[o]=f-1;--l[o],l[i]+=f}l[i]-=h[i]}for(;0===l[--u];)l.pop();for(;0===l[0];l.shift())--r;return l[0]?(t.d=l,t.e=r,a?S(t,y):t):new m(0)}function O(e,t,n){var r,i=x(e),a=b(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+"."+a.slice(1)+T(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+T(-i-1)+a,n&&(r=n-o)>0&&(a+=T(r))):i>=o?(a+=T(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+T(r))):((r=i+1)<o&&(a=a.slice(0,r)+"."+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+="."),a+=T(r))),e.s<0?"-"+a:a}function R(e,t){if(e.length>t)return e.length=t,!0}function P(e){if(!e||"object"!=typeof e)throw Error(o+"Object expected");var t,n,i,a=["precision",1,r,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if(void 0!==(i=e[n=a[t]])){if(!(l(i)===i&&i>=a[t+1]&&i<=a[t+2]))throw Error(s+n+": "+i);this[n]=i}if(void 0!==(i=e[n="LN10"])){if(i!=Math.LN10)throw Error(s+n+": "+i);this[n]=new this(i)}return this}i=function e(t){var n,r,i;function a(e){var t=this;if(!(t instanceof a))return new a(e);if(t.constructor=a,e instanceof a)return t.s=e.s,t.e=e.e,void(t.d=(e=e.d)?e.slice():e);if("number"==typeof e){if(0*e!=0)throw Error(s+e);if(e>0)t.s=1;else{if(!(e<0))return t.s=0,t.e=0,void(t.d=[0]);e=-e,t.s=-1}return e===~~e&&e<1e7?(t.e=0,void(t.d=[e])):I(t,e.toString())}if("string"!=typeof e)throw Error(s+e);if(45===e.charCodeAt(0)?(e=e.slice(1),t.s=-1):t.s=1,!d.test(e))throw Error(s+e);I(t,e)}if(a.prototype=y,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=e,a.config=a.set=P,void 0===t&&(t={}),t)for(i=["precision","rounding","toExpNeg","toExpPos","LN10"],n=0;n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return a.config(t),a}(i),i.default=i.Decimal=i,n=new i(1),e.exports?e.exports=i:(t||(t="undefined"!=typeof self&&self&&self.self==self?self:Function("return this")()),t.Decimal=i)}(it)}(mw);var yw=at(mw.exports),gw={exports:{}};!function(e){!function(t){var n,r=1e6,i=1e6,a="[big.js] ",o=a+"Invalid ",s=o+"decimal places",u=o+"rounding mode",l=a+"Division by zero",c={},d=void 0,f=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function p(e,t,n,r){var i=e.c,a=e.e+t+1;if(a<i.length){if(1===n)r=i[a]>=5;else if(2===n)r=i[a]>5||5==i[a]&&(r||a<0||i[a+1]!==d||1&i[a-1]);else if(3===n)r=r||!!i[0];else if(r=!1,0!==n)throw Error(u);if(a<1)i.length=1,r?(e.e=-t,i[0]=1):i[0]=e.e=0;else{if(i.length=a--,r)for(;++i[a]>9;)i[a]=0,a--||(++e.e,i.unshift(1));for(a=i.length;!i[--a];)i.pop()}}else if(n<0||n>3||n!==~~n)throw Error(u);return e}function h(e,t,n,i){var a,u,l=e.constructor,c=!e.c[0];if(n!==d){if(n!==~~n||n<(3==t)||n>r)throw Error(3==t?o+"precision":s);for(n=i-(e=new l(e)).e,e.c.length>++i&&p(e,n,l.RM),2==t&&(i=e.e+n+1);e.c.length<i;)e.c.push(0)}if(a=e.e,n=(u=e.c.join("")).length,2!=t&&(1==t||3==t&&i<=a||a<=l.NE||a>=l.PE))u=u.charAt(0)+(n>1?"."+u.slice(1):"")+(a<0?"e":"e+")+a;else if(a<0){for(;++a;)u="0"+u;u="0."+u}else if(a>0)if(++a>n)for(a-=n;a--;)u+="0";else a<n&&(u=u.slice(0,a)+"."+u.slice(a));else n>1&&(u=u.charAt(0)+"."+u.slice(1));return e.s<0&&(!c||4==t)?"-"+u:u}c.abs=function(){var e=new this.constructor(this);return e.s=1,e},c.cmp=function(e){var t,n=this,r=n.c,i=(e=new n.constructor(e)).c,a=n.s,o=e.s,s=n.e,u=e.e;if(!r[0]||!i[0])return r[0]?a:i[0]?-o:0;if(a!=o)return a;if(t=a<0,s!=u)return s>u^t?1:-1;for(o=(s=r.length)<(u=i.length)?s:u,a=-1;++a<o;)if(r[a]!=i[a])return r[a]>i[a]^t?1:-1;return s==u?0:s>u^t?1:-1},c.div=function(e){var t=this,n=t.constructor,i=t.c,a=(e=new n(e)).c,o=t.s==e.s?1:-1,u=n.DP;if(u!==~~u||u<0||u>r)throw Error(s);if(!a[0])throw Error(l);if(!i[0])return new n(0*o);var c,f,h,m,y,g=a.slice(),A=c=a.length,b=i.length,v=i.slice(0,c),w=v.length,x=e,E=x.c=[],T=0,C=u+(x.e=t.e-e.e)+1;for(x.s=o,o=C<0?0:C,g.unshift(0);w++<c;)v.push(0);do{for(h=0;h<10;h++){if(c!=(w=v.length))m=c>w?1:-1;else for(y=-1,m=0;++y<c;)if(a[y]!=v[y]){m=a[y]>v[y]?1:-1;break}if(!(m<0))break;for(f=w==c?a:g;w;){if(v[--w]<f[w]){for(y=w;y&&!v[--y];)v[y]=9;--v[y],v[w]+=10}v[w]-=f[w]}for(;!v[0];)v.shift()}E[T++]=m?h:++h,v[0]&&m?v[w]=i[A]||0:v=[i[A]]}while((A++<b||v[0]!==d)&&o--);return E[0]||1==T||(E.shift(),x.e--),T>C&&p(x,u,n.RM,v[0]!==d),x},c.eq=function(e){return!this.cmp(e)},c.gt=function(e){return this.cmp(e)>0},c.gte=function(e){return this.cmp(e)>-1},c.lt=function(e){return this.cmp(e)<0},c.lte=function(e){return this.cmp(e)<1},c.minus=c.sub=function(e){var t,n,r,i,a=this,o=a.constructor,s=a.s,u=(e=new o(e)).s;if(s!=u)return e.s=-u,a.plus(e);var l=a.c.slice(),c=a.e,d=e.c,f=e.e;if(!l[0]||!d[0])return d[0]?(e.s=-u,e):new o(l[0]?a:0);if(s=c-f){for((i=s<0)?(s=-s,r=l):(f=c,r=d),r.reverse(),u=s;u--;)r.push(0);r.reverse()}else for(n=((i=l.length<d.length)?l:d).length,s=u=0;u<n;u++)if(l[u]!=d[u]){i=l[u]<d[u];break}if(i&&(r=l,l=d,d=r,e.s=-e.s),(u=(n=d.length)-(t=l.length))>0)for(;u--;)l[t++]=0;for(u=t;n>s;){if(l[--n]<d[n]){for(t=n;t&&!l[--t];)l[t]=9;--l[t],l[n]+=10}l[n]-=d[n]}for(;0===l[--u];)l.pop();for(;0===l[0];)l.shift(),--f;return l[0]||(e.s=1,l=[f=0]),e.c=l,e.e=f,e},c.mod=function(e){var t,n=this,r=n.constructor,i=n.s,a=(e=new r(e)).s;if(!e.c[0])throw Error(l);return n.s=e.s=1,t=1==e.cmp(n),n.s=i,e.s=a,t?new r(n):(i=r.DP,a=r.RM,r.DP=r.RM=0,n=n.div(e),r.DP=i,r.RM=a,this.minus(n.times(e)))},c.plus=c.add=function(e){var t,n=this,r=n.constructor,i=n.s,a=(e=new r(e)).s;if(i!=a)return e.s=-a,n.minus(e);var o=n.e,s=n.c,u=e.e,l=e.c;if(!s[0]||!l[0])return l[0]?e:new r(s[0]?n:0*i);if(s=s.slice(),i=o-u){for(i>0?(u=o,t=l):(i=-i,t=s),t.reverse();i--;)t.push(0);t.reverse()}for(s.length-l.length<0&&(t=l,l=s,s=t),i=l.length,a=0;i;s[i]%=10)a=(s[--i]=s[i]+l[i]+a)/10|0;for(a&&(s.unshift(a),++u),i=s.length;0===s[--i];)s.pop();return e.c=s,e.e=u,e},c.pow=function(e){var t=this,n=new t.constructor(1),r=n,a=e<0;if(e!==~~e||e<-1e6||e>i)throw Error(o+"exponent");for(a&&(e=-e);1&e&&(r=r.times(t)),e>>=1;)t=t.times(t);return a?n.div(r):r},c.round=function(e,t){var n=this.constructor;if(e===d)e=0;else if(e!==~~e||e<-r||e>r)throw Error(s);return p(new n(this),e,t===d?n.RM:t)},c.sqrt=function(){var e,t,n,r=this,i=r.constructor,o=r.s,s=r.e,u=new i(.5);if(!r.c[0])return new i(r);if(o<0)throw Error(a+"No square root");0===(o=Math.sqrt(r+""))||o===1/0?((t=r.c.join("")).length+s&1||(t+="0"),s=((s+1)/2|0)-(s<0||1&s),e=new i(((o=Math.sqrt(t))==1/0?"1e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+s)):e=new i(o),s=e.e+(i.DP+=4);do{n=e,e=u.times(n.plus(r.div(n)))}while(n.c.slice(0,s).join("")!==e.c.slice(0,s).join(""));return p(e,i.DP-=4,i.RM)},c.times=c.mul=function(e){var t,n=this,r=n.constructor,i=n.c,a=(e=new r(e)).c,o=i.length,s=a.length,u=n.e,l=e.e;if(e.s=n.s==e.s?1:-1,!i[0]||!a[0])return new r(0*e.s);for(e.e=u+l,o<s&&(t=i,i=a,a=t,l=o,o=s,s=l),t=new Array(l=o+s);l--;)t[l]=0;for(u=s;u--;){for(s=0,l=o+u;l>u;)s=t[l]+a[u]*i[l-u-1]+s,t[l--]=s%10,s=s/10|0;t[l]=(t[l]+s)%10}for(s?++e.e:t.shift(),u=t.length;!t[--u];)t.pop();return e.c=t,e},c.toExponential=function(e){return h(this,1,e,e)},c.toFixed=function(e){return h(this,2,e,this.e+e)},c.toPrecision=function(e){return h(this,3,e,e-1)},c.toString=function(){return h(this)},c.valueOf=c.toJSON=function(){return h(this,4)},n=function e(){function t(n){var r=this;if(!(r instanceof t))return n===d?e():new t(n);n instanceof t?(r.s=n.s,r.e=n.e,r.c=n.c.slice()):function(e,t){var n,r,i;if(0===t&&1/t<0)t="-0";else if(!f.test(t+=""))throw Error(o+"number");e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(n=t.indexOf("."))>-1&&(t=t.replace(".",""));(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length);for(i=t.length,r=0;r<i&&"0"==t.charAt(r);)++r;if(r==i)e.c=[e.e=0];else{for(;i>0&&"0"==t.charAt(--i););for(e.e=n-r-1,e.c=[],n=0;r<=i;)e.c[n++]=+t.charAt(r++)}}(r,n),r.constructor=t}return t.prototype=c,t.DP=20,t.RM=1,t.NE=-7,t.PE=21,t.version="5.2.2",t}(),n.default=n.Big=n,e.exports?e.exports=n:t.Big=n}(it)}(gw);var Aw=at(gw.exports),bw={exports:{}};!function(e){e.exports&&(e.exports=function(e){return e.prototype.toFormat=function(e,t,n){if(!this.e&&0!==this.e)return this.toString();var r,i,a,o,s,u,l,c,d,f,p,h,m,y,g,A=this.format||{},b=this.constructor.format||{};if(e!=s?"object"==typeof e?(n=e,e=s):t!=s?"object"==typeof t?(n=t,t=s):"object"!=typeof n&&(n={}):n={}:n={},c=(r=this.toFixed(e,t).split("."))[0],d=r[1],u=(l=this.s<0?c.slice(1):c).length,(f=n.decimalSeparator)==s&&(f=A.decimalSeparator)==s&&(f=b.decimalSeparator)==s&&(f="."),(p=n.groupSeparator)==s&&(p=A.groupSeparator)==s&&(p=b.groupSeparator),p&&((h=n.groupSize)==s&&(h=A.groupSize)==s&&(h=b.groupSize)==s&&(h=0),(m=n.secondaryGroupSize)==s&&(m=A.secondaryGroupSize)==s&&(m=b.secondaryGroupSize)==s&&(m=0),m?(i=+m,u-=a=+h):(i=+h,a=+m),i>0&&u>0)){for(o=u%i||i,c=l.substr(0,o);o<u;o+=i)c+=p+l.substr(o,i);a>0&&(c+=p+l.slice(o)),this.s<0&&(c="-"+c)}return d?((y=n.fractionGroupSeparator)==s&&(y=A.fractionGroupSeparator)==s&&(y=b.fractionGroupSeparator),y&&((g=n.fractionGroupSize)==s&&(g=A.fractionGroupSize)==s&&(g=b.fractionGroupSize)==s&&(g=0),(g=+g)&&(d=d.replace(new RegExp("\\d{"+g+"}\\B","g"),"$&"+y))),c+f+d):c},e.format={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},e})}(bw);var vw,ww,xw,Ew=at(bw.exports);!function(e){e[e.MAINNET=1]="MAINNET",e[e.GOERLI=5]="GOERLI",e[e.SEPOLIA=11155111]="SEPOLIA",e[e.ARBITRUM_ONE=42161]="ARBITRUM_ONE",e[e.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",e[e.OPTIMISM=10]="OPTIMISM",e[e.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",e[e.POLYGON=137]="POLYGON",e[e.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",e[e.CELO=42220]="CELO",e[e.CELO_ALFAJORES=44787]="CELO_ALFAJORES",e[e.BNB=56]="BNB"}(vw||(vw={})),function(e){e[e.EXACT_INPUT=0]="EXACT_INPUT",e[e.EXACT_OUTPUT=1]="EXACT_OUTPUT"}(ww||(ww={})),function(e){e[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP"}(xw||(xw={}));var Tw,Cw,Iw=fw.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function Sw(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function kw(e,t,n){return t&&Sw(e.prototype,t),n&&Sw(e,n),e}function Ow(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var Rw=Ew(yw),Pw=Ew(Aw),Nw=((Tw={})[xw.ROUND_DOWN]=Rw.ROUND_DOWN,Tw[xw.ROUND_HALF_UP]=Rw.ROUND_HALF_UP,Tw[xw.ROUND_UP]=Rw.ROUND_UP,Tw),Lw=((Cw={})[xw.ROUND_DOWN]=0,Cw[xw.ROUND_HALF_UP]=1,Cw[xw.ROUND_UP]=3,Cw),Mw=function(){function e(e,t){void 0===t&&(t=fw.BigInt(1)),this.numerator=fw.BigInt(e),this.denominator=fw.BigInt(t)}e.tryParseFraction=function(t){if(t instanceof fw||"number"==typeof t||"string"==typeof t)return new e(t);if("numerator"in t&&"denominator"in t)return t;throw new Error("Could not parse fraction")};var t=e.prototype;return t.invert=function(){return new e(this.denominator,this.numerator)},t.add=function(t){var n=e.tryParseFraction(t);return fw.equal(this.denominator,n.denominator)?new e(fw.add(this.numerator,n.numerator),this.denominator):new e(fw.add(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator)),fw.multiply(this.denominator,n.denominator))},t.subtract=function(t){var n=e.tryParseFraction(t);return fw.equal(this.denominator,n.denominator)?new e(fw.subtract(this.numerator,n.numerator),this.denominator):new e(fw.subtract(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator)),fw.multiply(this.denominator,n.denominator))},t.lessThan=function(t){var n=e.tryParseFraction(t);return fw.lessThan(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.equalTo=function(t){var n=e.tryParseFraction(t);return fw.equal(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.greaterThan=function(t){var n=e.tryParseFraction(t);return fw.greaterThan(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.multiply=function(t){var n=e.tryParseFraction(t);return new e(fw.multiply(this.numerator,n.numerator),fw.multiply(this.denominator,n.denominator))},t.divide=function(t){var n=e.tryParseFraction(t);return new e(fw.multiply(this.numerator,n.denominator),fw.multiply(this.denominator,n.numerator))},t.toSignificant=function(e,t,n){void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=xw.ROUND_HALF_UP),Number.isInteger(e)||hw(!1),e>0||hw(!1),Rw.set({precision:e+1,rounding:Nw[n]});var r=new Rw(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return r.toFormat(r.decimalPlaces(),t)},t.toFixed=function(e,t,n){return void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=xw.ROUND_HALF_UP),Number.isInteger(e)||hw(!1),e>=0||hw(!1),Pw.DP=e,Pw.RM=Lw[n],new Pw(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)},kw(e,[{key:"quotient",get:function(){return fw.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new e(fw.remainder(this.numerator,this.denominator),this.denominator)}},{key:"asFraction",get:function(){return new e(this.numerator,this.denominator)}}]),e}(),Dw=Ew(Aw),Fw=function(e){function t(t,n,r){var i;return i=e.call(this,n,r)||this,fw.lessThanOrEqual(i.quotient,Iw)||hw(!1),i.currency=t,i.decimalScale=fw.exponentiate(fw.BigInt(10),fw.BigInt(t.decimals)),i}Ow(t,e),t.fromRawAmount=function(e,n){return new t(e,n)},t.fromFractionalAmount=function(e,n,r){return new t(e,n,r)};var n=t.prototype;return n.add=function(n){this.currency.equals(n.currency)||hw(!1);var r=e.prototype.add.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.subtract=function(n){this.currency.equals(n.currency)||hw(!1);var r=e.prototype.subtract.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.multiply=function(n){var r=e.prototype.multiply.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.divide=function(n){var r=e.prototype.divide.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.toSignificant=function(t,n,r){return void 0===t&&(t=6),void 0===r&&(r=xw.ROUND_DOWN),e.prototype.divide.call(this,this.decimalScale).toSignificant(t,n,r)},n.toFixed=function(t,n,r){return void 0===t&&(t=this.currency.decimals),void 0===r&&(r=xw.ROUND_DOWN),t<=this.currency.decimals||hw(!1),e.prototype.divide.call(this,this.decimalScale).toFixed(t,n,r)},n.toExact=function(e){return void 0===e&&(e={groupSeparator:""}),Dw.DP=this.currency.decimals,new Dw(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(e)},kw(t,[{key:"wrapped",get:function(){return this.currency.isToken?this:t.fromFractionalAmount(this.currency.wrapped,this.numerator,this.denominator)}}]),t}(Mw),jw=new Mw(fw.BigInt(100));function Bw(e){return new _w(e.numerator,e.denominator)}var _w=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).isPercent=!0,t}Ow(t,e);var n=t.prototype;return n.add=function(t){return Bw(e.prototype.add.call(this,t))},n.subtract=function(t){return Bw(e.prototype.subtract.call(this,t))},n.multiply=function(t){return Bw(e.prototype.multiply.call(this,t))},n.divide=function(t){return Bw(e.prototype.divide.call(this,t))},n.toSignificant=function(t,n,r){return void 0===t&&(t=5),e.prototype.multiply.call(this,jw).toSignificant(t,n,r)},n.toFixed=function(t,n,r){return void 0===t&&(t=2),e.prototype.multiply.call(this,jw).toFixed(t,n,r)},t}(Mw);var zw=/^0x[0-9a-fA-F]{40}$/;var Uw,Ww,Hw=function(e){function t(t,n,r,i,a,o){var s;return(s=e.call(this,t,r,i,a)||this).isNative=!1,s.isToken=!0,s.address=o?function(e){if(zw.test(e))return e;throw new Error(e+" is not a valid address.")}(n):function(e){try{return na(e)}catch(t){throw new Error(e+" is not a valid address.")}}(n),s}Ow(t,e);var n=t.prototype;return n.equals=function(e){return e.isToken&&this.chainId===e.chainId&&this.address.toLowerCase()===e.address.toLowerCase()},n.sortsBefore=function(e){return this.chainId!==e.chainId&&hw(!1),this.address.toLowerCase()===e.address.toLowerCase()&&hw(!1),this.address.toLowerCase()<e.address.toLowerCase()},kw(t,[{key:"wrapped",get:function(){return this}}]),t}((function(e,t,n,r){Number.isSafeInteger(e)||hw(!1),t>=0&&t<255&&Number.isInteger(t)||hw(!1),this.chainId=e,this.decimals=t,this.symbol=n,this.name=r}));(Uw={})[1]=new Hw(1,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),Uw[3]=new Hw(3,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),Uw[4]=new Hw(4,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),Uw[5]=new Hw(5,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),Uw[42]=new Hw(42,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),Uw[10]=new Hw(10,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),Uw[69]=new Hw(69,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),Uw[42161]=new Hw(42161,"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",18,"WETH","Wrapped Ether"),Uw[421611]=new Hw(421611,"0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681",18,"WETH","Wrapped Ether"),Ww="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var Vw=Ww;function qw(e,t){var n={seen:[],stylize:Xw};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Qw(t)?n.showHidden=t:t&&function(e,t){if(!t||!nx(t))return e;var n=Object.keys(t),r=n.length;for(;r--;)e[n[r]]=t[n[r]]}(n,t),ex(n.showHidden)&&(n.showHidden=!1),ex(n.depth)&&(n.depth=2),ex(n.colors)&&(n.colors=!1),ex(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Gw),Zw(n,e,n.depth)}function Gw(e,t){var n=qw.styles[t];return n?"["+qw.colors[n][0]+"m"+e+"["+qw.colors[n][1]+"m":e}function Xw(e,t){return e}function Zw(e,t,n){if(e.customInspect&&t&&ax(t.inspect)&&t.inspect!==qw&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return $w(r)||(r=Zw(e,r,n)),r}var i=function(e,t){if(ex(t))return e.stylize("undefined","undefined");if($w(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(r=t,"number"==typeof r)return e.stylize(""+t,"number");var r;if(Qw(t))return e.stylize(""+t,"boolean");if(Jw(t))return e.stylize("null","null")}(e,t);if(i)return i;var a=Object.keys(t),o=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),ix(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return Yw(t);if(0===a.length){if(ax(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(tx(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(rx(t))return e.stylize(Date.prototype.toString.call(t),"date");if(ix(t))return Yw(t)}var u,l="",c=!1,d=["{","}"];(function(e){return Array.isArray(e)}(t)&&(c=!0,d=["[","]"]),ax(t))&&(l=" [Function"+(t.name?": "+t.name:"")+"]");return tx(t)&&(l=" "+RegExp.prototype.toString.call(t)),rx(t)&&(l=" "+Date.prototype.toUTCString.call(t)),ix(t)&&(l=" "+Yw(t)),0!==a.length||c&&0!=t.length?n<0?tx(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=c?function(e,t,n,r,i){for(var a=[],o=0,s=t.length;o<s;++o)ux(t,String(o))?a.push(Kw(e,t,n,r,String(o),!0)):a.push("");return i.forEach((function(i){i.match(/^\d+$/)||a.push(Kw(e,t,n,r,i,!0))})),a}(e,t,n,o,a):a.map((function(r){return Kw(e,t,n,o,r,c)})),e.seen.pop(),function(e,t,n){var r=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(r>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(u,l,d)):d[0]+l+d[1]}function Yw(e){return"["+Error.prototype.toString.call(e)+"]"}function Kw(e,t,n,r,i,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),ux(r,i)||(o="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=Jw(n)?Zw(e,u.value,null):Zw(e,u.value,n-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),ex(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function Qw(e){return"boolean"==typeof e}function Jw(e){return null===e}function $w(e){return"string"==typeof e}function ex(e){return void 0===e}function tx(e){return nx(e)&&"[object RegExp]"===sx(e)}function nx(e){return"object"==typeof e&&null!==e}function rx(e){return nx(e)&&"[object Date]"===sx(e)}function ix(e){return nx(e)&&("[object Error]"===sx(e)||e instanceof Error)}function ax(e){return"function"==typeof e}function ox(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function sx(e){return Object.prototype.toString.call(e)}function ux(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function lx(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0}qw.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},qw.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var cx,dx=Object.prototype.hasOwnProperty,fx=Object.keys||function(e){var t=[];for(var n in e)dx.call(e,n)&&t.push(n);return t},px=Array.prototype.slice;function hx(){return void 0!==cx?cx:cx="foo"===function(){}.name}function mx(e){return Object.prototype.toString.call(e)}function yx(e){return!Hn(e)&&("function"==typeof Vt.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}function gx(e,t){e||Ix(e,!0,t,"==",Sx)}var Ax,bx,vx,wx=/\s*function\s+([^\(\s]*)\s*/;function xx(e){if(ax(e)){if(hx())return e.name;var t=e.toString().match(wx);return t&&t[1]}}function Ex(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return Tx(Cx(e.actual),128)+" "+e.operator+" "+Tx(Cx(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||Ix;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,i=xx(t),a=r.indexOf("\n"+i);if(a>=0){var o=r.indexOf("\n",a+1);r=r.substring(o+1)}this.stack=r}}}function Tx(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function Cx(e){if(hx()||!ax(e))return qw(e);var t=xx(e);return"[Function"+(t?": "+t:"")+"]"}function Ix(e,t,n,r,i){throw new Ex({message:n,actual:e,expected:t,operator:r,stackStartFunction:i})}function Sx(e,t){e||Ix(e,!0,t,"==",Sx)}function kx(e,t,n,r){if(e===t)return!0;if(Hn(e)&&Hn(t))return 0===lx(e,t);if(rx(e)&&rx(t))return e.getTime()===t.getTime();if(tx(e)&&tx(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(yx(e)&&yx(t)&&mx(e)===mx(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===lx(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(Hn(e)!==Hn(t))return!1;var i=(r=r||{actual:[],expected:[]}).actual.indexOf(e);return-1!==i&&i===r.expected.indexOf(t)||(r.actual.push(e),r.expected.push(t),function(e,t,n,r){if(null==e||null==t)return!1;if(ox(e)||ox(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=Ox(e),a=Ox(t);if(i&&!a||!i&&a)return!1;if(i)return kx(e=px.call(e),t=px.call(t),n);var o,s,u=fx(e),l=fx(t);if(u.length!==l.length)return!1;for(u.sort(),l.sort(),s=u.length-1;s>=0;s--)if(u[s]!==l[s])return!1;for(s=u.length-1;s>=0;s--)if(!kx(e[o=u[s]],t[o],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function Ox(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function Rx(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function Px(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&Ix(i,n,"Missing expected exception"+r);var a="string"==typeof r,o=!e&&i&&!n;if((!e&&ix(i)&&a&&Rx(i,n)||o)&&Ix(i,n,"Got unwanted exception"+r),e&&i&&n&&!Rx(i,n)||!e&&i)throw i}function Nx(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Lx(e,t,n){return t&&Nx(e.prototype,t),n&&Nx(e,n),e}function Mx(){return Mx=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mx.apply(this,arguments)}function Dx(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}gx.AssertionError=Ex,Vw(Ex,Error),gx.fail=Ix,gx.ok=Sx,gx.equal=function e(t,n,r){t!=n&&Ix(t,n,r,"==",e)},gx.notEqual=function e(t,n,r){t==n&&Ix(t,n,r,"!=",e)},gx.deepEqual=function e(t,n,r){kx(t,n,!1)||Ix(t,n,r,"deepEqual",e)},gx.deepStrictEqual=function e(t,n,r){kx(t,n,!0)||Ix(t,n,r,"deepStrictEqual",e)},gx.notDeepEqual=function e(t,n,r){kx(t,n,!1)&&Ix(t,n,r,"notDeepEqual",e)},gx.notDeepStrictEqual=function e(t,n,r){kx(t,n,!0)&&Ix(t,n,r,"notDeepStrictEqual",e)},gx.strictEqual=function e(t,n,r){t!==n&&Ix(t,n,r,"===",e)},gx.notStrictEqual=function e(t,n,r){t===n&&Ix(t,n,r,"!==",e)},gx.throws=function(e,t,n){Px(!0,e,t,n)},gx.doesNotThrow=function(e,t,n){Px(!1,e,t,n)},gx.ifError=function(e){if(e)throw e},function(e){e[e.MAINNET=1]="MAINNET",e[e.GOERLI=5]="GOERLI",e[e.SEPOLIA=11155111]="SEPOLIA",e[e.OPTIMISM=10]="OPTIMISM",e[e.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",e[e.ARBITRUM_ONE=42161]="ARBITRUM_ONE",e[e.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",e[e.POLYGON=137]="POLYGON",e[e.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",e[e.CELO=42220]="CELO",e[e.CELO_ALFAJORES=44787]="CELO_ALFAJORES",e[e.GNOSIS=100]="GNOSIS",e[e.MOONBEAM=1284]="MOONBEAM",e[e.BNB=56]="BNB",e[e.AVALANCHE=43114]="AVALANCHE",e[e.BASE_GOERLI=84531]="BASE_GOERLI",e[e.BASE=8453]="BASE"}(Ax||(Ax={})),Ax.MAINNET,Ax.OPTIMISM,Ax.OPTIMISM_GOERLI,Ax.ARBITRUM_ONE,Ax.ARBITRUM_GOERLI,Ax.POLYGON,Ax.POLYGON_MUMBAI,Ax.GOERLI,Ax.SEPOLIA,Ax.CELO_ALFAJORES,Ax.CELO,Ax.BNB,Ax.AVALANCHE,Ax.BASE,Ax.BASE_GOERLI,function(e){e.ETHER="ETH",e.MATIC="MATIC",e.CELO="CELO",e.GNOSIS="XDAI",e.MOONBEAM="GLMR",e.BNB="BNB",e.AVAX="AVAX"}(bx||(bx={}));Ax.MAINNET,Ax.GOERLI;Ax.OPTIMISM,Ax.ARBITRUM_ONE,Ax.POLYGON,Ax.POLYGON_MUMBAI,Ax.SEPOLIA;var Fx,jx,Bx={v3CoreFactoryAddress:"0x1F98431c8aD98523631AE4a59f267346ea31F984",multicallAddress:"0x1F98415757620B543A52E61c46B32eB19261F984",quoterAddress:"0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",v3MigratorAddress:"0xA5644E29708357803b5A882D272c41cC0dF92B34",nonfungiblePositionManagerAddress:"0xC36442b4a4522E871399CD717aBDD847Ab11FE88"},_x=Mx({},Bx,{v1MixedRouteQuoterAddress:"0x84E44095eeBfEC7793Cd7d5b57B7e401D7f1cA2E"}),zx=Mx({},Bx,{v1MixedRouteQuoterAddress:"0xBa60b6e6fF25488308789E6e0A65D838be34194e"}),Ux=Bx,Wx=Mx({},Bx,{multicallAddress:"0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB",tickLensAddress:"0xbfd8137f7d1516D3ea5cA83523914859ec47F573"}),Hx=Bx,Vx={v3CoreFactoryAddress:"0xAfE208a311B21f13EF87E33A90049fC17A7acDEc",multicallAddress:"0x633987602DE5C4F337e3DbF265303A1080324204",quoterAddress:"0x82825d0554fA07f7FC52Ab63c961F330fdEFa8E8",v3MigratorAddress:"0x3cFd4d48EDfDCC53D3f173F596f621064614C582",nonfungiblePositionManagerAddress:"0x3d79EdAaBC0EaB6F08ED885C05Fc0B014290D95A",tickLensAddress:"0x5f115D9113F88e0a0Db1b5033D90D4a9690AcD3D"};(vx={})[Ax.MAINNET]=_x,vx[Ax.OPTIMISM]=Ux,vx[Ax.ARBITRUM_ONE]=Wx,vx[Ax.POLYGON]=Hx,vx[Ax.POLYGON_MUMBAI]=Hx,vx[Ax.GOERLI]=zx,vx[Ax.CELO]=Vx,vx[Ax.CELO_ALFAJORES]=Vx,vx[Ax.BNB]={v3CoreFactoryAddress:"0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7",multicallAddress:"0x963Df249eD09c358A4819E39d9Cd5736c3087184",quoterAddress:"0x78D78E420Da98ad378D7799bE8f4AF69033EB077",v3MigratorAddress:"0x32681814957e0C13117ddc0c2aba232b5c9e760f",nonfungiblePositionManagerAddress:"0x7b8A01B39D58278b5DE7e48c8449c9f4F5170613",tickLensAddress:"0xD9270014D396281579760619CCf4c3af0501A47C",swapRouter02Address:"0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2"},vx[Ax.OPTIMISM_GOERLI]={v3CoreFactoryAddress:"0xB656dA17129e7EB733A557f4EBc57B76CFbB5d10",multicallAddress:"0x07F2D8a2a02251B62af965f22fC4744A5f96BCCd",quoterAddress:"0x9569CbA925c8ca2248772A9A4976A516743A246F",v3MigratorAddress:"0xf6c55fBe84B1C8c3283533c53F51bC32F5C7Aba8",nonfungiblePositionManagerAddress:"0x39Ca85Af2F383190cBf7d7c41ED9202D27426EF6",tickLensAddress:"0xe6140Bd164b63E8BfCfc40D5dF952f83e171758e"},vx[Ax.ARBITRUM_GOERLI]={v3CoreFactoryAddress:"0x4893376342d5D7b3e31d4184c08b265e5aB2A3f6",multicallAddress:"0x8260CB40247290317a4c062F3542622367F206Ee",quoterAddress:"0x1dd92b83591781D0C6d98d07391eea4b9a6008FA",v3MigratorAddress:"0xA815919D2584Ac3F76ea9CB62E6Fd40a43BCe0C3",nonfungiblePositionManagerAddress:"0x622e4726a167799826d1E1D150b076A7725f5D81",tickLensAddress:"0xb52429333da969a0C79a60930a4Bf0020E5D1DE8"},vx[Ax.SEPOLIA]={v3CoreFactoryAddress:"0x0227628f3F023bb0B980b67D528571c95c6DaC1c",multicallAddress:"0xD7F33bCdb21b359c8ee6F0251d30E94832baAd07",quoterAddress:"0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3",v3MigratorAddress:"0x729004182cF005CEC8Bd85df140094b6aCbe8b15",nonfungiblePositionManagerAddress:"0x1238536071E1c677A632429e3655c799b22cDA52",tickLensAddress:"0xd7f33bcdb21b359c8ee6f0251d30e94832baad07"},vx[Ax.AVALANCHE]={v3CoreFactoryAddress:"0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD",multicallAddress:"0x0139141Cd4Ee88dF3Cdb65881D411bAE271Ef0C2",quoterAddress:"0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F",v3MigratorAddress:"0x44f5f1f5E452ea8d29C890E8F6e893fC0f1f0f97",nonfungiblePositionManagerAddress:"0x655C406EBFa14EE2006250925e54ec43AD184f8B",tickLensAddress:"0xEB9fFC8bf81b4fFd11fb6A63a6B0f098c6e21950",swapRouter02Address:"0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE"},vx[Ax.BASE]={v3CoreFactoryAddress:"0x33128a8fC17869897dcE68Ed026d694621f6FDfD",multicallAddress:"0x091e99cb1C49331a94dD62755D168E941AbD0693",quoterAddress:"0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",v3MigratorAddress:"0x23cF10b1ee3AdfCA73B0eF17C07F7577e7ACd2d7",nonfungiblePositionManagerAddress:"0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",tickLensAddress:"0x0CdeE061c75D43c82520eD998C23ac2991c9ac6d",swapRouter02Address:"0x2626664c2603336E57B271c5C0b26F421741e481"},vx[Ax.BASE_GOERLI]={v3CoreFactoryAddress:"0x9323c1d6D800ed51Bd7C6B216cfBec678B7d0BC2",multicallAddress:"0xB206027a9E0E13F05eBEFa5D2402Bab3eA716439",quoterAddress:"0xedf539058e28E5937dAef3f69cEd0b25fbE66Ae9",v3MigratorAddress:"0x3efe5d02a04b7351D671Db7008ec6eBA9AD9e3aE",nonfungiblePositionManagerAddress:"0x3c61369ef0D1D2AFa70d8feC2F31C5D6Ce134F30",tickLensAddress:"0x1acB873Ee909D0c98adB18e4474943249F931b92",swapRouter02Address:"0x8357227D4eDc78991Db6FDB9bD6ADE250536dE1d"},{}[Ax.MAINNET]="0xC4e172459f1E7939D522503B81AFAaC1014CE6F6",{}[Ax.MAINNET]="0x408ED6354d4973f66138C91495F2f2FCbd8724C3",{}[Ax.MAINNET]="0x090D4613473dEE047c3f2706764f49E0821D256e",{}[Ax.MAINNET]="0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8",{}[Ax.MAINNET]="0x65770b5283117639760beA3F867b69b3697a91dd",function(e){e[e.EXACT_INPUT=0]="EXACT_INPUT",e[e.EXACT_OUTPUT=1]="EXACT_OUTPUT"}(Fx||(Fx={})),function(e){e[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP"}(jx||(jx={}));var qx,Gx,Xx=fw.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Zx=Ew(yw),Yx=Ew(Aw),Kx=((qx={})[jx.ROUND_DOWN]=Zx.ROUND_DOWN,qx[jx.ROUND_HALF_UP]=Zx.ROUND_HALF_UP,qx[jx.ROUND_UP]=Zx.ROUND_UP,qx),Qx=((Gx={})[jx.ROUND_DOWN]=0,Gx[jx.ROUND_HALF_UP]=1,Gx[jx.ROUND_UP]=3,Gx),Jx=function(){function e(e,t){void 0===t&&(t=fw.BigInt(1)),this.numerator=fw.BigInt(e),this.denominator=fw.BigInt(t)}e.tryParseFraction=function(t){if(t instanceof fw||"number"==typeof t||"string"==typeof t)return new e(t);if("numerator"in t&&"denominator"in t)return t;throw new Error("Could not parse fraction")};var t=e.prototype;return t.invert=function(){return new e(this.denominator,this.numerator)},t.add=function(t){var n=e.tryParseFraction(t);return fw.equal(this.denominator,n.denominator)?new e(fw.add(this.numerator,n.numerator),this.denominator):new e(fw.add(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator)),fw.multiply(this.denominator,n.denominator))},t.subtract=function(t){var n=e.tryParseFraction(t);return fw.equal(this.denominator,n.denominator)?new e(fw.subtract(this.numerator,n.numerator),this.denominator):new e(fw.subtract(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator)),fw.multiply(this.denominator,n.denominator))},t.lessThan=function(t){var n=e.tryParseFraction(t);return fw.lessThan(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.equalTo=function(t){var n=e.tryParseFraction(t);return fw.equal(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.greaterThan=function(t){var n=e.tryParseFraction(t);return fw.greaterThan(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.multiply=function(t){var n=e.tryParseFraction(t);return new e(fw.multiply(this.numerator,n.numerator),fw.multiply(this.denominator,n.denominator))},t.divide=function(t){var n=e.tryParseFraction(t);return new e(fw.multiply(this.numerator,n.denominator),fw.multiply(this.denominator,n.numerator))},t.toSignificant=function(e,t,n){void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=jx.ROUND_HALF_UP),Number.isInteger(e)||hw(!1),e>0||hw(!1),Zx.set({precision:e+1,rounding:Kx[n]});var r=new Zx(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return r.toFormat(r.decimalPlaces(),t)},t.toFixed=function(e,t,n){return void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=jx.ROUND_HALF_UP),Number.isInteger(e)||hw(!1),e>=0||hw(!1),Yx.DP=e,Yx.RM=Qx[n],new Yx(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)},Lx(e,[{key:"quotient",get:function(){return fw.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new e(fw.remainder(this.numerator,this.denominator),this.denominator)}},{key:"asFraction",get:function(){return new e(this.numerator,this.denominator)}}]),e}(),$x=Ew(Aw),eE=function(e){function t(t,n,r){var i;return i=e.call(this,n,r)||this,fw.lessThanOrEqual(i.quotient,Xx)||hw(!1),i.currency=t,i.decimalScale=fw.exponentiate(fw.BigInt(10),fw.BigInt(t.decimals)),i}Dx(t,e),t.fromRawAmount=function(e,n){return new t(e,n)},t.fromFractionalAmount=function(e,n,r){return new t(e,n,r)};var n=t.prototype;return n.add=function(n){this.currency.equals(n.currency)||hw(!1);var r=e.prototype.add.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.subtract=function(n){this.currency.equals(n.currency)||hw(!1);var r=e.prototype.subtract.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.multiply=function(n){var r=e.prototype.multiply.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.divide=function(n){var r=e.prototype.divide.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.toSignificant=function(t,n,r){return void 0===t&&(t=6),void 0===r&&(r=jx.ROUND_DOWN),e.prototype.divide.call(this,this.decimalScale).toSignificant(t,n,r)},n.toFixed=function(t,n,r){return void 0===t&&(t=this.currency.decimals),void 0===r&&(r=jx.ROUND_DOWN),t<=this.currency.decimals||hw(!1),e.prototype.divide.call(this,this.decimalScale).toFixed(t,n,r)},n.toExact=function(e){return void 0===e&&(e={groupSeparator:""}),$x.DP=this.currency.decimals,new $x(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(e)},Lx(t,[{key:"wrapped",get:function(){return this.currency.isToken?this:t.fromFractionalAmount(this.currency.wrapped,this.numerator,this.denominator)}}]),t}(Jx),tE=new Jx(fw.BigInt(100));function nE(e){return new rE(e.numerator,e.denominator)}var rE=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).isPercent=!0,t}Dx(t,e);var n=t.prototype;return n.add=function(t){return nE(e.prototype.add.call(this,t))},n.subtract=function(t){return nE(e.prototype.subtract.call(this,t))},n.multiply=function(t){return nE(e.prototype.multiply.call(this,t))},n.divide=function(t){return nE(e.prototype.divide.call(this,t))},n.toSignificant=function(t,n,r){return void 0===t&&(t=5),e.prototype.multiply.call(this,tE).toSignificant(t,n,r)},n.toFixed=function(t,n,r){return void 0===t&&(t=2),e.prototype.multiply.call(this,tE).toFixed(t,n,r)},t}(Jx),iE=function(e){function t(){for(var t,n,r,i,a,o=arguments.length,s=new Array(o),u=0;u<o;u++)s[u]=arguments[u];if(4===s.length)n=s[0],r=s[1],i=s[2],a=s[3];else{var l=s[0].quoteAmount.divide(s[0].baseAmount),c=[s[0].baseAmount.currency,s[0].quoteAmount.currency,l.denominator,l.numerator];n=c[0],r=c[1],i=c[2],a=c[3]}return(t=e.call(this,a,i)||this).baseCurrency=n,t.quoteCurrency=r,t.scalar=new Jx(fw.exponentiate(fw.BigInt(10),fw.BigInt(n.decimals)),fw.exponentiate(fw.BigInt(10),fw.BigInt(r.decimals))),t}Dx(t,e);var n=t.prototype;return n.invert=function(){return new t(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(n){this.quoteCurrency.equals(n.baseCurrency)||hw(!1);var r=e.prototype.multiply.call(this,n);return new t(this.baseCurrency,n.quoteCurrency,r.denominator,r.numerator)},n.quote=function(t){t.currency.equals(this.baseCurrency)||hw(!1);var n=e.prototype.multiply.call(this,t);return eE.fromFractionalAmount(this.quoteCurrency,n.numerator,n.denominator)},n.toSignificant=function(e,t,n){return void 0===e&&(e=6),this.adjustedForDecimals.toSignificant(e,t,n)},n.toFixed=function(e,t,n){return void 0===e&&(e=4),this.adjustedForDecimals.toFixed(e,t,n)},Lx(t,[{key:"adjustedForDecimals",get:function(){return e.prototype.multiply.call(this,this.scalar)}}]),t}(Jx);function aE(e){try{return na(e)}catch(t){throw new Error(e+" is not a valid address.")}}var oE=/^0x[0-9a-fA-F]{40}$/;var sE,uE=function(e){function t(t,n,r,i,a,o){var s;return(s=e.call(this,t,r,i,a)||this).isNative=!1,s.isToken=!0,s.address=o?function(e){if(oE.test(e))return e;throw new Error(e+" is not a valid address.")}(n):aE(n),s}Dx(t,e);var n=t.prototype;return n.equals=function(e){return e.isToken&&this.chainId===e.chainId&&this.address.toLowerCase()===e.address.toLowerCase()},n.sortsBefore=function(e){return this.chainId!==e.chainId&&hw(!1),this.address.toLowerCase()===e.address.toLowerCase()&&hw(!1),this.address.toLowerCase()<e.address.toLowerCase()},Lx(t,[{key:"wrapped",get:function(){return this}}]),t}((function(e,t,n,r){Number.isSafeInteger(e)||hw(!1),t>=0&&t<255&&Number.isInteger(t)||hw(!1),this.chainId=e,this.decimals=t,this.symbol=n,this.name=r}));function lE(e,t,n,r){if(n>0||hw(!1),e.length<=n||hw(!1),0===e.length)return e.push(t),null;var i=e.length===n;if(i&&r(e[e.length-1],t)<=0)return t;for(var a=0,o=e.length;a<o;){var s=a+o>>>1;r(e[s],t)<=0?a=s+1:o=s}return e.splice(a,0,t),i?e.pop():null}(sE={})[1]=new uE(1,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),sE[3]=new uE(3,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),sE[4]=new uE(4,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),sE[5]=new uE(5,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),sE[42]=new uE(42,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),sE[10]=new uE(10,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),sE[69]=new uE(69,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),sE[42161]=new uE(42161,"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",18,"WETH","Wrapped Ether"),sE[421611]=new uE(421611,"0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681",18,"WETH","Wrapped Ether");var cE=fw.BigInt(Number.MAX_SAFE_INTEGER),dE=fw.BigInt(0),fE=fw.BigInt(1),pE=fw.BigInt(2);var hE=[{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"}],mE=[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_WETH9",type:"address"},{internalType:"address",name:"_tokenDescriptor_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Collect",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"liquidity",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"DecreaseLiquidity",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"liquidity",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"IncreaseLiquidity",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"WETH9",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint128",name:"amount0Max",type:"uint128"},{internalType:"uint128",name:"amount1Max",type:"uint128"}],internalType:"struct INonfungiblePositionManager.CollectParams",name:"params",type:"tuple"}],name:"collect",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"uint160",name:"sqrtPriceX96",type:"uint160"}],name:"createAndInitializePoolIfNecessary",outputs:[{internalType:"address",name:"pool",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"liquidity",type:"uint128"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct INonfungiblePositionManager.DecreaseLiquidityParams",name:"params",type:"tuple"}],name:"decreaseLiquidity",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"amount0Desired",type:"uint256"},{internalType:"uint256",name:"amount1Desired",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct INonfungiblePositionManager.IncreaseLiquidityParams",name:"params",type:"tuple"}],name:"increaseLiquidity",outputs:[{internalType:"uint128",name:"liquidity",type:"uint128"},{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint256",name:"amount0Desired",type:"uint256"},{internalType:"uint256",name:"amount1Desired",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct INonfungiblePositionManager.MintParams",name:"params",type:"tuple"}],name:"mint",outputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"liquidity",type:"uint128"},{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"positions",outputs:[{internalType:"uint96",name:"nonce",type:"uint96"},{internalType:"address",name:"operator",type:"address"},{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"liquidity",type:"uint128"},{internalType:"uint256",name:"feeGrowthInside0LastX128",type:"uint256"},{internalType:"uint256",name:"feeGrowthInside1LastX128",type:"uint256"},{internalType:"uint128",name:"tokensOwed0",type:"uint128"},{internalType:"uint128",name:"tokensOwed1",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"refundETH",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitAllowed",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitAllowedIfNecessary",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitIfNecessary",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"sweepToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount0Owed",type:"uint256"},{internalType:"uint256",name:"amount1Owed",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"uniswapV3MintCallback",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"unwrapWETH9",outputs:[],stateMutability:"payable",type:"function"},{stateMutability:"payable",type:"receive"}],yE=[{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitAllowed",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitAllowedIfNecessary",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitIfNecessary",outputs:[],stateMutability:"payable",type:"function"}],gE=[{inputs:[],name:"refundETH",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"sweepToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"feeBips",type:"uint256"},{internalType:"address",name:"feeRecipient",type:"address"}],name:"sweepTokenWithFee",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"unwrapWETH9",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"feeBips",type:"uint256"},{internalType:"address",name:"feeRecipient",type:"address"}],name:"unwrapWETH9WithFee",outputs:[],stateMutability:"payable",type:"function"}],AE=[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_WETH9",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"WETH9",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"path",type:"bytes"},{internalType:"uint256",name:"amountIn",type:"uint256"}],name:"quoteExactInput",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"tokenIn",type:"address"},{internalType:"address",name:"tokenOut",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],name:"quoteExactInputSingle",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"path",type:"bytes"},{internalType:"uint256",name:"amountOut",type:"uint256"}],name:"quoteExactOutput",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"tokenIn",type:"address"},{internalType:"address",name:"tokenOut",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],name:"quoteExactOutputSingle",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"int256",name:"amount0Delta",type:"int256"},{internalType:"int256",name:"amount1Delta",type:"int256"},{internalType:"bytes",name:"path",type:"bytes"}],name:"uniswapV3SwapCallback",outputs:[],stateMutability:"view",type:"function"}],bE=[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_WETH9",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"WETH9",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"path",type:"bytes"},{internalType:"uint256",name:"amountIn",type:"uint256"}],name:"quoteExactInput",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"uint160[]",name:"sqrtPriceX96AfterList",type:"uint160[]"},{internalType:"uint32[]",name:"initializedTicksCrossedList",type:"uint32[]"},{internalType:"uint256",name:"gasEstimate",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"tokenIn",type:"address"},{internalType:"address",name:"tokenOut",type:"address"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],internalType:"struct IQuoterV2.QuoteExactInputSingleParams",name:"params",type:"tuple"}],name:"quoteExactInputSingle",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"uint160",name:"sqrtPriceX96After",type:"uint160"},{internalType:"uint32",name:"initializedTicksCrossed",type:"uint32"},{internalType:"uint256",name:"gasEstimate",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"path",type:"bytes"},{internalType:"uint256",name:"amountOut",type:"uint256"}],name:"quoteExactOutput",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint160[]",name:"sqrtPriceX96AfterList",type:"uint160[]"},{internalType:"uint32[]",name:"initializedTicksCrossedList",type:"uint32[]"},{internalType:"uint256",name:"gasEstimate",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"tokenIn",type:"address"},{internalType:"address",name:"tokenOut",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],internalType:"struct IQuoterV2.QuoteExactOutputSingleParams",name:"params",type:"tuple"}],name:"quoteExactOutputSingle",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint160",name:"sqrtPriceX96After",type:"uint160"},{internalType:"uint32",name:"initializedTicksCrossed",type:"uint32"},{internalType:"uint256",name:"gasEstimate",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"int256",name:"amount0Delta",type:"int256"},{internalType:"int256",name:"amount1Delta",type:"int256"},{internalType:"bytes",name:"path",type:"bytes"}],name:"uniswapV3SwapCallback",outputs:[],stateMutability:"view",type:"function"}],vE=[{inputs:[{internalType:"contract IUniswapV3Factory",name:"_factory",type:"address"},{internalType:"contract INonfungiblePositionManager",name:"_nonfungiblePositionManager",type:"address"},{internalType:"uint256",name:"_maxIncentiveStartLeadTime",type:"uint256"},{internalType:"uint256",name:"_maxIncentiveDuration",type:"uint256"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"DepositTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract IERC20Minimal",name:"rewardToken",type:"address"},{indexed:!0,internalType:"contract IUniswapV3Pool",name:"pool",type:"address"},{indexed:!1,internalType:"uint256",name:"startTime",type:"uint256"},{indexed:!1,internalType:"uint256",name:"endTime",type:"uint256"},{indexed:!1,internalType:"address",name:"refundee",type:"address"},{indexed:!1,internalType:"uint256",name:"reward",type:"uint256"}],name:"IncentiveCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"incentiveId",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"refund",type:"uint256"}],name:"IncentiveEnded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"reward",type:"uint256"}],name:"RewardClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"bytes32",name:"incentiveId",type:"bytes32"},{indexed:!1,internalType:"uint128",name:"liquidity",type:"uint128"}],name:"TokenStaked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"bytes32",name:"incentiveId",type:"bytes32"}],name:"TokenUnstaked",type:"event"},{inputs:[{internalType:"contract IERC20Minimal",name:"rewardToken",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amountRequested",type:"uint256"}],name:"claimReward",outputs:[{internalType:"uint256",name:"reward",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"contract IERC20Minimal",name:"rewardToken",type:"address"},{internalType:"contract IUniswapV3Pool",name:"pool",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"address",name:"refundee",type:"address"}],internalType:"struct IUniswapV3Staker.IncentiveKey",name:"key",type:"tuple"},{internalType:"uint256",name:"reward",type:"uint256"}],name:"createIncentive",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"deposits",outputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint48",name:"numberOfStakes",type:"uint48"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"contract IERC20Minimal",name:"rewardToken",type:"address"},{internalType:"contract IUniswapV3Pool",name:"pool",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"address",name:"refundee",type:"address"}],internalType:"struct IUniswapV3Staker.IncentiveKey",name:"key",type:"tuple"}],name:"endIncentive",outputs:[{internalType:"uint256",name:"refund",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"contract IUniswapV3Factory",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"contract IERC20Minimal",name:"rewardToken",type:"address"},{internalType:"contract IUniswapV3Pool",name:"pool",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"address",name:"refundee",type:"address"}],internalType:"struct IUniswapV3Staker.IncentiveKey",name:"key",type:"tuple"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getRewardInfo",outputs:[{internalType:"uint256",name:"reward",type:"uint256"},{internalType:"uint160",name:"secondsInsideX128",type:"uint160"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"incentives",outputs:[{internalType:"uint256",name:"totalRewardUnclaimed",type:"uint256"},{internalType:"uint160",name:"totalSecondsClaimedX128",type:"uint160"},{internalType:"uint96",name:"numberOfStakes",type:"uint96"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxIncentiveDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxIncentiveStartLeadTime",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[],name:"nonfungiblePositionManager",outputs:[{internalType:"contract INonfungiblePositionManager",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"onERC721Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20Minimal",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"rewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"contract IERC20Minimal",name:"rewardToken",type:"address"},{internalType:"contract IUniswapV3Pool",name:"pool",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"address",name:"refundee",type:"address"}],internalType:"struct IUniswapV3Staker.IncentiveKey",name:"key",type:"tuple"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"stakeToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"incentiveId",type:"bytes32"}],name:"stakes",outputs:[{internalType:"uint160",name:"secondsPerLiquidityInsideInitialX128",type:"uint160"},{internalType:"uint128",name:"liquidity",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"to",type:"address"}],name:"transferDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"contract IERC20Minimal",name:"rewardToken",type:"address"},{internalType:"contract IUniswapV3Pool",name:"pool",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"address",name:"refundee",type:"address"}],internalType:"struct IUniswapV3Staker.IncentiveKey",name:"key",type:"tuple"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"unstakeToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"to",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"withdrawToken",outputs:[],stateMutability:"nonpayable",type:"function"}],wE=[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_WETH9",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"WETH9",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"bytes",name:"path",type:"bytes"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOutMinimum",type:"uint256"}],internalType:"struct ISwapRouter.ExactInputParams",name:"params",type:"tuple"}],name:"exactInput",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"tokenIn",type:"address"},{internalType:"address",name:"tokenOut",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOutMinimum",type:"uint256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],internalType:"struct ISwapRouter.ExactInputSingleParams",name:"params",type:"tuple"}],name:"exactInputSingle",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"bytes",name:"path",type:"bytes"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"uint256",name:"amountInMaximum",type:"uint256"}],internalType:"struct ISwapRouter.ExactOutputParams",name:"params",type:"tuple"}],name:"exactOutput",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"tokenIn",type:"address"},{internalType:"address",name:"tokenOut",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"uint256",name:"amountInMaximum",type:"uint256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],internalType:"struct ISwapRouter.ExactOutputSingleParams",name:"params",type:"tuple"}],name:"exactOutputSingle",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[],name:"refundETH",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitAllowed",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitAllowedIfNecessary",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitIfNecessary",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"sweepToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"feeBips",type:"uint256"},{internalType:"address",name:"feeRecipient",type:"address"}],name:"sweepTokenWithFee",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"int256",name:"amount0Delta",type:"int256"},{internalType:"int256",name:"amount1Delta",type:"int256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"uniswapV3SwapCallback",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"unwrapWETH9",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"feeBips",type:"uint256"},{internalType:"address",name:"feeRecipient",type:"address"}],name:"unwrapWETH9WithFee",outputs:[],stateMutability:"payable",type:"function"},{stateMutability:"payable",type:"receive"}];function xE(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function EE(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){xE(a,r,i,o,s,"next",e)}function s(e){xE(a,r,i,o,s,"throw",e)}o(void 0)}))}}function TE(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function CE(e,t,n){return t&&TE(e.prototype,t),n&&TE(e,n),e}function IE(){return IE=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},IE.apply(this,arguments)}function SE(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kE(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return SE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?SE(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var OE,RE,PE=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),o=new k(r||[]);return a._invoke=function(e,t,n){var r=d;return function(i,a){if(r===p)throw new Error("Generator is already running");if(r===h){if("throw"===i)throw a;return R()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=C(o,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var u=c(e,t,n);if("normal"===u.type){if(r=n.done?h:f,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=h,n.method="throw",n.arg=u.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",p="executing",h="completed",m={};function y(){}function g(){}function A(){}var b={};b[a]=function(){return this};var v=Object.getPrototypeOf,w=v&&v(v(O([])));w&&w!==n&&r.call(w,a)&&(b=w);var x=A.prototype=y.prototype=Object.create(b);function E(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(i,a,o,s){var u=c(e[i],e,a);if("throw"!==u.type){var l=u.arg,d=l.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(d).then((function(e){l.value=e,o(l)}),(function(e){return n("throw",e,o,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}}function C(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,C(e,n),"throw"===n.method))return m;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var i=c(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function O(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}return{next:R}}function R(){return{value:t,done:!0}}return g.prototype=x.constructor=A,A.constructor=g,g.displayName=u(A,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,A):(e.__proto__=A,u(e,s,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},E(T.prototype),T.prototype[o]=function(){return this},e.AsyncIterator=T,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new T(l(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},E(x),u(x,s,"Generator"),x[a]=function(){return this},x.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=O,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(u&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),NE="0x1F98431c8aD98523631AE4a59f267346ea31F984",LE="0x0000000000000000000000000000000000000000",ME="0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54";!function(e){e[e.LOWEST=100]="LOWEST",e[e.LOW=500]="LOW",e[e.MEDIUM=3e3]="MEDIUM",e[e.HIGH=1e4]="HIGH"}(RE||(RE={}));var DE=((OE={})[RE.LOWEST]=1,OE[RE.LOW]=10,OE[RE.MEDIUM]=60,OE[RE.HIGH]=200,OE),FE=fw.BigInt(-1),jE=fw.BigInt(0),BE=fw.BigInt(1),_E=fw.exponentiate(fw.BigInt(2),fw.BigInt(96)),zE=fw.exponentiate(_E,fw.BigInt(2));function UE(e){var t=e.factoryAddress,n=e.tokenA,r=e.tokenB,i=e.fee,a=e.initCodeHashManualOverride,o=n.sortsBefore(r)?[n,r]:[r,n],s=o[0],u=o[1];return oa(t,nm(["bytes"],[lo.encode(["address","address","uint24"],[s.address,u.address,i])]),null!=a?a:ME)}var WE=function(){function e(){}return e.addDelta=function(e,t){return fw.lessThan(t,jE)?fw.subtract(e,fw.multiply(t,FE)):fw.add(e,t)},e}(),HE=function(){function e(){}return e.mulDivRoundingUp=function(e,t,n){var r=fw.multiply(e,t),i=fw.divide(r,n);return fw.notEqual(fw.remainder(r,n),jE)&&(i=fw.add(i,BE)),i},e}(),VE=fw.subtract(fw.exponentiate(fw.BigInt(2),fw.BigInt(160)),BE);function qE(e,t){var n=fw.multiply(e,t);return fw.bitwiseAnd(n,Xx)}var GE=function(){function e(){}return e.getAmount0Delta=function(e,t,n,r){if(fw.greaterThan(e,t)){var i=[t,e];e=i[0],t=i[1]}var a=fw.leftShift(n,fw.BigInt(96)),o=fw.subtract(t,e);return r?HE.mulDivRoundingUp(HE.mulDivRoundingUp(a,o,t),BE,e):fw.divide(fw.divide(fw.multiply(a,o),t),e)},e.getAmount1Delta=function(e,t,n,r){if(fw.greaterThan(e,t)){var i=[t,e];e=i[0],t=i[1]}return r?HE.mulDivRoundingUp(n,fw.subtract(t,e),_E):fw.divide(fw.multiply(n,fw.subtract(t,e)),_E)},e.getNextSqrtPriceFromInput=function(e,t,n,r){return fw.greaterThan(e,jE)||hw(!1),fw.greaterThan(t,jE)||hw(!1),r?this.getNextSqrtPriceFromAmount0RoundingUp(e,t,n,!0):this.getNextSqrtPriceFromAmount1RoundingDown(e,t,n,!0)},e.getNextSqrtPriceFromOutput=function(e,t,n,r){return fw.greaterThan(e,jE)||hw(!1),fw.greaterThan(t,jE)||hw(!1),r?this.getNextSqrtPriceFromAmount1RoundingDown(e,t,n,!1):this.getNextSqrtPriceFromAmount0RoundingUp(e,t,n,!1)},e.getNextSqrtPriceFromAmount0RoundingUp=function(e,t,n,r){if(fw.equal(n,jE))return e;var i=fw.leftShift(t,fw.BigInt(96));if(r){var a=qE(n,e);if(fw.equal(fw.divide(a,n),e)){var o=function(e,t){var n=fw.add(e,t);return fw.bitwiseAnd(n,Xx)}(i,a);if(fw.greaterThanOrEqual(o,i))return HE.mulDivRoundingUp(i,e,o)}return HE.mulDivRoundingUp(i,BE,fw.add(fw.divide(i,e),n))}var s=qE(n,e);fw.equal(fw.divide(s,n),e)||hw(!1),fw.greaterThan(i,s)||hw(!1);var u=fw.subtract(i,s);return HE.mulDivRoundingUp(i,e,u)},e.getNextSqrtPriceFromAmount1RoundingDown=function(e,t,n,r){if(r){var i=fw.lessThanOrEqual(n,VE)?fw.divide(fw.leftShift(n,fw.BigInt(96)),t):fw.divide(fw.multiply(n,_E),t);return fw.add(e,i)}var a=HE.mulDivRoundingUp(n,_E,t);return fw.greaterThan(e,a)||hw(!1),fw.subtract(e,a)},e}(),XE=fw.exponentiate(fw.BigInt(10),fw.BigInt(6)),ZE=function(){function e(){}return e.computeSwapStep=function(e,t,n,r,i){var a={},o=fw.greaterThanOrEqual(e,t),s=fw.greaterThanOrEqual(r,jE);if(s){var u=fw.divide(fw.multiply(r,fw.subtract(XE,fw.BigInt(i))),XE);a.amountIn=o?GE.getAmount0Delta(t,e,n,!0):GE.getAmount1Delta(e,t,n,!0),fw.greaterThanOrEqual(u,a.amountIn)?a.sqrtRatioNextX96=t:a.sqrtRatioNextX96=GE.getNextSqrtPriceFromInput(e,n,u,o)}else a.amountOut=o?GE.getAmount1Delta(t,e,n,!1):GE.getAmount0Delta(e,t,n,!1),fw.greaterThanOrEqual(fw.multiply(r,FE),a.amountOut)?a.sqrtRatioNextX96=t:a.sqrtRatioNextX96=GE.getNextSqrtPriceFromOutput(e,n,fw.multiply(r,FE),o);var l=fw.equal(t,a.sqrtRatioNextX96);return o?(a.amountIn=l&&s?a.amountIn:GE.getAmount0Delta(a.sqrtRatioNextX96,e,n,!0),a.amountOut=l&&!s?a.amountOut:GE.getAmount1Delta(a.sqrtRatioNextX96,e,n,!1)):(a.amountIn=l&&s?a.amountIn:GE.getAmount1Delta(e,a.sqrtRatioNextX96,n,!0),a.amountOut=l&&!s?a.amountOut:GE.getAmount0Delta(e,a.sqrtRatioNextX96,n,!1)),!s&&fw.greaterThan(a.amountOut,fw.multiply(r,FE))&&(a.amountOut=fw.multiply(r,FE)),s&&fw.notEqual(a.sqrtRatioNextX96,t)?a.feeAmount=fw.subtract(r,a.amountIn):a.feeAmount=HE.mulDivRoundingUp(a.amountIn,fw.BigInt(i),fw.subtract(XE,fw.BigInt(i))),[a.sqrtRatioNextX96,a.amountIn,a.amountOut,a.feeAmount]},e}(),YE=fw.BigInt(2),KE=[128,64,32,16,8,4,2,1].map((function(e){return[e,fw.exponentiate(YE,fw.BigInt(e))]}));function QE(e){fw.greaterThan(e,jE)||hw(!1),fw.lessThanOrEqual(e,Xx)||hw(!1);for(var t,n=0,r=kE(KE);!(t=r()).done;){var i=t.value,a=i[0],o=i[1];fw.greaterThanOrEqual(e,o)&&(e=fw.signedRightShift(e,fw.BigInt(a)),n+=a)}return n}function JE(e,t){return fw.signedRightShift(fw.multiply(e,fw.BigInt(t)),fw.BigInt(128))}var $E=fw.exponentiate(fw.BigInt(2),fw.BigInt(32)),eT=function(){function e(){}return e.getSqrtRatioAtTick=function(t){t>=e.MIN_TICK&&t<=e.MAX_TICK&&Number.isInteger(t)||hw(!1);var n=t<0?-1*t:t,r=0!=(1&n)?fw.BigInt("0xfffcb933bd6fad37aa2d162d1a594001"):fw.BigInt("0x100000000000000000000000000000000");return 0!=(2&n)&&(r=JE(r,"0xfff97272373d413259a46990580e213a")),0!=(4&n)&&(r=JE(r,"0xfff2e50f5f656932ef12357cf3c7fdcc")),0!=(8&n)&&(r=JE(r,"0xffe5caca7e10e4e61c3624eaa0941cd0")),0!=(16&n)&&(r=JE(r,"0xffcb9843d60f6159c9db58835c926644")),0!=(32&n)&&(r=JE(r,"0xff973b41fa98c081472e6896dfb254c0")),0!=(64&n)&&(r=JE(r,"0xff2ea16466c96a3843ec78b326b52861")),0!=(128&n)&&(r=JE(r,"0xfe5dee046a99a2a811c461f1969c3053")),0!=(256&n)&&(r=JE(r,"0xfcbe86c7900a88aedcffc83b479aa3a4")),0!=(512&n)&&(r=JE(r,"0xf987a7253ac413176f2b074cf7815e54")),0!=(1024&n)&&(r=JE(r,"0xf3392b0822b70005940c7a398e4b70f3")),0!=(2048&n)&&(r=JE(r,"0xe7159475a2c29b7443b29c7fa6e889d9")),0!=(4096&n)&&(r=JE(r,"0xd097f3bdfd2022b8845ad8f792aa5825")),0!=(8192&n)&&(r=JE(r,"0xa9f746462d870fdf8a65dc1f90e061e5")),0!=(16384&n)&&(r=JE(r,"0x70d869a156d2a1b890bb3df62baf32f7")),0!=(32768&n)&&(r=JE(r,"0x31be135f97d08fd981231505542fcfa6")),0!=(65536&n)&&(r=JE(r,"0x9aa508b5b7a84e1c677de54f3e99bc9")),0!=(131072&n)&&(r=JE(r,"0x5d6af8dedb81196699c329225ee604")),0!=(262144&n)&&(r=JE(r,"0x2216e584f5fa1ea926041bedfe98")),0!=(524288&n)&&(r=JE(r,"0x48a170391f7dc42444e8fa2")),t>0&&(r=fw.divide(Xx,r)),fw.greaterThan(fw.remainder(r,$E),jE)?fw.add(fw.divide(r,$E),BE):fw.divide(r,$E)},e.getTickAtSqrtRatio=function(t){fw.greaterThanOrEqual(t,e.MIN_SQRT_RATIO)&&fw.lessThan(t,e.MAX_SQRT_RATIO)||hw(!1);var n,r=fw.leftShift(t,fw.BigInt(32)),i=QE(r);n=fw.greaterThanOrEqual(fw.BigInt(i),fw.BigInt(128))?fw.signedRightShift(r,fw.BigInt(i-127)):fw.leftShift(r,fw.BigInt(127-i));for(var a=fw.leftShift(fw.subtract(fw.BigInt(i),fw.BigInt(128)),fw.BigInt(64)),o=0;o<14;o++){n=fw.signedRightShift(fw.multiply(n,n),fw.BigInt(127));var s=fw.signedRightShift(n,fw.BigInt(128));a=fw.bitwiseOr(a,fw.leftShift(s,fw.BigInt(63-o))),n=fw.signedRightShift(n,s)}var u=fw.multiply(a,fw.BigInt("255738958999603826347141")),l=fw.toNumber(fw.signedRightShift(fw.subtract(u,fw.BigInt("3402992956809132418596140100660247210")),fw.BigInt(128))),c=fw.toNumber(fw.signedRightShift(fw.add(u,fw.BigInt("291339464771989622907027621153398088495")),fw.BigInt(128)));return l===c?l:fw.lessThanOrEqual(e.getSqrtRatioAtTick(c),t)?c:l},e}();eT.MIN_TICK=-887272,eT.MAX_TICK=-eT.MIN_TICK,eT.MIN_SQRT_RATIO=fw.BigInt("4295128739"),eT.MAX_SQRT_RATIO=fw.BigInt("1461446703485210103287273052203988822378723970342");var tT=function(){function e(){}var t=e.prototype;return t.getTick=function(){var t=EE(PE.mark((function t(n){return PE.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw new Error(e.ERROR_MESSAGE);case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t.nextInitializedTickWithinOneWord=function(){var t=EE(PE.mark((function t(n,r,i){return PE.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw new Error(e.ERROR_MESSAGE);case 1:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),e}();function nT(e,t){for(var n=0;n<e.length-1;n++)if(t(e[n],e[n+1])>0)return!1;return!0}function rT(e,t){return e.index-t.index}tT.ERROR_MESSAGE="No tick data provider was given";var iT=function(){function e(){}return e.validateList=function(e,t){t>0||hw(!1),e.every((function(e){return e.index%t==0}))||hw(!1),fw.equal(e.reduce((function(e,t){var n=t.liquidityNet;return fw.add(e,n)}),jE),jE)||hw(!1),nT(e,rT)||hw(!1)},e.isBelowSmallest=function(e,t){return e.length>0||hw(!1),t<e[0].index},e.isAtOrAboveLargest=function(e,t){return e.length>0||hw(!1),t>=e[e.length-1].index},e.getTick=function(e,t){var n=e[this.binarySearch(e,t)];return n.index!==t&&hw(!1),n},e.binarySearch=function(e,t){this.isBelowSmallest(e,t)&&hw(!1);for(var n,r=0,i=e.length-1;;){if(e[n=Math.floor((r+i)/2)].index<=t&&(n===e.length-1||e[n+1].index>t))return n;e[n].index<t?r=n+1:i=n-1}},e.nextInitializedTick=function(t,n,r){return r?(e.isBelowSmallest(t,n)&&hw(!1),e.isAtOrAboveLargest(t,n)?t[t.length-1]:t[this.binarySearch(t,n)]):(this.isAtOrAboveLargest(t,n)&&hw(!1),this.isBelowSmallest(t,n)?t[0]:t[this.binarySearch(t,n)+1])},e.nextInitializedTickWithinOneWord=function(t,n,r,i){var a=Math.floor(n/i);if(r){var o=(a>>8<<8)*i;if(e.isBelowSmallest(t,n))return[o,!1];var s=e.nextInitializedTick(t,n,r).index,u=Math.max(o,s);return[u,u===s]}var l=(((a+1>>8)+1<<8)-1)*i;if(this.isAtOrAboveLargest(t,n))return[l,!1];var c=this.nextInitializedTick(t,n,r).index,d=Math.min(l,c);return[d,d===c]},e}();function aT(e){var t=fw.BigInt(e).toString(16);return t.length%2!=0&&(t="0"+t),"0x"+t}function oT(e,t){var n=e.input.wrapped,r=e.pools.reduce((function(e,t,n){var r=e.inputToken,i=e.path,a=e.types,o=t.token0.equals(r)?t.token1:t.token0;return 0===n?{inputToken:o,types:["address","uint24","address"],path:[r.address,t.fee,o.address]}:{inputToken:o,types:[].concat(a,["uint24","address"]),path:[].concat(i,[t.fee,o.address])}}),{inputToken:n,path:[],types:[]}),i=r.path,a=r.types;return t?tm(a.reverse(),i.reverse()):tm(a,i)}function sT(e,t){var n=fw.leftShift(fw.BigInt(e),fw.BigInt(192)),r=fw.BigInt(t);return function(e){if(fw.greaterThanOrEqual(e,dE)||hw(!1),fw.lessThan(e,cE))return fw.BigInt(Math.floor(Math.sqrt(fw.toNumber(e))));var t,n;for(t=e,n=fw.add(fw.divide(e,pE),fE);fw.lessThan(n,t);)t=n,n=fw.divide(fw.add(fw.divide(e,n),n),pE);return t}(fw.divide(n,r))}function uT(e,t,n){if(fw.greaterThan(e,t)){var r=[t,e];e=r[0],t=r[1]}var i=fw.divide(fw.multiply(e,t),_E);return fw.divide(fw.multiply(fw.BigInt(n),i),fw.subtract(t,e))}function lT(e,t,n){if(fw.greaterThan(e,t)){var r=[t,e];e=r[0],t=r[1]}var i=fw.multiply(fw.multiply(fw.BigInt(n),e),t),a=fw.multiply(_E,fw.subtract(t,e));return fw.divide(i,a)}function cT(e,t,n){if(fw.greaterThan(e,t)){var r=[t,e];e=r[0],t=r[1]}return fw.divide(fw.multiply(fw.BigInt(n),_E),fw.subtract(t,e))}function dT(e,t,n,r,i,a){if(fw.greaterThan(t,n)){var o=[n,t];t=o[0],n=o[1]}var s=a?lT:uT;if(fw.lessThanOrEqual(e,t))return s(t,n,r);if(fw.lessThan(e,n)){var u=s(e,n,r),l=cT(t,e,i);return fw.lessThan(u,l)?u:l}return cT(t,n,i)}var fT=fw.exponentiate(fw.BigInt(2),fw.BigInt(128)),pT=function(){function e(){}return e.getTokensOwed=function(e,t,n,r,i){return[fw.divide(fw.multiply(yT(r,e),n),fT),fw.divide(fw.multiply(yT(i,t),n),fT)]},e}();function hT(e,t,n){var r=eT.getSqrtRatioAtTick(n),i=fw.multiply(r,r);return e.sortsBefore(t)?new iE(e,t,zE,i):new iE(e,t,i,zE)}var mT=fw.exponentiate(fw.BigInt(2),fw.BigInt(256));function yT(e,t){var n=fw.subtract(e,t);return fw.lessThan(n,jE)?fw.add(mT,n):n}var gT=function(){function e(){}return e.getFeeGrowthInside=function(e,t,n,r,i,a,o){var s,u,l,c;return i>=n?(s=e.feeGrowthOutside0X128,u=e.feeGrowthOutside1X128):(s=yT(a,e.feeGrowthOutside0X128),u=yT(o,e.feeGrowthOutside1X128)),i<r?(l=t.feeGrowthOutside0X128,c=t.feeGrowthOutside1X128):(l=yT(a,t.feeGrowthOutside0X128),c=yT(o,t.feeGrowthOutside1X128)),[yT(yT(a,s),l),yT(yT(o,u),c)]},e}(),AT=function(e){var t=e.index,n=e.liquidityGross,r=e.liquidityNet;t>=eT.MIN_TICK&&t<=eT.MAX_TICK||hw(!1),this.index=t,this.liquidityGross=fw.BigInt(n),this.liquidityNet=fw.BigInt(r)},bT=function(){function e(e,t){var n=e.map((function(e){return e instanceof AT?e:new AT(e)}));iT.validateList(n,t),this.ticks=n}var t=e.prototype;return t.getTick=function(){var e=EE(PE.mark((function e(t){return PE.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",iT.getTick(this.ticks,t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.nextInitializedTickWithinOneWord=function(){var e=EE(PE.mark((function e(t,n,r){return PE.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",iT.nextInitializedTickWithinOneWord(this.ticks,t,n,r));case 1:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),e}(),vT=new tT,wT=function(){function e(e,t,n,r,i,a,o){void 0===o&&(o=vT),Number.isInteger(n)&&n<1e6||hw(!1);var s=eT.getSqrtRatioAtTick(a),u=eT.getSqrtRatioAtTick(a+1);fw.greaterThanOrEqual(fw.BigInt(r),s)&&fw.lessThanOrEqual(fw.BigInt(r),u)||hw(!1);var l=e.sortsBefore(t)?[e,t]:[t,e];this.token0=l[0],this.token1=l[1],this.fee=n,this.sqrtRatioX96=fw.BigInt(r),this.liquidity=fw.BigInt(i),this.tickCurrent=a,this.tickDataProvider=Array.isArray(o)?new bT(o,DE[n]):o}e.getAddress=function(e,t,n,r,i){return UE({factoryAddress:null!=i?i:NE,fee:n,tokenA:e,tokenB:t,initCodeHashManualOverride:r})};var t=e.prototype;return t.involvesToken=function(e){return e.equals(this.token0)||e.equals(this.token1)},t.priceOf=function(e){return this.involvesToken(e)||hw(!1),e.equals(this.token0)?this.token0Price:this.token1Price},t.getOutputAmount=function(){var t=EE(PE.mark((function t(n,r){var i,a,o,s,u,l,c;return PE.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.involvesToken(n.currency)||hw(!1),i=n.currency.equals(this.token0),t.next=4,this.swap(i,n.quotient,r);case 4:return a=t.sent,o=a.amountCalculated,s=a.sqrtRatioX96,u=a.liquidity,l=a.tickCurrent,c=i?this.token1:this.token0,t.abrupt("return",[eE.fromRawAmount(c,fw.multiply(o,FE)),new e(this.token0,this.token1,this.fee,s,u,l,this.tickDataProvider)]);case 11:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}(),t.getInputAmount=function(){var t=EE(PE.mark((function t(n,r){var i,a,o,s,u,l,c;return PE.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.currency.isToken&&this.involvesToken(n.currency)||hw(!1),i=n.currency.equals(this.token1),t.next=4,this.swap(i,fw.multiply(n.quotient,FE),r);case 4:return a=t.sent,o=a.amountCalculated,s=a.sqrtRatioX96,u=a.liquidity,l=a.tickCurrent,c=i?this.token0:this.token1,t.abrupt("return",[eE.fromRawAmount(c,o),new e(this.token0,this.token1,this.fee,s,u,l,this.tickDataProvider)]);case 11:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}(),t.swap=function(){var e=EE(PE.mark((function e(t,n,r){var i,a,o,s,u,l;return PE.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r||(r=t?fw.add(eT.MIN_SQRT_RATIO,BE):fw.subtract(eT.MAX_SQRT_RATIO,BE)),t?(fw.greaterThan(r,eT.MIN_SQRT_RATIO)||hw(!1),fw.lessThan(r,this.sqrtRatioX96)||hw(!1)):(fw.lessThan(r,eT.MAX_SQRT_RATIO)||hw(!1),fw.greaterThan(r,this.sqrtRatioX96)||hw(!1)),i=fw.greaterThanOrEqual(n,jE),a={amountSpecifiedRemaining:n,amountCalculated:jE,sqrtPriceX96:this.sqrtRatioX96,tick:this.tickCurrent,liquidity:this.liquidity};case 4:if(!fw.notEqual(a.amountSpecifiedRemaining,jE)||a.sqrtPriceX96==r){e.next=35;break}return(o={}).sqrtPriceStartX96=a.sqrtPriceX96,e.next=9,this.tickDataProvider.nextInitializedTickWithinOneWord(a.tick,t,this.tickSpacing);case 9:if(s=e.sent,o.tickNext=s[0],o.initialized=s[1],o.tickNext<eT.MIN_TICK?o.tickNext=eT.MIN_TICK:o.tickNext>eT.MAX_TICK&&(o.tickNext=eT.MAX_TICK),o.sqrtPriceNextX96=eT.getSqrtRatioAtTick(o.tickNext),u=ZE.computeSwapStep(a.sqrtPriceX96,(t?fw.lessThan(o.sqrtPriceNextX96,r):fw.greaterThan(o.sqrtPriceNextX96,r))?r:o.sqrtPriceNextX96,a.liquidity,a.amountSpecifiedRemaining,this.fee),a.sqrtPriceX96=u[0],o.amountIn=u[1],o.amountOut=u[2],o.feeAmount=u[3],i?(a.amountSpecifiedRemaining=fw.subtract(a.amountSpecifiedRemaining,fw.add(o.amountIn,o.feeAmount)),a.amountCalculated=fw.subtract(a.amountCalculated,o.amountOut)):(a.amountSpecifiedRemaining=fw.add(a.amountSpecifiedRemaining,o.amountOut),a.amountCalculated=fw.add(a.amountCalculated,fw.add(o.amountIn,o.feeAmount))),!fw.equal(a.sqrtPriceX96,o.sqrtPriceNextX96)){e.next=32;break}if(!o.initialized){e.next=29;break}return e.t0=fw,e.next=25,this.tickDataProvider.getTick(o.tickNext);case 25:e.t1=e.sent.liquidityNet,l=e.t0.BigInt.call(e.t0,e.t1),t&&(l=fw.multiply(l,FE)),a.liquidity=WE.addDelta(a.liquidity,l);case 29:a.tick=t?o.tickNext-1:o.tickNext,e.next=33;break;case 32:fw.notEqual(a.sqrtPriceX96,o.sqrtPriceStartX96)&&(a.tick=eT.getTickAtSqrtRatio(a.sqrtPriceX96));case 33:e.next=4;break;case 35:return e.abrupt("return",{amountCalculated:a.amountCalculated,sqrtRatioX96:a.sqrtPriceX96,liquidity:a.liquidity,tickCurrent:a.tick});case 36:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}(),CE(e,[{key:"token0Price",get:function(){var e;return null!=(e=this._token0Price)?e:this._token0Price=new iE(this.token0,this.token1,zE,fw.multiply(this.sqrtRatioX96,this.sqrtRatioX96))}},{key:"token1Price",get:function(){var e;return null!=(e=this._token1Price)?e:this._token1Price=new iE(this.token1,this.token0,fw.multiply(this.sqrtRatioX96,this.sqrtRatioX96),zE)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"tickSpacing",get:function(){return DE[this.fee]}}]),e}(),xT=function(){function e(e){var t=e.pool,n=e.liquidity,r=e.tickLower,i=e.tickUpper;this._token0Amount=null,this._token1Amount=null,this._mintAmounts=null,r<i||hw(!1),r>=eT.MIN_TICK&&r%t.tickSpacing==0||hw(!1),i<=eT.MAX_TICK&&i%t.tickSpacing==0||hw(!1),this.pool=t,this.tickLower=r,this.tickUpper=i,this.liquidity=fw.BigInt(n)}var t=e.prototype;return t.ratiosAfterSlippage=function(e){var t=this.pool.token0Price.asFraction.multiply(new rE(1).subtract(e)),n=this.pool.token0Price.asFraction.multiply(e.add(1)),r=sT(t.numerator,t.denominator);fw.lessThanOrEqual(r,eT.MIN_SQRT_RATIO)&&(r=fw.add(eT.MIN_SQRT_RATIO,fw.BigInt(1)));var i=sT(n.numerator,n.denominator);return fw.greaterThanOrEqual(i,eT.MAX_SQRT_RATIO)&&(i=fw.subtract(eT.MAX_SQRT_RATIO,fw.BigInt(1))),{sqrtRatioX96Lower:r,sqrtRatioX96Upper:i}},t.mintAmountsWithSlippage=function(t){var n=this.ratiosAfterSlippage(t),r=n.sqrtRatioX96Upper,i=n.sqrtRatioX96Lower,a=new wT(this.pool.token0,this.pool.token1,this.pool.fee,i,0,eT.getTickAtSqrtRatio(i)),o=new wT(this.pool.token0,this.pool.token1,this.pool.fee,r,0,eT.getTickAtSqrtRatio(r)),s=e.fromAmounts(IE({pool:this.pool,tickLower:this.tickLower,tickUpper:this.tickUpper},this.mintAmounts,{useFullPrecision:!1}));return{amount0:new e({pool:o,liquidity:s.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).mintAmounts.amount0,amount1:new e({pool:a,liquidity:s.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).mintAmounts.amount1}},t.burnAmountsWithSlippage=function(t){var n=this.ratiosAfterSlippage(t),r=n.sqrtRatioX96Upper,i=n.sqrtRatioX96Lower,a=new wT(this.pool.token0,this.pool.token1,this.pool.fee,i,0,eT.getTickAtSqrtRatio(i)),o=new e({pool:new wT(this.pool.token0,this.pool.token1,this.pool.fee,r,0,eT.getTickAtSqrtRatio(r)),liquidity:this.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).amount0,s=new e({pool:a,liquidity:this.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).amount1;return{amount0:o.quotient,amount1:s.quotient}},e.fromAmounts=function(t){var n=t.pool,r=t.tickLower,i=t.tickUpper,a=t.amount0,o=t.amount1,s=t.useFullPrecision,u=eT.getSqrtRatioAtTick(r),l=eT.getSqrtRatioAtTick(i);return new e({pool:n,tickLower:r,tickUpper:i,liquidity:dT(n.sqrtRatioX96,u,l,a,o,s)})},e.fromAmount0=function(t){var n=t.pool,r=t.tickLower,i=t.tickUpper,a=t.amount0,o=t.useFullPrecision;return e.fromAmounts({pool:n,tickLower:r,tickUpper:i,amount0:a,amount1:Xx,useFullPrecision:o})},e.fromAmount1=function(t){var n=t.pool,r=t.tickLower,i=t.tickUpper,a=t.amount1;return e.fromAmounts({pool:n,tickLower:r,tickUpper:i,amount0:Xx,amount1:a,useFullPrecision:!0})},CE(e,[{key:"token0PriceLower",get:function(){return hT(this.pool.token0,this.pool.token1,this.tickLower)}},{key:"token0PriceUpper",get:function(){return hT(this.pool.token0,this.pool.token1,this.tickUpper)}},{key:"amount0",get:function(){return null===this._token0Amount&&(this.pool.tickCurrent<this.tickLower?this._token0Amount=eE.fromRawAmount(this.pool.token0,GE.getAmount0Delta(eT.getSqrtRatioAtTick(this.tickLower),eT.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1)):this.pool.tickCurrent<this.tickUpper?this._token0Amount=eE.fromRawAmount(this.pool.token0,GE.getAmount0Delta(this.pool.sqrtRatioX96,eT.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1)):this._token0Amount=eE.fromRawAmount(this.pool.token0,jE)),this._token0Amount}},{key:"amount1",get:function(){return null===this._token1Amount&&(this.pool.tickCurrent<this.tickLower?this._token1Amount=eE.fromRawAmount(this.pool.token1,jE):this.pool.tickCurrent<this.tickUpper?this._token1Amount=eE.fromRawAmount(this.pool.token1,GE.getAmount1Delta(eT.getSqrtRatioAtTick(this.tickLower),this.pool.sqrtRatioX96,this.liquidity,!1)):this._token1Amount=eE.fromRawAmount(this.pool.token1,GE.getAmount1Delta(eT.getSqrtRatioAtTick(this.tickLower),eT.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1))),this._token1Amount}},{key:"mintAmounts",get:function(){return null===this._mintAmounts?this.pool.tickCurrent<this.tickLower?{amount0:GE.getAmount0Delta(eT.getSqrtRatioAtTick(this.tickLower),eT.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0),amount1:jE}:this.pool.tickCurrent<this.tickUpper?{amount0:GE.getAmount0Delta(this.pool.sqrtRatioX96,eT.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0),amount1:GE.getAmount1Delta(eT.getSqrtRatioAtTick(this.tickLower),this.pool.sqrtRatioX96,this.liquidity,!0)}:{amount0:jE,amount1:GE.getAmount1Delta(eT.getSqrtRatioAtTick(this.tickLower),eT.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0)}:this._mintAmounts}}]),e}(),ET=function(){function e(e,t,n){this._midPrice=null,e.length>0||hw(!1);var r=e[0].chainId,i=e.every((function(e){return e.chainId===r}));i||hw(!1);var a=t.wrapped;e[0].involvesToken(a)||hw(!1),e[e.length-1].involvesToken(n.wrapped)||hw(!1);for(var o,s=[a],u=kE(e.entries());!(o=u()).done;){var l=o.value,c=l[0],d=l[1],f=s[c];f.equals(d.token0)||f.equals(d.token1)||hw(!1);var p=f.equals(d.token0)?d.token1:d.token0;s.push(p)}this.pools=e,this.tokenPath=s,this.input=t,this.output=null!=n?n:s[s.length-1]}return CE(e,[{key:"chainId",get:function(){return this.pools[0].chainId}},{key:"midPrice",get:function(){if(null!==this._midPrice)return this._midPrice;var e=this.pools.slice(1).reduce((function(e,t){var n=e.nextInput,r=e.price;return n.equals(t.token0)?{nextInput:t.token1,price:r.multiply(t.token0Price)}:{nextInput:t.token0,price:r.multiply(t.token1Price)}}),this.pools[0].token0.equals(this.input.wrapped)?{nextInput:this.pools[0].token1,price:this.pools[0].token0Price}:{nextInput:this.pools[0].token0,price:this.pools[0].token1Price}).price;return this._midPrice=new iE(this.input,this.output,e.denominator,e.numerator)}}]),e}();function TT(e,t){return e.inputAmount.currency.equals(t.inputAmount.currency)||hw(!1),e.outputAmount.currency.equals(t.outputAmount.currency)||hw(!1),e.outputAmount.equalTo(t.outputAmount)?e.inputAmount.equalTo(t.inputAmount)?e.swaps.reduce((function(e,t){return e+t.route.tokenPath.length}),0)-t.swaps.reduce((function(e,t){return e+t.route.tokenPath.length}),0):e.inputAmount.lessThan(t.inputAmount)?-1:1:e.outputAmount.lessThan(t.outputAmount)?1:-1}var CT=function(){function e(e){var t=e.routes,n=e.tradeType,r=t[0].inputAmount.currency,i=t[0].outputAmount.currency;t.every((function(e){var t=e.route;return r.wrapped.equals(t.input.wrapped)}))||hw(!1),t.every((function(e){var t=e.route;return i.wrapped.equals(t.output.wrapped)}))||hw(!1);for(var a,o=t.map((function(e){return e.route.pools.length})).reduce((function(e,t){return e+t}),0),s=new Set,u=kE(t);!(a=u()).done;)for(var l,c=kE(a.value.route.pools);!(l=c()).done;){var d=l.value;s.add(wT.getAddress(d.token0,d.token1,d.fee))}o!=s.size&&hw(!1),this.swaps=t,this.tradeType=n}e.exactIn=function(){var t=EE(PE.mark((function t(n,r){return PE.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.fromRoute(n,r,Fx.EXACT_INPUT));case 1:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),e.exactOut=function(){var t=EE(PE.mark((function t(n,r){return PE.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.fromRoute(n,r,Fx.EXACT_OUTPUT));case 1:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),e.fromRoute=function(){var t=EE(PE.mark((function t(n,r,i){var a,o,s,u,l,c,d,f,p,h,m;return PE.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=new Array(n.tokenPath.length),i!==Fx.EXACT_INPUT){t.next=19;break}r.currency.equals(n.input)||hw(!1),a[0]=r.wrapped,u=0;case 5:if(!(u<n.tokenPath.length-1)){t.next=15;break}return l=n.pools[u],t.next=9,l.getOutputAmount(a[u]);case 9:c=t.sent,d=c[0],a[u+1]=d;case 12:u++,t.next=5;break;case 15:o=eE.fromFractionalAmount(n.input,r.numerator,r.denominator),s=eE.fromFractionalAmount(n.output,a[a.length-1].numerator,a[a.length-1].denominator),t.next=34;break;case 19:r.currency.equals(n.output)||hw(!1),a[a.length-1]=r.wrapped,f=n.tokenPath.length-1;case 22:if(!(f>0)){t.next=32;break}return p=n.pools[f-1],t.next=26,p.getInputAmount(a[f]);case 26:h=t.sent,m=h[0],a[f-1]=m;case 29:f--,t.next=22;break;case 32:o=eE.fromFractionalAmount(n.input,a[0].numerator,a[0].denominator),s=eE.fromFractionalAmount(n.output,r.numerator,r.denominator);case 34:return t.abrupt("return",new e({routes:[{inputAmount:o,outputAmount:s,route:n}],tradeType:i}));case 35:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),e.fromRoutes=function(){var t=EE(PE.mark((function t(n,r){var i,a,o,s,u,l,c,d,f,p,h,m,y,g,A,b,v;return PE.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=[],a=kE(n);case 2:if((o=a()).done){t.next=43;break}if(s=o.value,u=s.route,l=s.amount,c=new Array(u.tokenPath.length),d=void 0,f=void 0,r!==Fx.EXACT_INPUT){t.next=25;break}l.currency.equals(u.input)||hw(!1),d=eE.fromFractionalAmount(u.input,l.numerator,l.denominator),c[0]=eE.fromFractionalAmount(u.input.wrapped,l.numerator,l.denominator),p=0;case 12:if(!(p<u.tokenPath.length-1)){t.next=22;break}return h=u.pools[p],t.next=16,h.getOutputAmount(c[p]);case 16:m=t.sent,y=m[0],c[p+1]=y;case 19:p++,t.next=12;break;case 22:f=eE.fromFractionalAmount(u.output,c[c.length-1].numerator,c[c.length-1].denominator),t.next=40;break;case 25:l.currency.equals(u.output)||hw(!1),f=eE.fromFractionalAmount(u.output,l.numerator,l.denominator),c[c.length-1]=eE.fromFractionalAmount(u.output.wrapped,l.numerator,l.denominator),g=u.tokenPath.length-1;case 29:if(!(g>0)){t.next=39;break}return A=u.pools[g-1],t.next=33,A.getInputAmount(c[g]);case 33:b=t.sent,v=b[0],c[g-1]=v;case 36:g--,t.next=29;break;case 39:d=eE.fromFractionalAmount(u.input,c[0].numerator,c[0].denominator);case 40:i.push({route:u,inputAmount:d,outputAmount:f});case 41:t.next=2;break;case 43:return t.abrupt("return",new e({routes:i,tradeType:r}));case 44:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),e.createUncheckedTrade=function(t){return new e(IE({},t,{routes:[{inputAmount:t.inputAmount,outputAmount:t.outputAmount,route:t.route}]}))},e.createUncheckedTradeWithMultipleRoutes=function(t){return new e(t)};var t=e.prototype;return t.minimumAmountOut=function(e,t){if(void 0===t&&(t=this.outputAmount),e.lessThan(jE)&&hw(!1),this.tradeType===Fx.EXACT_OUTPUT)return t;var n=new Jx(BE).add(e).invert().multiply(t.quotient).quotient;return eE.fromRawAmount(t.currency,n)},t.maximumAmountIn=function(e,t){if(void 0===t&&(t=this.inputAmount),e.lessThan(jE)&&hw(!1),this.tradeType===Fx.EXACT_INPUT)return t;var n=new Jx(BE).add(e).multiply(t.quotient).quotient;return eE.fromRawAmount(t.currency,n)},t.worstExecutionPrice=function(e){return new iE(this.inputAmount.currency,this.outputAmount.currency,this.maximumAmountIn(e).quotient,this.minimumAmountOut(e).quotient)},e.bestTradeExactIn=function(){var t=EE(PE.mark((function t(n,r,i,a,o,s,u){var l,c,d,f,p,h,m,y,g,A,b,v;return PE.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:c=(l=void 0===a?{}:a).maxNumResults,d=void 0===c?3:c,f=l.maxHops,p=void 0===f?3:f,void 0===o&&(o=[]),void 0===s&&(s=r),void 0===u&&(u=[]),n.length>0||hw(!1),p>0||hw(!1),r===s||o.length>0||hw(!1),h=s.wrapped,m=i.wrapped,y=0;case 10:if(!(y<n.length)){t.next=46;break}if((g=n[y]).token0.equals(h.currency)||g.token1.equals(h.currency)){t.next=14;break}return t.abrupt("continue",43);case 14:return A=void 0,t.prev=15,t.next=19,g.getOutputAmount(h);case 19:b=t.sent,A=b[0],t.next=28;break;case 23:if(t.prev=23,t.t0=t.catch(15),!t.t0.isInsufficientInputAmountError){t.next=27;break}return t.abrupt("continue",43);case 27:throw t.t0;case 28:if(!A.currency.isToken||!A.currency.equals(m)){t.next=39;break}return t.t1=lE,t.t2=u,t.next=33,e.fromRoute(new ET([].concat(o,[g]),r.currency,i),r,Fx.EXACT_INPUT);case 33:t.t3=t.sent,t.t4=d,t.t5=TT,(0,t.t1)(t.t2,t.t3,t.t4,t.t5),t.next=43;break;case 39:if(!(p>1&&n.length>1)){t.next=43;break}return v=n.slice(0,y).concat(n.slice(y+1,n.length)),t.next=43,e.bestTradeExactIn(v,r,i,{maxNumResults:d,maxHops:p-1},[].concat(o,[g]),A,u);case 43:y++,t.next=10;break;case 46:return t.abrupt("return",u);case 47:case"end":return t.stop()}}),t,null,[[15,23]])})));return function(e,n,r,i,a,o,s){return t.apply(this,arguments)}}(),e.bestTradeExactOut=function(){var t=EE(PE.mark((function t(n,r,i,a,o,s,u){var l,c,d,f,p,h,m,y,g,A,b,v;return PE.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:c=(l=void 0===a?{}:a).maxNumResults,d=void 0===c?3:c,f=l.maxHops,p=void 0===f?3:f,void 0===o&&(o=[]),void 0===s&&(s=i),void 0===u&&(u=[]),n.length>0||hw(!1),p>0||hw(!1),i===s||o.length>0||hw(!1),h=s.wrapped,m=r.wrapped,y=0;case 10:if(!(y<n.length)){t.next=46;break}if((g=n[y]).token0.equals(h.currency)||g.token1.equals(h.currency)){t.next=14;break}return t.abrupt("continue",43);case 14:return A=void 0,t.prev=15,t.next=19,g.getInputAmount(h);case 19:b=t.sent,A=b[0],t.next=28;break;case 23:if(t.prev=23,t.t0=t.catch(15),!t.t0.isInsufficientReservesError){t.next=27;break}return t.abrupt("continue",43);case 27:throw t.t0;case 28:if(!A.currency.equals(m)){t.next=39;break}return t.t1=lE,t.t2=u,t.next=33,e.fromRoute(new ET([g].concat(o),r,i.currency),i,Fx.EXACT_OUTPUT);case 33:t.t3=t.sent,t.t4=d,t.t5=TT,(0,t.t1)(t.t2,t.t3,t.t4,t.t5),t.next=43;break;case 39:if(!(p>1&&n.length>1)){t.next=43;break}return v=n.slice(0,y).concat(n.slice(y+1,n.length)),t.next=43,e.bestTradeExactOut(v,r,i,{maxNumResults:d,maxHops:p-1},[g].concat(o),A,u);case 43:y++,t.next=10;break;case 46:return t.abrupt("return",u);case 47:case"end":return t.stop()}}),t,null,[[15,23]])})));return function(e,n,r,i,a,o,s){return t.apply(this,arguments)}}(),CE(e,[{key:"route",get:function(){return 1!=this.swaps.length&&hw(!1),this.swaps[0].route}},{key:"inputAmount",get:function(){if(this._inputAmount)return this._inputAmount;var e=this.swaps[0].inputAmount.currency,t=this.swaps.map((function(e){return e.inputAmount})).reduce((function(e,t){return e.add(t)}),eE.fromRawAmount(e,0));return this._inputAmount=t,this._inputAmount}},{key:"outputAmount",get:function(){if(this._outputAmount)return this._outputAmount;var e=this.swaps[0].outputAmount.currency,t=this.swaps.map((function(e){return e.outputAmount})).reduce((function(e,t){return e.add(t)}),eE.fromRawAmount(e,0));return this._outputAmount=t,this._outputAmount}},{key:"executionPrice",get:function(){var e;return null!=(e=this._executionPrice)?e:this._executionPrice=new iE(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.quotient,this.outputAmount.quotient)}},{key:"priceImpact",get:function(){if(this._priceImpact)return this._priceImpact;for(var e,t=eE.fromRawAmount(this.outputAmount.currency,0),n=kE(this.swaps);!(e=n()).done;){var r=e.value,i=r.route,a=r.inputAmount,o=i.midPrice;t=t.add(o.quote(a))}var s=t.subtract(this.outputAmount).divide(t);return this._priceImpact=new rE(s.numerator,s.denominator),this._priceImpact}}]),e}(),IT=function(){function e(){}return e.encodeMulticall=function(t){return Array.isArray(t)||(t=[t]),1===t.length?t[0]:e.INTERFACE.encodeFunctionData("multicall",[t])},e}();IT.INTERFACE=new ys(hE);var ST=function(){function e(){}return e.encodePermit=function(t,n){return"nonce"in n?e.INTERFACE.encodeFunctionData("selfPermitAllowed",[t.address,aT(n.nonce),aT(n.expiry),n.v,n.r,n.s]):e.INTERFACE.encodeFunctionData("selfPermit",[t.address,aT(n.amount),aT(n.deadline),n.v,n.r,n.s])},e}();ST.INTERFACE=new ys(yE);var kT=function(){function e(){}return e.encodeFeeBips=function(e){return aT(e.multiply(1e4).quotient)},e.encodeUnwrapWETH9=function(t,n,r){if(n=aE(n),r){var i=this.encodeFeeBips(r.fee),a=aE(r.recipient);return e.INTERFACE.encodeFunctionData("unwrapWETH9WithFee",[aT(t),n,i,a])}return e.INTERFACE.encodeFunctionData("unwrapWETH9",[aT(t),n])},e.encodeSweepToken=function(t,n,r,i){if(r=aE(r),i){var a=this.encodeFeeBips(i.fee),o=aE(i.recipient);return e.INTERFACE.encodeFunctionData("sweepTokenWithFee",[t.address,aT(n),r,a,o])}return e.INTERFACE.encodeFunctionData("sweepToken",[t.address,aT(n),r])},e.encodeRefundETH=function(){return e.INTERFACE.encodeFunctionData("refundETH")},e}();kT.INTERFACE=new ys(gE);var OT=aT(fw.subtract(fw.exponentiate(fw.BigInt(2),fw.BigInt(128)),fw.BigInt(1)));function RT(e){return Object.keys(e).some((function(e){return"recipient"===e}))}var PT=function(){function e(){}return e.encodeCreate=function(t){return e.INTERFACE.encodeFunctionData("createAndInitializePoolIfNecessary",[t.token0.address,t.token1.address,t.fee,aT(t.sqrtRatioX96)])},e.createCallParameters=function(e){return{calldata:this.encodeCreate(e),value:aT(0)}},e.addCallParameters=function(t,n){fw.greaterThan(t.liquidity,jE)||hw(!1);var r=[],i=t.mintAmounts,a=i.amount0,o=i.amount1,s=t.mintAmountsWithSlippage(n.slippageTolerance),u=aT(s.amount0),l=aT(s.amount1),c=aT(n.deadline);if(RT(n)&&n.createPool&&r.push(this.encodeCreate(t.pool)),n.token0Permit&&r.push(ST.encodePermit(t.pool.token0,n.token0Permit)),n.token1Permit&&r.push(ST.encodePermit(t.pool.token1,n.token1Permit)),RT(n)){var d=aE(n.recipient);r.push(e.INTERFACE.encodeFunctionData("mint",[{token0:t.pool.token0.address,token1:t.pool.token1.address,fee:t.pool.fee,tickLower:t.tickLower,tickUpper:t.tickUpper,amount0Desired:aT(a),amount1Desired:aT(o),amount0Min:u,amount1Min:l,recipient:d,deadline:c}]))}else r.push(e.INTERFACE.encodeFunctionData("increaseLiquidity",[{tokenId:aT(n.tokenId),amount0Desired:aT(a),amount1Desired:aT(o),amount0Min:u,amount1Min:l,deadline:c}]));var f=aT(0);if(n.useNative){var p=n.useNative.wrapped;t.pool.token0.equals(p)||t.pool.token1.equals(p)||hw(!1);var h=t.pool.token0.equals(p)?a:o;fw.greaterThan(h,jE)&&r.push(kT.encodeRefundETH()),f=aT(h)}return{calldata:IT.encodeMulticall(r),value:f}},e.encodeCollect=function(t){var n=[],r=aT(t.tokenId),i=t.expectedCurrencyOwed0.currency.isNative||t.expectedCurrencyOwed1.currency.isNative,a=aE(t.recipient);if(n.push(e.INTERFACE.encodeFunctionData("collect",[{tokenId:r,recipient:i?LE:a,amount0Max:OT,amount1Max:OT}])),i){var o=t.expectedCurrencyOwed0.currency.isNative?t.expectedCurrencyOwed0.quotient:t.expectedCurrencyOwed1.quotient,s=t.expectedCurrencyOwed0.currency.isNative?t.expectedCurrencyOwed1.currency:t.expectedCurrencyOwed0.currency,u=t.expectedCurrencyOwed0.currency.isNative?t.expectedCurrencyOwed1.quotient:t.expectedCurrencyOwed0.quotient;n.push(kT.encodeUnwrapWETH9(o,a)),n.push(kT.encodeSweepToken(s,u,a))}return n},e.collectCallParameters=function(t){var n=e.encodeCollect(t);return{calldata:IT.encodeMulticall(n),value:aT(0)}},e.removeCallParameters=function(t,n){var r=[],i=aT(n.deadline),a=aT(n.tokenId),o=new xT({pool:t.pool,liquidity:n.liquidityPercentage.multiply(t.liquidity).quotient,tickLower:t.tickLower,tickUpper:t.tickUpper});fw.greaterThan(o.liquidity,jE)||hw(!1);var s=o.burnAmountsWithSlippage(n.slippageTolerance),u=s.amount0,l=s.amount1;n.permit&&r.push(e.INTERFACE.encodeFunctionData("permit",[aE(n.permit.spender),a,aT(n.permit.deadline),n.permit.v,n.permit.r,n.permit.s])),r.push(e.INTERFACE.encodeFunctionData("decreaseLiquidity",[{tokenId:a,liquidity:aT(o.liquidity),amount0Min:aT(u),amount1Min:aT(l),deadline:i}]));var c=n.collectOptions,d=c.expectedCurrencyOwed0,f=c.expectedCurrencyOwed1,p=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(c,["expectedCurrencyOwed0","expectedCurrencyOwed1"]);return r.push.apply(r,e.encodeCollect(IE({tokenId:aT(n.tokenId),expectedCurrencyOwed0:d.add(eE.fromRawAmount(d.currency,u)),expectedCurrencyOwed1:f.add(eE.fromRawAmount(f.currency,l))},p))),n.liquidityPercentage.equalTo(BE)?n.burnToken&&r.push(e.INTERFACE.encodeFunctionData("burn",[a])):!0===n.burnToken&&hw(!1),{calldata:IT.encodeMulticall(r),value:aT(0)}},e.safeTransferFromParameters=function(t){var n=aE(t.recipient),r=aE(t.sender);return{calldata:t.data?e.INTERFACE.encodeFunctionData("safeTransferFrom(address,address,uint256,bytes)",[r,n,aT(t.tokenId),t.data]):e.INTERFACE.encodeFunctionData("safeTransferFrom(address,address,uint256)",[r,n,aT(t.tokenId)]),value:aT(0)}},e}();PT.INTERFACE=new ys(mE);var NT=function(){function e(){}return e.quoteCallParameters=function(e,t,n,r){void 0===r&&(r={});var i,a=1===e.pools.length,o=aT(t.quotient),s=r.useQuoterV2?this.V2INTERFACE:this.V1INTERFACE;if(a){var u,l,c={tokenIn:e.tokenPath[0].address,tokenOut:e.tokenPath[1].address,fee:e.pools[0].fee,sqrtPriceLimitX96:aT(null!=(u=null==(l=r)?void 0:l.sqrtPriceLimitX96)?u:0)},d=IE({},c,n==Fx.EXACT_INPUT?{amountIn:o}:{amount:o}),f=[c.tokenIn,c.tokenOut,c.fee,o,c.sqrtPriceLimitX96],p=n===Fx.EXACT_INPUT?"quoteExactInputSingle":"quoteExactOutputSingle";i=s.encodeFunctionData(p,r.useQuoterV2?[d]:f)}else{var h;void 0!==(null==(h=r)?void 0:h.sqrtPriceLimitX96)&&hw(!1);var m=oT(e,n===Fx.EXACT_OUTPUT),y=n===Fx.EXACT_INPUT?"quoteExactInput":"quoteExactOutput";i=s.encodeFunctionData(y,[m,o])}return{calldata:i,value:aT(0)}},e}();NT.V1INTERFACE=new ys(AE),NT.V2INTERFACE=new ys(bE);var LT=function(){function e(){}return e.encodeClaim=function(t,n){var r,i=[];i.push(e.INTERFACE.encodeFunctionData("unstakeToken",[this._encodeIncentiveKey(t),aT(n.tokenId)]));var a=aE(n.recipient),o=null!=(r=n.amount)?r:0;return i.push(e.INTERFACE.encodeFunctionData("claimReward",[t.rewardToken.address,a,aT(o)])),i},e.collectRewards=function(t,n){t=Array.isArray(t)?t:[t];for(var r=[],i=0;i<t.length;i++){var a=t[i];(r=r.concat(this.encodeClaim(a,n))).push(e.INTERFACE.encodeFunctionData("stakeToken",[this._encodeIncentiveKey(a),aT(n.tokenId)]))}return{calldata:IT.encodeMulticall(r),value:aT(0)}},e.withdrawToken=function(t,n){var r=[];t=Array.isArray(t)?t:[t];for(var i={tokenId:n.tokenId,recipient:n.recipient,amount:n.amount},a=0;a<t.length;a++){var o=t[a];r=r.concat(this.encodeClaim(o,i))}var s=aE(n.owner);return r.push(e.INTERFACE.encodeFunctionData("withdrawToken",[aT(n.tokenId),s,n.data?n.data:aT(0)])),{calldata:IT.encodeMulticall(r),value:aT(0)}},e.encodeDeposit=function(t){var n;if((t=Array.isArray(t)?t:[t]).length>1){for(var r=[],i=0;i<t.length;i++){var a=t[i];r.push(this._encodeIncentiveKey(a))}n=lo.encode([e.INCENTIVE_KEY_ABI+"[]"],[r])}else n=lo.encode([e.INCENTIVE_KEY_ABI],[this._encodeIncentiveKey(t[0])]);return n},e._encodeIncentiveKey=function(e){var t=e.pool,n=t.token0,r=t.token1,i=t.fee,a=aE(e.refundee);return{rewardToken:e.rewardToken.address,pool:wT.getAddress(n,r,i),startTime:aT(e.startTime),endTime:aT(e.endTime),refundee:a}},e}();LT.INTERFACE=new ys(vE),LT.INCENTIVE_KEY_ABI="tuple(address rewardToken, address pool, uint256 startTime, uint256 endTime, address refundee)";var MT=function(){function e(){}return e.swapCallParameters=function(t,n){Array.isArray(t)||(t=[t]);var r=t[0],i=r.inputAmount.currency.wrapped,a=r.outputAmount.currency.wrapped;t.every((function(e){return e.inputAmount.currency.wrapped.equals(i)}))||hw(!1),t.every((function(e){return e.outputAmount.currency.wrapped.equals(a)}))||hw(!1);var o=[],s=eE.fromRawAmount(t[0].inputAmount.currency,0),u=eE.fromRawAmount(t[0].outputAmount.currency,0),l=t.reduce((function(e,t){return e.add(t.minimumAmountOut(n.slippageTolerance))}),u),c=r.inputAmount.currency.isNative&&r.tradeType===Fx.EXACT_OUTPUT,d=r.inputAmount.currency.isNative,f=r.outputAmount.currency.isNative,p=f||!!n.fee,h=d?t.reduce((function(e,t){return e.add(t.maximumAmountIn(n.slippageTolerance))}),s):s;n.inputTokenPermit&&(r.inputAmount.currency.isToken||hw(!1),o.push(ST.encodePermit(r.inputAmount.currency,n.inputTokenPermit)));for(var m,y=aE(n.recipient),g=aT(n.deadline),A=kE(t);!(m=A()).done;)for(var b,v=m.value,w=kE(v.swaps);!(b=w()).done;){var x=b.value,E=x.route,T=x.inputAmount,C=x.outputAmount,I=aT(v.maximumAmountIn(n.slippageTolerance,T).quotient),S=aT(v.minimumAmountOut(n.slippageTolerance,C).quotient);if(1===E.pools.length)if(v.tradeType===Fx.EXACT_INPUT){var k,O={tokenIn:E.tokenPath[0].address,tokenOut:E.tokenPath[1].address,fee:E.pools[0].fee,recipient:p?LE:y,deadline:g,amountIn:I,amountOutMinimum:S,sqrtPriceLimitX96:aT(null!=(k=n.sqrtPriceLimitX96)?k:0)};o.push(e.INTERFACE.encodeFunctionData("exactInputSingle",[O]))}else{var R,P={tokenIn:E.tokenPath[0].address,tokenOut:E.tokenPath[1].address,fee:E.pools[0].fee,recipient:p?LE:y,deadline:g,amountOut:S,amountInMaximum:I,sqrtPriceLimitX96:aT(null!=(R=n.sqrtPriceLimitX96)?R:0)};o.push(e.INTERFACE.encodeFunctionData("exactOutputSingle",[P]))}else{void 0!==n.sqrtPriceLimitX96&&hw(!1);var N=oT(E,v.tradeType===Fx.EXACT_OUTPUT);if(v.tradeType===Fx.EXACT_INPUT){var L={path:N,recipient:p?LE:y,deadline:g,amountIn:I,amountOutMinimum:S};o.push(e.INTERFACE.encodeFunctionData("exactInput",[L]))}else{var M={path:N,recipient:p?LE:y,deadline:g,amountOut:S,amountInMaximum:I};o.push(e.INTERFACE.encodeFunctionData("exactOutput",[M]))}}}return p&&(n.fee?f?o.push(kT.encodeUnwrapWETH9(l.quotient,y,n.fee)):o.push(kT.encodeSweepToken(r.outputAmount.currency.wrapped,l.quotient,y,n.fee)):o.push(kT.encodeUnwrapWETH9(l.quotient,y))),c&&o.push(kT.encodeRefundETH()),{calldata:IT.encodeMulticall(o),value:aT(h.quotient)}},e}();MT.INTERFACE=new ys(wE);var DT,FT,jT=Object.freeze({__proto__:null,ADDRESS_ZERO:LE,FACTORY_ADDRESS:NE,get FeeAmount(){return RE},FullMath:HE,LiquidityMath:WE,Multicall:IT,NoTickDataProvider:tT,NonfungiblePositionManager:PT,POOL_INIT_CODE_HASH:ME,Payments:kT,Pool:wT,Position:xT,PositionLibrary:pT,Route:ET,SelfPermit:ST,SqrtPriceMath:GE,Staker:LT,SwapMath:ZE,SwapQuoter:NT,SwapRouter:MT,TICK_SPACINGS:DE,Tick:AT,TickLibrary:gT,TickList:iT,TickListDataProvider:bT,TickMath:eT,Trade:CT,computePoolAddress:UE,encodeRouteToPath:oT,encodeSqrtRatioX96:sT,isSorted:nT,maxLiquidityForAmounts:dT,mostSignificantBit:QE,nearestUsableTick:function(e,t){Number.isInteger(e)&&Number.isInteger(t)||hw(!1),t>0||hw(!1),e>=eT.MIN_TICK&&e<=eT.MAX_TICK||hw(!1);var n=Math.round(e/t)*t;return n<eT.MIN_TICK?n+t:n>eT.MAX_TICK?n-t:n},priceToClosestTick:function(e){var t=e.baseCurrency.sortsBefore(e.quoteCurrency),n=t?sT(e.numerator,e.denominator):sT(e.denominator,e.numerator),r=eT.getTickAtSqrtRatio(n),i=hT(e.baseCurrency,e.quoteCurrency,r+1);return t?e.lessThan(i)||r++:e.greaterThan(i)||r++,r},subIn256:yT,tickToPrice:hT,toHex:aT,tradeComparator:TT}),BT={exports:{}},_T={},zT=ot(gs);var UT,WT={_format:"hh-sol-artifact-1",contractName:"IApproveAndCall",sourceName:"contracts/interfaces/IApproveAndCall.sol",abi:[{inputs:[{internalType:"address",name:"token",type:"address"}],name:"approveMax",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"approveMaxMinusOne",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"approveZeroThenMax",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"approveZeroThenMaxMinusOne",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"data",type:"bytes"}],name:"callPositionManager",outputs:[{internalType:"bytes",name:"result",type:"bytes"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"getApprovalType",outputs:[{internalType:"enum IApproveAndCall.ApprovalType",name:"",type:"uint8"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"}],internalType:"struct IApproveAndCall.IncreaseLiquidityParams",name:"params",type:"tuple"}],name:"increaseLiquidity",outputs:[{internalType:"bytes",name:"result",type:"bytes"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],internalType:"struct IApproveAndCall.MintParams",name:"params",type:"tuple"}],name:"mint",outputs:[{internalType:"bytes",name:"result",type:"bytes"}],stateMutability:"payable",type:"function"}],bytecode:"0x",deployedBytecode:"0x",linkReferences:{},deployedLinkReferences:{}},HT=ot(jT),VT={_format:"hh-sol-artifact-1",contractName:"IMulticallExtended",sourceName:"contracts/interfaces/IMulticallExtended.sol",abi:[{inputs:[{internalType:"bytes32",name:"previousBlockhash",type:"bytes32"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"}],bytecode:"0x",deployedBytecode:"0x",linkReferences:{},deployedLinkReferences:{}};function qT(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function GT(e,t,n){return t&&qT(e.prototype,t),n&&qT(e,n),e}function XT(){return XT=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},XT.apply(this,arguments)}function ZT(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}!function(e){e[e.MAINNET=1]="MAINNET",e[e.GOERLI=5]="GOERLI",e[e.SEPOLIA=11155111]="SEPOLIA",e[e.OPTIMISM=10]="OPTIMISM",e[e.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",e[e.ARBITRUM_ONE=42161]="ARBITRUM_ONE",e[e.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",e[e.POLYGON=137]="POLYGON",e[e.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",e[e.CELO=42220]="CELO",e[e.CELO_ALFAJORES=44787]="CELO_ALFAJORES",e[e.GNOSIS=100]="GNOSIS",e[e.MOONBEAM=1284]="MOONBEAM",e[e.BNB=56]="BNB",e[e.AVALANCHE=43114]="AVALANCHE",e[e.BASE_GOERLI=84531]="BASE_GOERLI",e[e.BASE=8453]="BASE"}(UT||(UT={}));var KT,QT,JT,$T,eC,tC,nC,rC=[UT.MAINNET,UT.OPTIMISM,UT.OPTIMISM_GOERLI,UT.ARBITRUM_ONE,UT.ARBITRUM_GOERLI,UT.POLYGON,UT.POLYGON_MUMBAI,UT.GOERLI,UT.SEPOLIA,UT.CELO_ALFAJORES,UT.CELO,UT.BNB,UT.AVALANCHE,UT.BASE,UT.BASE_GOERLI];!function(e){e.ETHER="ETH",e.MATIC="MATIC",e.CELO="CELO",e.GNOSIS="XDAI",e.MOONBEAM="GLMR",e.BNB="BNB",e.AVAX="AVAX"}(KT||(KT={}));var iC=[UT.MAINNET,UT.GOERLI];function aC(e,t){return void 0===t&&(t=[]),iC.concat(t).reduce((function(t,n){return t[n]=e,t}),{})}var oC,sC,uC=aC("0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",[UT.OPTIMISM,UT.ARBITRUM_ONE,UT.POLYGON,UT.POLYGON_MUMBAI,UT.SEPOLIA]),lC="0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",cC=aC(lC),dC="0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",fC=aC(dC),pC={v3CoreFactoryAddress:"0x1F98431c8aD98523631AE4a59f267346ea31F984",multicallAddress:"0x1F98415757620B543A52E61c46B32eB19261F984",quoterAddress:"0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",v3MigratorAddress:"0xA5644E29708357803b5A882D272c41cC0dF92B34",nonfungiblePositionManagerAddress:"0xC36442b4a4522E871399CD717aBDD847Ab11FE88"},hC=XT({},pC,{v1MixedRouteQuoterAddress:"0x84E44095eeBfEC7793Cd7d5b57B7e401D7f1cA2E"}),mC=XT({},pC,{v1MixedRouteQuoterAddress:"0xBa60b6e6fF25488308789E6e0A65D838be34194e"}),yC=pC,gC=XT({},pC,{multicallAddress:"0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB",tickLensAddress:"0xbfd8137f7d1516D3ea5cA83523914859ec47F573"}),AC=pC,bC={v3CoreFactoryAddress:"0xAfE208a311B21f13EF87E33A90049fC17A7acDEc",multicallAddress:"0x633987602DE5C4F337e3DbF265303A1080324204",quoterAddress:"0x82825d0554fA07f7FC52Ab63c961F330fdEFa8E8",v3MigratorAddress:"0x3cFd4d48EDfDCC53D3f173F596f621064614C582",nonfungiblePositionManagerAddress:"0x3d79EdAaBC0EaB6F08ED885C05Fc0B014290D95A",tickLensAddress:"0x5f115D9113F88e0a0Db1b5033D90D4a9690AcD3D"},vC=((QT={})[UT.MAINNET]=hC,QT[UT.OPTIMISM]=yC,QT[UT.ARBITRUM_ONE]=gC,QT[UT.POLYGON]=AC,QT[UT.POLYGON_MUMBAI]=AC,QT[UT.GOERLI]=mC,QT[UT.CELO]=bC,QT[UT.CELO_ALFAJORES]=bC,QT[UT.BNB]={v3CoreFactoryAddress:"0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7",multicallAddress:"0x963Df249eD09c358A4819E39d9Cd5736c3087184",quoterAddress:"0x78D78E420Da98ad378D7799bE8f4AF69033EB077",v3MigratorAddress:"0x32681814957e0C13117ddc0c2aba232b5c9e760f",nonfungiblePositionManagerAddress:"0x7b8A01B39D58278b5DE7e48c8449c9f4F5170613",tickLensAddress:"0xD9270014D396281579760619CCf4c3af0501A47C",swapRouter02Address:"0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2"},QT[UT.OPTIMISM_GOERLI]={v3CoreFactoryAddress:"0xB656dA17129e7EB733A557f4EBc57B76CFbB5d10",multicallAddress:"0x07F2D8a2a02251B62af965f22fC4744A5f96BCCd",quoterAddress:"0x9569CbA925c8ca2248772A9A4976A516743A246F",v3MigratorAddress:"0xf6c55fBe84B1C8c3283533c53F51bC32F5C7Aba8",nonfungiblePositionManagerAddress:"0x39Ca85Af2F383190cBf7d7c41ED9202D27426EF6",tickLensAddress:"0xe6140Bd164b63E8BfCfc40D5dF952f83e171758e"},QT[UT.ARBITRUM_GOERLI]={v3CoreFactoryAddress:"0x4893376342d5D7b3e31d4184c08b265e5aB2A3f6",multicallAddress:"0x8260CB40247290317a4c062F3542622367F206Ee",quoterAddress:"0x1dd92b83591781D0C6d98d07391eea4b9a6008FA",v3MigratorAddress:"0xA815919D2584Ac3F76ea9CB62E6Fd40a43BCe0C3",nonfungiblePositionManagerAddress:"0x622e4726a167799826d1E1D150b076A7725f5D81",tickLensAddress:"0xb52429333da969a0C79a60930a4Bf0020E5D1DE8"},QT[UT.SEPOLIA]={v3CoreFactoryAddress:"0x0227628f3F023bb0B980b67D528571c95c6DaC1c",multicallAddress:"0xD7F33bCdb21b359c8ee6F0251d30E94832baAd07",quoterAddress:"0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3",v3MigratorAddress:"0x729004182cF005CEC8Bd85df140094b6aCbe8b15",nonfungiblePositionManagerAddress:"0x1238536071E1c677A632429e3655c799b22cDA52",tickLensAddress:"0xd7f33bcdb21b359c8ee6f0251d30e94832baad07"},QT[UT.AVALANCHE]={v3CoreFactoryAddress:"0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD",multicallAddress:"0x0139141Cd4Ee88dF3Cdb65881D411bAE271Ef0C2",quoterAddress:"0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F",v3MigratorAddress:"0x44f5f1f5E452ea8d29C890E8F6e893fC0f1f0f97",nonfungiblePositionManagerAddress:"0x655C406EBFa14EE2006250925e54ec43AD184f8B",tickLensAddress:"0xEB9fFC8bf81b4fFd11fb6A63a6B0f098c6e21950",swapRouter02Address:"0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE"},QT[UT.BASE]={v3CoreFactoryAddress:"0x33128a8fC17869897dcE68Ed026d694621f6FDfD",multicallAddress:"0x091e99cb1C49331a94dD62755D168E941AbD0693",quoterAddress:"0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",v3MigratorAddress:"0x23cF10b1ee3AdfCA73B0eF17C07F7577e7ACd2d7",nonfungiblePositionManagerAddress:"0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",tickLensAddress:"0x0CdeE061c75D43c82520eD998C23ac2991c9ac6d",swapRouter02Address:"0x2626664c2603336E57B271c5C0b26F421741e481"},QT[UT.BASE_GOERLI]={v3CoreFactoryAddress:"0x9323c1d6D800ed51Bd7C6B216cfBec678B7d0BC2",multicallAddress:"0xB206027a9E0E13F05eBEFa5D2402Bab3eA716439",quoterAddress:"0xedf539058e28E5937dAef3f69cEd0b25fbE66Ae9",v3MigratorAddress:"0x3efe5d02a04b7351D671Db7008ec6eBA9AD9e3aE",nonfungiblePositionManagerAddress:"0x3c61369ef0D1D2AFa70d8feC2F31C5D6Ce134F30",tickLensAddress:"0x1acB873Ee909D0c98adB18e4474943249F931b92",swapRouter02Address:"0x8357227D4eDc78991Db6FDB9bD6ADE250536dE1d"},QT),wC=XT({},rC.reduce((function(e,t){return e[t]=vC[t].v3CoreFactoryAddress,e}),{})),xC=XT({},rC.reduce((function(e,t){var n=vC[t].v3MigratorAddress;return n&&(e[t]=n),e}),{})),EC=XT({},rC.reduce((function(e,t){return e[t]=vC[t].multicallAddress,e}),{})),TC=aC("0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F"),CC=((JT={})[UT.MAINNET]="0xC4e172459f1E7939D522503B81AFAaC1014CE6F6",JT),IC=(($T={})[UT.MAINNET]="0x408ED6354d4973f66138C91495F2f2FCbd8724C3",$T),SC=aC("0x1a9C8182C09F50C8318d769245beA52c32BE35BC"),kC=((eC={})[UT.MAINNET]="0x090D4613473dEE047c3f2706764f49E0821D256e",eC),OC=((tC={})[UT.MAINNET]="0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8",tC),RC=XT({},rC.reduce((function(e,t){return e[t]=vC[t].quoterAddress,e}),{})),PC=XT({},rC.reduce((function(e,t){var n=vC[t].nonfungiblePositionManagerAddress;return n&&(e[t]=n),e}),{})),NC=XT({},aC("0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e")),LC=((nC={})[UT.MAINNET]="0x65770b5283117639760beA3F867b69b3697a91dd",nC),MC=XT({},rC.reduce((function(e,t){var n=vC[t].tickLensAddress;return n&&(e[t]=n),e}),{})),DC=rC.reduce((function(e,t){var n=vC[t].v1MixedRouteQuoterAddress;return n&&(e[t]=n),e}),{});!function(e){e[e.EXACT_INPUT=0]="EXACT_INPUT",e[e.EXACT_OUTPUT=1]="EXACT_OUTPUT"}(oC||(oC={})),function(e){e[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP"}(sC||(sC={}));var FC,jC,BC=fw.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),_C=Ew(yw),zC=Ew(Aw),UC=((FC={})[sC.ROUND_DOWN]=_C.ROUND_DOWN,FC[sC.ROUND_HALF_UP]=_C.ROUND_HALF_UP,FC[sC.ROUND_UP]=_C.ROUND_UP,FC),WC=((jC={})[sC.ROUND_DOWN]=0,jC[sC.ROUND_HALF_UP]=1,jC[sC.ROUND_UP]=3,jC),HC=function(){function e(e,t){void 0===t&&(t=fw.BigInt(1)),this.numerator=fw.BigInt(e),this.denominator=fw.BigInt(t)}e.tryParseFraction=function(t){if(t instanceof fw||"number"==typeof t||"string"==typeof t)return new e(t);if("numerator"in t&&"denominator"in t)return t;throw new Error("Could not parse fraction")};var t=e.prototype;return t.invert=function(){return new e(this.denominator,this.numerator)},t.add=function(t){var n=e.tryParseFraction(t);return fw.equal(this.denominator,n.denominator)?new e(fw.add(this.numerator,n.numerator),this.denominator):new e(fw.add(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator)),fw.multiply(this.denominator,n.denominator))},t.subtract=function(t){var n=e.tryParseFraction(t);return fw.equal(this.denominator,n.denominator)?new e(fw.subtract(this.numerator,n.numerator),this.denominator):new e(fw.subtract(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator)),fw.multiply(this.denominator,n.denominator))},t.lessThan=function(t){var n=e.tryParseFraction(t);return fw.lessThan(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.equalTo=function(t){var n=e.tryParseFraction(t);return fw.equal(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.greaterThan=function(t){var n=e.tryParseFraction(t);return fw.greaterThan(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.multiply=function(t){var n=e.tryParseFraction(t);return new e(fw.multiply(this.numerator,n.numerator),fw.multiply(this.denominator,n.denominator))},t.divide=function(t){var n=e.tryParseFraction(t);return new e(fw.multiply(this.numerator,n.denominator),fw.multiply(this.denominator,n.numerator))},t.toSignificant=function(e,t,n){void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=sC.ROUND_HALF_UP),Number.isInteger(e)||hw(!1),e>0||hw(!1),_C.set({precision:e+1,rounding:UC[n]});var r=new _C(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return r.toFormat(r.decimalPlaces(),t)},t.toFixed=function(e,t,n){return void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=sC.ROUND_HALF_UP),Number.isInteger(e)||hw(!1),e>=0||hw(!1),zC.DP=e,zC.RM=WC[n],new zC(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)},GT(e,[{key:"quotient",get:function(){return fw.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new e(fw.remainder(this.numerator,this.denominator),this.denominator)}},{key:"asFraction",get:function(){return new e(this.numerator,this.denominator)}}]),e}(),VC=Ew(Aw),qC=function(e){function t(t,n,r){var i;return i=e.call(this,n,r)||this,fw.lessThanOrEqual(i.quotient,BC)||hw(!1),i.currency=t,i.decimalScale=fw.exponentiate(fw.BigInt(10),fw.BigInt(t.decimals)),i}ZT(t,e),t.fromRawAmount=function(e,n){return new t(e,n)},t.fromFractionalAmount=function(e,n,r){return new t(e,n,r)};var n=t.prototype;return n.add=function(n){this.currency.equals(n.currency)||hw(!1);var r=e.prototype.add.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.subtract=function(n){this.currency.equals(n.currency)||hw(!1);var r=e.prototype.subtract.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.multiply=function(n){var r=e.prototype.multiply.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.divide=function(n){var r=e.prototype.divide.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.toSignificant=function(t,n,r){return void 0===t&&(t=6),void 0===r&&(r=sC.ROUND_DOWN),e.prototype.divide.call(this,this.decimalScale).toSignificant(t,n,r)},n.toFixed=function(t,n,r){return void 0===t&&(t=this.currency.decimals),void 0===r&&(r=sC.ROUND_DOWN),t<=this.currency.decimals||hw(!1),e.prototype.divide.call(this,this.decimalScale).toFixed(t,n,r)},n.toExact=function(e){return void 0===e&&(e={groupSeparator:""}),VC.DP=this.currency.decimals,new VC(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(e)},GT(t,[{key:"wrapped",get:function(){return this.currency.isToken?this:t.fromFractionalAmount(this.currency.wrapped,this.numerator,this.denominator)}}]),t}(HC),GC=new HC(fw.BigInt(100));function XC(e){return new ZC(e.numerator,e.denominator)}var ZC=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).isPercent=!0,t}ZT(t,e);var n=t.prototype;return n.add=function(t){return XC(e.prototype.add.call(this,t))},n.subtract=function(t){return XC(e.prototype.subtract.call(this,t))},n.multiply=function(t){return XC(e.prototype.multiply.call(this,t))},n.divide=function(t){return XC(e.prototype.divide.call(this,t))},n.toSignificant=function(t,n,r){return void 0===t&&(t=5),e.prototype.multiply.call(this,GC).toSignificant(t,n,r)},n.toFixed=function(t,n,r){return void 0===t&&(t=2),e.prototype.multiply.call(this,GC).toFixed(t,n,r)},t}(HC),YC=function(e){function t(){for(var t,n,r,i,a,o=arguments.length,s=new Array(o),u=0;u<o;u++)s[u]=arguments[u];if(4===s.length)n=s[0],r=s[1],i=s[2],a=s[3];else{var l=s[0].quoteAmount.divide(s[0].baseAmount),c=[s[0].baseAmount.currency,s[0].quoteAmount.currency,l.denominator,l.numerator];n=c[0],r=c[1],i=c[2],a=c[3]}return(t=e.call(this,a,i)||this).baseCurrency=n,t.quoteCurrency=r,t.scalar=new HC(fw.exponentiate(fw.BigInt(10),fw.BigInt(n.decimals)),fw.exponentiate(fw.BigInt(10),fw.BigInt(r.decimals))),t}ZT(t,e);var n=t.prototype;return n.invert=function(){return new t(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(n){this.quoteCurrency.equals(n.baseCurrency)||hw(!1);var r=e.prototype.multiply.call(this,n);return new t(this.baseCurrency,n.quoteCurrency,r.denominator,r.numerator)},n.quote=function(t){t.currency.equals(this.baseCurrency)||hw(!1);var n=e.prototype.multiply.call(this,t);return qC.fromFractionalAmount(this.quoteCurrency,n.numerator,n.denominator)},n.toSignificant=function(e,t,n){return void 0===e&&(e=6),this.adjustedForDecimals.toSignificant(e,t,n)},n.toFixed=function(e,t,n){return void 0===e&&(e=4),this.adjustedForDecimals.toFixed(e,t,n)},GT(t,[{key:"adjustedForDecimals",get:function(){return e.prototype.multiply.call(this,this.scalar)}}]),t}(HC),KC=function(e,t,n,r){Number.isSafeInteger(e)||hw(!1),t>=0&&t<255&&Number.isInteger(t)||hw(!1),this.chainId=e,this.decimals=t,this.symbol=n,this.name=r},QC=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).isNative=!0,t.isToken=!1,t}return ZT(t,e),t}(KC);function JC(e){try{return na(e)}catch(t){throw new Error(e+" is not a valid address.")}}var $C=/^0x[0-9a-fA-F]{40}$/;var eI,tI=function(e){function t(t,n,r,i,a,o){var s;return(s=e.call(this,t,r,i,a)||this).isNative=!1,s.isToken=!0,s.address=o?function(e){if($C.test(e))return e;throw new Error(e+" is not a valid address.")}(n):JC(n),s}ZT(t,e);var n=t.prototype;return n.equals=function(e){return e.isToken&&this.chainId===e.chainId&&this.address.toLowerCase()===e.address.toLowerCase()},n.sortsBefore=function(e){return this.chainId!==e.chainId&&hw(!1),this.address.toLowerCase()===e.address.toLowerCase()&&hw(!1),this.address.toLowerCase()<e.address.toLowerCase()},GT(t,[{key:"wrapped",get:function(){return this}}]),t}(KC),nI=((eI={})[1]=new tI(1,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),eI[3]=new tI(3,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),eI[4]=new tI(4,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),eI[5]=new tI(5,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),eI[42]=new tI(42,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),eI[10]=new tI(10,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),eI[69]=new tI(69,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),eI[42161]=new tI(42161,"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",18,"WETH","Wrapped Ether"),eI[421611]=new tI(421611,"0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681",18,"WETH","Wrapped Ether"),eI),rI=function(e){function t(t){return e.call(this,t,18,"ETH","Ether")||this}return ZT(t,e),t.onChain=function(e){var n;return null!=(n=this._etherCache[e])?n:this._etherCache[e]=new t(e)},t.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},GT(t,[{key:"wrapped",get:function(){var e=nI[this.chainId];return e||hw(!1),e}}]),t}(QC);rI._etherCache={};var iI=fw.BigInt(Number.MAX_SAFE_INTEGER),aI=fw.BigInt(0),oI=fw.BigInt(1),sI=fw.BigInt(2);var uI,lI,cI,dI=Object.freeze({__proto__:null,ARGENT_WALLET_DETECTOR_ADDRESS:OC,CHAIN_TO_ADDRESSES_MAP:vC,get ChainId(){return UT},CurrencyAmount:qC,ENS_REGISTRAR_ADDRESSES:NC,Ether:rI,Fraction:HC,GOVERNANCE_ALPHA_V0_ADDRESSES:TC,GOVERNANCE_ALPHA_V1_ADDRESSES:CC,GOVERNANCE_BRAVO_ADDRESSES:IC,MERKLE_DISTRIBUTOR_ADDRESS:kC,MIXED_ROUTE_QUOTER_V1_ADDRESSES:DC,MULTICALL_ADDRESSES:EC,MaxUint256:BC,NONFUNGIBLE_POSITION_MANAGER_ADDRESSES:PC,NativeCurrency:QC,get NativeCurrencyName(){return KT},Percent:ZC,Price:YC,QUOTER_ADDRESSES:RC,get Rounding(){return sC},SOCKS_CONTROLLER_ADDRESSES:LC,SUPPORTED_CHAINS:rC,SWAP_ROUTER_02_ADDRESSES:function(e){return e==UT.BNB?vC[e].swapRouter02Address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"},TICK_LENS_ADDRESSES:MC,TIMELOCK_ADDRESSES:SC,Token:tI,get TradeType(){return oC},UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS:"0x8B799381ac40b838BBA4131ffB26197C432AFe78",UNI_ADDRESSES:uC,V2_FACTORY_ADDRESS:lC,V2_FACTORY_ADDRESSES:cC,V2_ROUTER_ADDRESS:dC,V2_ROUTER_ADDRESSES:fC,V3_CORE_FACTORY_ADDRESSES:wC,V3_MIGRATOR_ADDRESSES:xC,WETH9:nI,computePriceImpact:function(e,t,n){var r=e.quote(t),i=r.subtract(n).divide(r);return new ZC(i.numerator,i.denominator)},sortedInsert:function(e,t,n,r){if(n>0||hw(!1),e.length<=n||hw(!1),0===e.length)return e.push(t),null;var i=e.length===n;if(i&&r(e[e.length-1],t)<=0)return t;for(var a=0,o=e.length;a<o;){var s=a+o>>>1;r(e[s],t)<=0?a=s+1:o=s}return e.splice(a,0,t),i?e.pop():null},sqrt:function(e){if(fw.greaterThanOrEqual(e,aI)||hw(!1),fw.lessThan(e,iI))return fw.BigInt(Math.floor(Math.sqrt(fw.toNumber(e))));var t,n;for(t=e,n=fw.add(fw.divide(e,sI),oI);fw.lessThan(n,t);)t=n,n=fw.divide(fw.add(fw.divide(e,n),n),sI);return t},validateAndParseAddress:JC}),fI=ot(dI),pI={_format:"hh-sol-artifact-1",contractName:"IPeripheryPaymentsWithFeeExtended",sourceName:"contracts/interfaces/IPeripheryPaymentsWithFeeExtended.sol",abi:[{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"pull",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"refundETH",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"sweepToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amountMinimum",type:"uint256"}],name:"sweepToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"uint256",name:"feeBips",type:"uint256"},{internalType:"address",name:"feeRecipient",type:"address"}],name:"sweepTokenWithFee",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"feeBips",type:"uint256"},{internalType:"address",name:"feeRecipient",type:"address"}],name:"sweepTokenWithFee",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"unwrapWETH9",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"}],name:"unwrapWETH9",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"feeBips",type:"uint256"},{internalType:"address",name:"feeRecipient",type:"address"}],name:"unwrapWETH9WithFee",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"uint256",name:"feeBips",type:"uint256"},{internalType:"address",name:"feeRecipient",type:"address"}],name:"unwrapWETH9WithFee",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"value",type:"uint256"}],name:"wrapETH",outputs:[],stateMutability:"payable",type:"function"}],bytecode:"0x",deployedBytecode:"0x",linkReferences:{},deployedLinkReferences:{}},hI={_format:"hh-sol-artifact-1",contractName:"ISwapRouter02",sourceName:"contracts/interfaces/ISwapRouter02.sol",abi:[{inputs:[{internalType:"address",name:"token",type:"address"}],name:"approveMax",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"approveMaxMinusOne",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"approveZeroThenMax",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"approveZeroThenMaxMinusOne",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"data",type:"bytes"}],name:"callPositionManager",outputs:[{internalType:"bytes",name:"result",type:"bytes"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"bytes",name:"path",type:"bytes"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOutMinimum",type:"uint256"}],internalType:"struct IV3SwapRouter.ExactInputParams",name:"params",type:"tuple"}],name:"exactInput",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"tokenIn",type:"address"},{internalType:"address",name:"tokenOut",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOutMinimum",type:"uint256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],internalType:"struct IV3SwapRouter.ExactInputSingleParams",name:"params",type:"tuple"}],name:"exactInputSingle",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"bytes",name:"path",type:"bytes"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"uint256",name:"amountInMaximum",type:"uint256"}],internalType:"struct IV3SwapRouter.ExactOutputParams",name:"params",type:"tuple"}],name:"exactOutput",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"tokenIn",type:"address"},{internalType:"address",name:"tokenOut",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"uint256",name:"amountInMaximum",type:"uint256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],internalType:"struct IV3SwapRouter.ExactOutputSingleParams",name:"params",type:"tuple"}],name:"exactOutputSingle",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"getApprovalType",outputs:[{internalType:"enum IApproveAndCall.ApprovalType",name:"",type:"uint8"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"}],internalType:"struct IApproveAndCall.IncreaseLiquidityParams",name:"params",type:"tuple"}],name:"increaseLiquidity",outputs:[{internalType:"bytes",name:"result",type:"bytes"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],internalType:"struct IApproveAndCall.MintParams",name:"params",type:"tuple"}],name:"mint",outputs:[{internalType:"bytes",name:"result",type:"bytes"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"previousBlockhash",type:"bytes32"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitAllowed",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitAllowedIfNecessary",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitIfNecessary",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOutMin",type:"uint256"},{internalType:"address[]",name:"path",type:"address[]"},{internalType:"address",name:"to",type:"address"}],name:"swapExactTokensForTokens",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"uint256",name:"amountInMax",type:"uint256"},{internalType:"address[]",name:"path",type:"address[]"},{internalType:"address",name:"to",type:"address"}],name:"swapTokensForExactTokens",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"int256",name:"amount0Delta",type:"int256"},{internalType:"int256",name:"amount1Delta",type:"int256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"uniswapV3SwapCallback",outputs:[],stateMutability:"nonpayable",type:"function"}],bytecode:"0x",deployedBytecode:"0x",linkReferences:{},deployedLinkReferences:{}};function mI(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yI(e,t,n){return t&&mI(e.prototype,t),n&&mI(e,n),e}function gI(){return gI=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gI.apply(this,arguments)}function AI(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}!function(e){e[e.MAINNET=1]="MAINNET",e[e.GOERLI=5]="GOERLI",e[e.SEPOLIA=11155111]="SEPOLIA",e[e.OPTIMISM=10]="OPTIMISM",e[e.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",e[e.ARBITRUM_ONE=42161]="ARBITRUM_ONE",e[e.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",e[e.POLYGON=137]="POLYGON",e[e.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",e[e.CELO=42220]="CELO",e[e.CELO_ALFAJORES=44787]="CELO_ALFAJORES",e[e.GNOSIS=100]="GNOSIS",e[e.MOONBEAM=1284]="MOONBEAM",e[e.BNB=56]="BNB",e[e.AVALANCHE=43114]="AVALANCHE",e[e.BASE_GOERLI=84531]="BASE_GOERLI",e[e.BASE=8453]="BASE"}(uI||(uI={})),uI.MAINNET,uI.OPTIMISM,uI.OPTIMISM_GOERLI,uI.ARBITRUM_ONE,uI.ARBITRUM_GOERLI,uI.POLYGON,uI.POLYGON_MUMBAI,uI.GOERLI,uI.SEPOLIA,uI.CELO_ALFAJORES,uI.CELO,uI.BNB,uI.AVALANCHE,uI.BASE,uI.BASE_GOERLI,function(e){e.ETHER="ETH",e.MATIC="MATIC",e.CELO="CELO",e.GNOSIS="XDAI",e.MOONBEAM="GLMR",e.BNB="BNB",e.AVAX="AVAX"}(lI||(lI={}));uI.MAINNET,uI.GOERLI;uI.OPTIMISM,uI.ARBITRUM_ONE,uI.POLYGON,uI.POLYGON_MUMBAI,uI.SEPOLIA;var bI,vI,wI={v3CoreFactoryAddress:"0x1F98431c8aD98523631AE4a59f267346ea31F984",multicallAddress:"0x1F98415757620B543A52E61c46B32eB19261F984",quoterAddress:"0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",v3MigratorAddress:"0xA5644E29708357803b5A882D272c41cC0dF92B34",nonfungiblePositionManagerAddress:"0xC36442b4a4522E871399CD717aBDD847Ab11FE88"},xI=gI({},wI,{v1MixedRouteQuoterAddress:"0x84E44095eeBfEC7793Cd7d5b57B7e401D7f1cA2E"}),EI=gI({},wI,{v1MixedRouteQuoterAddress:"0xBa60b6e6fF25488308789E6e0A65D838be34194e"}),TI=wI,CI=gI({},wI,{multicallAddress:"0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB",tickLensAddress:"0xbfd8137f7d1516D3ea5cA83523914859ec47F573"}),II=wI,SI={v3CoreFactoryAddress:"0xAfE208a311B21f13EF87E33A90049fC17A7acDEc",multicallAddress:"0x633987602DE5C4F337e3DbF265303A1080324204",quoterAddress:"0x82825d0554fA07f7FC52Ab63c961F330fdEFa8E8",v3MigratorAddress:"0x3cFd4d48EDfDCC53D3f173F596f621064614C582",nonfungiblePositionManagerAddress:"0x3d79EdAaBC0EaB6F08ED885C05Fc0B014290D95A",tickLensAddress:"0x5f115D9113F88e0a0Db1b5033D90D4a9690AcD3D"};(cI={})[uI.MAINNET]=xI,cI[uI.OPTIMISM]=TI,cI[uI.ARBITRUM_ONE]=CI,cI[uI.POLYGON]=II,cI[uI.POLYGON_MUMBAI]=II,cI[uI.GOERLI]=EI,cI[uI.CELO]=SI,cI[uI.CELO_ALFAJORES]=SI,cI[uI.BNB]={v3CoreFactoryAddress:"0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7",multicallAddress:"0x963Df249eD09c358A4819E39d9Cd5736c3087184",quoterAddress:"0x78D78E420Da98ad378D7799bE8f4AF69033EB077",v3MigratorAddress:"0x32681814957e0C13117ddc0c2aba232b5c9e760f",nonfungiblePositionManagerAddress:"0x7b8A01B39D58278b5DE7e48c8449c9f4F5170613",tickLensAddress:"0xD9270014D396281579760619CCf4c3af0501A47C",swapRouter02Address:"0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2"},cI[uI.OPTIMISM_GOERLI]={v3CoreFactoryAddress:"0xB656dA17129e7EB733A557f4EBc57B76CFbB5d10",multicallAddress:"0x07F2D8a2a02251B62af965f22fC4744A5f96BCCd",quoterAddress:"0x9569CbA925c8ca2248772A9A4976A516743A246F",v3MigratorAddress:"0xf6c55fBe84B1C8c3283533c53F51bC32F5C7Aba8",nonfungiblePositionManagerAddress:"0x39Ca85Af2F383190cBf7d7c41ED9202D27426EF6",tickLensAddress:"0xe6140Bd164b63E8BfCfc40D5dF952f83e171758e"},cI[uI.ARBITRUM_GOERLI]={v3CoreFactoryAddress:"0x4893376342d5D7b3e31d4184c08b265e5aB2A3f6",multicallAddress:"0x8260CB40247290317a4c062F3542622367F206Ee",quoterAddress:"0x1dd92b83591781D0C6d98d07391eea4b9a6008FA",v3MigratorAddress:"0xA815919D2584Ac3F76ea9CB62E6Fd40a43BCe0C3",nonfungiblePositionManagerAddress:"0x622e4726a167799826d1E1D150b076A7725f5D81",tickLensAddress:"0xb52429333da969a0C79a60930a4Bf0020E5D1DE8"},cI[uI.SEPOLIA]={v3CoreFactoryAddress:"0x0227628f3F023bb0B980b67D528571c95c6DaC1c",multicallAddress:"0xD7F33bCdb21b359c8ee6F0251d30E94832baAd07",quoterAddress:"0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3",v3MigratorAddress:"0x729004182cF005CEC8Bd85df140094b6aCbe8b15",nonfungiblePositionManagerAddress:"0x1238536071E1c677A632429e3655c799b22cDA52",tickLensAddress:"0xd7f33bcdb21b359c8ee6f0251d30e94832baad07"},cI[uI.AVALANCHE]={v3CoreFactoryAddress:"0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD",multicallAddress:"0x0139141Cd4Ee88dF3Cdb65881D411bAE271Ef0C2",quoterAddress:"0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F",v3MigratorAddress:"0x44f5f1f5E452ea8d29C890E8F6e893fC0f1f0f97",nonfungiblePositionManagerAddress:"0x655C406EBFa14EE2006250925e54ec43AD184f8B",tickLensAddress:"0xEB9fFC8bf81b4fFd11fb6A63a6B0f098c6e21950",swapRouter02Address:"0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE"},cI[uI.BASE]={v3CoreFactoryAddress:"0x33128a8fC17869897dcE68Ed026d694621f6FDfD",multicallAddress:"0x091e99cb1C49331a94dD62755D168E941AbD0693",quoterAddress:"0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",v3MigratorAddress:"0x23cF10b1ee3AdfCA73B0eF17C07F7577e7ACd2d7",nonfungiblePositionManagerAddress:"0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",tickLensAddress:"0x0CdeE061c75D43c82520eD998C23ac2991c9ac6d",swapRouter02Address:"0x2626664c2603336E57B271c5C0b26F421741e481"},cI[uI.BASE_GOERLI]={v3CoreFactoryAddress:"0x9323c1d6D800ed51Bd7C6B216cfBec678B7d0BC2",multicallAddress:"0xB206027a9E0E13F05eBEFa5D2402Bab3eA716439",quoterAddress:"0xedf539058e28E5937dAef3f69cEd0b25fbE66Ae9",v3MigratorAddress:"0x3efe5d02a04b7351D671Db7008ec6eBA9AD9e3aE",nonfungiblePositionManagerAddress:"0x3c61369ef0D1D2AFa70d8feC2F31C5D6Ce134F30",tickLensAddress:"0x1acB873Ee909D0c98adB18e4474943249F931b92",swapRouter02Address:"0x8357227D4eDc78991Db6FDB9bD6ADE250536dE1d"},{}[uI.MAINNET]="0xC4e172459f1E7939D522503B81AFAaC1014CE6F6",{}[uI.MAINNET]="0x408ED6354d4973f66138C91495F2f2FCbd8724C3",{}[uI.MAINNET]="0x090D4613473dEE047c3f2706764f49E0821D256e",{}[uI.MAINNET]="0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8",{}[uI.MAINNET]="0x65770b5283117639760beA3F867b69b3697a91dd",function(e){e[e.EXACT_INPUT=0]="EXACT_INPUT",e[e.EXACT_OUTPUT=1]="EXACT_OUTPUT"}(bI||(bI={})),function(e){e[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP"}(vI||(vI={}));var kI,OI,RI=fw.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),PI=Ew(yw),NI=Ew(Aw),LI=((kI={})[vI.ROUND_DOWN]=PI.ROUND_DOWN,kI[vI.ROUND_HALF_UP]=PI.ROUND_HALF_UP,kI[vI.ROUND_UP]=PI.ROUND_UP,kI),MI=((OI={})[vI.ROUND_DOWN]=0,OI[vI.ROUND_HALF_UP]=1,OI[vI.ROUND_UP]=3,OI),DI=function(){function e(e,t){void 0===t&&(t=fw.BigInt(1)),this.numerator=fw.BigInt(e),this.denominator=fw.BigInt(t)}e.tryParseFraction=function(t){if(t instanceof fw||"number"==typeof t||"string"==typeof t)return new e(t);if("numerator"in t&&"denominator"in t)return t;throw new Error("Could not parse fraction")};var t=e.prototype;return t.invert=function(){return new e(this.denominator,this.numerator)},t.add=function(t){var n=e.tryParseFraction(t);return fw.equal(this.denominator,n.denominator)?new e(fw.add(this.numerator,n.numerator),this.denominator):new e(fw.add(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator)),fw.multiply(this.denominator,n.denominator))},t.subtract=function(t){var n=e.tryParseFraction(t);return fw.equal(this.denominator,n.denominator)?new e(fw.subtract(this.numerator,n.numerator),this.denominator):new e(fw.subtract(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator)),fw.multiply(this.denominator,n.denominator))},t.lessThan=function(t){var n=e.tryParseFraction(t);return fw.lessThan(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.equalTo=function(t){var n=e.tryParseFraction(t);return fw.equal(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.greaterThan=function(t){var n=e.tryParseFraction(t);return fw.greaterThan(fw.multiply(this.numerator,n.denominator),fw.multiply(n.numerator,this.denominator))},t.multiply=function(t){var n=e.tryParseFraction(t);return new e(fw.multiply(this.numerator,n.numerator),fw.multiply(this.denominator,n.denominator))},t.divide=function(t){var n=e.tryParseFraction(t);return new e(fw.multiply(this.numerator,n.denominator),fw.multiply(this.denominator,n.numerator))},t.toSignificant=function(e,t,n){void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=vI.ROUND_HALF_UP),Number.isInteger(e)||hw(!1),e>0||hw(!1),PI.set({precision:e+1,rounding:LI[n]});var r=new PI(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return r.toFormat(r.decimalPlaces(),t)},t.toFixed=function(e,t,n){return void 0===t&&(t={groupSeparator:""}),void 0===n&&(n=vI.ROUND_HALF_UP),Number.isInteger(e)||hw(!1),e>=0||hw(!1),NI.DP=e,NI.RM=MI[n],new NI(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,t)},yI(e,[{key:"quotient",get:function(){return fw.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new e(fw.remainder(this.numerator,this.denominator),this.denominator)}},{key:"asFraction",get:function(){return new e(this.numerator,this.denominator)}}]),e}(),FI=Ew(Aw),jI=function(e){function t(t,n,r){var i;return i=e.call(this,n,r)||this,fw.lessThanOrEqual(i.quotient,RI)||hw(!1),i.currency=t,i.decimalScale=fw.exponentiate(fw.BigInt(10),fw.BigInt(t.decimals)),i}AI(t,e),t.fromRawAmount=function(e,n){return new t(e,n)},t.fromFractionalAmount=function(e,n,r){return new t(e,n,r)};var n=t.prototype;return n.add=function(n){this.currency.equals(n.currency)||hw(!1);var r=e.prototype.add.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.subtract=function(n){this.currency.equals(n.currency)||hw(!1);var r=e.prototype.subtract.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.multiply=function(n){var r=e.prototype.multiply.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.divide=function(n){var r=e.prototype.divide.call(this,n);return t.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.toSignificant=function(t,n,r){return void 0===t&&(t=6),void 0===r&&(r=vI.ROUND_DOWN),e.prototype.divide.call(this,this.decimalScale).toSignificant(t,n,r)},n.toFixed=function(t,n,r){return void 0===t&&(t=this.currency.decimals),void 0===r&&(r=vI.ROUND_DOWN),t<=this.currency.decimals||hw(!1),e.prototype.divide.call(this,this.decimalScale).toFixed(t,n,r)},n.toExact=function(e){return void 0===e&&(e={groupSeparator:""}),FI.DP=this.currency.decimals,new FI(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(e)},yI(t,[{key:"wrapped",get:function(){return this.currency.isToken?this:t.fromFractionalAmount(this.currency.wrapped,this.numerator,this.denominator)}}]),t}(DI),BI=new DI(fw.BigInt(100));function _I(e){return new zI(e.numerator,e.denominator)}var zI=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).isPercent=!0,t}AI(t,e);var n=t.prototype;return n.add=function(t){return _I(e.prototype.add.call(this,t))},n.subtract=function(t){return _I(e.prototype.subtract.call(this,t))},n.multiply=function(t){return _I(e.prototype.multiply.call(this,t))},n.divide=function(t){return _I(e.prototype.divide.call(this,t))},n.toSignificant=function(t,n,r){return void 0===t&&(t=5),e.prototype.multiply.call(this,BI).toSignificant(t,n,r)},n.toFixed=function(t,n,r){return void 0===t&&(t=2),e.prototype.multiply.call(this,BI).toFixed(t,n,r)},t}(DI),UI=function(e){function t(){for(var t,n,r,i,a,o=arguments.length,s=new Array(o),u=0;u<o;u++)s[u]=arguments[u];if(4===s.length)n=s[0],r=s[1],i=s[2],a=s[3];else{var l=s[0].quoteAmount.divide(s[0].baseAmount),c=[s[0].baseAmount.currency,s[0].quoteAmount.currency,l.denominator,l.numerator];n=c[0],r=c[1],i=c[2],a=c[3]}return(t=e.call(this,a,i)||this).baseCurrency=n,t.quoteCurrency=r,t.scalar=new DI(fw.exponentiate(fw.BigInt(10),fw.BigInt(n.decimals)),fw.exponentiate(fw.BigInt(10),fw.BigInt(r.decimals))),t}AI(t,e);var n=t.prototype;return n.invert=function(){return new t(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(n){this.quoteCurrency.equals(n.baseCurrency)||hw(!1);var r=e.prototype.multiply.call(this,n);return new t(this.baseCurrency,n.quoteCurrency,r.denominator,r.numerator)},n.quote=function(t){t.currency.equals(this.baseCurrency)||hw(!1);var n=e.prototype.multiply.call(this,t);return jI.fromFractionalAmount(this.quoteCurrency,n.numerator,n.denominator)},n.toSignificant=function(e,t,n){return void 0===e&&(e=6),this.adjustedForDecimals.toSignificant(e,t,n)},n.toFixed=function(e,t,n){return void 0===e&&(e=4),this.adjustedForDecimals.toFixed(e,t,n)},yI(t,[{key:"adjustedForDecimals",get:function(){return e.prototype.multiply.call(this,this.scalar)}}]),t}(DI);function WI(e){try{return na(e)}catch(t){throw new Error(e+" is not a valid address.")}}var HI=/^0x[0-9a-fA-F]{40}$/;var VI,qI=function(e){function t(t,n,r,i,a,o){var s;return(s=e.call(this,t,r,i,a)||this).isNative=!1,s.isToken=!0,s.address=o?function(e){if(HI.test(e))return e;throw new Error(e+" is not a valid address.")}(n):WI(n),s}AI(t,e);var n=t.prototype;return n.equals=function(e){return e.isToken&&this.chainId===e.chainId&&this.address.toLowerCase()===e.address.toLowerCase()},n.sortsBefore=function(e){return this.chainId!==e.chainId&&hw(!1),this.address.toLowerCase()===e.address.toLowerCase()&&hw(!1),this.address.toLowerCase()<e.address.toLowerCase()},yI(t,[{key:"wrapped",get:function(){return this}}]),t}((function(e,t,n,r){Number.isSafeInteger(e)||hw(!1),t>=0&&t<255&&Number.isInteger(t)||hw(!1),this.chainId=e,this.decimals=t,this.symbol=n,this.name=r}));function GI(e,t,n,r){if(n>0||hw(!1),e.length<=n||hw(!1),0===e.length)return e.push(t),null;var i=e.length===n;if(i&&r(e[e.length-1],t)<=0)return t;for(var a=0,o=e.length;a<o;){var s=a+o>>>1;r(e[s],t)<=0?a=s+1:o=s}return e.splice(a,0,t),i?e.pop():null}(VI={})[1]=new qI(1,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),VI[3]=new qI(3,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),VI[4]=new qI(4,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),VI[5]=new qI(5,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),VI[42]=new qI(42,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),VI[10]=new qI(10,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),VI[69]=new qI(69,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),VI[42161]=new qI(42161,"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",18,"WETH","Wrapped Ether"),VI[421611]=new qI(421611,"0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681",18,"WETH","Wrapped Ether");var XI=fw.BigInt(Number.MAX_SAFE_INTEGER),ZI=fw.BigInt(0),YI=fw.BigInt(1),KI=fw.BigInt(2);function QI(e){if(fw.greaterThanOrEqual(e,ZI)||hw(!1),fw.lessThan(e,XI))return fw.BigInt(Math.floor(Math.sqrt(fw.toNumber(e))));var t,n;for(t=e,n=fw.add(fw.divide(e,KI),YI);fw.lessThan(n,t);)t=n,n=fw.divide(fw.add(fw.divide(e,n),n),KI);return t}var JI="0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",$I="0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f",eS=fw.BigInt(1e3),tS=fw.BigInt(0),nS=fw.BigInt(1),rS=fw.BigInt(5),iS=fw.BigInt(997),aS=fw.BigInt(1e3);function oS(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function sS(e,t,n){return t&&oS(e.prototype,t),n&&oS(e,n),e}function uS(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function lS(e){return lS=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},lS(e)}function cS(e,t){return cS=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},cS(e,t)}function dS(e,t,n){return dS=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&cS(i,n.prototype),i},dS.apply(null,arguments)}function fS(e){var t="function"==typeof Map?new Map:void 0;return fS=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return dS(e,arguments,lS(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),cS(n,e)},fS(e)}function pS(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mS(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return hS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hS(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var yS="setPrototypeOf"in Object,gS=function(e){function t(){var n;return(n=e.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,yS&&Object.setPrototypeOf(pS(n),(this instanceof t?this.constructor:void 0).prototype),n}return uS(t,e),t}(fS(Error)),AS=function(e){function t(){var n;return(n=e.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,yS&&Object.setPrototypeOf(pS(n),(this instanceof t?this.constructor:void 0).prototype),n}return uS(t,e),t}(fS(Error)),bS=function(e){var t=e.factoryAddress,n=e.tokenA,r=e.tokenB,i=n.sortsBefore(r)?[n,r]:[r,n],a=i[1];return oa(t,nm(["bytes"],[tm(["address","address"],[i[0].address,a.address])]),$I)},vS=function(){function e(t,n){var r=t.currency.sortsBefore(n.currency)?[t,n]:[n,t];this.liquidityToken=new qI(r[0].currency.chainId,e.getAddress(r[0].currency,r[1].currency),18,"UNI-V2","Uniswap V2"),this.tokenAmounts=r}e.getAddress=function(e,t){return bS({factoryAddress:JI,tokenA:e,tokenB:t})};var t=e.prototype;return t.involvesToken=function(e){return e.equals(this.token0)||e.equals(this.token1)},t.priceOf=function(e){return this.involvesToken(e)||hw(!1),e.equals(this.token0)?this.token0Price:this.token1Price},t.reserveOf=function(e){return this.involvesToken(e)||hw(!1),e.equals(this.token0)?this.reserve0:this.reserve1},t.getOutputAmount=function(t){if(this.involvesToken(t.currency)||hw(!1),fw.equal(this.reserve0.quotient,tS)||fw.equal(this.reserve1.quotient,tS))throw new gS;var n=this.reserveOf(t.currency),r=this.reserveOf(t.currency.equals(this.token0)?this.token1:this.token0),i=fw.multiply(t.quotient,iS),a=fw.multiply(i,r.quotient),o=fw.add(fw.multiply(n.quotient,aS),i),s=jI.fromRawAmount(t.currency.equals(this.token0)?this.token1:this.token0,fw.divide(a,o));if(fw.equal(s.quotient,tS))throw new AS;return[s,new e(n.add(t),r.subtract(s))]},t.getInputAmount=function(t){if(this.involvesToken(t.currency)||hw(!1),fw.equal(this.reserve0.quotient,tS)||fw.equal(this.reserve1.quotient,tS)||fw.greaterThanOrEqual(t.quotient,this.reserveOf(t.currency).quotient))throw new gS;var n=this.reserveOf(t.currency),r=this.reserveOf(t.currency.equals(this.token0)?this.token1:this.token0),i=fw.multiply(fw.multiply(r.quotient,t.quotient),aS),a=fw.multiply(fw.subtract(n.quotient,t.quotient),iS),o=jI.fromRawAmount(t.currency.equals(this.token0)?this.token1:this.token0,fw.add(fw.divide(i,a),nS));return[o,new e(r.add(o),n.subtract(t))]},t.getLiquidityMinted=function(e,t,n){e.currency.equals(this.liquidityToken)||hw(!1);var r,i=t.currency.sortsBefore(n.currency)?[t,n]:[n,t];if(i[0].currency.equals(this.token0)&&i[1].currency.equals(this.token1)||hw(!1),fw.equal(e.quotient,tS))r=fw.subtract(QI(fw.multiply(i[0].quotient,i[1].quotient)),eS);else{var a=fw.divide(fw.multiply(i[0].quotient,e.quotient),this.reserve0.quotient),o=fw.divide(fw.multiply(i[1].quotient,e.quotient),this.reserve1.quotient);r=fw.lessThanOrEqual(a,o)?a:o}if(!fw.greaterThan(r,tS))throw new AS;return jI.fromRawAmount(this.liquidityToken,r)},t.getLiquidityValue=function(e,t,n,r,i){var a;if(void 0===r&&(r=!1),this.involvesToken(e)||hw(!1),t.currency.equals(this.liquidityToken)||hw(!1),n.currency.equals(this.liquidityToken)||hw(!1),fw.lessThanOrEqual(n.quotient,t.quotient)||hw(!1),r){i||hw(!1);var o=fw.BigInt(i);if(fw.equal(o,tS))a=t;else{var s=QI(fw.multiply(this.reserve0.quotient,this.reserve1.quotient)),u=QI(o);if(fw.greaterThan(s,u)){var l=fw.multiply(t.quotient,fw.subtract(s,u)),c=fw.add(fw.multiply(s,rS),u),d=fw.divide(l,c);a=t.add(jI.fromRawAmount(this.liquidityToken,d))}else a=t}}else a=t;return jI.fromRawAmount(e,fw.divide(fw.multiply(n.quotient,this.reserveOf(e).quotient),a.quotient))},sS(e,[{key:"token0Price",get:function(){var e=this.tokenAmounts[1].divide(this.tokenAmounts[0]);return new UI(this.token0,this.token1,e.denominator,e.numerator)}},{key:"token1Price",get:function(){var e=this.tokenAmounts[0].divide(this.tokenAmounts[1]);return new UI(this.token1,this.token0,e.denominator,e.numerator)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"token0",get:function(){return this.tokenAmounts[0].currency}},{key:"token1",get:function(){return this.tokenAmounts[1].currency}},{key:"reserve0",get:function(){return this.tokenAmounts[0]}},{key:"reserve1",get:function(){return this.tokenAmounts[1]}}]),e}(),wS=function(){function e(e,t,n){this._midPrice=null,e.length>0||hw(!1);var r=e[0].chainId;e.every((function(e){return e.chainId===r}))||hw(!1);var i=t.wrapped;e[0].involvesToken(i)||hw(!1),void 0===n||e[e.length-1].involvesToken(n.wrapped)||hw(!1);for(var a,o=[i],s=mS(e.entries());!(a=s()).done;){var u=a.value,l=u[0],c=u[1],d=o[l];d.equals(c.token0)||d.equals(c.token1)||hw(!1);var f=d.equals(c.token0)?c.token1:c.token0;o.push(f)}this.pairs=e,this.path=o,this.input=t,this.output=n}return sS(e,[{key:"midPrice",get:function(){if(null!==this._midPrice)return this._midPrice;for(var e,t=[],n=mS(this.pairs.entries());!(e=n()).done;){var r=e.value,i=r[0],a=r[1];t.push(this.path[i].equals(a.token0)?new UI(a.reserve0.currency,a.reserve1.currency,a.reserve0.quotient,a.reserve1.quotient):new UI(a.reserve1.currency,a.reserve0.currency,a.reserve1.quotient,a.reserve0.quotient))}var o=t.slice(1).reduce((function(e,t){return e.multiply(t)}),t[0]);return this._midPrice=new UI(this.input,this.output,o.denominator,o.numerator)}},{key:"chainId",get:function(){return this.pairs[0].chainId}}]),e}();function xS(e,t){return e.inputAmount.currency.equals(t.inputAmount.currency)||hw(!1),e.outputAmount.currency.equals(t.outputAmount.currency)||hw(!1),e.outputAmount.equalTo(t.outputAmount)?e.inputAmount.equalTo(t.inputAmount)?0:e.inputAmount.lessThan(t.inputAmount)?-1:1:e.outputAmount.lessThan(t.outputAmount)?1:-1}function ES(e,t){var n=xS(e,t);return 0!==n?n:e.priceImpact.lessThan(t.priceImpact)?-1:e.priceImpact.greaterThan(t.priceImpact)?1:e.route.path.length-t.route.path.length}var TS=function(){function e(e,t,n){this.route=e,this.tradeType=n;var r=new Array(e.path.length);if(n===bI.EXACT_INPUT){t.currency.equals(e.input)||hw(!1),r[0]=t.wrapped;for(var i=0;i<e.path.length-1;i++){var a=e.pairs[i].getOutputAmount(r[i])[0];r[i+1]=a}this.inputAmount=jI.fromFractionalAmount(e.input,t.numerator,t.denominator),this.outputAmount=jI.fromFractionalAmount(e.output,r[r.length-1].numerator,r[r.length-1].denominator)}else{t.currency.equals(e.output)||hw(!1),r[r.length-1]=t.wrapped;for(var o=e.path.length-1;o>0;o--){var s=e.pairs[o-1].getInputAmount(r[o])[0];r[o-1]=s}this.inputAmount=jI.fromFractionalAmount(e.input,r[0].numerator,r[0].denominator),this.outputAmount=jI.fromFractionalAmount(e.output,t.numerator,t.denominator)}this.executionPrice=new UI(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.quotient,this.outputAmount.quotient),this.priceImpact=function(e,t,n){var r=e.quote(t),i=r.subtract(n).divide(r);return new zI(i.numerator,i.denominator)}(e.midPrice,this.inputAmount,this.outputAmount)}e.exactIn=function(t,n){return new e(t,n,bI.EXACT_INPUT)},e.exactOut=function(t,n){return new e(t,n,bI.EXACT_OUTPUT)};var t=e.prototype;return t.minimumAmountOut=function(e){if(e.lessThan(tS)&&hw(!1),this.tradeType===bI.EXACT_OUTPUT)return this.outputAmount;var t=new DI(nS).add(e).invert().multiply(this.outputAmount.quotient).quotient;return jI.fromRawAmount(this.outputAmount.currency,t)},t.maximumAmountIn=function(e){if(e.lessThan(tS)&&hw(!1),this.tradeType===bI.EXACT_INPUT)return this.inputAmount;var t=new DI(nS).add(e).multiply(this.inputAmount.quotient).quotient;return jI.fromRawAmount(this.inputAmount.currency,t)},e.bestTradeExactIn=function(t,n,r,i,a,o,s){var u=void 0===i?{}:i,l=u.maxNumResults,c=void 0===l?3:l,d=u.maxHops,f=void 0===d?3:d;void 0===a&&(a=[]),void 0===o&&(o=n),void 0===s&&(s=[]),t.length>0||hw(!1),f>0||hw(!1),n===o||a.length>0||hw(!1);for(var p=o.wrapped,h=r.wrapped,m=0;m<t.length;m++){var y=t[m];if((y.token0.equals(p.currency)||y.token1.equals(p.currency))&&(!y.reserve0.equalTo(tS)&&!y.reserve1.equalTo(tS))){var g=void 0;try{g=y.getOutputAmount(p)[0]}catch(e){if(e.isInsufficientInputAmountError)continue;throw e}if(g.currency.equals(h))GI(s,new e(new wS([].concat(a,[y]),n.currency,r),n,bI.EXACT_INPUT),c,ES);else if(f>1&&t.length>1){var A=t.slice(0,m).concat(t.slice(m+1,t.length));e.bestTradeExactIn(A,n,r,{maxNumResults:c,maxHops:f-1},[].concat(a,[y]),g,s)}}}return s},t.worstExecutionPrice=function(e){return new UI(this.inputAmount.currency,this.outputAmount.currency,this.maximumAmountIn(e).quotient,this.minimumAmountOut(e).quotient)},e.bestTradeExactOut=function(t,n,r,i,a,o,s){var u=void 0===i?{}:i,l=u.maxNumResults,c=void 0===l?3:l,d=u.maxHops,f=void 0===d?3:d;void 0===a&&(a=[]),void 0===o&&(o=r),void 0===s&&(s=[]),t.length>0||hw(!1),f>0||hw(!1),r===o||a.length>0||hw(!1);for(var p=o.wrapped,h=n.wrapped,m=0;m<t.length;m++){var y=t[m];if((y.token0.equals(p.currency)||y.token1.equals(p.currency))&&(!y.reserve0.equalTo(tS)&&!y.reserve1.equalTo(tS))){var g=void 0;try{g=y.getInputAmount(p)[0]}catch(e){if(e.isInsufficientReservesError)continue;throw e}if(g.currency.equals(h))GI(s,new e(new wS([y].concat(a),n,r.currency),r,bI.EXACT_OUTPUT),c,ES);else if(f>1&&t.length>1){var A=t.slice(0,m).concat(t.slice(m+1,t.length));e.bestTradeExactOut(A,n,r,{maxNumResults:c,maxHops:f-1},[y].concat(a),g,s)}}}return s},e}();function CS(e){return"0x"+e.quotient.toString(16)}var IS,SS="0x0",kS=function(){function e(){}return e.swapCallParameters=function(e,t){var n=e.inputAmount.currency.isNative,r=e.outputAmount.currency.isNative;n&&r&&hw(!1),!("ttl"in t)||t.ttl>0||hw(!1);var i,a,o,s=WI(t.recipient),u=CS(e.maximumAmountIn(t.allowedSlippage)),l=CS(e.minimumAmountOut(t.allowedSlippage)),c=e.route.path.map((function(e){return e.address})),d="ttl"in t?"0x"+(Math.floor((new Date).getTime()/1e3)+t.ttl).toString(16):"0x"+t.deadline.toString(16),f=Boolean(t.feeOnTransfer);switch(e.tradeType){case bI.EXACT_INPUT:n?(i=f?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",a=[l,c,s,d],o=u):r?(i=f?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",a=[u,l,c,s,d],o=SS):(i=f?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",a=[u,l,c,s,d],o=SS);break;case bI.EXACT_OUTPUT:f&&hw(!1),n?(i="swapETHForExactTokens",a=[l,c,s,d],o=u):r?(i="swapTokensForExactETH",a=[l,u,c,s,d],o=SS):(i="swapTokensForExactTokens",a=[l,u,c,s,d],o=SS)}return{methodName:i,args:a,value:o}},e}(),OS=ot(Object.freeze({__proto__:null,FACTORY_ADDRESS:JI,INIT_CODE_HASH:$I,InsufficientInputAmountError:AS,InsufficientReservesError:gS,MINIMUM_LIQUIDITY:eS,Pair:vS,Route:wS,Router:kS,Trade:TS,computePairAddress:bS,inputOutputComparator:xS,tradeComparator:ES})),RS=ot(im);BT.exports=(IS||(IS=1,function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(e,"__esModule",{value:!0});var n,r=t(dw),i=zT,a=t(FT?DT:(FT=1,DT=function(e,t){if(!e)throw new Error("Invariant failed")})),o=WT,s=HT,u=VT,l=fI,c=pI,d=hI,f=OS,p=RS,h="0x0000000000000000000000000000000000000001",m="0x0000000000000000000000000000000000000002",y=r.BigInt(0),g=r.BigInt(1);function A(e){return Object.keys(e).some((function(e){return"recipient"===e}))}(n=e.ApprovalTypes||(e.ApprovalTypes={}))[n.NOT_REQUIRED=0]="NOT_REQUIRED",n[n.MAX=1]="MAX",n[n.MAX_MINUS_ONE=2]="MAX_MINUS_ONE",n[n.ZERO_THEN_MAX=3]="ZERO_THEN_MAX",n[n.ZERO_THEN_MAX_MINUS_ONE=4]="ZERO_THEN_MAX_MINUS_ONE";var b=function(){function t(){}return t.encodeApproveMax=function(e){return t.INTERFACE.encodeFunctionData("approveMax",[e.address])},t.encodeApproveMaxMinusOne=function(e){return t.INTERFACE.encodeFunctionData("approveMaxMinusOne",[e.address])},t.encodeApproveZeroThenMax=function(e){return t.INTERFACE.encodeFunctionData("approveZeroThenMax",[e.address])},t.encodeApproveZeroThenMaxMinusOne=function(e){return t.INTERFACE.encodeFunctionData("approveZeroThenMaxMinusOne",[e.address])},t.encodeCallPositionManager=function(e){if(e.length>0||a(!1),1==e.length)return t.INTERFACE.encodeFunctionData("callPositionManager",e);var n=s.NonfungiblePositionManager.INTERFACE.encodeFunctionData("multicall",[e]);return t.INTERFACE.encodeFunctionData("callPositionManager",[n])},t.encodeAddLiquidity=function(e,n,i,a){var o=e.mintAmountsWithSlippage(a),u=o.amount0,l=o.amount1;return r.lessThan(n.amount0.quotient,u)&&(u=n.amount0.quotient),r.lessThan(n.amount1.quotient,l)&&(l=n.amount1.quotient),A(i)?t.INTERFACE.encodeFunctionData("mint",[{token0:e.pool.token0.address,token1:e.pool.token1.address,fee:e.pool.fee,tickLower:e.tickLower,tickUpper:e.tickUpper,amount0Min:s.toHex(u),amount1Min:s.toHex(l),recipient:i.recipient}]):t.INTERFACE.encodeFunctionData("increaseLiquidity",[{token0:e.pool.token0.address,token1:e.pool.token1.address,amount0Min:s.toHex(u),amount1Min:s.toHex(l),tokenId:s.toHex(i.tokenId)}])},t.encodeApprove=function(n,r){switch(r){case e.ApprovalTypes.MAX:return t.encodeApproveMax(n.wrapped);case e.ApprovalTypes.MAX_MINUS_ONE:return t.encodeApproveMaxMinusOne(n.wrapped);case e.ApprovalTypes.ZERO_THEN_MAX:return t.encodeApproveZeroThenMax(n.wrapped);case e.ApprovalTypes.ZERO_THEN_MAX_MINUS_ONE:return t.encodeApproveZeroThenMaxMinusOne(n.wrapped);default:throw"Error: invalid ApprovalType"}},t}();b.INTERFACE=new i.Interface(o.abi);var v=function(){function e(){}return e.encodeMulticall=function(t,n){if(void 0===n)return s.Multicall.encodeMulticall(t);if(Array.isArray(t)||(t=[t]),"string"==typeof n&&n.startsWith("0x")){var r=function(e){if(!e.match(/^0x[0-9a-fA-F]{64}$/))throw new Error(e+" is not valid bytes32.");return e.toLowerCase()}(n);return e.INTERFACE.encodeFunctionData("multicall(bytes32,bytes[])",[r,t])}var i=s.toHex(n);return e.INTERFACE.encodeFunctionData("multicall(uint256,bytes[])",[i,t])},e}();function w(e){return s.toHex(e.multiply(1e4).quotient)}v.INTERFACE=new i.Interface(u.abi);var x=function(){function e(){}return e.encodeUnwrapWETH9=function(t,n,r){if("string"==typeof n)return s.Payments.encodeUnwrapWETH9(t,n,r);if(r){var i=w(r.fee),a=l.validateAndParseAddress(r.recipient);return e.INTERFACE.encodeFunctionData("unwrapWETH9WithFee(uint256,uint256,address)",[s.toHex(t),i,a])}return e.INTERFACE.encodeFunctionData("unwrapWETH9(uint256)",[s.toHex(t)])},e.encodeSweepToken=function(t,n,r,i){if("string"==typeof r)return s.Payments.encodeSweepToken(t,n,r,i);if(i){var a=w(i.fee),o=l.validateAndParseAddress(i.recipient);return e.INTERFACE.encodeFunctionData("sweepTokenWithFee(address,uint256,uint256,address)",[t.address,s.toHex(n),a,o])}return e.INTERFACE.encodeFunctionData("sweepToken(address,uint256)",[t.address,s.toHex(n)])},e.encodePull=function(t,n){return e.INTERFACE.encodeFunctionData("pull",[t.address,s.toHex(n)])},e.encodeWrapETH=function(t){return e.INTERFACE.encodeFunctionData("wrapETH",[s.toHex(t)])},e}();function E(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function T(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){E(a,r,i,o,s,"next",e)}function s(e){E(a,r,i,o,s,"throw",e)}o(void 0)}))}}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function I(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),e}function S(){return(S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function k(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function R(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return O(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}x.INTERFACE=new i.Interface(c.abi);var P,N=(function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=Object.create((t&&t.prototype instanceof d?t:d).prototype),a=new E(r||[]);return i._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=v(o,n);if(s){if(s===c)continue;return s}}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=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,a),i}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var c={};function d(){}function f(){}function p(){}var h={};s(h,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(T([])));y&&y!==t&&n.call(y,i)&&(h=y);var g=p.prototype=d.prototype=Object.create(h);function A(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,s){var u=l(e[i],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,o,s)}),(function(e){r("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return r("throw",e,o,s)}))}s(u.arg)}(i,a,r,o)}))}return r=r?r.then(o,o):o()}}function v(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,v(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function T(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:C}}function C(){return{value:void 0,done:!0}}return f.prototype=p,s(g,"constructor",p),s(p,"constructor",f),f.displayName=s(p,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},A(b.prototype),s(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new b(u(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},A(g),s(g,o,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=T,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,c):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(P={exports:{}}),P.exports),L=function(){function e(e,t,n){this._midPrice=null,e.length>0||a(!1);var r=e[0].chainId;e.every((function(e){return e.chainId===r}))||a(!1);var i=t.wrapped;e[0].involvesToken(i)||a(!1),e[e.length-1].involvesToken(n.wrapped)||a(!1);for(var o,s=[i],u=R(e.entries());!(o=u()).done;){var l=o.value,c=l[1],d=s[l[0]];d.equals(c.token0)||d.equals(c.token1)||a(!1);var f=d.equals(c.token0)?c.token1:c.token0;s.push(f)}this.pools=e,this.path=s,this.input=t,this.output=null!=n?n:s[s.length-1]}return I(e,[{key:"chainId",get:function(){return this.pools[0].chainId}},{key:"midPrice",get:function(){if(null!==this._midPrice)return this._midPrice;var e=this.pools.slice(1).reduce((function(e,t){var n=e.price;return e.nextInput.equals(t.token0)?{nextInput:t.token1,price:n.multiply(t.token0Price)}:{nextInput:t.token0,price:n.multiply(t.token1Price)}}),this.pools[0].token0.equals(this.input.wrapped)?{nextInput:this.pools[0].token1,price:this.pools[0].token0Price}:{nextInput:this.pools[0].token0,price:this.pools[0].token1Price}).price;return this._midPrice=new l.Price(this.input,this.output,e.denominator,e.numerator)}}]),e}();function M(e,t){return e.inputAmount.currency.equals(t.inputAmount.currency)||a(!1),e.outputAmount.currency.equals(t.outputAmount.currency)||a(!1),e.outputAmount.equalTo(t.outputAmount)?e.inputAmount.equalTo(t.inputAmount)?e.swaps.reduce((function(e,t){return e+t.route.path.length}),0)-t.swaps.reduce((function(e,t){return e+t.route.path.length}),0):e.inputAmount.lessThan(t.inputAmount)?-1:1:e.outputAmount.lessThan(t.outputAmount)?1:-1}var D,F=function(){function e(e){var t=e.routes,n=e.tradeType,r=t[0].inputAmount.currency,i=t[0].outputAmount.currency;t.every((function(e){return r.wrapped.equals(e.route.input.wrapped)}))||a(!1),t.every((function(e){return i.wrapped.equals(e.route.output.wrapped)}))||a(!1);for(var o,u=t.map((function(e){return e.route.pools.length})).reduce((function(e,t){return e+t}),0),c=new Set,d=R(t);!(o=d()).done;)for(var p,h=R(o.value.route.pools);!(p=h()).done;){var m=p.value;c.add(m instanceof s.Pool?s.Pool.getAddress(m.token0,m.token1,m.fee):f.Pair.getAddress(m.token0,m.token1))}u!=c.size&&a(!1),n!==l.TradeType.EXACT_INPUT&&a(!1),this.swaps=t,this.tradeType=n}e.fromRoute=function(){var t=T(N.mark((function t(n,r,i){var o,s,u,c,d;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=new Array(n.path.length),i!==l.TradeType.EXACT_INPUT&&a(!1),r.currency.equals(n.input)||a(!1),o[0]=r.wrapped,c=0;case 5:if(!(c<n.path.length-1)){t.next=15;break}return d=n.pools[c],t.next=9,d.getOutputAmount(o[c]);case 9:o[c+1]=t.sent[0];case 12:c++,t.next=5;break;case 15:return s=l.CurrencyAmount.fromFractionalAmount(n.input,r.numerator,r.denominator),u=l.CurrencyAmount.fromFractionalAmount(n.output,o[o.length-1].numerator,o[o.length-1].denominator),t.abrupt("return",new e({routes:[{inputAmount:s,outputAmount:u,route:n}],tradeType:i}));case 18:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),e.fromRoutes=function(){var t=T(N.mark((function t(n,r){var i,o,s,u,c,d,f,p,h,m,y;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=[],r!==l.TradeType.EXACT_INPUT&&a(!1),o=R(n);case 3:if((s=o()).done){t.next=26;break}c=(u=s.value).route,d=u.amount,f=new Array(c.path.length),p=void 0,h=void 0,d.currency.equals(c.input)||a(!1),p=l.CurrencyAmount.fromFractionalAmount(c.input,d.numerator,d.denominator),f[0]=l.CurrencyAmount.fromFractionalAmount(c.input.wrapped,d.numerator,d.denominator),m=0;case 12:if(!(m<c.path.length-1)){t.next=22;break}return y=c.pools[m],t.next=16,y.getOutputAmount(f[m]);case 16:f[m+1]=t.sent[0];case 19:m++,t.next=12;break;case 22:h=l.CurrencyAmount.fromFractionalAmount(c.output,f[f.length-1].numerator,f[f.length-1].denominator),i.push({route:c,inputAmount:p,outputAmount:h});case 24:t.next=3;break;case 26:return t.abrupt("return",new e({routes:i,tradeType:r}));case 27:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),e.createUncheckedTrade=function(t){return new e(S({},t,{routes:[{inputAmount:t.inputAmount,outputAmount:t.outputAmount,route:t.route}]}))},e.createUncheckedTradeWithMultipleRoutes=function(t){return new e(t)};var t=e.prototype;return t.minimumAmountOut=function(e,t){void 0===t&&(t=this.outputAmount),e.lessThan(y)&&a(!1);var n=new l.Fraction(g).add(e).invert().multiply(t.quotient).quotient;return l.CurrencyAmount.fromRawAmount(t.currency,n)},t.maximumAmountIn=function(e,t){return void 0===t&&(t=this.inputAmount),e.lessThan(y)&&a(!1),t},t.worstExecutionPrice=function(e){return new l.Price(this.inputAmount.currency,this.outputAmount.currency,this.maximumAmountIn(e).quotient,this.minimumAmountOut(e).quotient)},e.bestTradeExactIn=function(){var t=T(N.mark((function t(n,r,i,o,s,u,c){var d,p,h,m,g,A,b,v,w,x,E;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:h=void 0===(p=(d=void 0===o?{}:o).maxNumResults)?3:p,g=void 0===(m=d.maxHops)?3:m,void 0===s&&(s=[]),void 0===u&&(u=r),void 0===c&&(c=[]),n.length>0||a(!1),g>0||a(!1),r===u||s.length>0||a(!1),A=u.wrapped,b=i.wrapped,v=0;case 10:if(!(v<n.length)){t.next=49;break}if((w=n[v]).token0.equals(A.currency)||w.token1.equals(A.currency)){t.next=14;break}return t.abrupt("continue",46);case 14:if(!(w instanceof f.Pair)){t.next=17;break}if(!w.reserve0.equalTo(y)&&!w.reserve1.equalTo(y)){t.next=17;break}return t.abrupt("continue",46);case 17:return x=void 0,t.prev=18,t.next=22,w.getOutputAmount(A);case 22:x=t.sent[0],t.next=31;break;case 26:if(t.prev=26,t.t0=t.catch(18),!t.t0.isInsufficientInputAmountError){t.next=30;break}return t.abrupt("continue",46);case 30:throw t.t0;case 31:if(!x.currency.isToken||!x.currency.equals(b)){t.next=42;break}return t.t1=l.sortedInsert,t.t2=c,t.next=36,e.fromRoute(new L([].concat(s,[w]),r.currency,i),r,l.TradeType.EXACT_INPUT);case 36:t.t3=t.sent,t.t4=h,t.t5=M,(0,t.t1)(t.t2,t.t3,t.t4,t.t5),t.next=46;break;case 42:if(!(g>1&&n.length>1)){t.next=46;break}return E=n.slice(0,v).concat(n.slice(v+1,n.length)),t.next=46,e.bestTradeExactIn(E,r,i,{maxNumResults:h,maxHops:g-1},[].concat(s,[w]),x,c);case 46:v++,t.next=10;break;case 49:return t.abrupt("return",c);case 50:case"end":return t.stop()}}),t,null,[[18,26]])})));return function(e,n,r,i,a,o,s){return t.apply(this,arguments)}}(),I(e,[{key:"route",get:function(){return 1!=this.swaps.length&&a(!1),this.swaps[0].route}},{key:"inputAmount",get:function(){if(this._inputAmount)return this._inputAmount;var e=this.swaps[0].inputAmount.currency,t=this.swaps.map((function(e){return e.inputAmount})).reduce((function(e,t){return e.add(t)}),l.CurrencyAmount.fromRawAmount(e,0));return this._inputAmount=t,this._inputAmount}},{key:"outputAmount",get:function(){if(this._outputAmount)return this._outputAmount;var e=this.swaps[0].outputAmount.currency,t=this.swaps.map((function(e){return e.outputAmount})).reduce((function(e,t){return e.add(t)}),l.CurrencyAmount.fromRawAmount(e,0));return this._outputAmount=t,this._outputAmount}},{key:"executionPrice",get:function(){var e;return null!=(e=this._executionPrice)?e:this._executionPrice=new l.Price(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.quotient,this.outputAmount.quotient)}},{key:"priceImpact",get:function(){if(this._priceImpact)return this._priceImpact;for(var e,t=l.CurrencyAmount.fromRawAmount(this.outputAmount.currency,0),n=R(this.swaps);!(e=n()).done;){var r=e.value;t=t.add(r.route.midPrice.quote(r.inputAmount))}var i=t.subtract(this.outputAmount).divide(t);return this._priceImpact=new l.Percent(i.numerator,i.denominator),this._priceImpact}}]),e}();(D=e.Protocol||(e.Protocol={})).V2="V2",D.V3="V3",D.MIXED="MIXED";var j=function(t){function n(n){var r;return(r=t.call(this,n.pairs,n.input,n.output)||this).protocol=e.Protocol.V2,r.pools=r.pairs,r}return k(n,t),n}(f.Route),B=function(t){function n(n){var r;return(r=t.call(this,n.pools,n.input,n.output)||this).protocol=e.Protocol.V3,r.path=n.tokenPath,r}return k(n,t),n}(s.Route),_=function(t){function n(n){var r;return(r=t.call(this,n.pools,n.input,n.output)||this).protocol=e.Protocol.MIXED,r}return k(n,t),n}(L),z=function(){function e(e){var t=e.v2Routes,n=e.v3Routes,r=e.tradeType,i=e.mixedRoutes;this.swaps=[],this.routes=[];for(var o,u=R(t);!(o=u()).done;){var l=o.value,c=l.inputAmount,d=l.outputAmount,p=new j(l.routev2);this.routes.push(p),this.swaps.push({route:p,inputAmount:c,outputAmount:d})}for(var h,m=R(n);!(h=m()).done;){var y=h.value,g=y.inputAmount,A=y.outputAmount,b=new B(y.routev3);this.routes.push(b),this.swaps.push({route:b,inputAmount:g,outputAmount:A})}if(i)for(var v,w=R(i);!(v=w()).done;){var x=v.value,E=x.inputAmount,T=x.outputAmount,C=new _(x.mixedRoute);this.routes.push(C),this.swaps.push({route:C,inputAmount:E,outputAmount:T})}this.tradeType=r;var I=this.swaps[0].inputAmount.currency,S=this.swaps[0].outputAmount.currency;this.swaps.every((function(e){return I.wrapped.equals(e.route.input.wrapped)}))||a(!1),this.swaps.every((function(e){return S.wrapped.equals(e.route.output.wrapped)}))||a(!1);for(var k,O=this.swaps.map((function(e){return e.route.pools.length})).reduce((function(e,t){return e+t}),0),P=new Set,N=R(this.swaps);!(k=N()).done;)for(var L,M=R(k.value.route.pools);!(L=M()).done;){var D=L.value;if(D instanceof s.Pool)P.add(s.Pool.getAddress(D.token0,D.token1,D.fee));else{if(!(D instanceof f.Pair))throw new Error("Unexpected pool type in route when constructing trade object");P.add(f.Pair.getAddress(D.token0,D.token1))}}O!=P.size&&a(!1)}var t=e.prototype;return t.minimumAmountOut=function(e,t){if(void 0===t&&(t=this.outputAmount),e.lessThan(y)&&a(!1),this.tradeType===l.TradeType.EXACT_OUTPUT)return t;var n=new l.Fraction(g).add(e).invert().multiply(t.quotient).quotient;return l.CurrencyAmount.fromRawAmount(t.currency,n)},t.maximumAmountIn=function(e,t){if(void 0===t&&(t=this.inputAmount),e.lessThan(y)&&a(!1),this.tradeType===l.TradeType.EXACT_INPUT)return t;var n=new l.Fraction(g).add(e).multiply(t.quotient).quotient;return l.CurrencyAmount.fromRawAmount(t.currency,n)},t.worstExecutionPrice=function(e){return new l.Price(this.inputAmount.currency,this.outputAmount.currency,this.maximumAmountIn(e).quotient,this.minimumAmountOut(e).quotient)},e.fromRoutes=function(){var t=T(N.mark((function t(n,r,i,a){var o,u,l,c,d,p,h,m,y,g,A,b,v,w,x,E,T,C,I,S;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(o=[],u=[],l=[],c=R(n);!(d=c()).done;)m=new f.Trade(h=(p=d.value).routev2,p.amount,i),o.push({routev2:h,inputAmount:m.inputAmount,outputAmount:m.outputAmount});y=R(r);case 5:if((g=y()).done){t.next=14;break}return b=(A=g.value).routev3,v=A.amount,t.next=9,s.Trade.fromRoute(b,v,i);case 9:u.push({routev3:b,inputAmount:(w=t.sent).inputAmount,outputAmount:w.outputAmount});case 12:t.next=5;break;case 14:if(!a){t.next=25;break}x=R(a);case 16:if((E=x()).done){t.next=25;break}return C=(T=E.value).mixedRoute,I=T.amount,t.next=20,F.fromRoute(C,I,i);case 20:l.push({mixedRoute:C,inputAmount:(S=t.sent).inputAmount,outputAmount:S.outputAmount});case 23:t.next=16;break;case 25:return t.abrupt("return",new e({v2Routes:o,v3Routes:u,mixedRoutes:l,tradeType:i}));case 26:case"end":return t.stop()}}),t)})));return function(e,n,r,i){return t.apply(this,arguments)}}(),e.fromRoute=function(){var t=T(N.mark((function t(n,r,i){var a,o,u,l,c,d;return N.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=[],o=[],u=[],!(n instanceof f.Route)){t.next=9;break}l=new f.Trade(n,r,i),a=[{routev2:n,inputAmount:l.inputAmount,outputAmount:l.outputAmount}],t.next=26;break;case 9:if(!(n instanceof s.Route)){t.next=17;break}return t.next=12,s.Trade.fromRoute(n,r,i);case 12:o=[{routev3:n,inputAmount:(c=t.sent).inputAmount,outputAmount:c.outputAmount}],t.next=26;break;case 17:if(!(n instanceof L)){t.next=25;break}return t.next=20,F.fromRoute(n,r,i);case 20:u=[{mixedRoute:n,inputAmount:(d=t.sent).inputAmount,outputAmount:d.outputAmount}],t.next=26;break;case 25:throw new Error("Invalid route type");case 26:return t.abrupt("return",new e({v2Routes:a,v3Routes:o,mixedRoutes:u,tradeType:i}));case 27:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),I(e,[{key:"inputAmount",get:function(){if(this._inputAmount)return this._inputAmount;var e=this.swaps[0].inputAmount.currency,t=this.swaps.map((function(e){return e.inputAmount})).reduce((function(e,t){return e.add(t)}),l.CurrencyAmount.fromRawAmount(e,0));return this._inputAmount=t,this._inputAmount}},{key:"outputAmount",get:function(){if(this._outputAmount)return this._outputAmount;var e=this.swaps[0].outputAmount.currency,t=this.swaps.map((function(e){return e.outputAmount})).reduce((function(e,t){return e.add(t)}),l.CurrencyAmount.fromRawAmount(e,0));return this._outputAmount=t,this._outputAmount}},{key:"executionPrice",get:function(){var e;return null!=(e=this._executionPrice)?e:this._executionPrice=new l.Price(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.quotient,this.outputAmount.quotient)}},{key:"priceImpact",get:function(){if(this._priceImpact)return this._priceImpact;for(var e,t=l.CurrencyAmount.fromRawAmount(this.outputAmount.currency,0),n=R(this.swaps);!(e=n()).done;){var r=e.value;t=t.add(r.route.midPrice.quote(r.inputAmount))}var i=t.subtract(this.outputAmount).divide(t);return this._priceImpact=new l.Percent(i.numerator,i.denominator),this._priceImpact}}]),e}();function U(e){var t=e.pools.reduce((function(e,t,n){var r=e.inputToken,i=e.path,a=e.types,o=t.token0.equals(r)?t.token1:t.token0;return 0===n?{inputToken:o,types:["address","uint24","address"],path:[r.address,t instanceof s.Pool?t.fee:8388608,o.address]}:{inputToken:o,types:[].concat(a,["uint24","address"]),path:[].concat(i,[t instanceof s.Pool?t.fee:8388608,o.address])}}),{inputToken:e.input.wrapped,path:[],types:[]});return p.pack(t.types,t.path)}var W=function(e){for(var t=[],n=0,r=0;r<e.pools.length;)(e.pools[n]instanceof s.Pool&&e.pools[r]instanceof f.Pair||e.pools[n]instanceof f.Pair&&e.pools[r]instanceof s.Pool)&&(t.push(e.pools.slice(n,r)),n=r),++r===e.pools.length&&t.push(e.pools.slice(n,r));return t},H=function(e,t){return e.reduce((function(e,t){var n=e.inputToken;if(!t.involvesToken(n))throw new Error("PATH");return{inputToken:t.token0.equals(n)?t.token1:t.token0}}),{inputToken:t}).inputToken},V=r.BigInt(0),q=new l.Percent(r.BigInt(50),r.BigInt(100)),G=function(){function t(){}return t.encodeV2Swap=function(e,n,r,i){var a=s.toHex(e.maximumAmountIn(n.slippageTolerance).quotient),o=s.toHex(e.minimumAmountOut(n.slippageTolerance).quotient),u=e.route.path.map((function(e){return e.address})),c=r?m:void 0===n.recipient?h:l.validateAndParseAddress(n.recipient);return e.tradeType===l.TradeType.EXACT_INPUT?t.INTERFACE.encodeFunctionData("swapExactTokensForTokens",[a,i?0:o,u,c]):t.INTERFACE.encodeFunctionData("swapTokensForExactTokens",[o,a,u,c])},t.encodeV3Swap=function(e,n,r,i){for(var a,o=[],u=R(e.swaps);!(a=u()).done;){var c=a.value,d=c.route,f=c.outputAmount,p=s.toHex(e.maximumAmountIn(n.slippageTolerance,c.inputAmount).quotient),y=s.toHex(e.minimumAmountOut(n.slippageTolerance,f).quotient),g=1===d.pools.length,A=r?m:void 0===n.recipient?h:l.validateAndParseAddress(n.recipient);if(g)o.push(e.tradeType===l.TradeType.EXACT_INPUT?t.INTERFACE.encodeFunctionData("exactInputSingle",[{tokenIn:d.tokenPath[0].address,tokenOut:d.tokenPath[1].address,fee:d.pools[0].fee,recipient:A,amountIn:p,amountOutMinimum:i?0:y,sqrtPriceLimitX96:0}]):t.INTERFACE.encodeFunctionData("exactOutputSingle",[{tokenIn:d.tokenPath[0].address,tokenOut:d.tokenPath[1].address,fee:d.pools[0].fee,recipient:A,amountOut:y,amountInMaximum:p,sqrtPriceLimitX96:0}]));else{var b=s.encodeRouteToPath(d,e.tradeType===l.TradeType.EXACT_OUTPUT);o.push(e.tradeType===l.TradeType.EXACT_INPUT?t.INTERFACE.encodeFunctionData("exactInput",[{path:b,recipient:A,amountIn:p,amountOutMinimum:i?0:y}]):t.INTERFACE.encodeFunctionData("exactOutput",[{path:b,recipient:A,amountOut:y,amountInMaximum:p}]))}}return o},t.encodeMixedRouteSwap=function(e,n,r,i){var o=[];e.tradeType!==l.TradeType.EXACT_INPUT&&a(!1);for(var u,c=R(e.swaps);!(u=c()).done;){var d=u.value,f=d.route,p=d.outputAmount,y=s.toHex(e.maximumAmountIn(n.slippageTolerance,d.inputAmount).quotient),g=s.toHex(e.minimumAmountOut(n.slippageTolerance,p).quotient),A=1===f.pools.length,b=r?m:void 0===n.recipient?h:l.validateAndParseAddress(n.recipient),v=function(e){return e.pools.every((function(e){return e instanceof s.Pool}))};if(A)if(v(f))o.push(t.INTERFACE.encodeFunctionData("exactInputSingle",[{tokenIn:f.path[0].address,tokenOut:f.path[1].address,fee:f.pools[0].fee,recipient:b,amountIn:y,amountOutMinimum:i?0:g,sqrtPriceLimitX96:0}]));else{var w=f.path.map((function(e){return e.address}));o.push(t.INTERFACE.encodeFunctionData("swapExactTokensForTokens",[y,i?0:g,w,b]))}else!function(){for(var e=W(f),n=function(t){return t===e.length-1},r=void 0,i=f.input.wrapped,a=0;a<e.length;a++){var s=e[a];r=H(s,i);var u=new L([].concat(s),s[0].token0.equals(i)?s[0].token0:s[0].token1,r),l=new _(u);if(i=r,v(l)){var c={path:U(l),recipient:n(a)?b:m,amountIn:0==a?y:0,amountOutMinimum:n(a)?g:0};o.push(t.INTERFACE.encodeFunctionData("exactInput",[c]))}else{var d=[0==a?y:0,n(a)?g:0,l.path.map((function(e){return e.address})),n(a)?b:m];o.push(t.INTERFACE.encodeFunctionData("swapExactTokensForTokens",d))}}}()}return o},t.encodeSwaps=function(n,r,i){if(n instanceof z){n.swaps.every((function(t){return t.route.protocol==e.Protocol.V3||t.route.protocol==e.Protocol.V2||t.route.protocol==e.Protocol.MIXED}))||a(!1);for(var o,u=[],c=R(n.swaps);!(o=c()).done;){var d=o.value,p=d.route,h=d.inputAmount,m=d.outputAmount;if(p.protocol==e.Protocol.V2)u.push(new f.Trade(p,n.tradeType==l.TradeType.EXACT_INPUT?h:m,n.tradeType));else if(p.protocol==e.Protocol.V3)u.push(s.Trade.createUncheckedTrade({route:p,inputAmount:h,outputAmount:m,tradeType:n.tradeType}));else{if(p.protocol!=e.Protocol.MIXED)throw new Error("UNSUPPORTED_TRADE_PROTOCOL");u.push(F.createUncheckedTrade({route:p,inputAmount:h,outputAmount:m,tradeType:n.tradeType}))}}n=u}Array.isArray(n)||(n=[n]);var y=n.reduce((function(e,t){return e+(t instanceof s.Trade||t instanceof F?t.swaps.length:1)}),0),g=n[0];n.every((function(e){return e.inputAmount.currency.equals(g.inputAmount.currency)}))||a(!1),n.every((function(e){return e.outputAmount.currency.equals(g.outputAmount.currency)}))||a(!1),n.every((function(e){return e.tradeType===g.tradeType}))||a(!1);var A=[],b=g.inputAmount.currency.isNative,v=g.outputAmount.currency.isNative,w=g.tradeType===l.TradeType.EXACT_INPUT&&y>2,x=v||!!r.fee||!!i||w;r.inputTokenPermit&&(g.inputAmount.currency.isToken||a(!1),A.push(s.SelfPermit.encodePermit(g.inputAmount.currency,r.inputTokenPermit)));for(var E,T=R(n);!(E=T()).done;){var C=E.value;if(C instanceof f.Trade)A.push(t.encodeV2Swap(C,r,x,w));else if(C instanceof s.Trade)for(var I,S=R(t.encodeV3Swap(C,r,x,w));!(I=S()).done;)A.push(I.value);else{if(!(C instanceof F))throw new Error("Unsupported trade object");for(var k,O=R(t.encodeMixedRouteSwap(C,r,x,w));!(k=O()).done;)A.push(k.value)}}var P=l.CurrencyAmount.fromRawAmount(g.inputAmount.currency,0),N=l.CurrencyAmount.fromRawAmount(g.outputAmount.currency,0),L=n.reduce((function(e,t){return e.add(t.minimumAmountOut(r.slippageTolerance))}),N),M=n.reduce((function(e,t){return e.add(t.outputAmount)}),N),D=n.reduce((function(e,t){return e.add(t.maximumAmountIn(r.slippageTolerance))}),P);return{calldatas:A,sampleTrade:g,routerMustCustody:x,inputIsNative:b,outputIsNative:v,totalAmountIn:D,minimumAmountOut:L,quoteAmountOut:M}},t.swapCallParameters=function(e,n){var r=t.encodeSwaps(e,n),i=r.calldatas,a=r.sampleTrade,o=r.inputIsNative,u=r.totalAmountIn,c=r.minimumAmountOut;return r.routerMustCustody&&i.push(r.outputIsNative?x.encodeUnwrapWETH9(c.quotient,n.recipient,n.fee):x.encodeSweepToken(a.outputAmount.currency.wrapped,c.quotient,n.recipient,n.fee)),o&&(a.tradeType===l.TradeType.EXACT_OUTPUT||t.riskOfPartialFill(e))&&i.push(s.Payments.encodeRefundETH()),{calldata:v.encodeMulticall(i,n.deadlineOrPreviousBlockhash),value:s.toHex(o?u.quotient:V)}},t.swapAndAddCallParameters=function(n,r,i,o,u,c){var d=t.encodeSwaps(n,r,!0),f=d.calldatas,p=d.inputIsNative,h=d.outputIsNative,m=d.sampleTrade,y=d.totalAmountIn,g=d.quoteAmountOut,A=d.minimumAmountOut;r.outputTokenPermit&&(g.currency.isToken||a(!1),f.push(s.SelfPermit.encodePermit(g.currency,r.outputTokenPermit)));var w=m.route.chainId,E=i.pool.token0.wrapped.address===y.currency.wrapped.address,T=t.getPositionAmounts(i,E),C=T.positionAmountIn,I=T.positionAmountOut,S=p?l.WETH9[w]:C.currency.wrapped,k=h?l.WETH9[w]:I.currency.wrapped,O=I.subtract(g.wrapped);O.greaterThan(l.CurrencyAmount.fromRawAmount(I.currency,0))&&f.push(h?x.encodeWrapETH(O.quotient):x.encodePull(k,O.quotient)),f.push(p?x.encodeWrapETH(C.quotient):x.encodePull(S,C.quotient)),u!==e.ApprovalTypes.NOT_REQUIRED&&f.push(b.encodeApprove(S,u)),c!==e.ApprovalTypes.NOT_REQUIRED&&f.push(b.encodeApprove(k,c));var R,P=s.Position.fromAmounts({pool:i.pool,tickLower:i.tickLower,tickUpper:i.tickUpper,amount0:E?i.amount0.quotient.toString():A.quotient.toString(),amount1:E?A.quotient.toString():i.amount1.quotient.toString(),useFullPrecision:!1});return f.push(b.encodeAddLiquidity(i,P,o,r.slippageTolerance)),f.push(p?x.encodeUnwrapWETH9(V):x.encodeSweepToken(S,V)),f.push(h?x.encodeUnwrapWETH9(V):x.encodeSweepToken(k,V)),R=p?y.wrapped.add(C.wrapped).quotient:h?O.quotient:V,{calldata:v.encodeMulticall(f,r.deadlineOrPreviousBlockhash),value:R.toString()}},t.riskOfPartialFill=function(e){return Array.isArray(e)?e.some((function(e){return t.v3TradeWithHighPriceImpact(e)})):t.v3TradeWithHighPriceImpact(e)},t.v3TradeWithHighPriceImpact=function(e){return!(e instanceof f.Trade)&&e.priceImpact.greaterThan(q)},t.getPositionAmounts=function(e,t){var n=e.mintAmounts,r=n.amount1,i=l.CurrencyAmount.fromRawAmount(e.pool.token0,n.amount0),a=l.CurrencyAmount.fromRawAmount(e.pool.token1,r),o=t?[i,a]:[a,i];return{positionAmountIn:o[0],positionAmountOut:o[1]}},t}();G.INTERFACE=new i.Interface(d.abi),e.ADDRESS_THIS=m,e.ApproveAndCall=b,e.MSG_SENDER=h,e.MixedRoute=_,e.MixedRouteSDK=L,e.MixedRouteTrade=F,e.MulticallExtended=v,e.ONE=g,e.PaymentsExtended=x,e.RouteV2=j,e.RouteV3=B,e.SwapRouter=G,e.Trade=z,e.V2_FEE_PATH_PLACEHOLDER=8388608,e.ZERO=y,e.encodeMixedRouteToPath=U,e.getOutputOfPools=H,e.isMint=A,e.partitionMixedRouteByProtocol=W,e.tradeComparator=M}(_T)),_T);var PS,NS=BT.exports;!function(e){e.INVALID_CONFIGURATION="INVALID_CONFIGURATION",e.INVALID_SLIPPAGE="INVALID_SLIPPAGE",e.INVALID_MAX_HOPS="INVALID_MAX_HOPS",e.INVALID_ADDRESS="INVALID_ADDRESS",e.DUPLICATE_ADDRESSES="DUPLICATE_ADDRESSES",e.CHAIN_NOT_SUPPORTED="CHAIN_NOT_SUPPORTED",e.NO_ROUTES_AVAILABLE="NO_ROUTES_AVAILABLE",e.PROVIDER_CALL_ERROR="PROVIDER_CALL_ERROR",e.APPROVE_ERROR="APPROVE_ERROR",e.ALREADY_APPROVED_ERROR="ALREADY_APPROVED_ERROR"}(PS||(PS={}));class LS extends Error{message;code;constructor(e,t){super(e),this.message=e,this.code=t}}class MS extends LS{constructor(e){super(e||"Invalid configuration",PS.INVALID_CONFIGURATION)}}class DS extends LS{constructor(e,t){super(`Chain with ID ${e} is not a supported chain in environment ${t}`,PS.CHAIN_NOT_SUPPORTED)}}class FS extends LS{constructor(e){super(e,PS.INVALID_SLIPPAGE)}}class jS extends LS{constructor(e){super(e,PS.INVALID_MAX_HOPS)}}class BS extends LS{constructor(e){super(e,PS.INVALID_ADDRESS)}}class _S extends LS{constructor(){super("token in and token out addresses must be different",PS.DUPLICATE_ADDRESSES)}}class zS extends LS{constructor(){super("no routes available",PS.NO_ROUTES_AVAILABLE)}}class US extends LS{constructor(e){super(e,PS.PROVIDER_CALL_ERROR)}}class WS extends LS{constructor(e){super(e,PS.APPROVE_ERROR)}}const HS=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}];class VS{static abi=HS;static createInterface(){return new ys(HS)}static connect(e,t){return new $c(e,HS,t)}}const qS=[{inputs:[{internalType:"address",name:"_admin",type:"address"},{internalType:"address",name:"_uniRouter",type:"address"},{internalType:"address",name:"_wimx",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"ContractPaused",type:"error"},{inputs:[],name:"DeadlinePassed",type:"error"},{inputs:[],name:"FailedToRefundNativeTokens",type:"error"},{inputs:[{internalType:"address payable",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"FailedToSendFees",type:"error"},{inputs:[{internalType:"uint256",name:"required",type:"uint256"},{internalType:"uint256",name:"actual",type:"uint256"}],name:"FailedToUnwrapNativeTokens",type:"error"},{inputs:[],name:"FailedToWithdrawNativeTokens",type:"error"},{inputs:[],name:"FeeTooHigh",type:"error"},{inputs:[],name:"IncorrectRecipient",type:"error"},{inputs:[],name:"InputTokenNotWrapped",type:"error"},{inputs:[],name:"NativeTokenAmountMismatch",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"feeToken",type:"address"},{indexed:!0,internalType:"address",name:"feePayer",type:"address"},{indexed:!0,internalType:"address",name:"feeRecipient",type:"address"},{indexed:!1,internalType:"uint256",name:"feeAmount",type:"uint256"}],name:"FeeTaken",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"feePayer",type:"address"},{indexed:!0,internalType:"address",name:"feeRecipient",type:"address"},{indexed:!1,internalType:"uint256",name:"feeAmount",type:"uint256"}],name:"FeeTaken",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address payable",name:"recipient",type:"address"},{internalType:"uint256",name:"feeBasisPoints",type:"uint256"}],internalType:"struct IImmutableSwapProxy.SecondaryFeeParams[]",name:"secondaryFees",type:"tuple[]"},{components:[{internalType:"address",name:"tokenIn",type:"address"},{internalType:"address",name:"tokenOut",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOutMinimum",type:"uint256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],internalType:"struct IV3SwapRouter.ExactInputSingleParams",name:"swapParams",type:"tuple"}],name:"exactInputSingleWithSecondaryFee",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address payable",name:"recipient",type:"address"},{internalType:"uint256",name:"feeBasisPoints",type:"uint256"}],internalType:"struct IImmutableSwapProxy.SecondaryFeeParams[]",name:"secondaryFees",type:"tuple[]"},{components:[{internalType:"bytes",name:"path",type:"bytes"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOutMinimum",type:"uint256"}],internalType:"struct IV3SwapRouter.ExactInputParams",name:"swapParams",type:"tuple"}],name:"exactInputWithSecondaryFee",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address payable",name:"recipient",type:"address"},{internalType:"uint256",name:"feeBasisPoints",type:"uint256"}],internalType:"struct IImmutableSwapProxy.SecondaryFeeParams[]",name:"secondaryFees",type:"tuple[]"},{components:[{internalType:"address",name:"tokenIn",type:"address"},{internalType:"address",name:"tokenOut",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"uint256",name:"amountInMaximum",type:"uint256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"}],internalType:"struct IV3SwapRouter.ExactOutputSingleParams",name:"swapParams",type:"tuple"}],name:"exactOutputSingleWithSecondaryFee",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address payable",name:"recipient",type:"address"},{internalType:"uint256",name:"feeBasisPoints",type:"uint256"}],internalType:"struct IImmutableSwapProxy.SecondaryFeeParams[]",name:"secondaryFees",type:"tuple[]"},{components:[{internalType:"bytes",name:"path",type:"bytes"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"uint256",name:"amountInMaximum",type:"uint256"}],internalType:"struct IV3SwapRouter.ExactOutputParams",name:"swapParams",type:"tuple"}],name:"exactOutputWithSecondaryFee",outputs:[{internalType:"uint256",name:"amountIn",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"}],name:"unwrapNativeToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"address",name:"erc20",type:"address"}],name:"withdrawFunds",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"withdrawFunds",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],GS="0x60806040523480156200001157600080fd5b50604051620034dd380380620034dd83398101604081905262000034916200015c565b6001805460ff191690556200004b6000846200009e565b600180546001600160a01b039384166101008102610100600160a81b03199092169190911790915560038054929093166001600160a01b03199283161790925560028054909116909117905550620001a6565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200013b576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000fa3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b03811681146200015757600080fd5b919050565b6000806000606084860312156200017257600080fd5b6200017d846200013f565b92506200018d602085016200013f565b91506200019d604085016200013f565b90509250925092565b61332780620001b66000396000f3fe6080604052600436106101175760003560e01c806358e81a50116100a05780638456cb59116100645780638456cb59146102c457806391d14854146102d9578063a217fddf146102f9578063ac9650d81461030e578063d547741f1461032e57600080fd5b806358e81a50146102465780635ae401dc146102595780635c975abb146102795780635ebca7991461029157806368742da6146102a457600080fd5b80632f2ff15d116100e75780632f2ff15d146101cb57806336568abe146101eb578063383ebb0b1461020b5780633f4ba83a1461021e5780635640f6591461023357600080fd5b80620fa9fb1461012357806301ffc9a714610145578063116944b21461017a578063248a9ca31461019b57600080fd5b3661011e57005b600080fd5b34801561012f57600080fd5b5061014361013e366004612ab8565b61034e565b005b34801561015157600080fd5b50610165610160366004612af1565b61041a565b60405190151581526020015b60405180910390f35b61018d610188366004612c89565b610451565b604051908152602001610171565b3480156101a757600080fd5b5061018d6101b6366004612cde565b60009081526020819052604090206001015490565b3480156101d757600080fd5b506101436101e6366004612cf7565b610771565b3480156101f757600080fd5b50610143610206366004612cf7565b610796565b61018d610219366004612ddf565b610819565b34801561022a57600080fd5b50610143610b86565b61018d610241366004612ddf565b610bd6565b61018d610254366004612c89565b610ee4565b61026c610267366004612e8b565b61121e565b6040516101719190612f26565b34801561028557600080fd5b5060015460ff16610165565b61014361029f366004612cde565b611255565b3480156102b057600080fd5b506101436102bf366004612f88565b6113ad565b3480156102d057600080fd5b50610143611428565b3480156102e557600080fd5b506101656102f4366004612cf7565b611476565b34801561030557600080fd5b5061018d600081565b34801561031a57600080fd5b5061026c610329366004612fa5565b61149f565b34801561033a57600080fd5b50610143610349366004612cf7565b611593565b6103787f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e98286933611476565b610394576040516282b42960e81b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190612fe6565b90506104156001600160a01b03831684836115b8565b505050565b60006001600160e01b03198216637965db0b60e01b148061044b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600061045f60015460ff1690565b1561047d5760405163ab35696f60e01b815260040160405180910390fd5b61048a826060015161161b565b6104a75760405163519bdea760e01b815260040160405180910390fd5b608082015134801561065a57836080015181146104d7576040516342f7487960e11b815260040160405180910390fd5b60035484516001600160a01b03908116911614610507576040516324d0121760e01b815260040160405180910390fd5b60008061056f866000015187608001518a8a808060200260200160405190810160405280939291908181526020016000905b828210156105655761055660408302860136819003810190612fff565b81526020019060010190610539565b5050505050611641565b608088018290526001546040516304e45aaf60e01b815292945090925061010090046001600160a01b0316906304e45aaf9084906105b1908a90600401613056565b60206040518083038185885af11580156105cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906105f49190612fe6565b945061065384828a8a808060200260200160405190810160405280939291908181526020016000905b828210156106495761063a60408302860136819003810190612fff565b8152602001906001019061061d565b5050505050611679565b5050610768565b6000806106b8866000015187608001518a8a808060200260200160405190810160405280939291908181526020016000905b82821015610565576106a960408302860136819003810190612fff565b8152602001906001019061068c565b60808801829052875191935091506106db906001600160a01b031633308561170c565b6001546040516304e45aaf60e01b81526101009091046001600160a01b0316906304e45aaf9061070f908990600401613056565b6020604051808303816000875af115801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107529190612fe6565b9450610765866000015185838b8b61174a565b50505b50509392505050565b60008281526020819052604090206001015461078c8161184b565b6104158383611855565b6001600160a01b038116331461080b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61081582826118d9565b5050565b600061082760015460ff1690565b156108455760405163ab35696f60e01b815260040160405180910390fd5b610852826020015161161b565b61086f5760405163519bdea760e01b815260040160405180910390fd5b600061087e836000015161193e565b606084015190915034908115610a30576003546001600160a01b038481169116146108bc576040516324d0121760e01b815260040160405180910390fd5b846060015182146108e0576040516342f7487960e11b815260040160405180910390fd5b600061094286606001518989808060200260200160405190810160405280939291908181526020016000905b828210156109385761092960408302860136819003810190612fff565b8152602001906001019061090c565b5050505050611974565b606087018190526001546040516304dc09a360e11b81529192506000916101009091046001600160a01b0316906309b81346908490610985908b906004016130fc565b60206040518083038185885af11580156109a3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109c89190612fe6565b9050610a2781848b8b808060200260200160405190810160405280939291908181526020016000905b82821015610a1d57610a0e60408302860136819003810190612fff565b815260200190600101906109f1565b50505050506119c3565b95505050610b7c565b6000610a938487606001518a8a808060200260200160405190810160405280939291908181526020016000905b82821015610a8957610a7a60408302860136819003810190612fff565b81526020019060010190610a5d565b5050505050611aab565b606087018190526001546040516304dc09a360e11b81529192506000916101009091046001600160a01b0316906309b8134690610ad4908a906004016130fc565b6020604051808303816000875af1158015610af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b179190612fe6565b9050610b778582858c8c808060200260200160405190810160405280939291908181526020016000905b82821015610b6d57610b5e60408302860136819003810190612fff565b81526020019060010190610b41565b5050505050611b03565b955050505b5050509392505050565b610bb07fe7276a2a84d8de556657ec9cf93a55a7d66f096e529d0582ed08e9e2208b92b533611476565b610bcc576040516282b42960e81b815260040160405180910390fd5b610bd4611b57565b565b6000610be460015460ff1690565b15610c025760405163ab35696f60e01b815260040160405180910390fd5b610c0f826020015161161b565b610c2c5760405163519bdea760e01b815260040160405180910390fd5b6000610c3b8360000151611ba9565b6040840151909150348015610dd75784604001518114610c6e576040516342f7487960e11b815260040160405180910390fd5b6003546001600160a01b03848116911614610c9c576040516324d0121760e01b815260040160405180910390fd5b600080610cf68588604001518b8b808060200260200160405190810160405280939291908181526020016000905b8282101561056557610ce760408302860136819003810190612fff565b81526020019060010190610cca565b6040898101839052600154905163b858183f60e01b815292945090925061010090046001600160a01b03169063b858183f908490610d38908b906004016130fc565b60206040518083038185885af1158015610d56573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d7b9190612fe6565b9550610dd084828b8b808060200260200160405190810160405280939291908181526020016000905b8282101561064957610dc160408302860136819003810190612fff565b81526020019060010190610da4565b5050610b7c565b600080610e318588604001518b8b808060200260200160405190810160405280939291908181526020016000905b8282101561056557610e2260408302860136819003810190612fff565b81526020019060010190610e05565b604089018290529092509050610e526001600160a01b03861633308561170c565b60015460405163b858183f60e01b81526101009091046001600160a01b03169063b858183f90610e86908a906004016130fc565b6020604051808303816000875af1158015610ea5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec99190612fe6565b9550610ed88585838c8c61174a565b50505050509392505050565b6000610ef260015460ff1690565b15610f105760405163ab35696f60e01b815260040160405180910390fd5b610f1d826060015161161b565b610f3a5760405163519bdea760e01b815260040160405180910390fd5b60a0820151349081156110d75760035484516001600160a01b03908116911614610f77576040516324d0121760e01b815260040160405180910390fd5b8360a001518214610f9b576040516342f7487960e11b815260040160405180910390fd5b6000610ff38560a001518888808060200260200160405190810160405280939291908181526020016000905b8282101561093857610fe460408302860136819003810190612fff565b81526020019060010190610fc7565b60a08601819052600154604051635023b4df60e01b81529192506000916101009091046001600160a01b031690635023b4df908490611036908a90600401613056565b60206040518083038185885af1158015611054573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110799190612fe6565b90506110ce81848a8a808060200260200160405190810160405280939291908181526020016000905b82821015610a1d576110bf60408302860136819003810190612fff565b815260200190600101906110a2565b94505050610768565b600061113485600001518660a001518989808060200260200160405190810160405280939291908181526020016000905b82821015610a895761112560408302860136819003810190612fff565b81526020019060010190611108565b60a08601819052600154604051635023b4df60e01b81529192506000916101009091046001600160a01b031690635023b4df90611175908990600401613056565b6020604051808303816000875af1158015611194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b89190612fe6565b9050611212866000015182858b8b808060200260200160405190810160405280939291908181526020016000905b82821015610b6d5761120360408302860136819003810190612fff565b815260200190600101906111e6565b98975050505050505050565b6060834211156112415760405163387b2e5560e11b815260040160405180910390fd5b61124b838361149f565b90505b9392505050565b60015460ff16156112795760405163ab35696f60e01b815260040160405180910390fd5b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156112c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e69190612fe6565b905081811015611313576040516342fb4ceb60e11b81526004810183905260248101829052604401610802565b801561081557600354604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561135f57600080fd5b505af1158015611373573d6000803e3d6000fd5b5050505060006113833383611bb5565b905080610415576040516342fb4ceb60e11b81526004810184905260248101839052604401610802565b6113d77f7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e98286933611476565b6113f3576040516282b42960e81b815260040160405180910390fd5b47156114255760006114058247611bb5565b90508061081557604051633398652560e11b815260040160405180910390fd5b50565b6114527ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f633611476565b61146e576040516282b42960e81b815260040160405180910390fd5b610bd4611c5f565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060816001600160401b038111156114b9576114b9612b66565b6040519080825280602002602001820160405280156114ec57816020015b60608152602001906001900390816114d75790505b50905060005b8281101561158c5761155c308585848181106115105761151061310f565b90506020028101906115229190613125565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611c9a92505050565b82828151811061156e5761156e61310f565b6020026020010181905250808061158490613181565b9150506114f2565b5092915050565b6000828152602081905260409020600101546115ae8161184b565b61041583836118d9565b6040516001600160a01b03831660248201526044810182905261041590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611cbf565b60006001600160a01b03821633148061044b57506001600160a01b038216301492915050565b60008061164d83611d94565b506116588484611e07565b509050611665818561319a565b91506116718583611f30565b935093915050565b600061168361202d565b905060006116928583866120a4565b90506000806116a18386611e07565b915091506116ae816120d0565b8315611703576000826116c1858a61319a565b6116cb919061319a565b905080156117015760006116df3383611bb5565b9050806116ff576040516382e4f46960e01b815260040160405180910390fd5b505b505b50505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526117449085906323b872dd60e01b906084016115e4565b50505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa158015611791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b59190612fe6565b905060006117c48683876120a4565b90506000611824828686808060200260200160405190810160405280939291908181526020016000905b8282101561181a5761180b60408302860136819003810190612fff565b815260200190600101906117ee565b5050505050611e07565b91505061183188826121af565b8215611701576117016001600160a01b03891633856115b8565b61142581336122b8565b61185f8282611476565b610815576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556118953390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6118e38282611476565b15610815576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000806014835161194f919061319a565b9050600061195f84836014612311565b905061196c81600061241e565b949350505050565b60008061198083611d94565b90506000611990826127106131ad565b905060006119a18661271084612483565b6003549091506119ba906001600160a01b031682611f30565b95945050505050565b60008060006119d28685611e07565b915091506119df816120d0565b600260009054906101000a90046001600160a01b03166001600160a01b03166312210e8a6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611a2f57600080fd5b505af1158015611a43573d6000803e3d6000fd5b505050506000828787611a56919061319a565b611a60919061319a565b90508015611a96576000611a743383611bb5565b905080611a94576040516382e4f46960e01b815260040160405180910390fd5b505b611aa083886131ad565b979650505050505050565b600080611ab783611d94565b90506000611ac7826127106131ad565b90506000611ad88661271084612483565b9050611ae48782611f30565b611af96001600160a01b03881633308961170c565b9695505050505050565b6000806000611b128685611e07565b91509150611b2087826124c3565b600082611b2d888861319a565b611b37919061319a565b9050611b4d6001600160a01b03891633836115b8565b61121283886131ad565b611b5f6125ca565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600061044b828261241e565b600081471015611c075760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610802565b6040516001600160a01b038416908390600081818185875af1925050503d8060008114611c50576040519150601f19603f3d011682016040523d82523d6000602084013e611c55565b606091505b5090949350505050565b611c67612613565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611b8c565b606061124e83836040518060600160405280602781526020016132cb60279139612659565b6000611d14826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126c79092919063ffffffff16565b9050805160001480611d35575080806020019051810190611d3591906131c0565b6104155760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610802565b6000805b8251811015611dde57828181518110611db357611db361310f565b60200260200101516020015182611dca91906131ad565b915080611dd681613181565b915050611d98565b506103e8811115611e025760405163cd4e616760e01b815260040160405180910390fd5b919050565b6000606082516001600160401b03811115611e2457611e24612b66565b604051908082528060200260200182016040528015611e6957816020015b6040805180820190915260008082526020820152815260200190600190039081611e425790505b50905060005b8351811015611f28576000611eae858381518110611e8f57611e8f61310f565b602002602001015160200151612710886126d69092919063ffffffff16565b90506040518060400160405280868481518110611ecd57611ecd61310f565b6020026020010151600001516001600160a01b0316815260200182815250838381518110611efd57611efd61310f565b6020908102919091010152611f1281856131ad565b9350508080611f2090613181565b915050611e6f565b509250929050565b600154604051636eb1769f60e11b81523060048201526001600160a01b0361010090920482166024820152829184169063dd62ed3e90604401602060405180830381865afa158015611f86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611faa9190612fe6565b10156108155760015460405163095ea7b360e01b81526101009091046001600160a01b039081166004830152600019602483015283169063095ea7b3906044016020604051808303816000875af1158015612009573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041591906131c0565b60025460408051630910874560e11b8152905160009247926001600160a01b03909116916312210e8a91600480820192879290919082900301818387803b15801561207757600080fd5b505af115801561208b573d6000803e3d6000fd5b5047925061209d91508390508261319a565b9250505090565b600082156120c857816120b7848661319a565b6120c1919061319a565b905061124e565b509192915050565b60005b81518110156108155760008282815181106120f0576120f061310f565b60200260200101519050600061210e82600001518360200151611bb5565b90508061214557815160208301516040516208c3b360e61b81526001600160a01b0390921660048301526024820152604401610802565b81600001516001600160a01b0316336001600160a01b03167fe0e765ab26c1caf691c510426951246128b96830e49cc81d8c093fd551abac35846020015160405161219291815260200190565b60405180910390a3505080806121a790613181565b9150506120d3565b60005b815181101561041557612215338383815181106121d1576121d161310f565b6020026020010151600001518484815181106121ef576121ef61310f565b602002602001015160200151866001600160a01b031661170c909392919063ffffffff16565b8181815181106122275761222761310f565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106122835761228361310f565b60200260200101516020015160405161229e91815260200190565b60405180910390a4806122b081613181565b9150506121b2565b6122c28282611476565b610815576122cf81612778565b6122da83602061278a565b6040516020016122eb9291906131e2565b60408051601f198184030181529082905262461bcd60e51b825261080291600401613257565b60608161231f81601f6131ad565b101561235e5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610802565b61236882846131ad565b845110156123ac5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610802565b6060821580156123cb5760405191506000825260208201604052612415565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156124045780518352602092830192016123ec565b5050858452601f01601f1916604052505b50949350505050565b600061242b8260146131ad565b835110156124735760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610802565b500160200151600160601b900490565b60006124908484846126d6565b9050600082806124a2576124a261326a565b848609111561124e5760001981106124b957600080fd5b6001019392505050565b60005b8151811015610415576125278282815181106124e4576124e461310f565b6020026020010151600001518383815181106125025761250261310f565b602002602001015160200151856001600160a01b03166115b89092919063ffffffff16565b8181815181106125395761253961310f565b6020026020010151600001516001600160a01b0316336001600160a01b0316846001600160a01b03167f1f9a9fdac86b6ca3c5300bec0b61555cded1f1a234378602dcca6c27085eac8e8585815181106125955761259561310f565b6020026020010151602001516040516125b091815260200190565b60405180910390a4806125c281613181565b9150506124c6565b60015460ff16610bd45760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610802565b60015460ff1615610bd45760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610802565b6060600080856001600160a01b0316856040516126769190613280565b600060405180830381855af49150503d80600081146126b1576040519150601f19603f3d011682016040523d82523d6000602084013e6126b6565b606091505b5091509150611af986838387612925565b606061124b848460008561299e565b600083830281600019858709828110838203039150508084116126f857600080fd5b8060000361270b5750829004905061124e565b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b606061044b6001600160a01b03831660145b6060600061279983600261329c565b6127a49060026131ad565b6001600160401b038111156127bb576127bb612b66565b6040519080825280601f01601f1916602001820160405280156127e5576020820181803683370190505b509050600360fc1b816000815181106128005761280061310f565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061282f5761282f61310f565b60200101906001600160f81b031916908160001a905350600061285384600261329c565b61285e9060016131ad565b90505b60018111156128d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106128925761289261310f565b1a60f81b8282815181106128a8576128a861310f565b60200101906001600160f81b031916908160001a90535060049490941c936128cf816132b3565b9050612861565b50831561124e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610802565b6060831561299457825160000361298d576001600160a01b0385163b61298d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610802565b508161196c565b61196c8383612a6e565b6060824710156129ff5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610802565b600080866001600160a01b03168587604051612a1b9190613280565b60006040518083038185875af1925050503d8060008114612a58576040519150601f19603f3d011682016040523d82523d6000602084013e612a5d565b606091505b5091509150611aa087838387612925565b815115612a7e5781518083602001fd5b8060405162461bcd60e51b81526004016108029190613257565b6001600160a01b038116811461142557600080fd5b8035611e0281612a98565b60008060408385031215612acb57600080fd5b8235612ad681612a98565b91506020830135612ae681612a98565b809150509250929050565b600060208284031215612b0357600080fd5b81356001600160e01b03198116811461124e57600080fd5b60008083601f840112612b2d57600080fd5b5081356001600160401b03811115612b4457600080fd5b6020830191508360208260061b8501011115612b5f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715612b9e57612b9e612b66565b60405290565b604051608081016001600160401b0381118282101715612b9e57612b9e612b66565b604051601f8201601f191681016001600160401b0381118282101715612bee57612bee612b66565b604052919050565b600060e08284031215612c0857600080fd5b612c10612b7c565b90508135612c1d81612a98565b81526020820135612c2d81612a98565b6020820152604082013562ffffff81168114612c4857600080fd5b6040820152612c5960608301612aad565b60608201526080820135608082015260a082013560a0820152612c7e60c08301612aad565b60c082015292915050565b60008060006101008486031215612c9f57600080fd5b83356001600160401b03811115612cb557600080fd5b612cc186828701612b1b565b9094509250612cd590508560208601612bf6565b90509250925092565b600060208284031215612cf057600080fd5b5035919050565b60008060408385031215612d0a57600080fd5b823591506020830135612ae681612a98565b600060808284031215612d2e57600080fd5b612d36612ba4565b905081356001600160401b0380821115612d4f57600080fd5b818401915084601f830112612d6357600080fd5b8135602082821115612d7757612d77612b66565b612d89601f8301601f19168201612bc6565b92508183528681838601011115612d9f57600080fd5b81818501828501376000818385010152828552612dbd818701612aad565b8186015250505050604082013560408201526060820135606082015292915050565b600080600060408486031215612df457600080fd5b83356001600160401b0380821115612e0b57600080fd5b612e1787838801612b1b565b90955093506020860135915080821115612e3057600080fd5b50612e3d86828701612d1c565b9150509250925092565b60008083601f840112612e5957600080fd5b5081356001600160401b03811115612e7057600080fd5b6020830191508360208260051b8501011115612b5f57600080fd5b600080600060408486031215612ea057600080fd5b8335925060208401356001600160401b03811115612ebd57600080fd5b612ec986828701612e47565b9497909650939450505050565b60005b83811015612ef1578181015183820152602001612ed9565b50506000910152565b60008151808452612f12816020860160208601612ed6565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612f7b57603f19888603018452612f69858351612efa565b94509285019290850190600101612f4d565b5092979650505050505050565b600060208284031215612f9a57600080fd5b813561124e81612a98565b60008060208385031215612fb857600080fd5b82356001600160401b03811115612fce57600080fd5b612fda85828601612e47565b90969095509350505050565b600060208284031215612ff857600080fd5b5051919050565b60006040828403121561301157600080fd5b604051604081018181106001600160401b038211171561303357613033612b66565b604052823561304181612a98565b81526020928301359281019290925250919050565b60e0810161044b828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c09182015116910152565b60008151608084526130ca6080850182612efa565b6020848101516001600160a01b0316908601526040808501519086015260609384015193909401929092525090919050565b60208152600061124e60208301846130b5565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261313c57600080fd5b8301803591506001600160401b0382111561315657600080fd5b602001915036819003821315612b5f57600080fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016131935761319361316b565b5060010190565b8181038181111561044b5761044b61316b565b8082018082111561044b5761044b61316b565b6000602082840312156131d257600080fd5b8151801515811461124e57600080fd5b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161321a816017850160208801612ed6565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161324b816028840160208801612ed6565b01602801949350505050565b60208152600061124e6020830184612efa565b634e487b7160e01b600052601260045260246000fd5b60008251613292818460208701612ed6565b9190910192915050565b808202811582820484141761044b5761044b61316b565b6000816132c2576132c261316b565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220162c0f9d1b47c666f486fc65c7c7502bb0e7378e3166be6f93d98943154831c364736f6c63430008130033";class XS extends ed{constructor(...e){e.length>1?super(...e):super(qS,GS,e[0])}deploy(e,t,n,r){return super.deploy(e,t,n,r||{})}getDeployTransaction(e,t,n,r){return super.getDeployTransaction(e,t,n,r||{})}attach(e){return super.attach(e)}connect(e){return super.connect(e)}static bytecode=GS;static abi=qS;static createInterface(){return new ys(qS)}static connect(e,t){return new $c(e,qS,t)}}const ZS=[{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"getEthBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"gasLimit",type:"uint256"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct UniswapInterfaceMulticall.Call[]",name:"calls",type:"tuple[]"}],name:"multicall",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint256",name:"gasUsed",type:"uint256"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct UniswapInterfaceMulticall.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"}],YS="0x608060405234801561001057600080fd5b50610567806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630f28c97d146100465780631749e1e3146100645780634d2301cc14610085575b600080fd5b61004e610098565b60405161005b919061041f565b60405180910390f35b6100776100723660046102a7565b61009c565b60405161005b929190610428565b61004e610093366004610286565b610220565b4290565b8051439060609067ffffffffffffffff811180156100b957600080fd5b506040519080825280602002602001820160405280156100f357816020015b6100e061023a565b8152602001906001900390816100d85790505b50905060005b835181101561021a57600080600086848151811061011357fe5b60200260200101516000015187858151811061012b57fe5b60200260200101516020015188868151811061014357fe5b60200260200101516040015192509250925060005a90506000808573ffffffffffffffffffffffffffffffffffffffff1685856040516101839190610403565b60006040518083038160008787f1925050503d80600081146101c1576040519150601f19603f3d011682016040523d82523d6000602084013e6101c6565b606091505b509150915060005a8403905060405180606001604052808415158152602001828152602001838152508989815181106101fb57fe5b60200260200101819052505050505050505080806001019150506100f9565b50915091565b73ffffffffffffffffffffffffffffffffffffffff163190565b604051806060016040528060001515815260200160008152602001606081525090565b803573ffffffffffffffffffffffffffffffffffffffff8116811461028157600080fd5b919050565b600060208284031215610297578081fd5b6102a08261025d565b9392505050565b600060208083850312156102b9578182fd5b823567ffffffffffffffff808211156102d0578384fd5b818501915085601f8301126102e3578384fd5b8135818111156102ef57fe5b6102fc8485830201610506565b81815284810190848601875b848110156103f457813587017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0606081838f03011215610346578a8bfd5b60408051606081018181108b8211171561035c57fe5b8252610369848d0161025d565b8152818401358c82015260608401358a811115610384578d8efd5b8085019450508e603f850112610398578c8dfd5b8b8401358a8111156103a657fe5b6103b68d85601f84011601610506565b93508084528f838287010111156103cb578d8efd5b808386018e86013783018c018d9052908101919091528552509287019290870190600101610308565b50909998505050505050505050565b6000825161041581846020870161052a565b9190910192915050565b90815260200190565b600060408083018584526020828186015281865180845260609350838701915083838202880101838901875b838110156104f6578983037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa001855281518051151584528681015187850152880151888401889052805188850181905260806104b582828801858c0161052a565b96880196601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01694909401909301925090850190600101610454565b50909a9950505050505050505050565b60405181810167ffffffffffffffff8111828210171561052257fe5b604052919050565b60005b8381101561054557818101518382015260200161052d565b83811115610554576000848401525b5050505056fea164736f6c6343000706000a";class KS extends ed{constructor(...e){e.length>1?super(...e):super(ZS,YS,e[0])}deploy(e){return super.deploy(e||{})}getDeployTransaction(e){return super.getDeployTransaction(e||{})}attach(e){return super.attach(e)}connect(e){return super.connect(e)}static bytecode=YS;static abi=ZS;static createInterface(){return new ys(ZS)}static connect(e,t){return new $c(e,ZS,t)}}const QS=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Burn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount0",type:"uint128"},{indexed:!1,internalType:"uint128",name:"amount1",type:"uint128"}],name:"Collect",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint128",name:"amount0",type:"uint128"},{indexed:!1,internalType:"uint128",name:"amount1",type:"uint128"}],name:"CollectProtocol",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"},{indexed:!1,internalType:"uint256",name:"paid0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"paid1",type:"uint256"}],name:"Flash",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"observationCardinalityNextOld",type:"uint16"},{indexed:!1,internalType:"uint16",name:"observationCardinalityNextNew",type:"uint16"}],name:"IncreaseObservationCardinalityNext",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{indexed:!1,internalType:"int24",name:"tick",type:"int24"}],name:"Initialize",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Mint",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"feeProtocol0Old",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol1Old",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol0New",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol1New",type:"uint8"}],name:"SetFeeProtocol",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"int256",name:"amount0",type:"int256"},{indexed:!1,internalType:"int256",name:"amount1",type:"int256"},{indexed:!1,internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{indexed:!1,internalType:"uint128",name:"liquidity",type:"uint128"},{indexed:!1,internalType:"int24",name:"tick",type:"int24"}],name:"Swap",type:"event"},{inputs:[{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount",type:"uint128"}],name:"burn",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount0Requested",type:"uint128"},{internalType:"uint128",name:"amount1Requested",type:"uint128"}],name:"collect",outputs:[{internalType:"uint128",name:"amount0",type:"uint128"},{internalType:"uint128",name:"amount1",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint128",name:"amount0Requested",type:"uint128"},{internalType:"uint128",name:"amount1Requested",type:"uint128"}],name:"collectProtocol",outputs:[{internalType:"uint128",name:"amount0",type:"uint128"},{internalType:"uint128",name:"amount1",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"fee",outputs:[{internalType:"uint24",name:"",type:"uint24"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeGrowthGlobal0X128",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeGrowthGlobal1X128",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"flash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"observationCardinalityNext",type:"uint16"}],name:"increaseObservationCardinalityNext",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint160",name:"sqrtPriceX96",type:"uint160"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"liquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxLiquidityPerTick",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"observations",outputs:[{internalType:"uint32",name:"blockTimestamp",type:"uint32"},{internalType:"int56",name:"tickCumulative",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityCumulativeX128",type:"uint160"},{internalType:"bool",name:"initialized",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32[]",name:"secondsAgos",type:"uint32[]"}],name:"observe",outputs:[{internalType:"int56[]",name:"tickCumulatives",type:"int56[]"},{internalType:"uint160[]",name:"secondsPerLiquidityCumulativeX128s",type:"uint160[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"positions",outputs:[{internalType:"uint128",name:"liquidity",type:"uint128"},{internalType:"uint256",name:"feeGrowthInside0LastX128",type:"uint256"},{internalType:"uint256",name:"feeGrowthInside1LastX128",type:"uint256"},{internalType:"uint128",name:"tokensOwed0",type:"uint128"},{internalType:"uint128",name:"tokensOwed1",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFees",outputs:[{internalType:"uint128",name:"token0",type:"uint128"},{internalType:"uint128",name:"token1",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint8",name:"feeProtocol0",type:"uint8"},{internalType:"uint8",name:"feeProtocol1",type:"uint8"}],name:"setFeeProtocol",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"slot0",outputs:[{internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{internalType:"int24",name:"tick",type:"int24"},{internalType:"uint16",name:"observationIndex",type:"uint16"},{internalType:"uint16",name:"observationCardinality",type:"uint16"},{internalType:"uint16",name:"observationCardinalityNext",type:"uint16"},{internalType:"uint8",name:"feeProtocol",type:"uint8"},{internalType:"bool",name:"unlocked",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"}],name:"snapshotCumulativesInside",outputs:[{internalType:"int56",name:"tickCumulativeInside",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityInsideX128",type:"uint160"},{internalType:"uint32",name:"secondsInside",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"bool",name:"zeroForOne",type:"bool"},{internalType:"int256",name:"amountSpecified",type:"int256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"},{internalType:"bytes",name:"data",type:"bytes"}],name:"swap",outputs:[{internalType:"int256",name:"amount0",type:"int256"},{internalType:"int256",name:"amount1",type:"int256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"int16",name:"",type:"int16"}],name:"tickBitmap",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"tickSpacing",outputs:[{internalType:"int24",name:"",type:"int24"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"int24",name:"",type:"int24"}],name:"ticks",outputs:[{internalType:"uint128",name:"liquidityGross",type:"uint128"},{internalType:"int128",name:"liquidityNet",type:"int128"},{internalType:"uint256",name:"feeGrowthOutside0X128",type:"uint256"},{internalType:"uint256",name:"feeGrowthOutside1X128",type:"uint256"},{internalType:"int56",name:"tickCumulativeOutside",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityOutsideX128",type:"uint160"},{internalType:"uint32",name:"secondsOutside",type:"uint32"},{internalType:"bool",name:"initialized",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"token0",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"token1",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],JS="0x6101606040523480156200001257600080fd5b503060601b60805260408051630890357360e41b81529051600091339163890357309160048082019260a092909190829003018186803b1580156200005657600080fd5b505afa1580156200006b573d6000803e3d6000fd5b505050506040513d60a08110156200008257600080fd5b508051602080830151604084015160608086015160809096015160e896871b6001600160e81b0319166101005291811b6001600160601b031990811660e05292811b831660c0529390931b1660a052600282810b900b90921b610120529150620000f79082906200010f811b62002b8417901c565b60801b6001600160801b03191661014052506200017d565b60008082600281900b620d89e719816200012557fe5b05029050600083600281900b620d89e8816200013d57fe5b0502905060008460020b83830360020b816200015557fe5b0560010190508062ffffff166001600160801b038016816200017357fe5b0495945050505050565b60805160601c60a05160601c60c05160601c60e05160601c6101005160e81c6101205160e81c6101405160801c61567e6200024a60003980611fee5280614b5f5280614b96525080610c0052806128fd5280614bca5280614bfc525080610cef52806119cb5280611a0252806129455250806111c75280611a855280611ef4528061244452806129215280613e6b5250806108d252806112f55280611a545280611e8e52806123be5280613d2252508061207b528061227d52806128d9525080612bfb525061567e6000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c806370cf754a116100ee578063c45a015511610097578063ddca3f4311610071578063ddca3f4314610800578063f305839914610820578063f30dba9314610828578063f637731d146108aa576101ae565b8063c45a0155146107d1578063d0c93a7c146107d9578063d21220a7146107f8576101ae565b8063883bdbfd116100c8578063883bdbfd14610633578063a34123a71461073c578063a38807f214610776576101ae565b806370cf754a146105c65780638206a4d1146105ce57806385b66729146105f6576101ae565b80633850c7bd1161015b578063490e6cbc11610135578063490e6cbc146104705780634f1eb3d8146104fc578063514ea4bf1461054d5780635339c296146105a6576101ae565b80633850c7bd1461035b5780633c8a7d8d146103b45780634614131914610456576101ae565b80631ad8b03b1161018c5780631ad8b03b146102aa578063252c09d7146102e157806332148f6714610338576101ae565b80630dfe1681146101b3578063128acb08146101d75780631a68650214610286575b600080fd5b6101bb6108d0565b604080516001600160a01b039092168252519081900360200190f35b61026d600480360360a08110156101ed57600080fd5b6001600160a01b0382358116926020810135151592604082013592606083013516919081019060a08101608082013564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b5090925090506108f4565b6040805192835260208301919091528051918290030190f35b61028e6114ad565b604080516001600160801b039092168252519081900360200190f35b6102b26114bc565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b6102fe600480360360208110156102f757600080fd5b50356114d6565b6040805163ffffffff909516855260069390930b60208501526001600160a01b039091168383015215156060830152519081900360800190f35b6103596004803603602081101561034e57600080fd5b503561ffff1661151c565b005b610363611616565b604080516001600160a01b03909816885260029690960b602088015261ffff9485168787015292841660608701529216608085015260ff90911660a0840152151560c0830152519081900360e00190f35b61026d600480360360a08110156103ca57600080fd5b6001600160a01b03823516916020810135600290810b92604083013590910b916001600160801b036060820135169181019060a08101608082013564010000000081111561041757600080fd5b82018360208201111561042957600080fd5b8035906020019184600183028401116401000000008311171561044b57600080fd5b509092509050611666565b61045e611922565b60408051918252519081900360200190f35b6103596004803603608081101561048657600080fd5b6001600160a01b0382351691602081013591604082013591908101906080810160608201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050611928565b6102b2600480360360a081101561051257600080fd5b506001600160a01b03813516906020810135600290810b91604081013590910b906001600160801b0360608201358116916080013516611d83565b61056a6004803603602081101561056357600080fd5b5035611f9d565b604080516001600160801b0396871681526020810195909552848101939093529084166060840152909216608082015290519081900360a00190f35b61045e600480360360208110156105bc57600080fd5b503560010b611fda565b61028e611fec565b610359600480360360408110156105e457600080fd5b5060ff81358116916020013516612010565b6102b26004803603606081101561060c57600080fd5b506001600160a01b03813516906001600160801b036020820135811691604001351661220f565b6106a36004803603602081101561064957600080fd5b81019060208101813564010000000081111561066457600080fd5b82018360208201111561067657600080fd5b8035906020019184602083028401116401000000008311171561069857600080fd5b5090925090506124dc565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106e75781810151838201526020016106cf565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561072657818101518382015260200161070e565b5050505090500194505050505060405180910390f35b61026d6004803603606081101561075257600080fd5b508035600290810b91602081013590910b90604001356001600160801b0316612569565b6107a06004803603604081101561078c57600080fd5b508035600290810b9160200135900b6126e0565b6040805160069490940b84526001600160a01b03909216602084015263ffffffff1682820152519081900360600190f35b6101bb6128d7565b6107e16128fb565b6040805160029290920b8252519081900360200190f35b6101bb61291f565b610808612943565b6040805162ffffff9092168252519081900360200190f35b61045e612967565b6108486004803603602081101561083e57600080fd5b503560020b61296d565b604080516001600160801b039099168952600f9790970b602089015287870195909552606087019390935260069190910b60808601526001600160a01b031660a085015263ffffffff1660c0840152151560e083015251908190036101000190f35b610359600480360360208110156108c057600080fd5b50356001600160a01b03166129db565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806108ff612bf0565b85610936576040805162461bcd60e51b8152602060048201526002602482015261415360f01b604482015290519081900360640190fd5b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602083015261ffff600160b81b8204811693830193909352600160c81b810483166060830152600160d81b8104909216608082015260ff600160e81b8304811660a0830152600160f01b909204909116151560c082018190526109ef576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b87610a3a5780600001516001600160a01b0316866001600160a01b0316118015610a35575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038716105b610a6c565b80600001516001600160a01b0316866001600160a01b0316108015610a6c57506401000276a36001600160a01b038716115b610aa3576040805162461bcd60e51b815260206004820152600360248201526214d41360ea1b604482015290519081900360640190fd5b6000805460ff60f01b191681556040805160c08101909152808a610ad25760048460a0015160ff16901c610ae5565b60108460a0015160ff1681610ae357fe5b065b60ff1681526004546001600160801b03166020820152604001610b06612c27565b63ffffffff168152602001600060060b815260200160006001600160a01b031681526020016000151581525090506000808913905060006040518060e001604052808b81526020016000815260200185600001516001600160a01b03168152602001856020015160020b81526020018c610b8257600254610b86565b6001545b815260200160006001600160801b0316815260200184602001516001600160801b031681525090505b805115801590610bd55750886001600160a01b031681604001516001600160a01b031614155b15610f9f57610be261560e565b60408201516001600160a01b031681526060820151610c25906006907f00000000000000000000000000000000000000000000000000000000000000008f612c2b565b15156040830152600290810b810b60208301819052620d89e719910b1215610c5657620d89e7196020820152610c75565b6020810151620d89e860029190910b1315610c7557620d89e860208201525b610c828160200151612d6d565b6001600160a01b031660608201526040820151610d13908d610cbc578b6001600160a01b031683606001516001600160a01b031611610cd6565b8b6001600160a01b031683606001516001600160a01b0316105b610ce4578260600151610ce6565b8b5b60c085015185517f000000000000000000000000000000000000000000000000000000000000000061309f565b60c085015260a084015260808301526001600160a01b031660408301528215610d7557610d498160c00151826080015101613291565b825103825260a0810151610d6b90610d6090613291565b6020840151906132a7565b6020830152610db0565b610d828160a00151613291565b825101825260c08101516080820151610daa91610d9f9101613291565b6020840151906132c3565b60208301525b835160ff1615610df6576000846000015160ff168260c0015181610dd057fe5b60c0840180519290910491829003905260a0840180519091016001600160801b03169052505b60c08201516001600160801b031615610e3557610e298160c00151600160801b8460c001516001600160801b03166132d9565b60808301805190910190525b80606001516001600160a01b031682604001516001600160a01b03161415610f5e57806040015115610f35578360a00151610ebf57610e9d846040015160008760200151886040015188602001518a606001516008613389909695949392919063ffffffff16565b6001600160a01b03166080860152600690810b900b6060850152600160a08501525b6000610f0b82602001518e610ed657600154610edc565b84608001515b8f610eeb578560800151610eef565b6002545b608089015160608a015160408b0151600595949392919061351c565b90508c15610f17576000035b610f258360c00151826135ef565b6001600160801b031660c0840152505b8b610f44578060200151610f4d565b60018160200151035b600290810b900b6060830152610f99565b80600001516001600160a01b031682604001516001600160a01b031614610f9957610f8c82604001516136a5565b600290810b900b60608301525b50610baf565b836020015160020b816060015160020b1461107a57600080610fed86604001518660400151886020015188602001518a606001518b6080015160086139d1909695949392919063ffffffff16565b604085015160608601516000805461ffff60c81b1916600160c81b61ffff958616021761ffff60b81b1916600160b81b95909416949094029290921762ffffff60a01b1916600160a01b62ffffff60029490940b93909316929092029190911773ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116179055506110ac9050565b60408101516000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b8060c001516001600160801b031683602001516001600160801b0316146110f25760c0810151600480546001600160801b0319166001600160801b039092169190911790555b8a1561114257608081015160015560a08101516001600160801b03161561113d5760a0810151600380546001600160801b031981166001600160801b03918216909301169190911790555b611188565b608081015160025560a08101516001600160801b0316156111885760a0810151600380546001600160801b03808216600160801b92839004821690940116029190911790555b8115158b1515146111a157602081015181518b036111ae565b80600001518a0381602001515b90965094508a156112e75760008512156111f0576111f07f00000000000000000000000000000000000000000000000000000000000000008d87600003613b86565b60006111fa613cd4565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561127e57600080fd5b505af1158015611292573d6000803e3d6000fd5b5050505061129e613cd4565b6112a88289613e0d565b11156112e1576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b50611411565b600086121561131e5761131e7f00000000000000000000000000000000000000000000000000000000000000008d88600003613b86565b6000611328613e1d565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156113ac57600080fd5b505af11580156113c0573d6000803e3d6000fd5b505050506113cc613e1d565b6113d68288613e0d565b111561140f576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b505b60408082015160c083015160608085015184518b8152602081018b90526001600160a01b03948516818701526001600160801b039093169183019190915260020b60808201529151908e169133917fc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca679181900360a00190a350506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b6004546001600160801b031681565b6003546001600160801b0380821691600160801b90041682565b60088161ffff81106114e757600080fd5b015463ffffffff81169150640100000000810460060b90600160581b81046001600160a01b031690600160f81b900460ff1684565b600054600160f01b900460ff16611560576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611575612bf0565b60008054600160d81b900461ffff169061159160088385613eb5565b6000805461ffff808416600160d81b810261ffff60d81b19909316929092179092559192508316146115fe576040805161ffff80851682528316602082015281517fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a929181900390910190a15b50506000805460ff60f01b1916600160f01b17905550565b6000546001600160a01b03811690600160a01b810460020b9061ffff600160b81b8204811691600160c81b8104821691600160d81b8204169060ff600160e81b8204811691600160f01b90041687565b600080548190600160f01b900460ff166116ad576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b191690556001600160801b0385166116cd57600080fd5b60008061171b60405180608001604052808c6001600160a01b031681526020018b60020b81526020018a60020b81526020016117118a6001600160801b0316613f58565b600f0b9052613f69565b9250925050819350809250600080600086111561173d5761173a613cd4565b91505b841561174e5761174b613e1d565b90505b336001600160a01b031663d348799787878b8b6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50505050600086111561183b576117f9613cd4565b6118038388613e0d565b111561183b576040805162461bcd60e51b815260206004820152600260248201526104d360f41b604482015290519081900360640190fd5b841561188b57611849613e1d565b6118538287613e0d565b111561188b576040805162461bcd60e51b81526020600482015260026024820152614d3160f01b604482015290519081900360640190fd5b8960020b8b60020b8d6001600160a01b03167f7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde338d8b8b60405180856001600160a01b03168152602001846001600160801b0316815260200183815260200182815260200194505050505060405180910390a450506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b60025481565b600054600160f01b900460ff1661196c576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611981612bf0565b6004546001600160801b0316806119c3576040805162461bcd60e51b81526020600482015260016024820152601360fa1b604482015290519081900360640190fd5b60006119f8867f000000000000000000000000000000000000000000000000000000000000000062ffffff16620f42406141a9565b90506000611a2f867f000000000000000000000000000000000000000000000000000000000000000062ffffff16620f42406141a9565b90506000611a3b613cd4565b90506000611a47613e1d565b90508815611a7a57611a7a7f00000000000000000000000000000000000000000000000000000000000000008b8b613b86565b8715611aab57611aab7f00000000000000000000000000000000000000000000000000000000000000008b8a613b86565b336001600160a01b031663e9cbafb085858a8a6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b158015611b2d57600080fd5b505af1158015611b41573d6000803e3d6000fd5b505050506000611b4f613cd4565b90506000611b5b613e1d565b905081611b688588613e0d565b1115611ba0576040805162461bcd60e51b8152602060048201526002602482015261046360f41b604482015290519081900360640190fd5b80611bab8487613e0d565b1115611be3576040805162461bcd60e51b8152602060048201526002602482015261463160f01b604482015290519081900360640190fd5b8382038382038115611c725760008054600160e81b9004600f16908115611c16578160ff168481611c1057fe5b04611c19565b60005b90506001600160801b03811615611c4c57600380546001600160801b038082168401166001600160801b03199091161790555b611c66818503600160801b8d6001600160801b03166132d9565b60018054909101905550505b8015611cfd5760008054600160e81b900460041c600f16908115611ca2578160ff168381611c9c57fe5b04611ca5565b60005b90506001600160801b03811615611cd757600380546001600160801b03600160801b8083048216850182160291161790555b611cf1818403600160801b8d6001600160801b03166132d9565b60028054909101905550505b8d6001600160a01b0316336001600160a01b03167fbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca6338f8f86866040518085815260200184815260200183815260200182815260200194505050505060405180910390a350506000805460ff60f01b1916600160f01b179055505050505050505050505050565b600080548190600160f01b900460ff16611dca576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19168155611de460073389896141e3565b60038101549091506001600160801b0390811690861611611e055784611e14565b60038101546001600160801b03165b60038201549093506001600160801b03600160801b909104811690851611611e3c5783611e52565b6003810154600160801b90046001600160801b03165b91506001600160801b03831615611eb7576003810180546001600160801b031981166001600160801b03918216869003821617909155611eb7907f0000000000000000000000000000000000000000000000000000000000000000908a908616613b86565b6001600160801b03821615611f1d576003810180546001600160801b03600160801b808304821686900382160291811691909117909155611f1d907f0000000000000000000000000000000000000000000000000000000000000000908a908516613b86565b604080516001600160a01b038a1681526001600160801b0380861660208301528416818301529051600288810b92908a900b9133917f70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0919081900360600190a4506000805460ff60f01b1916600160f01b17905590969095509350505050565b60076020526000908152604090208054600182015460028301546003909301546001600160801b0392831693919281811691600160801b90041685565b60066020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b600054600160f01b900460ff16612054576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638da5cb5b916004808301926020929190829003018186803b1580156120c157600080fd5b505afa1580156120d5573d6000803e3d6000fd5b505050506040513d60208110156120eb57600080fd5b50516001600160a01b0316331461210157600080fd5b60ff82161580612124575060048260ff16101580156121245750600a8260ff1611155b801561214e575060ff8116158061214e575060048160ff161015801561214e5750600a8160ff1611155b61215757600080fd5b60008054610ff0600484901b16840160ff908116600160e81b9081027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841617909355919004167f973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b1336010826040805160ff9390920683168252600f600486901c16602083015286831682820152918516606082015290519081900360800190a150506000805460ff60f01b1916600160f01b17905550565b600080548190600160f01b900460ff16612256576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638da5cb5b916004808301926020929190829003018186803b1580156122c357600080fd5b505afa1580156122d7573d6000803e3d6000fd5b505050506040513d60208110156122ed57600080fd5b50516001600160a01b0316331461230357600080fd5b6003546001600160801b039081169085161161231f578361232c565b6003546001600160801b03165b6003549092506001600160801b03600160801b9091048116908416116123525782612366565b600354600160801b90046001600160801b03165b90506001600160801b038216156123e7576003546001600160801b038381169116141561239557600019909101905b600380546001600160801b031981166001600160801b039182168590038216179091556123e7907f00000000000000000000000000000000000000000000000000000000000000009087908516613b86565b6001600160801b0381161561246d576003546001600160801b03828116600160801b90920416141561241857600019015b600380546001600160801b03600160801b80830482168590038216029181169190911790915561246d907f00000000000000000000000000000000000000000000000000000000000000009087908416613b86565b604080516001600160801b0380851682528316602082015281516001600160a01b0388169233927f596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151929081900390910190a36000805460ff60f01b1916600160f01b1790559094909350915050565b6060806124e7612bf0565b61255e6124f2612c27565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092018290525054600454600896959450600160a01b820460020b935061ffff600160b81b8304811693506001600160801b0390911691600160c81b900416614247565b915091509250929050565b600080548190600160f01b900460ff166125b0576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916815560408051608081018252338152600288810b602083015287900b918101919091528190819061260990606081016125fc6001600160801b038a16613f58565b600003600f0b9052613f69565b925092509250816000039450806000039350600085118061262a5750600084115b15612669576003830180546001600160801b038082168089018216600160801b93849004831689019092169092029091176001600160801b0319161790555b604080516001600160801b0388168152602081018790528082018690529051600289810b92908b900b9133917f0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c919081900360600190a450506000805460ff60f01b1916600160f01b179055509094909350915050565b60008060006126ed612bf0565b6126f785856143a1565b600285810b810b60009081526005602052604080822087840b90930b825281206003830154600681900b9367010000000000000082046001600160a01b0316928492600160d81b810463ffffffff169284929091600160f81b900460ff168061275f57600080fd5b6003820154600681900b985067010000000000000081046001600160a01b03169650600160d81b810463ffffffff169450600160f81b900460ff16806127a457600080fd5b50506040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b810b6020840181905261ffff600160b81b8404811695850195909552600160c81b830485166060850152600160d81b8304909416608084015260ff600160e81b8304811660a0850152600160f01b909204909116151560c08301529093508e810b91900b1215905061284d575093909403965090039350900390506128d0565b8a60020b816020015160020b12156128c1576000612869612c27565b602083015160408401516004546060860151939450600093849361289f936008938893879392916001600160801b031690613389565b9a9003989098039b5050949096039290920396509091030392506128d0915050565b50949093039650039350900390505b9250925092565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60056020526000908152604090208054600182015460028301546003909301546001600160801b03831693600160801b909304600f0b9290600681900b9067010000000000000081046001600160a01b031690600160d81b810463ffffffff1690600160f81b900460ff1688565b6000546001600160a01b031615612a1e576040805162461bcd60e51b8152602060048201526002602482015261414960f01b604482015290519081900360640190fd5b6000612a29826136a5565b9050600080612a41612a39612c27565b60089061446a565b6040805160e0810182526001600160a01b038816808252600288810b6020808501829052600085870181905261ffff898116606088018190529089166080880181905260a08801839052600160c0909801979097528154600160f01b73ffffffffffffffffffffffffffffffffffffffff19909116871762ffffff60a01b1916600160a01b62ffffff9787900b9790971696909602959095177fffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffff16600160c81b9091021761ffff60d81b1916600160d81b909602959095177fff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1692909217909355835191825281019190915281519395509193507f98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c9592918290030190a150505050565b60008082600281900b620d89e71981612b9957fe5b05029050600083600281900b620d89e881612bb057fe5b0502905060008460020b83830360020b81612bc757fe5b0560010190508062ffffff166001600160801b03801681612be457fe5b0493505050505b919050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614612c2557600080fd5b565b4290565b60008060008460020b8660020b81612c3f57fe5b05905060008660020b128015612c6657508460020b8660020b81612c5f57fe5b0760020b15155b15612c7057600019015b8315612ce557600080612c82836144b6565b600182810b810b600090815260208d9052604090205460ff83169190911b80016000190190811680151597509294509092509085612cc757888360ff16860302612cda565b88612cd1826144c8565b840360ff168603025b965050505050612d63565b600080612cf4836001016144b6565b91509150600060018260ff166001901b031990506000818b60008660010b60010b8152602001908152602001600020541690508060001415955085612d4657888360ff0360ff16866001010102612d5c565b8883612d5183614568565b0360ff168660010101025b9650505050505b5094509492505050565b60008060008360020b12612d84578260020b612d8c565b8260020b6000035b9050620d89e8811115612dca576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b600060018216612dde57600160801b612df0565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612e24576ffff97272373d413259a46990580e213a0260801c5b6004821615612e43576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612e62576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612e81576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612ea0576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612ebf576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612ede576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615612efe576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615612f1e576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615612f3e576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612f5e576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612f7e576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612f9e576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612fbe576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612fde576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615612fff576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561301f576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561303e576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561305b576b048a170391f7dc42444e8fa20260801c5b60008460020b131561307657806000198161307257fe5b0490505b64010000000081061561308a57600161308d565b60005b60ff16602082901c0192505050919050565b60008080806001600160a01b03808916908a1610158187128015906131245760006130d88989620f42400362ffffff16620f42406132d9565b9050826130f1576130ec8c8c8c6001614652565b6130fe565b6130fe8b8d8c60016146cd565b955085811061310f578a965061311e565b61311b8c8b838661478a565b96505b5061316e565b8161313b576131368b8b8b60006146cd565b613148565b6131488a8c8b6000614652565b935083886000031061315c5789955061316e565b61316b8b8a8a600003856147d6565b95505b6001600160a01b038a81169087161482156131d15780801561318d5750815b6131a35761319e878d8c60016146cd565b6131a5565b855b95508080156131b2575081155b6131c8576131c3878d8c6000614652565b6131ca565b845b945061321b565b8080156131db5750815b6131f1576131ec8c888c6001614652565b6131f3565b855b9550808015613200575081155b613216576132118c888c60006146cd565b613218565b845b94505b8115801561322b57508860000385115b15613237578860000394505b81801561325657508a6001600160a01b0316876001600160a01b031614155b15613265578589039350613282565b61327f868962ffffff168a620f42400362ffffff166141a9565b93505b50505095509550955095915050565b6000600160ff1b82106132a357600080fd5b5090565b808203828113156000831215146132bd57600080fd5b92915050565b818101828112156000831215146132bd57600080fd5b600080806000198587098686029250828110908390030390508061330f576000841161330457600080fd5b508290049050613382565b80841161331b57600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60008063ffffffff8716613430576000898661ffff1661ffff81106133aa57fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff16151560608301529092508a161461341c57613419818a8988614822565b90505b806020015181604001519250925050613510565b8688036000806134458c8c858c8c8c8c6148d2565b91509150816000015163ffffffff168363ffffffff161415613477578160200151826040015194509450505050613510565b805163ffffffff8481169116141561349f578060200151816040015194509450505050613510565b8151815160208085015190840151918390039286039163ffffffff80841692908516910360060b816134cd57fe5b05028460200151018263ffffffff168263ffffffff1686604001518660400151036001600160a01b031602816134ff57fe5b048560400151019650965050505050505b97509795505050505050565b600295860b860b60009081526020979097526040909620600181018054909503909455938301805490920390915560038201805463ffffffff600160d81b6001600160a01b036701000000000000008085048216909603169094027fffffffffff0000000000000000000000000000000000000000ffffffffffffff90921691909117600681810b90960390950b66ffffffffffffff1666ffffffffffffff199095169490941782810485169095039093160263ffffffff60d81b1990931692909217905554600160801b9004600f0b90565b60008082600f0b121561365457826001600160801b03168260000384039150816001600160801b03161061364f576040805162461bcd60e51b81526020600482015260026024820152614c5360f01b604482015290519081900360640190fd5b6132bd565b826001600160801b03168284019150816001600160801b031610156132bd576040805162461bcd60e51b81526020600482015260026024820152614c4160f01b604482015290519081900360640190fd5b60006401000276a36001600160a01b038316108015906136e1575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b613716576040805162461bcd60e51b81526020600482015260016024820152602960f91b604482015290519081900360640190fd5b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106137b757607f810383901c91506137c1565b80607f0383901b91505b908002607f81811c60ff83811c9190911c800280831c81831c1c800280841c81841c1c800280851c81851c1c800280861c81861c1c800280871c81871c1c800280881c81881c1c800280891c81891c1c8002808a1c818a1c1c8002808b1c818b1c1c8002808c1c818c1c1c8002808d1c818d1c1c8002808e1c9c81901c9c909c1c80029c8d901c9e9d607f198f0160401b60c09190911c678000000000000000161760c19b909b1c674000000000000000169a909a1760c29990991c672000000000000000169890981760c39790971c671000000000000000169690961760c49590951c670800000000000000169490941760c59390931c670400000000000000169290921760c69190911c670200000000000000161760c79190911c670100000000000000161760c89190911c6680000000000000161760c99190911c6640000000000000161760ca9190911c6620000000000000161760cb9190911c6610000000000000161760cc9190911c6608000000000000161760cd9190911c66040000000000001617693627a301d71055774c8581026f028f6481ab7f045a5af012a19d003aa9198101608090811d906fdb2df09e81959a81455e260799a0632f8301901d600281810b9083900b146139c257886001600160a01b03166139a682612d6d565b6001600160a01b031611156139bb57816139bd565b805b6139c4565b815b9998505050505050505050565b6000806000898961ffff1661ffff81106139e757fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff161515606083015290925089161415613a575788859250925050613510565b8461ffff168461ffff16118015613a7857506001850361ffff168961ffff16145b15613a8557839150613a89565b8491505b8161ffff168960010161ffff1681613a9d57fe5b069250613aac81898989614822565b8a8461ffff1661ffff8110613abd57fe5b825191018054602084015160408501516060909501511515600160f81b027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160a01b03909616600160581b027fff0000000000000000000000000000000000000000ffffffffffffffffffffff60069390930b66ffffffffffffff16640100000000026affffffffffffff000000001963ffffffff90971663ffffffff199095169490941795909516929092171692909217929092161790555097509795505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310613c025780518252601f199092019160209182019101613be3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613c64576040519150601f19603f3d011682016040523d82523d6000602084013e613c69565b606091505b5091509150818015613c97575080511580613c975750808060200190516020811015613c9457600080fd5b50515b613ccd576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693919290918291908083835b60208310613d6d5780518252601f199092019160209182019101613d4e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613dcd576040519150601f19603f3d011682016040523d82523d6000602084013e613dd2565b606091505b5091509150818015613de657506020815110155b613def57600080fd5b808060200190516020811015613e0457600080fd5b50519250505090565b808201828110156132bd57600080fd5b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016939192909182919080838360208310613d6d5780518252601f199092019160209182019101613d4e565b6000808361ffff1611613ef3576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b8261ffff168261ffff1611613f09575081613382565b825b8261ffff168161ffff161015613f4f576001858261ffff1661ffff8110613f2e57fe5b01805463ffffffff191663ffffffff92909216919091179055600101613f0b565b50909392505050565b80600f81900b8114612beb57600080fd5b6000806000613f76612bf0565b613f88846020015185604001516143a1565b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602080840182905261ffff600160b81b8404811685870152600160c81b84048116606080870191909152600160d81b8504909116608086015260ff600160e81b8504811660a0870152600160f01b909404909316151560c08501528851908901519489015192890151939461402c9491939092909190614acf565b93508460600151600f0b6000146141a157846020015160020b816020015160020b12156140815761407a6140638660200151612d6d565b6140708760400151612d6d565b8760600151614c84565b92506141a1565b846040015160020b816020015160020b12156141775760045460408201516001600160801b03909116906140d3906140b7612c27565b60208501516060860151608087015160089493929187916139d1565b6000805461ffff60c81b1916600160c81b61ffff938416021761ffff60b81b1916600160b81b939092169290920217905581516040870151614123919061411990612d6d565b8860600151614c84565b93506141416141358760200151612d6d565b83516060890151614cc8565b92506141518187606001516135ef565b600480546001600160801b0319166001600160801b0392909216919091179055506141a1565b61419e6141878660200151612d6d565b6141948760400151612d6d565b8760600151614cc8565b91505b509193909250565b60006141b68484846132d9565b9050600082806141c257fe5b84860911156133825760001981106141d957600080fd5b6001019392505050565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a90930181528251928201929092206000908152929052902090565b60608060008361ffff1611614287576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b865167ffffffffffffffff8111801561429f57600080fd5b506040519080825280602002602001820160405280156142c9578160200160208202803683370190505b509150865167ffffffffffffffff811180156142e457600080fd5b5060405190808252806020026020018201604052801561430e578160200160208202803683370190505b50905060005b87518110156143945761433f8a8a8a848151811061432e57fe5b60200260200101518a8a8a8a613389565b84838151811061434b57fe5b6020026020010184848151811061435e57fe5b60200260200101826001600160a01b03166001600160a01b03168152508260060b60060b81525050508080600101915050614314565b5097509795505050505050565b8060020b8260020b126143e1576040805162461bcd60e51b8152602060048201526003602482015262544c5560e81b604482015290519081900360640190fd5b620d89e719600283900b1215614424576040805162461bcd60e51b8152602060048201526003602482015262544c4d60e81b604482015290519081900360640190fd5b620d89e8600282900b1315614466576040805162461bcd60e51b815260206004820152600360248201526254554d60e81b604482015290519081900360640190fd5b5050565b6040805160808101825263ffffffff9283168082526000602083018190529282019290925260016060909101819052835463ffffffff1916909117909116600160f81b17909155908190565b60020b600881901d9161010090910790565b60008082116144d657600080fd5b600160801b82106144e957608091821c91015b68010000000000000000821061450157604091821c91015b640100000000821061451557602091821c91015b62010000821061452757601091821c91015b610100821061453857600891821c91015b6010821061454857600491821c91015b6004821061455857600291821c91015b60028210612beb57600101919050565b600080821161457657600080fd5b5060ff6001600160801b0382161561459157607f1901614599565b608082901c91505b67ffffffffffffffff8216156145b257603f19016145ba565b604082901c91505b63ffffffff8216156145cf57601f19016145d7565b602082901c91505b61ffff8216156145ea57600f19016145f2565b601082901c91505b60ff821615614604576007190161460c565b600882901c91505b600f82161561461e5760031901614626565b600482901c91505b60038216156146385760011901614640565b600282901c91505b6001821615612beb5760001901919050565b6000836001600160a01b0316856001600160a01b03161115614672579293925b8161469f5761469a836001600160801b03168686036001600160a01b0316600160601b6132d9565b6146c2565b6146c2836001600160801b03168686036001600160a01b0316600160601b6141a9565b90505b949350505050565b6000836001600160a01b0316856001600160a01b031611156146ed579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b166001600160a01b03868603811690871661472957600080fd5b8361475957866001600160a01b031661474c8383896001600160a01b03166132d9565b8161475357fe5b0461477f565b61477f6147708383896001600160a01b03166141a9565b886001600160a01b0316614cf7565b979650505050505050565b600080856001600160a01b0316116147a157600080fd5b6000846001600160801b0316116147b757600080fd5b816147c95761469a8585856001614d02565b6146c28585856001614de3565b600080856001600160a01b0316116147ed57600080fd5b6000846001600160801b03161161480357600080fd5b816148155761469a8585856000614de3565b6146c28585856000614d02565b61482a61564a565b600085600001518503905060405180608001604052808663ffffffff1681526020018263ffffffff168660020b0288602001510160060b81526020016000856001600160801b03161161487e576001614880565b845b6001600160801b031673ffffffff00000000000000000000000000000000608085901b16816148ab57fe5b048860400151016001600160a01b0316815260200160011515815250915050949350505050565b6148da61564a565b6148e261564a565b888561ffff1661ffff81106148f357fe5b60408051608081018252919092015463ffffffff81168083526401000000008204600690810b810b900b6020840152600160581b82046001600160a01b031693830193909352600160f81b900460ff1615156060820152925061495890899089614ed8565b15614990578663ffffffff16826000015163ffffffff16141561497a57613510565b8161498783898988614822565b91509150613510565b888361ffff168660010161ffff16816149a557fe5b0661ffff1661ffff81106149b557fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b90910416151560608201819052909250614a6c57604080516080810182528a5463ffffffff811682526401000000008104600690810b810b900b6020830152600160581b81046001600160a01b031692820192909252600160f81b90910460ff161515606082015291505b614a7b88836000015189614ed8565b614ab2576040805162461bcd60e51b815260206004820152600360248201526213d31160ea1b604482015290519081900360640190fd5b614abf8989898887614f9b565b9150915097509795505050505050565b6000614ade60078787876141e3565b60015460025491925090600080600f87900b15614c24576000614aff612c27565b6000805460045492935090918291614b499160089186918591600160a01b810460020b9161ffff600160b81b83048116926001600160801b0390921691600160c81b900416613389565b9092509050614b8360058d8b8d8b8b87898b60007f000000000000000000000000000000000000000000000000000000000000000061513b565b9450614bba60058c8b8d8b8b87898b60017f000000000000000000000000000000000000000000000000000000000000000061513b565b93508415614bee57614bee60068d7f0000000000000000000000000000000000000000000000000000000000000000615325565b8315614c2057614c2060068c7f0000000000000000000000000000000000000000000000000000000000000000615325565b5050505b600080614c3660058c8c8b8a8a61538b565b9092509050614c47878a8484615437565b600089600f0b1215614c75578315614c6457614c6460058c6155cc565b8215614c7557614c7560058b6155cc565b50505050505095945050505050565b60008082600f0b12614caa57614ca5614ca085858560016146cd565b613291565b6146c5565b614cbd614ca085858560000360006146cd565b600003949350505050565b60008082600f0b12614ce457614ca5614ca08585856001614652565b614cbd614ca08585856000036000614652565b808204910615150190565b60008115614d755760006001600160a01b03841115614d3857614d3384600160601b876001600160801b03166132d9565b614d50565b6001600160801b038516606085901b81614d4e57fe5b045b9050614d6d614d686001600160a01b03881683613e0d565b6155f8565b9150506146c5565b60006001600160a01b03841115614da357614d9e84600160601b876001600160801b03166141a9565b614dba565b614dba606085901b6001600160801b038716614cf7565b905080866001600160a01b031611614dd157600080fd5b6001600160a01b0386160390506146c5565b600082614df15750836146c5565b7bffffffffffffffffffffffffffffffff000000000000000000000000606085901b168215614e91576001600160a01b03861684810290858281614e3157fe5b041415614e6257818101828110614e6057614e5683896001600160a01b0316836141a9565b93505050506146c5565b505b614e8882614e83878a6001600160a01b03168681614e7c57fe5b0490613e0d565b614cf7565b925050506146c5565b6001600160a01b03861684810290858281614ea857fe5b04148015614eb557508082115b614ebe57600080fd5b808203614e56614d68846001600160a01b038b16846141a9565b60008363ffffffff168363ffffffff1611158015614f0257508363ffffffff168263ffffffff1611155b15614f1e578163ffffffff168363ffffffff1611159050613382565b60008463ffffffff168463ffffffff1611614f46578363ffffffff1664010000000001614f4e565b8363ffffffff165b64ffffffffff16905060008563ffffffff168463ffffffff1611614f7f578363ffffffff1664010000000001614f87565b8363ffffffff165b64ffffffffff169091111595945050505050565b614fa361564a565b614fab61564a565b60008361ffff168560010161ffff1681614fc157fe5b0661ffff169050600060018561ffff16830103905060005b506002818301048961ffff87168281614fee57fe5b0661ffff8110614ffa57fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b9091041615156060820181905290955061506557806001019250614fd9565b898661ffff16826001018161507657fe5b0661ffff811061508257fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b909104161515606082015285519094506000906150ed908b908b614ed8565b905080801561510657506151068a8a8760000151614ed8565b15615111575061512e565b8061512157600182039250615128565b8160010193505b50614fd9565b5050509550959350505050565b60028a810b900b600090815260208c90526040812080546001600160801b031682615166828d6135ef565b9050846001600160801b0316816001600160801b031611156151b4576040805162461bcd60e51b81526020600482015260026024820152614c4f60f01b604482015290519081900360640190fd5b6001600160801b03828116159082161581141594501561528a578c60020b8e60020b1361525a57600183018b9055600283018a90556003830180547fffffffffff0000000000000000000000000000000000000000ffffffffffffff166701000000000000006001600160a01b038c16021766ffffffffffffff191666ffffffffffffff60068b900b161763ffffffff60d81b1916600160d81b63ffffffff8a16021790555b6003830180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1790555b82546001600160801b0319166001600160801b038216178355856152d35782546152ce906152c990600160801b9004600f90810b810b908f900b6132c3565b613f58565b6152f4565b82546152f4906152c990600160801b9004600f90810b810b908f900b6132a7565b8354600f9190910b6001600160801b03908116600160801b0291161790925550909c9b505050505050505050505050565b8060020b8260020b8161533457fe5b0760020b1561534257600080fd5b60008061535d8360020b8560020b8161535757fe5b056144b6565b600191820b820b60009081526020979097526040909620805460ff9097169190911b90951890945550505050565b600285810b80820b60009081526020899052604080822088850b850b83529082209193849391929184918291908a900b126153d1575050600182015460028301546153e4565b8360010154880391508360020154870390505b6000808b60020b8b60020b121561540657505060018301546002840154615419565b84600101548a0391508460020154890390505b92909803979097039b96909503949094039850939650505050505050565b6040805160a08101825285546001600160801b0390811682526001870154602083015260028701549282019290925260038601548083166060830152600160801b900490911660808201526000600f85900b6154d65781516001600160801b03166154ce576040805162461bcd60e51b815260206004820152600260248201526104e560f41b604482015290519081900360640190fd5b5080516154e5565b81516154e290866135ef565b90505b60006155098360200151860384600001516001600160801b0316600160801b6132d9565b9050600061552f8460400151860385600001516001600160801b0316600160801b6132d9565b905086600f0b6000146155565787546001600160801b0319166001600160801b0384161788555b60018801869055600288018590556001600160801b03821615158061558457506000816001600160801b0316115b156155c2576003880180546001600160801b031981166001600160801b039182168501821617808216600160801b9182900483168501909216021790555b5050505050505050565b600290810b810b6000908152602092909252604082208281556001810183905590810182905560030155565b806001600160a01b0381168114612beb57600080fd5b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6040805160808101825260008082526020820181905291810182905260608101919091529056fea164736f6c6343000706000a";class $S extends ed{constructor(...e){e.length>1?super(...e):super(QS,JS,e[0])}deploy(e){return super.deploy(e||{})}getDeployTransaction(e){return super.getDeployTransaction(e||{})}attach(e){return super.attach(e)}connect(e){return super.connect(e)}static bytecode=JS;static abi=QS;static createInterface(){return new ys(QS)}static connect(e,t){return new $c(e,QS,t)}}const ek=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"guy",type:"address"},{name:"wad",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"src",type:"address"},{name:"dst",type:"address"},{name:"wad",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"wad",type:"uint256"}],name:"withdraw",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"dst",type:"address"},{name:"wad",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[],name:"deposit",outputs:[],payable:!0,stateMutability:"payable",type:"function"},{constant:!0,inputs:[{name:"",type:"address"},{name:"",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!0,name:"guy",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!0,name:"dst",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"dst",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"}];class tk{static abi=ek;static createInterface(){return new ys(ek)}static connect(e,t){return new $c(e,ek,t)}}async function nk(e,t,n){const r=$S.createInterface(),i=rk(t,r),a=[];return i&&n.forEach((e=>{e&&a.push({target:e,callData:i,gasLimit:Lr.from("1000000")})})),e.callStatic.multicall(a)}const rk=(e,t)=>{const n=t?.getFunction(e);return n?t?.encodeFunctionData(n):void 0},ik={"0xcdca1753":["uint256","uint160[]","uint32[]","uint256"],"0xc6a5026a":["uint256","uint160","uint32","uint256"],"0x2f80bb1d":["uint256","uint160[]","uint32[]","uint256"],"0xbd21704a":["uint256","uint160","uint32","uint256"]};const ak=co("decimals()").substring(0,10);async function ok(e,t,n){if("native"===e)return n.decimals;try{const n=await t.call({to:e,data:ak});return parseInt(n,16)}catch(e){const t=e instanceof Error?e.message:"Unknown Error";throw new US(`failed to get ERC20 decimals: ${t}`)}}function sk(e){if(e===ba)return!1;try{return na(e),!0}catch(e){return!1}}const uk=e=>"native"===e||sk(e),lk=e=>new Hw(e.chainId,e.address,e.decimals,e.symbol,e.name),ck=e=>({chainId:e.chainId,address:e.address,decimals:e.decimals,symbol:e.symbol,name:e.name,type:"erc20"}),dk=e=>{const t=lk(e.token);return Fw.fromRawAmount(t,e.value.toString())},fk=(e,t)=>({value:e,token:t}),pk=e=>"erc20"===e.token.type,hk=e=>"native"===e.token.type,mk=e=>"native"===e.type,yk=(e,t)=>{if(pk(e)&&pk(t))return((e,t)=>{if(e.token.address!==t.token.address)throw new Error("Token mismatch: token addresses must be the same");return{value:e.value.add(t.value),token:e.token}})(e,t);if(hk(e)&&hk(t))return((e,t)=>({value:e.value.add(t.value),token:e.token}))(e,t);throw new Error("Token mismatch: token types must be the same")},gk=(e,t)=>{if(pk(e)&&pk(t))return((e,t)=>{if(e.token.address!==t.token.address)throw new Error("Token mismatch: token addresses must be the same");return{value:e.value.sub(t.value),token:e.token}})(e,t);if(hk(e)&&hk(t))return((e,t)=>({value:e.value.sub(t.value),token:e.token}))(e,t);throw new Error("Token mismatch: token types must be the same")},Ak=e=>"native"===e.type?{address:"native",chainId:e.chainId,decimals:e.decimals,symbol:e.symbol,name:e.name}:e,bk=e=>({token:Ak(e.token),value:e.value}),vk=()=>Math.floor(Date.now()/1e3)+900;function wk({factoryAddress:e,erc20Pair:t,fee:n,initCodeHashManualOverride:r}){return t=xk(t),oa(e,nm(["bytes"],[lo.encode(["address","address","uint24"],[t[0].address,t[1].address,n])]),r??"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54")}const xk=e=>{if(e[0].address.toLowerCase()>e[1].address.toLowerCase()){const t=e[0];e[0]=e[1],e[1]=t}return e},Ek=[RE.LOWEST,RE.LOW,RE.MEDIUM,RE.HIGH],Tk=(e,t,n)=>{const r=((e,t)=>{const n=new Map,r=[];[...e,...t].forEach((e=>{n.set(e.address,e),r.push(e.address)}));const i=[...new Set([...r])],a=[];for(let e=0;e<i.length;e++)for(let t=e+1;t<i.length;t++){const r=n.get(i[e]),o=n.get(i[t]);r&&o&&a.push([r,o])}return a})(e,t),i=[];for(let e=0;e<r.length;e++)for(let t=0;t<Ek.length;t++){const a=wk({factoryAddress:n,erc20Pair:r[e],fee:Ek[t]});i.push({erc20Pair:r[e],fee:Ek[t],poolAddress:a})}return i},Ck="liquidity",Ik="slot0";class Sk{provider;multicallContract;routingTokens;routingContracts;constructor(e,t,n,r){this.provider=e,this.multicallContract=t,this.routingTokens=n,this.routingContracts=r,this.provider=e,this.multicallContract=t,this.routingTokens=n,this.routingContracts=r}async findOptimalRoute(e,t,n,r=2){const[i,a]=this.determineERC20InAndERC20Out(n,e,t),o=[i,a],s=await(async(e,t,n,r)=>{const i=Tk(t,n,r),a=i.map((e=>e.poolAddress));let o,s;try{[o,s]=await Promise.all([nk(e,Ik,a),nk(e,Ck,a)])}catch(e){const t=e instanceof Error?e.message:"Unknown Error";throw new US(`failed multicall: ${t}`)}const u=o.returnData,l=s.returnData,c=$S.createInterface(),d=[];return i.forEach(((e,t)=>{const n="0x"===o.returnData[t].returnData,r="0x"===s.returnData[t].returnData;if(n||r)return;const i=c.decodeFunctionResult(Ik,u[t].returnData),a=c.decodeFunctionResult(Ck,l[t].returnData),f=i.sqrtPriceX96.isZero(),p=a[0].isZero();if(f||p)return;const h=new wT(lk(e.erc20Pair[0]),lk(e.erc20Pair[1]),e.fee,i.sqrtPriceX96.toString(),a.toString(),i.tick);d.push(h)})),d})(this.multicallContract,o,this.routingTokens,this.routingContracts.coreFactory);if(0===s.length)throw new zS;const u=kk(i,a,s,r,[],[],i);if(0===u.length)throw new zS;return await this.getBestQuoteFromRoutes(u,e,n)}async getBestQuoteFromRoutes(e,t,n){const r=await async function(e,t,n,r,i){const a=n.map((e=>NT.quoteCallParameters(e,dk(r),i,{useQuoterV2:!0}).calldata)),o=(await Promise.allSettled(a.map((n=>e.send("eth_call",[{to:t,data:n},"latest"]))))).reduce(((e,t,o)=>{if("rejected"===t.status)return e;const s=a[o].substring(0,10),u=ik[s];if(!u)throw new Error("No quoting function signature found");if("0x"===t.value)return e;try{const a=lo.decode(u,t.value);if(a){const t=a[0];if(!(t instanceof Lr))throw new Error("Expected BigNumber");const s=ck(n[o].input),u=ck(n[o].output);e.push({route:n[o],amountIn:i===ww.EXACT_INPUT?r:fk(t,s),amountOut:i===ww.EXACT_INPUT?fk(t,u):r,gasEstimate:Lr.from(a[3]),tradeType:i})}}catch{}return e}),new Array);return o}(this.provider,this.routingContracts.quoter,e,t,n);if(0===r.length)throw new zS;if(n===ww.EXACT_INPUT)return this.bestQuoteForAmountIn(r);if(n===ww.EXACT_OUTPUT)return this.bestQuoteForAmountOut(r);throw new Error("Invalid trade type")}bestQuoteForAmountIn(e){let t=e[0];for(let n=1;n<e.length;n++)e[n].amountOut.value.gt(t.amountOut.value)&&(t=e[n]);return t}bestQuoteForAmountOut(e){let t=e[0];for(let n=1;n<e.length;n++)e[n].amountIn.value.lt(t.amountIn.value)&&(t=e[n]);return t}determineERC20InAndERC20Out(e,t,n){return e===ww.EXACT_INPUT?[t.token,n]:[n,t.token]}}const kk=(e,t,n,r,i=[],a=[],o=e)=>{const s=lk(e),u=lk(t),l=lk(o);for(const e of n){const c=e.involvesToken(s),d=i.find((t=>{return(n=e)===(r=t)||n.token0.equals(r.token0)&&n.token1.equals(r.token1)&&n.fee===r.fee;var n,r}));if(!c||d)continue;const f=e.token0.equals(s)?e.token1:e.token0;f.equals(u)?a.push(new ET([...i,e],l,u)):r>1&&kk(ck(f),t,n,r-1,[...i,e],a,o)}return a},Ok=13473,Rk=13371,Pk={chainId:Ok,decimals:18,symbol:"tIMX",name:"Immutable Testnet Token",type:"native"},Nk={chainId:Ok,address:"0x1CcCa691501174B4A623CeDA58cC8f1a76dc3439",decimals:18,symbol:"WIMX",name:"Wrapped Immutable Testnet Token",type:"erc20"},Lk=[Nk],Mk={chainId:Rk,decimals:18,symbol:"IMX",name:"Immutable Token",type:"native"},Dk={chainId:Rk,address:"0x3a0c2ba54d6cbd3121f01b96dfd20e99d1696c9d",decimals:18,symbol:"WIMX",name:"Wrapped Immutable Token",type:"erc20"},Fk=[Dk,{chainId:Rk,address:"0x52a6c53869ce09a731cd772f245b97a4401d3348",decimals:18,symbol:"ETH",name:"Ethereum",type:"erc20"}],jk=async(e,t)=>{const n=await(async e=>{const[t,n]=await Promise.all([e.getBlock("latest"),e.send("eth_maxPriorityFeePerGas",[])]);if(!t.baseFeePerGas)throw new Error("Base fee per gas not found in block");return{maxFeePerGas:t.baseFeePerGas.mul(2).add(n),maxPriorityFeePerGas:n,lastBaseFeePerGas:t.baseFeePerGas}})(e).catch((()=>null));return n?fk(n.maxFeePerGas,t):null},Bk=(e,t,n)=>{const r=fk(n.mul(t.value),t.token);return e?fk(r.value.add(t.value.mul(50876)),t.token):r},_k=async(e,t,n,r)=>{const i=await(async(e,t,n,r)=>{const i=VS.connect(n.token.address,e);let a;try{a=await i.allowance(t,r)}catch(e){const t=e instanceof Error?e.message:"Unknown Error";throw new WS(`failed to get allowance: ${t}`)}const o=n.value.sub(a);return!o.isNegative()&&!o.isZero()})(e,t,n,r);return i?((e,t,n)=>{if(e===n)throw new WS("owner and spender addresses are the same");return{data:VS.createInterface().encodeFunctionData("approve",[n,t.value]),to:t.token.address,value:0,from:e}})(t,n,r):null};const zk=async(e,t,n,r)=>{const i=await _k(e,t,n.amount,n.spender);if(!i)return null;const a=await async function(e,t,n,r){const i=VS.connect(r,e);return await i.estimateGas.approve(n,Ca,{from:t})}(e,t,n.spender,n.amount.token.address),o=r?Bk(!1,r,a):null;return{transaction:i,gasFeeEstimate:o?bk(o):null}},Uk=e=>"native"===e.type;class Wk{nativeToken;wrappedToken;constructor(e,t){this.nativeToken=e,this.wrappedToken=t}wrapAmount(e){return fk(e.value,this.wrappedToken)}unwrapAmount(e){if(e.token.address.toLowerCase()!==this.wrappedToken.address.toLowerCase())throw new Error(`cannot unwrap non-wrapped token ${e.token.address}`);return fk(e.value,this.nativeToken)}maybeWrapToken(e){return Uk(e)?this.wrappedToken:e}maybeWrapAmount(e){return fk(e.value,this.maybeWrapToken(e.token))}isWrappedNative(e){return"erc20"===e.type&&e.address.toLowerCase()===this.wrappedToken.address.toLowerCase()}isWrapOrUnwrap(e,t){return e===this.nativeToken&&this.isWrappedNative(t)||this.isWrappedNative(e)&&t===this.nativeToken}}const Hk=e=>{if(1===e.toString().split(".").length)return new _w(e,100);const t=(e/100).toString().split("."),n=t[0]+t[1],r=10**t[1].length;return new _w(n,r)};const Vk=(e,t,n,r)=>{const i=function(e){return e.tradeType===ww.EXACT_INPUT?e.amountOut:e.amountIn}(t),a=Uk(r)?e.unwrapAmount(i):i,o=fk(function(e,t,n){const r=Hk(n).add(1),i=(e===ww.EXACT_INPUT?r.invert():r).multiply(t.toString()).quotient;return Lr.from(i.toString())}(t.tradeType,a.value,n),r);return{quotedAmount:a,quotedAmountWithMaxSlippage:o}};const qk="multicall(uint256,bytes[])";function Gk(e,t,n,r,i,a,o,s,u,l){const{route:c}=r.swaps[0],d=1===c.pools.length,f=i.length>0;return d?f?function(e,t,n,r,i,a,o,s){const u=a.map((e=>({feeBasisPoints:e.basisPoints,recipient:e.recipient}))),l=[];return t.tradeType===ww.EXACT_INPUT&&l.push(o.encodeFunctionData("exactInputSingleWithSecondaryFee",[u,{tokenIn:n.tokenPath[0].address,tokenOut:n.tokenPath[1].address,fee:n.pools[0].fee,recipient:e,amountIn:r,amountOutMinimum:i,sqrtPriceLimitX96:0}])),t.tradeType===ww.EXACT_OUTPUT&&l.push(o.encodeFunctionData("exactOutputSingleWithSecondaryFee",[u,{tokenIn:n.tokenPath[0].address,tokenOut:n.tokenPath[1].address,fee:n.pools[0].fee,recipient:e,amountInMaximum:r,amountOut:i,sqrtPriceLimitX96:0}])),mk(s)&&l.push(o.encodeFunctionData("unwrapNativeToken",[i])),l}(n,r,c,u,l,i,a,t):function(e,t,n,r,i,a,o,s,u){const l=[];return r.tradeType===ww.EXACT_INPUT&&l.push(s.encodeFunctionData("exactInputSingle",[{tokenIn:i.tokenPath[0].address,tokenOut:i.tokenPath[1].address,fee:i.pools[0].fee,recipient:n,amountIn:a,amountOutMinimum:o,sqrtPriceLimitX96:0}])),r.tradeType===ww.EXACT_OUTPUT&&l.push(s.encodeFunctionData("exactOutputSingle",[{tokenIn:i.tokenPath[0].address,tokenOut:i.tokenPath[1].address,fee:i.pools[0].fee,recipient:n,amountInMaximum:a,amountOut:o,sqrtPriceLimitX96:0}])),mk(e)&&l.push(u.encodeFunctionData("refundETH")),mk(t)&&l.push(u.encodeFunctionData("unwrapWETH9(uint256)",[o])),l}(e,t,n,r,c,u,l,o,s):f?function(e,t,n,r,i,a,o,s){const u=oT(n,t.tradeType===ww.EXACT_OUTPUT),l=a.map((e=>({feeBasisPoints:e.basisPoints,recipient:e.recipient}))),c=[];return t.tradeType===ww.EXACT_INPUT&&c.push(o.encodeFunctionData("exactInputWithSecondaryFee",[l,{path:u,recipient:e,amountIn:r,amountOutMinimum:i}])),t.tradeType===ww.EXACT_OUTPUT&&c.push(o.encodeFunctionData("exactOutputWithSecondaryFee",[l,{path:u,recipient:e,amountInMaximum:r,amountOut:i}])),mk(s)&&c.push(o.encodeFunctionData("unwrapNativeToken",[i])),c}(n,r,c,u,l,i,a,t):function(e,t,n,r,i,a,o,s,u){const l=oT(i,r.tradeType===ww.EXACT_OUTPUT),c=[];return r.tradeType===ww.EXACT_INPUT&&c.push(s.encodeFunctionData("exactInput",[{path:l,recipient:n,amountIn:a,amountOutMinimum:o}])),r.tradeType===ww.EXACT_OUTPUT&&c.push(s.encodeFunctionData("exactOutput",[{path:l,recipient:n,amountInMaximum:a,amountOut:o}])),mk(e)&&c.push(u.encodeFunctionData("refundETH")),mk(t)&&c.push(u.encodeFunctionData("unwrapWETH9(uint256)",[o])),c}(e,t,n,r,c,u,l,o,s)}function Xk(e,t,n,r,i,a,o,s){const u=XS.createInterface(),l=Gk(e,t,r,n,a,u,NS.SwapRouter.INTERFACE,NS.PaymentsExtended.INTERFACE,o,s);return u.encodeFunctionData(qk,[i.deadlineOrPreviousBlockhash,l])}function Zk(e,t,n,r,i,a,o,s,u,l){const c=((e,t,n,r,i)=>mk(e)?0===i.length?n:r:t)(t,r,o,s,l),{calldata:d,maximumAmountIn:f}=function(e,t,n,r,i,a,o){const s=CT.createUncheckedTrade({route:n.route,inputAmount:dk(n.amountIn),outputAmount:dk(n.amountOut),tradeType:n.tradeType}),u={slippageTolerance:Hk(i),recipient:r,deadlineOrPreviousBlockhash:a},l=aT(s.maximumAmountIn(u.slippageTolerance).quotient),c=aT(s.minimumAmountOut(u.slippageTolerance).quotient);return{calldata:Xk(e,t,s,r,u,o,l,c),maximumAmountIn:l}}(e,t,n,c,i,a,l),p=l.length>0,h=u?Bk(p,u,n.gasEstimate):null,m=((e,t)=>"native"===e.type?t:"0x00")(e,f);return{transaction:{data:d,to:l.length>0?s:o,value:m,from:r},gasFeeEstimate:h?bk(h):null}}function Yk(e,t,n,r){const i=((e,t,n,r)=>{if(e.tradeType===ww.EXACT_OUTPUT){const t=Uk(n.token)?r.unwrapAmount(e.amountIn):e.amountIn;return n.addAmount(t),r.maybeWrapAmount(n.amountWithFeesApplied())}return r.maybeWrapAmount(t)})(e,t,n,r);return{gasEstimate:e.gasEstimate,route:e.route,amountIn:i,amountOut:e.amountOut,tradeType:e.tradeType}}const Kk={[Ok]:{multicall:"0x4857Dfd11c712e862eC362cEee29F7974B70EfcD",coreFactory:"0x56c2162254b0E4417288786eE402c2B41d4e181e",quoter:"0xF6Ad3CcF71Abb3E12beCf6b3D2a74C963859ADCd",swapRouter:"0x0b012055F770AE7BB7a8303968A7Fb6088A2296e",immutableSwapProxy:"0xDdBDa144cEbe1cCd68E746CDff8a6e4Be51A9e98"},[Rk]:{multicall:"0xc7efb32470dEE601959B15f1f923e017C6A918cA",coreFactory:"0x56c2162254b0E4417288786eE402c2B41d4e181e",quoter:"0xF6Ad3CcF71Abb3E12beCf6b3D2a74C963859ADCd",swapRouter:"0xE5a02c2Be08406c3fB36F9Aa29bF7C7A09CAe50B",immutableSwapProxy:"0xD67cc11151dBccCC424A16F8963ece3D0539BD61"}},Qk={[Ok]:{chainId:Ok,rpcUrl:"https://rpc.testnet.immutable.com",contracts:Kk[13473],commonRoutingTokens:Lk,nativeToken:Pk,wrappedNativeToken:Nk}},Jk={[Rk]:{chainId:Rk,rpcUrl:"https://rpc.immutable.com",contracts:Kk[13371],commonRoutingTokens:Fk,nativeToken:Mk,wrappedNativeToken:Dk}},$k={[Ut.SANDBOX]:Qk,[Ut.PRODUCTION]:Jk};class eO{baseConfig;chain;secondaryFees=[];constructor({chainId:e,baseConfig:t,secondaryFees:n,overrides:r}){if(this.baseConfig=t,this.secondaryFees=n||[],function(e){let t=0;for(const n of e){if(!sk(n.recipient))throw new MS(`Invalid secondary fee recipient address: ${n.recipient}`);if(n.basisPoints<=0||n.basisPoints>1e3)throw new MS(`Invalid secondary fee basis points: ${n.basisPoints}`);t+=n.basisPoints}if(t>1e3)throw new MS(`Invalid total secondary fee basis points: ${t}`)}(this.secondaryFees),r)return function(e){const t=["rpcURL","exchangeContracts","commonRoutingTokens","nativeToken"];for(const n of t)if(!e[n])throw new MS(`Missing override: ${n}`);Object.entries(e.exchangeContracts).forEach((([e,t])=>{if(!sk(t))throw new MS(`Invalid exchange contract address for ${e}`)}))}(r),this.chain={chainId:e,rpcUrl:r.rpcURL,contracts:r.exchangeContracts,commonRoutingTokens:r.commonRoutingTokens,nativeToken:r.nativeToken,wrappedNativeToken:r.wrappedNativeToken},void(this.secondaryFees=n||[]);const i=$k[t.environment][e];if(!i)throw new DS(e,t.environment);this.chain=i}}class tO{provider;batchProvider;router;chainId;nativeToken;wrappedNativeToken;secondaryFees;nativeTokenService;swapProxyContractAddress;routerContractAddress;constructor(e){const t=new eO(e);this.chainId=t.chain.chainId,this.nativeToken=t.chain.nativeToken,this.wrappedNativeToken=t.chain.wrappedNativeToken,this.nativeTokenService=new Wk(this.nativeToken,this.wrappedNativeToken),this.secondaryFees=t.secondaryFees,this.routerContractAddress=t.chain.contracts.swapRouter,this.swapProxyContractAddress=t.chain.contracts.immutableSwapProxy,this.provider=new Kp({url:t.chain.rpcUrl,skipFetchSetup:!0},t.chain.chainId),this.batchProvider=new Fh({url:t.chain.rpcUrl,skipFetchSetup:!0},t.chain.chainId);const n=KS.connect(t.chain.contracts.multicall,this.provider);this.router=new Sk(this.batchProvider,n,t.chain.commonRoutingTokens,t.chain.contracts)}static validate(e,t,n,r,i){gx(sk(i),new BS("invalid from address")),gx(uk(e),new BS("invalid token in address")),gx(uk(t),new BS("invalid token out address")),gx(e.toLocaleLowerCase()!==t.toLocaleLowerCase(),new _S),gx(n<=10,new jS("max hops must be less than or equal to 10")),gx(n>=1,new jS("max hops must be greater than or equal to 1")),gx(r<=50,new FS("slippage percent must be less than or equal to 50")),gx(r>=0,new FS("slippage percent must be greater than or equal to 0"))}async getSecondaryFees(e){if(0===this.secondaryFees.length)return[];const t=XS.connect(this.swapProxyContractAddress,e);return await t.paused()?[]:this.secondaryFees}parseTokenLiteral(e,t){return"native"===e?this.nativeToken:{type:"erc20",address:e,chainId:this.chainId,decimals:t}}async getUnwrapTransaction(e,t,n,r){const i=n.encodeFunctionData("withdraw",[t]),a=Lr.from(35216),o=r?bk(Bk(!1,r,a)):null;return{transaction:{transaction:{data:i,to:this.wrappedNativeToken.address,from:e},gasFeeEstimate:o},approval:null}}getWrapTransaction(e,t,n,r){const i=n.encodeFunctionData("deposit"),a=Lr.from(45038),o=r?bk(Bk(!1,r,a)):null;return{transaction:{transaction:{data:i,to:this.wrappedNativeToken.address,value:t,from:e},gasFeeEstimate:o},approval:null}}async getUnsignedWrapUnwrapTx(e,t,n,r){const i="native"===t.token.type,a={token:"native"===e.type?this.wrappedNativeToken:this.nativeToken,value:t.value},o={amount:bk(a),amountWithMaxSlippage:bk(a),slippage:0,fees:[]},s=tk.createInterface();let u;return u=i?this.getWrapTransaction(n,a.value,s,r):await this.getUnwrapTransaction(n,a.value,s,r),{quote:o,approval:u.approval,swap:u.transaction}}async getUnsignedSwapTx(e,t,n,r,i,a,o,s){tO.validate(t,n,a,i,e);const u=[ok(t,this.batchProvider,this.nativeToken),ok(n,this.batchProvider,this.nativeToken),this.getSecondaryFees(this.batchProvider),jk(this.batchProvider,this.nativeToken)],[l,c,d,f]=await Promise.all(u),p=this.parseTokenLiteral(t,l),h=this.parseTokenLiteral(n,c),[m,y]=s===ww.EXACT_INPUT?[p,h]:[h,p],g=fk(r,m);if(this.nativeTokenService.isWrapOrUnwrap(p,h))return this.getUnsignedWrapUnwrapTx(m,fk(r,p),e,f);const A=new class{secondaryFees;amount;constructor(e,t){this.secondaryFees=e,this.amount=fk(Lr.from(0),t)}get token(){return this.amount.token}addAmount(e){this.amount=yk(this.amount,e)}amountWithFeesApplied(){return yk(this.amount,this.total())}amountLessFees(){return gk(this.amount,this.total())}withAmounts(){return this.secondaryFees.map((e=>{const t=this.amount.value.mul(e.basisPoints).div(1e4);return{...e,amount:fk(t,this.amount.token)}}))}total(){let e=fk(Lr.from(0),this.amount.token);for(const t of this.secondaryFees){const n=this.amount.value.mul(t.basisPoints).div(1e4);e=yk(e,fk(n,this.amount.token))}return e}}(d,p),b=function(e,t,n,r){return n===ww.EXACT_OUTPUT?r.maybeWrapAmount(e):(t.addAmount(e),r.maybeWrapAmount(t.amountLessFees()))}(g,A,s,this.nativeTokenService),v=Yk(await this.router.findOptimalRoute(b,this.nativeTokenService.maybeWrapToken(y),s,a),g,A,this.nativeTokenService),w=Zk(p,h,v,e,i,o,this.routerContractAddress,this.swapProxyContractAddress,f,d),{quotedAmount:x,quotedAmountWithMaxSlippage:E}=Vk(this.nativeTokenService,v,i,y),T=((e,t,n,r,i)=>{const a=e===ww.EXACT_INPUT?t:n;return pk(a)?{spender:0===i.length?r.routerAddress:r.secondaryFeeAddress,amount:a}:null})(s,g,E,{routerAddress:this.routerContractAddress,secondaryFeeAddress:this.swapProxyContractAddress},d),C=T?await zk(this.provider,e,T,f):null,I=((e,t,n,r)=>({amount:bk(e),amountWithMaxSlippage:bk(t),slippage:n,fees:r.withAmounts().map((e=>({...e,amount:bk(e.amount)})))}))(x,E,i,A);return{quote:I,approval:C,swap:w}}async getUnsignedSwapTxFromAmountIn(e,t,n,r,i=.1,a=2,o=vk()){return await this.getUnsignedSwapTx(e,t,n,Lr.from(r),i,a,o,ww.EXACT_INPUT)}async getUnsignedSwapTxFromAmountOut(e,t,n,r,i=.1,a=2,o=vk()){return await this.getUnsignedSwapTx(e,t,n,Lr.from(r),i,a,o,ww.EXACT_OUTPUT)}}var nO={};const rO={erc1271:Object.freeze({__proto__:null,abi:[{type:"function",name:"isValidSignature",constant:!0,inputs:[{type:"bytes32"},{type:"bytes"}],outputs:[{type:"bytes4"}],payable:!1,stateMutability:"view"}],returns:{isValidSignatureBytes32:"0x1626ba7e"}}),factory:Object.freeze({__proto__:null,abi:[{type:"function",name:"deploy",constant:!1,inputs:[{type:"address"},{type:"bytes32"}],outputs:[],payable:!0,stateMutability:"payable"}]}),mainModule:Object.freeze({__proto__:null,abi:[{type:"function",name:"nonce",constant:!0,inputs:[],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"readNonce",constant:!0,inputs:[{type:"uint256"}],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"updateImplementation",constant:!1,inputs:[{type:"address"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"selfExecute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"execute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"},{type:"uint256"},{type:"bytes"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"createContract",inputs:[{type:"bytes"}],payable:!0,stateMutability:"payable"}]}),mainModuleUpgradable:Object.freeze({__proto__:null,abi:[{type:"function",name:"updateImageHash",constant:!0,inputs:[{type:"bytes32"}],outputs:[],payable:!1,stateMutability:"view"},{type:"function",name:"imageHash",constant:!0,inputs:[],outputs:[{type:"bytes32"}],payable:!1,stateMutability:"view"}]}),sequenceUtils:Object.freeze({__proto__:null,abi:[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_mainModule",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"bytes32",name:"_imageHash",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"_threshold",type:"uint256"},{indexed:!1,internalType:"bytes",name:"_signers",type:"bytes"}],name:"RequiredConfig",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"address",name:"_signer",type:"address"}],name:"RequiredSigner",type:"event"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callBalanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callBlockNumber",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_i",type:"uint256"}],name:"callBlockhash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"callChainId",outputs:[{internalType:"uint256",name:"id",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCode",outputs:[{internalType:"bytes",name:"code",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeHash",outputs:[{internalType:"bytes32",name:"codeHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeSize",outputs:[{internalType:"uint256",name:"size",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callCoinbase",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callDifficulty",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLeft",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLimit",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callOrigin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"knownImageHashes",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"lastImageHashUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastSignerUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastWalletUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"bool",name:"delegateCall",type:"bool"},{internalType:"bool",name:"revertOnError",type:"bool"},{internalType:"uint256",name:"gasLimit",type:"uint256"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct IModuleCalls.Transaction[]",name:"_txs",type:"tuple[]"}],name:"multiCall",outputs:[{internalType:"bool[]",name:"_successes",type:"bool[]"},{internalType:"bytes[]",name:"_results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_threshold",type:"uint256"},{components:[{internalType:"uint256",name:"weight",type:"uint256"},{internalType:"address",name:"signer",type:"address"}],internalType:"struct RequireUtils.Member[]",name:"_members",type:"tuple[]"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishConfig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"uint256",name:"_sizeMembers",type:"uint256"},{internalType:"bytes",name:"_signature",type:"bytes"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishInitialSigners",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_nonce",type:"uint256"}],name:"requireMinNonce",outputs:[],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_expiration",type:"uint256"}],name:"requireNonExpired",outputs:[],stateMutability:"view",type:"function"}]}),requireFreshSigner:Object.freeze({__proto__:null,abi:[{inputs:[{internalType:"address",name:"",type:"address"}],name:"requireFreshSigner",outputs:[],stateMutability:"nonpayable",type:"function"}]})};function iO(){return iO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iO.apply(this,arguments)}var aO;!function(e){e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.DISABLED=5]="DISABLED"}(aO||(aO={}));function oO(e,t){return function(...n){const r=Array.prototype.slice.call(n);return new Promise((async(n,i)=>{try{r.push(((e,t)=>e?i(e):n(t))),await e.apply(t,r)}catch(e){i(e)}}))}}new class{constructor(e){this.config=e,this.logLevel=void 0,this.configure(e)}configure(e){switch(this.config=iO({},this.config,e),this.config.logLevel){case"DEBUG":this.logLevel=aO.DEBUG;break;case"INFO":default:this.logLevel=aO.INFO;break;case"WARN":this.logLevel=aO.WARN;break;case"ERROR":this.logLevel=aO.ERROR;break;case"DISABLED":this.logLevel=aO.DISABLED}void 0===this.config.silence&&(this.config.silence=!1)}debug(e,...t){!0!==this.config.silence&&this.logLevel===aO.DEBUG&&console.log(e,...t)}info(e,...t){!0!==this.config.silence&&this.logLevel<=aO.INFO&&console.log(e,...t)}warn(e,...t){!0!==this.config.silence&&this.logLevel<=aO.WARN&&(console.warn(e,...t),this.config.onwarn&&this.config.onwarn(e,t))}error(e,...t){!0!==this.config.silence&&this.logLevel<=aO.ERROR&&(console.error(e,...t),this.config.onerror&&this.config.onerror(e,t))}}({logLevel:"INFO",silence:!0});const sO=(e=0,t=Number.MAX_SAFE_INTEGER)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function uO(){return uO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uO.apply(this,arguments)}const lO=(e,t=!1)=>(((e,t=!1,n=!1)=>{if(!e)throw new Error("invalid network config: empty config");const r=[];if(Array.isArray(e)?r.push(...e):r.push(e),0===r.length){if(t)throw new Error("invalid network config: empty config");return!1}const i=r.map((e=>e.chainId)).sort(),a=i.filter(((e,t)=>i.indexOf(e)!==t));if(a.length>0){if(t)throw new Error(`invalid network config: duplicate chainIds ${a}`);return!1}r.forEach((e=>e.name=e.name.toLowerCase()));const o=r.map((e=>e.name)).sort(),s=o.filter(((e,t)=>o.indexOf(e)!==t));if(s.length>0){if(t)throw new Error(`invalid network config: duplicate network names ${s}`);return!1}let u=!1,l=!1;for(let e=0;e<r.length;e++){const i=r[e];if(!(i.rpcUrl&&""!==i.rpcUrl||i.provider)){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: rpcUrl or provider must be provided`);return!1}if(!n&&!i.relayer){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: relayer must be provided`);return!1}if(i.isDefaultChain){if(u){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: DefaultChain is already set by another config`);return!1}u=!0}if(i.isAuthChain){if(l&&t)throw new Error(`invalid network config for chainId ${i.chainId}: AuthChain is already set by another config`);l=!0}}if(!u){if(t)throw new Error("invalid network config: DefaultChain must be set");return!1}if(!l){if(t)throw new Error("invalid network config: AuthChain must be set");return!1}})(e,!0,t),e),cO=e=>lO(dO(e)),dO=e=>{if(!e)return[];const t=e.sort(((e,t)=>e.chainId===t.chainId?0:e.chainId<t.chainId?-1:1)),n=t.findIndex((e=>e.isDefaultChain));n>0&&t.splice(0,0,t.splice(n,1)[0]);const r=t.findIndex((e=>e.isAuthChain&&!0!==e.isDefaultChain));return r>0&&t.splice(1,0,t.splice(r,1)[0]),t},fO=(e,t)=>"string"==typeof e?(t=t||{},e.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim,(function(e,n){let r=t[n];return r="function"==typeof r?r():null==r?"":"object"==typeof r||"symbol"==typeof r?r.toString():r.valueOf(),r}))):"";let pO;!function(e){e[e.MAINNET=1]="MAINNET",e[e.ROPSTEN=3]="ROPSTEN",e[e.RINKEBY=4]="RINKEBY",e[e.GOERLI=5]="GOERLI",e[e.KOVAN=42]="KOVAN",e[e.POLYGON=137]="POLYGON",e[e.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",e[e.POLYGON_ZKEVM=1101]="POLYGON_ZKEVM",e[e.BSC=56]="BSC",e[e.BSC_TESTNET=97]="BSC_TESTNET",e[e.OPTIMISM=10]="OPTIMISM",e[e.OPTIMISM_TESTNET=69]="OPTIMISM_TESTNET",e[e.ARBITRUM=42161]="ARBITRUM",e[e.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",e[e.ARBITRUM_NOVA=42170]="ARBITRUM_NOVA",e[e.AVALANCHE=43114]="AVALANCHE",e[e.AVALANCHE_TESTNET=43113]="AVALANCHE_TESTNET",e[e.FANTOM=250]="FANTOM",e[e.FANTOM_TESTNET=4002]="FANTOM_TESTNET",e[e.GNOSIS=100]="GNOSIS",e[e.AURORA=1313161554]="AURORA",e[e.AURORA_TESTNET=1313161556]="AURORA_TESTNET",e[e.BASE_GOERLI=84531]="BASE_GOERLI"}(pO||(pO={}));const hO=e=>fO("https://${network}-indexer.sequence.app",{network:e}),mO=e=>fO("https://${network}-relayer.sequence.app",{network:e}),yO=e=>fO("https://nodes.sequence.app/${network}",{network:e}),gO={[pO.MAINNET]:{chainId:pO.MAINNET,name:"mainnet",title:"Ethereum",blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[pO.ROPSTEN]:{chainId:pO.ROPSTEN,name:"ropsten",title:"Ropsten",testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[pO.RINKEBY]:{chainId:pO.RINKEBY,name:"rinkeby",title:"Rinkeby",testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",disabled:!0},[pO.GOERLI]:{chainId:pO.GOERLI,name:"goerli",title:"Goerli",testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[pO.KOVAN]:{chainId:pO.KOVAN,name:"kovan",title:"Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"}},[pO.POLYGON]:{chainId:pO.POLYGON,name:"polygon",title:"Polygon",blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"}},[pO.POLYGON_MUMBAI]:{chainId:pO.POLYGON_MUMBAI,name:"mumbai",title:"Polygon Mumbai",testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"}},[pO.POLYGON_ZKEVM]:{chainId:pO.POLYGON_ZKEVM,name:"polygon-zkevm",title:"Polygon zkEVM",blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"}},[pO.BSC]:{chainId:pO.BSC,name:"bsc",title:"BNB Smart Chain",blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"}},[pO.BSC_TESTNET]:{chainId:pO.BSC_TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"}},[pO.OPTIMISM]:{chainId:pO.OPTIMISM,name:"optimism",title:"Optimism",blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"}},[pO.OPTIMISM_TESTNET]:{chainId:pO.OPTIMISM_TESTNET,name:"optimism-testnet",title:"Optimistic Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Optimism Testnet)",rootUrl:"https://kovan-optimistic.etherscan.io/"}},[pO.ARBITRUM]:{chainId:pO.ARBITRUM,name:"arbitrum",title:"Arbitrum One",blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"}},[pO.ARBITRUM_GOERLI]:{chainId:pO.ARBITRUM_GOERLI,name:"arbitrum-goerli",title:"Arbitrum Goerli",testnet:!0,blockExplorer:{name:"Arbiscan (Testnet)",rootUrl:"https://testnet.arbiscan.io/"}},[pO.ARBITRUM_NOVA]:{chainId:pO.ARBITRUM_NOVA,name:"arbitrum-nova",title:"Arbitrum Nova",blockExplorer:{name:"Nova Explorer",rootUrl:"https://nova-explorer.arbitrum.io/"}},[pO.AVALANCHE]:{chainId:pO.AVALANCHE,name:"avalanche",title:"Avalanche",blockExplorer:{name:"Snowtrace",rootUrl:"https://snowtrace.io/"}},[pO.AVALANCHE_TESTNET]:{chainId:pO.AVALANCHE_TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://testnet.snowtrace.io/"}},[pO.FANTOM]:{chainId:pO.FANTOM,name:"fantom",title:"Fantom",blockExplorer:{name:"FTMScan",rootUrl:"https://ftmscan.com/"}},[pO.FANTOM_TESTNET]:{chainId:pO.FANTOM_TESTNET,name:"fantom-testnet",title:"Fantom Testnet",testnet:!0,blockExplorer:{name:"FTMScan (Testnet)",rootUrl:"https://testnet.ftmscan.com/"}},[pO.GNOSIS]:{chainId:pO.GNOSIS,name:"gnosis",title:"Gnosis Chain",blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"}},[pO.AURORA]:{chainId:pO.AURORA,name:"aurora",title:"Aurora",blockExplorer:{name:"Aurora Explorer",rootUrl:"https://aurorascan.dev/"}},[pO.AURORA_TESTNET]:{chainId:pO.AURORA_TESTNET,name:"aurora-testnet",title:"Aurora Testnet",blockExplorer:{name:"Aurora Explorer (Testnet)",rootUrl:"https://testnet.aurorascan.dev/"}},[pO.BASE_GOERLI]:{chainId:pO.BASE_GOERLI,name:"base-goerli",title:"Base Goerli",blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"}}};cO([uO({},gO[pO.MAINNET],{rpcUrl:yO("mainnet"),relayer:{url:mO("mainnet")},indexerUrl:hO("mainnet")}),uO({},gO[pO.POLYGON],{rpcUrl:yO("polygon"),relayer:{url:mO("polygon")},indexerUrl:hO("polygon"),isDefaultChain:!0,isAuthChain:!0}),uO({},gO[pO.BSC],{rpcUrl:yO("bsc"),indexerUrl:hO("bsc"),relayer:{url:mO("bsc")}}),uO({},gO[pO.AVALANCHE],{rpcUrl:yO("avalanche"),indexerUrl:hO("avalanche"),relayer:{url:mO("avalanche")}}),uO({},gO[pO.ARBITRUM],{rpcUrl:yO("arbitrum"),indexerUrl:hO("arbitrum"),relayer:{url:mO("arbitrum")}}),uO({},gO[pO.ARBITRUM_NOVA],{rpcUrl:yO("arbitrum-nova"),indexerUrl:hO("arbitrum-nova"),relayer:{url:mO("arbitrum-nova")}}),uO({},gO[pO.OPTIMISM],{rpcUrl:yO("optimism"),indexerUrl:hO("optimism"),relayer:{url:mO("optimism")}}),uO({},gO[pO.POLYGON_ZKEVM],{rpcUrl:yO("polygon-zkevm"),indexerUrl:hO("polygon-zkevm"),relayer:{url:mO("polygon-zkevm")}}),uO({},gO[pO.GNOSIS],{rpcUrl:yO("gnosis"),indexerUrl:hO("gnosis"),relayer:{url:mO("gnosis")}})]),cO([uO({},gO[pO.RINKEBY],{rpcUrl:yO("rinkeby"),relayer:{url:mO("rinkeby")},indexerUrl:hO("rinkeby")}),uO({},gO[pO.GOERLI],{rpcUrl:yO("goerli"),relayer:{url:mO("goerli")},indexerUrl:hO("goerli")}),uO({},gO[pO.POLYGON_MUMBAI],{rpcUrl:yO("mumbai"),relayer:{url:mO("mumbai")},indexerUrl:hO("mumbai"),isDefaultChain:!0,isAuthChain:!0}),uO({},gO[pO.BSC_TESTNET],{rpcUrl:yO("bsc-testnet"),relayer:{url:mO("bsc-testnet")},indexerUrl:hO("bsc-testnet")}),uO({},gO[pO.ARBITRUM_GOERLI],{rpcUrl:yO("arbitrum-goerli"),relayer:{url:mO("arbitrum-goerli")},indexerUrl:hO("arbitrum-goerli")}),uO({},gO[pO.BASE_GOERLI],{rpcUrl:yO("base-goerli"),relayer:{url:mO("base-goerli")},indexerUrl:hO("base-goerli")})]);const AO="2.0";function bO(){return bO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bO.apply(this,arguments)}let vO;function wO(e,t){return e.reduce((function(e,n,r){return t(n,r)?e[0].push(n):e[1].push(n),e}),[[],[]])}!function(e){e.ethCall="eth_call",e.ethGetBalance="eth_getBalance",e.ethGetCode="eth_getCode"}(vO||(vO={}));const xO={batchSize:50,timeWindow:50,contract:"0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E",verbose:!1};class EO{constructor(e){var t=this;if(this.batchableJsonRpcMethods=[vO.ethCall,vO.ethGetCode,vO.ethGetBalance],this.multicallInterface=new ys(rO.sequenceUtils.abi),this.options=void 0,this.timeout=void 0,this.queue=[],this.scheduleExecution=()=>{this.queue.length>0&&(this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(this.run,this.options.timeWindow))},this.handle=(e,t,n)=>this.batchableJsonRpcMethods.find((e=>e===t.method))?(this.queue.push({request:t,callback:n,next:e}),this.options.verbose&&console.log("Scheduling call",t.method),void this.scheduleExecution()):(this.options.verbose&&console.log("Forwarded call",t.method),e(t,n)),this.run=async function(){t.options.verbose&&console.log("Processing multicall");const e=Math.min(t.options.batchSize,t.queue.length);if(0===e)return;if(1===e)return t.forward(t.queue[0]),t.queue=[],void(t.options.verbose&&console.log("Skip multicall, single item"));t.options.verbose&&console.log("Resolving",e);var n=t.queue.slice(0,e);t.queue=e===t.queue.length?[]:t.queue.slice(e),t.options.verbose&&console.log("Updated queue",t.queue.length),0!==t.queue.length&&t.scheduleExecution();const r=n[0].next;let i;var[n,a]=wO(n,(e=>{try{if(e.next!==r)return!1;switch(e.request.method){case vO.ethCall:if(e.request.params[0].from||e.request.params[0].gasPrice||e.request.params[0].value)return!1;case vO.ethGetBalance:case vO.ethGetCode:const t=function(e){if(void 0===e)return"latest";switch(e){case"earliest":case"latest":case"pending":return e}return Lr.from(e)}(e.request.params[1]);if(void 0===i&&(i=t),!function(e,t){return e===t||(Lr.isBigNumber(e)?!!Lr.isBigNumber(t)&&e.eq(t):!Lr.isBigNumber(t)&&e===t)}(t,i))return!1}return!0}catch(e){return!1}}));if(0!==a.length&&(t.options.verbose&&console.log("Forwarding incompatible calls",a.length),t.forward(a),0===n.length))return;let o=n.map((e=>{try{switch(e.request.method){case vO.ethCall:return{delegateCall:!1,revertOnError:!1,target:e.request.params[0].to,data:e.request.params[0].data,gasLimit:e.request.params[0].gas?e.request.params[0].gas:0,value:0};case vO.ethGetCode:return{delegateCall:!1,revertOnError:!1,target:t.options.contract,gasLimit:0,value:0,data:t.multicallInterface.encodeFunctionData(t.multicallInterface.getFunction("callCode"),[e.request.params[0]])};case vO.ethGetBalance:return{delegateCall:!1,revertOnError:!1,target:t.options.contract,gasLimit:0,value:0,data:t.multicallInterface.encodeFunctionData(t.multicallInterface.getFunction("callBalanceOf"),[e.request.params[0]])};default:return null}}catch(e){return null}}));var[n,a]=wO(n,((e,t)=>void 0!==o[t]));if(o=o.filter((e=>e)),0!==a.length&&(t.options.verbose&&console.log("Forwarding calls on error",a.length),t.forward(a),0===n.length))return;let s;try{s=t.multicallInterface.encodeFunctionData(t.multicallInterface.getFunction("multiCall"),[o])}catch(e){return void t.forward(n)}const u=sO(),l=await async function(e,t){try{return await e}catch(e){return t instanceof Function?t(e):t}}(oO(r)({id:u,jsonrpc:AO,method:vO.ethCall,params:[{to:t.options.contract,value:0,data:s},Lr.isBigNumber(i)?i.toNumber():i]}),(e=>({jsonrpc:AO,id:u,result:void 0,error:e})));if(l.error)return t.forward(n);let c;try{c=t.multicallInterface.decodeFunctionResult(t.multicallInterface.getFunction("multiCall"),l.result)}catch(e){return void t.forward(n)}t.options.verbose&&console.log("Got response for",n.length),n.forEach(((e,n)=>{if(c[0][n])switch(e.request.method){case vO.ethCall:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:c[1][n]});break;case vO.ethGetCode:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:lo.decode(["bytes"],c[1][n])[0]});break;case vO.ethGetBalance:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:lo.decode(["uint256"],c[1][n])[0]})}else t.forward(e)}))},this.options=e?bO({},EO.DefaultOptions,e):EO.DefaultOptions,this.options.batchSize<=0)throw new Error(`Invalid batch size of ${this.options.batchSize}`)}forward(e){Array.isArray(e)?e.forEach((e=>e.next(e.request,e.callback))):e.next(e.request,e.callback)}static isMulticall(e){return e&&void 0!==e.handle&&void 0!==e.conf&&EO.isMulticallOptions(e.options)}static isMulticallOptions(e){return void 0!==e&&void 0!==e.batchSize&&void 0!==e.timeWindow&&void 0!==e.contract}}EO.DefaultOptions=bO({},xO);const TO=["getNetwork","getBlockNumber","getGasPrice","getTransactionCount","getStorageAt","sendTransaction","estimateGas","getBlock","getTransaction","getTransactionReceipt","getLogs","emit","litenerCount","addListener","removeListener","waitForTransaction","detectNetwork","getBlockWithTransactions"];var CO=Object.freeze({__proto__:null,ProxyMethods:TO,MulticallProvider:class extends Op{constructor(e,t){var n;super(e.getNetwork()),n=this,this.provider=e,this.multicall=void 0,this.listenerCount=this.provider.listenerCount,this.getResolver=async function(e){const t=n.provider;if(t.getResolver){const r=await t.getResolver(await e);return r?new Ip(n,r.address,r.name):null}return t.getResolver(await e)},this.next=async function(e,t){try{switch(e.method){case vO.ethCall:n.callback(e,t,await n.provider.call(e.params[0],e.params[1]));break;case vO.ethGetCode:n.callback(e,t,await n.provider.getCode(e.params[0],e.params[1]));break;case vO.ethGetBalance:n.callback(e,t,await n.provider.getBalance(e.params[0],e.params[1]))}}catch(r){n.callback(e,t,void 0,r)}},this.multicall=EO.isMulticall(t)?t:new EO(t),TO.forEach((t=>{void 0!==e[t]&&(this[t]=(...n)=>e[t](...n))}))}callback(e,t,n,r){t(r,{jsonrpc:AO,id:e.id,result:n,error:r})}async call(e,t){return this.rpcCall(vO.ethCall,e,t)}async getCode(e,t){return this.rpcCall(vO.ethGetCode,e,t)}async getBalance(e,t){return this.rpcCall(vO.ethGetBalance,e,t)}async rpcCall(e,...t){const n=sO();return(await oO(this.multicall.handle)(this.next,{jsonrpc:AO,id:n,method:e,params:t})).result}},MulticallExternalProvider:class{constructor(e,t){if(this.provider=e,this.multicall=void 0,this.multicall=EO.isMulticall(t)?t:new EO(t),e.send){const t=async function(t,n){e.send(t,n)};this.send=(e,n)=>{this.multicall.handle(t,e,n)}}if(e.sendAsync){const t=async function(t,n){e.sendAsync(t,n)};this.sendAsync=(e,n)=>{this.multicall.handle(t,e,n)}}}get isMetaMask(){return this.provider.isMetaMask}get isStatus(){return this.provider.isStatus}},multicallMiddleware:e=>t=>{const n=EO.isMulticall(e)?e:new EO(e);return(e,r)=>n.handle(t,e,r)}}),IO=ot(Object.freeze({__proto__:null,Multicall:EO,providers:CO})),SO=ot(gm),kO={},OO=ot(sa),RO=ot(mo),PO=ot(ad),NO=ot(Ir),LO=ot(us),MO=ot(Dd),DO=ot(Af),FO=ot(Ui),jO=ot(ir),BO=ot(dd),_O=ot(Ud),zO=ot(li),UO=ot(Ki),WO=ot(bc),HO=ot(no),VO=ot(jc),qO=ot(fm),GO=ot(Tf),XO=ot(Wf);!function(e){var t=it&&it.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=it&&it.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=it&&it.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.formatBytes32String=e.Utf8ErrorFuncs=e.toUtf8String=e.toUtf8CodePoints=e.toUtf8Bytes=e._toEscapedUtf8String=e.nameprep=e.hexDataSlice=e.hexDataLength=e.hexZeroPad=e.hexValue=e.hexStripZeros=e.hexConcat=e.isHexString=e.hexlify=e.base64=e.base58=e.TransactionDescription=e.LogDescription=e.Interface=e.SigningKey=e.HDNode=e.defaultPath=e.isBytesLike=e.isBytes=e.zeroPad=e.stripZeros=e.concat=e.arrayify=e.shallowCopy=e.resolveProperties=e.getStatic=e.defineReadOnly=e.deepCopy=e.checkProperties=e.poll=e.fetchJson=e._fetchData=e.RLP=e.Logger=e.checkResultErrors=e.FormatTypes=e.ParamType=e.FunctionFragment=e.EventFragment=e.ErrorFragment=e.ConstructorFragment=e.Fragment=e.defaultAbiCoder=e.AbiCoder=void 0,e.Indexed=e.Utf8ErrorReason=e.UnicodeNormalizationForm=e.SupportedAlgorithm=e.mnemonicToSeed=e.isValidMnemonic=e.entropyToMnemonic=e.mnemonicToEntropy=e.getAccountPath=e.verifyTypedData=e.verifyMessage=e.recoverPublicKey=e.computePublicKey=e.recoverAddress=e.computeAddress=e.getJsonWalletAddress=e.TransactionTypes=e.serializeTransaction=e.parseTransaction=e.accessListify=e.joinSignature=e.splitSignature=e.soliditySha256=e.solidityKeccak256=e.solidityPack=e.shuffled=e.randomBytes=e.sha512=e.sha256=e.ripemd160=e.keccak256=e.computeHmac=e.commify=e.parseUnits=e.formatUnits=e.parseEther=e.formatEther=e.isAddress=e.getCreate2Address=e.getContractAddress=e.getIcapAddress=e.getAddress=e._TypedDataEncoder=e.id=e.isValidName=e.namehash=e.hashMessage=e.dnsEncode=e.parseBytes32String=void 0;var i=zT;Object.defineProperty(e,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(e,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(e,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(e,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(e,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(e,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(e,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(e,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(e,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(e,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(e,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(e,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var a=OO;Object.defineProperty(e,"getAddress",{enumerable:!0,get:function(){return a.getAddress}}),Object.defineProperty(e,"getCreate2Address",{enumerable:!0,get:function(){return a.getCreate2Address}}),Object.defineProperty(e,"getContractAddress",{enumerable:!0,get:function(){return a.getContractAddress}}),Object.defineProperty(e,"getIcapAddress",{enumerable:!0,get:function(){return a.getIcapAddress}}),Object.defineProperty(e,"isAddress",{enumerable:!0,get:function(){return a.isAddress}});var o=r(RO);e.base64=o;var s=PO;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var u=NO;Object.defineProperty(e,"arrayify",{enumerable:!0,get:function(){return u.arrayify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return u.concat}}),Object.defineProperty(e,"hexConcat",{enumerable:!0,get:function(){return u.hexConcat}}),Object.defineProperty(e,"hexDataSlice",{enumerable:!0,get:function(){return u.hexDataSlice}}),Object.defineProperty(e,"hexDataLength",{enumerable:!0,get:function(){return u.hexDataLength}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return u.hexlify}}),Object.defineProperty(e,"hexStripZeros",{enumerable:!0,get:function(){return u.hexStripZeros}}),Object.defineProperty(e,"hexValue",{enumerable:!0,get:function(){return u.hexValue}}),Object.defineProperty(e,"hexZeroPad",{enumerable:!0,get:function(){return u.hexZeroPad}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return u.isBytes}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return u.isBytesLike}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return u.isHexString}}),Object.defineProperty(e,"joinSignature",{enumerable:!0,get:function(){return u.joinSignature}}),Object.defineProperty(e,"zeroPad",{enumerable:!0,get:function(){return u.zeroPad}}),Object.defineProperty(e,"splitSignature",{enumerable:!0,get:function(){return u.splitSignature}}),Object.defineProperty(e,"stripZeros",{enumerable:!0,get:function(){return u.stripZeros}});var l=LO;Object.defineProperty(e,"_TypedDataEncoder",{enumerable:!0,get:function(){return l._TypedDataEncoder}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return l.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return l.hashMessage}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return l.id}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return l.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return l.namehash}});var c=MO;Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return c.defaultPath}}),Object.defineProperty(e,"entropyToMnemonic",{enumerable:!0,get:function(){return c.entropyToMnemonic}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return c.getAccountPath}}),Object.defineProperty(e,"HDNode",{enumerable:!0,get:function(){return c.HDNode}}),Object.defineProperty(e,"isValidMnemonic",{enumerable:!0,get:function(){return c.isValidMnemonic}}),Object.defineProperty(e,"mnemonicToEntropy",{enumerable:!0,get:function(){return c.mnemonicToEntropy}}),Object.defineProperty(e,"mnemonicToSeed",{enumerable:!0,get:function(){return c.mnemonicToSeed}});var d=DO;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return d.getJsonWalletAddress}});var f=FO;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return f.keccak256}});var p=jO;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return p.Logger}});var h=BO;Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return h.computeHmac}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return h.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return h.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return h.sha512}});var m=RS;Object.defineProperty(e,"solidityKeccak256",{enumerable:!0,get:function(){return m.keccak256}}),Object.defineProperty(e,"solidityPack",{enumerable:!0,get:function(){return m.pack}}),Object.defineProperty(e,"soliditySha256",{enumerable:!0,get:function(){return m.sha256}});var y=_O;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return y.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return y.shuffled}});var g=zO;Object.defineProperty(e,"checkProperties",{enumerable:!0,get:function(){return g.checkProperties}}),Object.defineProperty(e,"deepCopy",{enumerable:!0,get:function(){return g.deepCopy}}),Object.defineProperty(e,"defineReadOnly",{enumerable:!0,get:function(){return g.defineReadOnly}}),Object.defineProperty(e,"getStatic",{enumerable:!0,get:function(){return g.getStatic}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return g.resolveProperties}}),Object.defineProperty(e,"shallowCopy",{enumerable:!0,get:function(){return g.shallowCopy}});var A=r(UO);e.RLP=A;var b=WO;Object.defineProperty(e,"computePublicKey",{enumerable:!0,get:function(){return b.computePublicKey}}),Object.defineProperty(e,"recoverPublicKey",{enumerable:!0,get:function(){return b.recoverPublicKey}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return b.SigningKey}});var v=HO;Object.defineProperty(e,"formatBytes32String",{enumerable:!0,get:function(){return v.formatBytes32String}}),Object.defineProperty(e,"nameprep",{enumerable:!0,get:function(){return v.nameprep}}),Object.defineProperty(e,"parseBytes32String",{enumerable:!0,get:function(){return v.parseBytes32String}}),Object.defineProperty(e,"_toEscapedUtf8String",{enumerable:!0,get:function(){return v._toEscapedUtf8String}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return v.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return v.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return v.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return v.Utf8ErrorFuncs}});var w=VO;Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return w.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return w.computeAddress}}),Object.defineProperty(e,"parseTransaction",{enumerable:!0,get:function(){return w.parse}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return w.recoverAddress}}),Object.defineProperty(e,"serializeTransaction",{enumerable:!0,get:function(){return w.serialize}}),Object.defineProperty(e,"TransactionTypes",{enumerable:!0,get:function(){return w.TransactionTypes}});var x=qO;Object.defineProperty(e,"commify",{enumerable:!0,get:function(){return x.commify}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return x.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return x.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return x.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return x.parseUnits}});var E=GO;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return E.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return E.verifyTypedData}});var T=XO;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return T._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return T.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return T.poll}});var C=BO;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return C.SupportedAlgorithm}});var I=HO;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return I.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return I.Utf8ErrorReason}})}(kO);var ZO={};Object.defineProperty(ZO,"__esModule",{value:!0}),ZO.DomainRegistryABI=void 0;ZO.DomainRegistryABI=[{inputs:[{internalType:"string",name:"domain",type:"string"}],name:"DomainAlreadyRegistered",type:"error"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"},{internalType:"uint256",name:"maxIndex",type:"uint256"},{internalType:"uint256",name:"suppliedIndex",type:"uint256"}],name:"DomainIndexOutOfRange",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"domain",type:"string"},{indexed:!1,internalType:"bytes4",name:"tag",type:"bytes4"},{indexed:!1,internalType:"uint256",name:"index",type:"uint256"}],name:"DomainRegistered",type:"event"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"},{internalType:"uint256",name:"index",type:"uint256"}],name:"getDomain",outputs:[{internalType:"string",name:"domain",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"}],name:"getDomains",outputs:[{internalType:"string[]",name:"domains",type:"string[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"}],name:"getNumberOfDomains",outputs:[{internalType:"uint256",name:"totalDomains",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"domain",type:"string"}],name:"setDomain",outputs:[{internalType:"bytes4",name:"tag",type:"bytes4"}],stateMutability:"nonpayable",type:"function"}];var YO={};Object.defineProperty(YO,"__esModule",{value:!0}),YO.SeaportABIv14=void 0;YO.SeaportABIv14=[{inputs:[{internalType:"address",name:"conduitController",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"BadContractSignature",type:"error"},{inputs:[],name:"BadFraction",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"BadReturnValueFromERC20OnTransfer",type:"error"},{inputs:[{internalType:"uint8",name:"v",type:"uint8"}],name:"BadSignatureV",type:"error"},{inputs:[],name:"CannotCancelOrder",type:"error"},{inputs:[],name:"ConsiderationCriteriaResolverOutOfRange",type:"error"},{inputs:[],name:"ConsiderationLengthNotEqualToTotalOriginal",type:"error"},{inputs:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"considerationIndex",type:"uint256"},{internalType:"uint256",name:"shortfallAmount",type:"uint256"}],name:"ConsiderationNotMet",type:"error"},{inputs:[],name:"CriteriaNotEnabledForItem",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"identifiers",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"}],name:"ERC1155BatchTransferGenericFailure",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"EtherTransferGenericFailure",type:"error"},{inputs:[],name:"InexactFraction",type:"error"},{inputs:[],name:"InsufficientEtherSupplied",type:"error"},{inputs:[],name:"Invalid1155BatchTransferEncoding",type:"error"},{inputs:[],name:"InvalidBasicOrderParameterEncoding",type:"error"},{inputs:[{internalType:"address",name:"conduit",type:"address"}],name:"InvalidCallToConduit",type:"error"},{inputs:[{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"address",name:"conduit",type:"address"}],name:"InvalidConduit",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"InvalidContractOrder",type:"error"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"InvalidERC721TransferAmount",type:"error"},{inputs:[],name:"InvalidFulfillmentComponentData",type:"error"},{inputs:[{internalType:"uint256",name:"value",type:"uint256"}],name:"InvalidMsgValue",type:"error"},{inputs:[],name:"InvalidNativeOfferItem",type:"error"},{inputs:[],name:"InvalidProof",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"InvalidRestrictedOrder",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"InvalidSigner",type:"error"},{inputs:[{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"}],name:"InvalidTime",type:"error"},{inputs:[{internalType:"uint256",name:"fulfillmentIndex",type:"uint256"}],name:"MismatchedFulfillmentOfferAndConsiderationComponents",type:"error"},{inputs:[{internalType:"enum Side",name:"side",type:"uint8"}],name:"MissingFulfillmentComponentOnAggregation",type:"error"},{inputs:[],name:"MissingItemAmount",type:"error"},{inputs:[],name:"MissingOriginalConsiderationItems",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"NoContract",type:"error"},{inputs:[],name:"NoReentrantCalls",type:"error"},{inputs:[],name:"NoSpecifiedOrdersAvailable",type:"error"},{inputs:[],name:"OfferAndConsiderationRequiredOnFulfillment",type:"error"},{inputs:[],name:"OfferCriteriaResolverOutOfRange",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderAlreadyFilled",type:"error"},{inputs:[{internalType:"enum Side",name:"side",type:"uint8"}],name:"OrderCriteriaResolverOutOfRange",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderIsCancelled",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderPartiallyFilled",type:"error"},{inputs:[],name:"PartialFillsNotEnabledForOrder",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"TokenTransferGenericFailure",type:"error"},{inputs:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"considerationIndex",type:"uint256"}],name:"UnresolvedConsiderationCriteria",type:"error"},{inputs:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"offerIndex",type:"uint256"}],name:"UnresolvedOfferCriteria",type:"error"},{inputs:[],name:"UnusedItemParameters",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"newCounter",type:"uint256"},{indexed:!0,internalType:"address",name:"offerer",type:"address"}],name:"CounterIncremented",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"orderHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"offerer",type:"address"},{indexed:!0,internalType:"address",name:"zone",type:"address"}],name:"OrderCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"orderHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"offerer",type:"address"},{indexed:!0,internalType:"address",name:"zone",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],indexed:!1,internalType:"struct SpentItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],indexed:!1,internalType:"struct ReceivedItem[]",name:"consideration",type:"tuple[]"}],name:"OrderFulfilled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"orderHash",type:"bytes32"},{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],indexed:!1,internalType:"struct OrderParameters",name:"orderParameters",type:"tuple"}],name:"OrderValidated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32[]",name:"orderHashes",type:"bytes32[]"}],name:"OrdersMatched",type:"event"},{inputs:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"counter",type:"uint256"}],internalType:"struct OrderComponents[]",name:"orders",type:"tuple[]"}],name:"cancel",outputs:[{internalType:"bool",name:"cancelled",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"uint120",name:"numerator",type:"uint120"},{internalType:"uint120",name:"denominator",type:"uint120"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],internalType:"struct AdvancedOrder",name:"advancedOrder",type:"tuple"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"enum Side",name:"side",type:"uint8"},{internalType:"uint256",name:"index",type:"uint256"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"bytes32[]",name:"criteriaProof",type:"bytes32[]"}],internalType:"struct CriteriaResolver[]",name:"criteriaResolvers",type:"tuple[]"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"address",name:"recipient",type:"address"}],name:"fulfillAdvancedOrder",outputs:[{internalType:"bool",name:"fulfilled",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"uint120",name:"numerator",type:"uint120"},{internalType:"uint120",name:"denominator",type:"uint120"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],internalType:"struct AdvancedOrder[]",name:"advancedOrders",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"enum Side",name:"side",type:"uint8"},{internalType:"uint256",name:"index",type:"uint256"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"bytes32[]",name:"criteriaProof",type:"bytes32[]"}],internalType:"struct CriteriaResolver[]",name:"criteriaResolvers",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"offerFulfillments",type:"tuple[][]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"considerationFulfillments",type:"tuple[][]"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"maximumFulfilled",type:"uint256"}],name:"fulfillAvailableAdvancedOrders",outputs:[{internalType:"bool[]",name:"availableOrders",type:"bool[]"},{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order[]",name:"orders",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"offerFulfillments",type:"tuple[][]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"considerationFulfillments",type:"tuple[][]"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"uint256",name:"maximumFulfilled",type:"uint256"}],name:"fulfillAvailableOrders",outputs:[{internalType:"bool[]",name:"availableOrders",type:"bool[]"},{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"considerationToken",type:"address"},{internalType:"uint256",name:"considerationIdentifier",type:"uint256"},{internalType:"uint256",name:"considerationAmount",type:"uint256"},{internalType:"address payable",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{internalType:"address",name:"offerToken",type:"address"},{internalType:"uint256",name:"offerIdentifier",type:"uint256"},{internalType:"uint256",name:"offerAmount",type:"uint256"},{internalType:"enum BasicOrderType",name:"basicOrderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"offererConduitKey",type:"bytes32"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalAdditionalRecipients",type:"uint256"},{components:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct AdditionalRecipient[]",name:"additionalRecipients",type:"tuple[]"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct BasicOrderParameters",name:"parameters",type:"tuple"}],name:"fulfillBasicOrder",outputs:[{internalType:"bool",name:"fulfilled",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order",name:"order",type:"tuple"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"}],name:"fulfillOrder",outputs:[{internalType:"bool",name:"fulfilled",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"contractOfferer",type:"address"}],name:"getContractOffererNonce",outputs:[{internalType:"uint256",name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"offerer",type:"address"}],name:"getCounter",outputs:[{internalType:"uint256",name:"counter",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"counter",type:"uint256"}],internalType:"struct OrderComponents",name:"order",type:"tuple"}],name:"getOrderHash",outputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"getOrderStatus",outputs:[{internalType:"bool",name:"isValidated",type:"bool"},{internalType:"bool",name:"isCancelled",type:"bool"},{internalType:"uint256",name:"totalFilled",type:"uint256"},{internalType:"uint256",name:"totalSize",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"incrementCounter",outputs:[{internalType:"uint256",name:"newCounter",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"information",outputs:[{internalType:"string",name:"version",type:"string"},{internalType:"bytes32",name:"domainSeparator",type:"bytes32"},{internalType:"address",name:"conduitController",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"uint120",name:"numerator",type:"uint120"},{internalType:"uint120",name:"denominator",type:"uint120"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],internalType:"struct AdvancedOrder[]",name:"orders",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"enum Side",name:"side",type:"uint8"},{internalType:"uint256",name:"index",type:"uint256"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"bytes32[]",name:"criteriaProof",type:"bytes32[]"}],internalType:"struct CriteriaResolver[]",name:"criteriaResolvers",type:"tuple[]"},{components:[{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"offerComponents",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"considerationComponents",type:"tuple[]"}],internalType:"struct Fulfillment[]",name:"fulfillments",type:"tuple[]"},{internalType:"address",name:"recipient",type:"address"}],name:"matchAdvancedOrders",outputs:[{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order[]",name:"orders",type:"tuple[]"},{components:[{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"offerComponents",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"considerationComponents",type:"tuple[]"}],internalType:"struct Fulfillment[]",name:"fulfillments",type:"tuple[]"}],name:"matchOrders",outputs:[{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"contractName",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order[]",name:"orders",type:"tuple[]"}],name:"validate",outputs:[{internalType:"bool",name:"validated",type:"bool"}],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];var KO={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DOMAIN_REGISTRY_ADDRESS=e.CROSS_CHAIN_SEAPORT_V1_5_ADDRESS=e.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS=e.KNOWN_CONDUIT_KEYS_TO_CONDUIT=e.NO_CONDUIT=e.ONE_HUNDRED_PERCENT_BP=e.MAX_INT=e.BasicOrderRouteType=e.Side=e.ItemType=e.OrderType=e.EIP_712_BULK_ORDER_TYPE=e.EIP_712_ORDER_TYPE=e.OPENSEA_CONDUIT_ADDRESS=e.OPENSEA_CONDUIT_KEY=e.SEAPORT_CONTRACT_VERSION_V1_5=e.SEAPORT_CONTRACT_VERSION_V1_4=e.SEAPORT_CONTRACT_NAME=void 0;const t=SO;var n,r,i,a;e.SEAPORT_CONTRACT_NAME="Seaport",e.SEAPORT_CONTRACT_VERSION_V1_4="1.4",e.SEAPORT_CONTRACT_VERSION_V1_5="1.5",e.OPENSEA_CONDUIT_KEY="0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000",e.OPENSEA_CONDUIT_ADDRESS="0x1e0049783f008a0085193e00003d00cd54003c71",e.EIP_712_ORDER_TYPE={OrderComponents:[{name:"offerer",type:"address"},{name:"zone",type:"address"},{name:"offer",type:"OfferItem[]"},{name:"consideration",type:"ConsiderationItem[]"},{name:"orderType",type:"uint8"},{name:"startTime",type:"uint256"},{name:"endTime",type:"uint256"},{name:"zoneHash",type:"bytes32"},{name:"salt",type:"uint256"},{name:"conduitKey",type:"bytes32"},{name:"counter",type:"uint256"}],OfferItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"}],ConsiderationItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"},{name:"recipient",type:"address"}]},e.EIP_712_BULK_ORDER_TYPE={BulkOrder:[{name:"tree",type:"OrderComponents[2][2][2][2][2][2][2]"}],OrderComponents:[{name:"offerer",type:"address"},{name:"zone",type:"address"},{name:"offer",type:"OfferItem[]"},{name:"consideration",type:"ConsiderationItem[]"},{name:"orderType",type:"uint8"},{name:"startTime",type:"uint256"},{name:"endTime",type:"uint256"},{name:"zoneHash",type:"bytes32"},{name:"salt",type:"uint256"},{name:"conduitKey",type:"bytes32"},{name:"counter",type:"uint256"}],OfferItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"}],ConsiderationItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"},{name:"recipient",type:"address"}]},function(e){e[e.FULL_OPEN=0]="FULL_OPEN",e[e.PARTIAL_OPEN=1]="PARTIAL_OPEN",e[e.FULL_RESTRICTED=2]="FULL_RESTRICTED",e[e.PARTIAL_RESTRICTED=3]="PARTIAL_RESTRICTED"}(n||(e.OrderType=n={})),function(e){e[e.NATIVE=0]="NATIVE",e[e.ERC20=1]="ERC20",e[e.ERC721=2]="ERC721",e[e.ERC1155=3]="ERC1155",e[e.ERC721_WITH_CRITERIA=4]="ERC721_WITH_CRITERIA",e[e.ERC1155_WITH_CRITERIA=5]="ERC1155_WITH_CRITERIA"}(r||(e.ItemType=r={})),function(e){e[e.OFFER=0]="OFFER",e[e.CONSIDERATION=1]="CONSIDERATION"}(i||(e.Side=i={})),function(e){e[e.ETH_TO_ERC721=0]="ETH_TO_ERC721",e[e.ETH_TO_ERC1155=1]="ETH_TO_ERC1155",e[e.ERC20_TO_ERC721=2]="ERC20_TO_ERC721",e[e.ERC20_TO_ERC1155=3]="ERC20_TO_ERC1155",e[e.ERC721_TO_ERC20=4]="ERC721_TO_ERC20",e[e.ERC1155_TO_ERC20=5]="ERC1155_TO_ERC20"}(a||(e.BasicOrderRouteType=a={})),e.MAX_INT=t.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.ONE_HUNDRED_PERCENT_BP=1e4,e.NO_CONDUIT="0x0000000000000000000000000000000000000000000000000000000000000000",e.KNOWN_CONDUIT_KEYS_TO_CONDUIT={[e.OPENSEA_CONDUIT_KEY]:e.OPENSEA_CONDUIT_ADDRESS},e.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS="0x00000000000001ad428e4906aE43D8F9852d0dD6",e.CROSS_CHAIN_SEAPORT_V1_5_ADDRESS="0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC",e.DOMAIN_REGISTRY_ADDRESS="0x000000000DaD0DE04D2B2D4a5A74581EBA94124A"}(KO);var QO={},JO={};Object.defineProperty(JO,"__esModule",{value:!0}),JO.ERC20ABI=void 0;JO.ERC20ABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];var $O={};Object.defineProperty($O,"__esModule",{value:!0}),$O.ERC721ABI=void 0;$O.ERC721ABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}];var eR,tR={},nR={};function rR(){if(eR)return nR;eR=1,Object.defineProperty(nR,"__esModule",{value:!0}),nR.getItemToCriteriaMap=nR.generateCriteriaResolvers=void 0;const e=KO,t=oR();nR.generateCriteriaResolvers=({orders:n,offerCriterias:r=[[]],considerationCriterias:i=[[]]})=>{const a=n.flatMap(((n,r)=>n.parameters.offer.map(((t,n)=>({orderIndex:r,item:t,index:n,side:e.Side.OFFER}))).filter((({item:e})=>(0,t.isCriteriaItem)(e.itemType))))),o=n.flatMap(((n,r)=>n.parameters.consideration.map(((t,n)=>({orderIndex:r,item:t,index:n,side:e.Side.CONSIDERATION}))).filter((({item:e})=>(0,t.isCriteriaItem)(e.itemType))))),s=(e,t)=>e.map((({orderIndex:e,item:n,index:r,side:i})=>{const a=n.identifierOrCriteria||"0",o=t[e][r];return{orderIndex:e,index:r,side:i,identifier:o.identifier,criteriaProof:"0"===a?[]:o.proof}}));return[...s(a,r),...s(o,i)]};return nR.getItemToCriteriaMap=(e,n)=>{const r=[...n];return e.reduce(((e,n)=>((0,t.isCriteriaItem)(n.itemType)&&e.set(n,r.shift()),e)),new Map)},nR}var iR,aR={};function oR(){return iR||(iR=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMaximumSizeForOrder=e.getSummedTokenAndIdentifierAmounts=e.getPresentItemAmount=e.isCriteriaItem=e.isErc1155Item=e.isErc721Item=e.isErc20Item=e.isNativeCurrencyItem=e.isCurrencyItem=void 0;const t=SO,n=KO,r=rR(),i=aR;e.isCurrencyItem=({itemType:e})=>[n.ItemType.NATIVE,n.ItemType.ERC20].includes(e);e.isNativeCurrencyItem=({itemType:e})=>e===n.ItemType.NATIVE;e.isErc20Item=e=>e===n.ItemType.ERC20;e.isErc721Item=e=>[n.ItemType.ERC721,n.ItemType.ERC721_WITH_CRITERIA].includes(e);e.isErc1155Item=e=>[n.ItemType.ERC1155,n.ItemType.ERC1155_WITH_CRITERIA].includes(e);e.isCriteriaItem=e=>[n.ItemType.ERC721_WITH_CRITERIA,n.ItemType.ERC1155_WITH_CRITERIA].includes(e);e.getPresentItemAmount=({startAmount:e,endAmount:n,timeBasedItemParams:r})=>{const i=t.BigNumber.from(e),a=t.BigNumber.from(n);if(!r)return i.gt(a)?i:a;const{isConsiderationItem:o,currentBlockTimestamp:s,ascendingAmountTimestampBuffer:u,startTime:l,endTime:c}=r,d=t.BigNumber.from(c).sub(l),f=a.gt(e),p=t.BigNumber.from(f?s+u:s);if(p.lt(l))return i;const h=(p.gt(c)?t.BigNumber.from(c):p).sub(l),m=d.sub(h);return i.mul(m).add(a.mul(h)).add(o?d.sub(1):0).div(d)};e.getSummedTokenAndIdentifierAmounts=({items:n,criterias:i,timeBasedItemParams:a})=>{const o=(0,r.getItemToCriteriaMap)(n,i),s=n.reduce(((n,r)=>{var i,s,u,l;const c=null!==(s=null===(i=o.get(r))||void 0===i?void 0:i.identifier)&&void 0!==s?s:r.identifierOrCriteria;return Object.assign(Object.assign({},n),{[r.token]:Object.assign(Object.assign({},n[r.token]),{[c]:(null!==(l=null===(u=n[r.token])||void 0===u?void 0:u[c])&&void 0!==l?l:t.BigNumber.from(0)).add((0,e.getPresentItemAmount)({startAmount:r.startAmount,endAmount:r.endAmount,timeBasedItemParams:a}))})})}),{});return s};e.getMaximumSizeForOrder=({parameters:{offer:e,consideration:t}})=>{const n=[...e,...t].flatMap((({startAmount:e,endAmount:t})=>[e,t]));return(0,i.findGcd)(n)}}(tR)),tR}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findGcd=e.gcd=void 0;const t=SO;e.gcd=(n,r)=>{const i=t.BigNumber.from(n),a=t.BigNumber.from(r);return i.eq(0)?a:(0,e.gcd)(a.mod(n),i)};e.findGcd=n=>{let r=t.BigNumber.from(n[0]);for(let t=1;t<n.length;t++)if(r=(0,e.gcd)(n[t],r),r.eq(1))return r;return r}}(aR);var sR={};!function(e){var t=it&&it.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getTagFromDomain=e.getTransactionMethods=e.executeAllActions=void 0;const n=kO;e.executeAllActions=e=>t(void 0,void 0,void 0,(function*(){for(let t=0;t<e.length-1;t++){const n=e[t];if("approval"===n.type){const e=yield n.transactionMethods.transact();yield e.wait()}}const t=e[e.length-1];switch(t.type){case"create":return t.createOrder();case"createBulk":return t.createBulkOrders();default:return t.transactionMethods.transact()}}));e.getTransactionMethods=(n,r,i,a)=>{const o=i[i.length-1];let s;(e=>{const t=["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","type","accessList","customData","ccipReadEnabled","value","blockTag","CallOverrides"];return void 0===e||Object.keys(e).every((e=>t.includes(e)))})(o)&&(s=o,i.pop());const u=o=>t(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},s),o),u=yield n.populateTransaction[r](...i,t);if(a){const t=(0,e.getTagFromDomain)(a);u.data=u.data+t}return u}));return{callStatic:e=>{const t=Object.assign(Object.assign({},s),e);return n.callStatic[r](...i,t)},estimateGas:e=>{const t=Object.assign(Object.assign({},s),e);return n.estimateGas[r](...i,t)},transact:e=>t(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},s),e),r=yield u(t);return n.signer.sendTransaction(r)})),buildTransaction:u}};e.getTagFromDomain=e=>(0,n.keccak256)((0,n.toUtf8Bytes)(e)).slice(2,10)}(sR);var uR=it&&it.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(QO,"__esModule",{value:!0}),QO.getApprovalActions=QO.approvedItemAmount=void 0;const lR=SO,cR=JO,dR=$O,fR=KO,pR=oR(),hR=sR;QO.approvedItemAmount=(e,t,n,r)=>uR(void 0,void 0,void 0,(function*(){if((0,pR.isErc721Item)(t.itemType)||(0,pR.isErc1155Item)(t.itemType)){return new lR.Contract(t.token,dR.ERC721ABI,r).isApprovedForAll(e,n).then((e=>e?fR.MAX_INT:lR.BigNumber.from(0)))}if(t.itemType===fR.ItemType.ERC20){return new lR.Contract(t.token,cR.ERC20ABI,r).allowance(e,n)}return fR.MAX_INT})),QO.getApprovalActions=function(e,t,n){return e.filter(((t,n)=>n===e.length-1||e[n+1].token!==t.token)).map((({token:e,operator:r,itemType:i,identifierOrCriteria:a,requiredApprovedAmount:o})=>{const s=(0,pR.isErc1155Item)(i);if((0,pR.isErc721Item)(i)||s){const o=new lR.Contract(e,dR.ERC721ABI,n);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,operator:r,transactionMethods:(0,hR.getTransactionMethods)(o.connect(n),t&&!s?"approve":"setApprovalForAll",[r,!(t&&!s)||a])}}{const s=new lR.Contract(e,cR.ERC20ABI,n);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,transactionMethods:(0,hR.getTransactionMethods)(s.connect(n),"approve",[r,t?o:fR.MAX_INT]),operator:r}}}))};var mR={},yR={},gR={};Object.defineProperty(gR,"__esModule",{value:!0}),gR.ERC1155ABI=void 0;gR.ERC1155ABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"amounts",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"owners",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"balances",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];var AR=it&&it.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(yR,"__esModule",{value:!0}),yR.balanceOf=void 0;const bR=SO,vR=gR,wR=JO,xR=$O,ER=KO,TR=oR();yR.balanceOf=(e,t,n,r)=>AR(void 0,void 0,void 0,(function*(){if((0,TR.isErc721Item)(t.itemType)){const i=new bR.Contract(t.token,xR.ERC721ABI,n);return t.itemType===ER.ItemType.ERC721_WITH_CRITERIA?r?i.ownerOf(r.identifier).then((t=>bR.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase())))):i.balanceOf(e):i.ownerOf(t.identifierOrCriteria).then((t=>bR.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase()))))}if((0,TR.isErc1155Item)(t.itemType)){const i=new bR.Contract(t.token,vR.ERC1155ABI,n);if(t.itemType===ER.ItemType.ERC1155_WITH_CRITERIA){if(!r){const e=bR.BigNumber.from(t.startAmount),n=bR.BigNumber.from(t.endAmount);return e.gt(n)?e:n}return i.balanceOf(e,r.identifier)}return i.balanceOf(e,t.identifierOrCriteria)}if((0,TR.isErc20Item)(t.itemType)){return new bR.Contract(t.token,wR.ERC20ABI,n).balanceOf(e)}return n.getBalance(e)})),function(e){var t=it&&it.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.validateStandardFulfillBalancesAndApprovals=e.validateBasicFulfillBalancesAndApprovals=e.validateOfferBalancesAndApprovals=e.getInsufficientBalanceAndApprovalAmounts=e.getBalancesAndApprovals=void 0;const n=SO,r=KO,i=QO,a=yR,o=rR(),s=oR(),u=(e,t,n)=>{const r=e.find((({token:e,identifierOrCriteria:r})=>t.toLowerCase()===e.toLowerCase()&&r.toLowerCase()===n.toLowerCase()));if(!r)throw new Error("Balances and approvals didn't contain all tokens and identifiers");return r};e.getBalancesAndApprovals=({owner:e,items:u,criterias:l,operator:c,multicallProvider:d})=>t(void 0,void 0,void 0,(function*(){const f=(0,o.getItemToCriteriaMap)(u,l);return Promise.all(u.map((o=>t(void 0,void 0,void 0,(function*(){var t,u;let l=Promise.resolve(n.BigNumber.from(0));return l=(0,s.isErc721Item)(o.itemType)||(0,s.isErc1155Item)(o.itemType)||(0,s.isErc20Item)(o.itemType)?(0,i.approvedItemAmount)(e,o,c,d):Promise.resolve(r.MAX_INT),{token:o.token,identifierOrCriteria:null!==(u=null===(t=f.get(o))||void 0===t?void 0:t.identifier)&&void 0!==u?u:o.identifierOrCriteria,balance:yield(0,a.balanceOf)(e,o,d,f.get(o)),approvedAmount:yield l,itemType:o.itemType}})))))}));e.getInsufficientBalanceAndApprovalAmounts=({balancesAndApprovals:e,tokenAndIdentifierAmounts:t,operator:n})=>{const r=[...Object.entries(t).map((([e,t])=>Object.entries(t).map((([t,n])=>[e,t,n]))))].flat(),i=t=>r.filter((([n,r,i])=>u(e,n,r)[t].lt(i))).map((([n,r,i])=>{const a=u(e,n,r);return{token:n,identifierOrCriteria:r,requiredAmount:i,amountHave:a[t],itemType:a.itemType}})),[a,o]=[i("balance"),i("approvedAmount").map((e=>({token:e.token,identifierOrCriteria:e.identifierOrCriteria,approvedAmount:e.amountHave,requiredApprovedAmount:e.requiredAmount,itemType:e.itemType,operator:n})))];return{insufficientBalances:a,insufficientApprovals:o}};e.validateOfferBalancesAndApprovals=({offer:t,criterias:n,balancesAndApprovals:r,timeBasedItemParams:i,throwOnInsufficientBalances:a=!0,throwOnInsufficientApprovals:o,operator:u})=>{const{insufficientBalances:l,insufficientApprovals:c}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:r,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:t,criterias:n,timeBasedItemParams:i?Object.assign(Object.assign({},i),{isConsiderationItem:!1}):void 0}),operator:u});if(a&&l.length>0)throw new Error("The offerer does not have the amount needed to create or fulfill.");if(o&&c.length>0)throw new Error("The offerer does not have the sufficient approvals.");return c};e.validateBasicFulfillBalancesAndApprovals=({offer:t,consideration:n,offererBalancesAndApprovals:r,fulfillerBalancesAndApprovals:i,timeBasedItemParams:a,offererOperator:o,fulfillerOperator:u})=>{(0,e.validateOfferBalancesAndApprovals)({offer:t,criterias:[],balancesAndApprovals:r,timeBasedItemParams:a,throwOnInsufficientApprovals:!0,operator:o});const l=n.filter((e=>e.itemType!==t[0].itemType)),{insufficientBalances:c,insufficientApprovals:d}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:i,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:l,criterias:[],timeBasedItemParams:Object.assign(Object.assign({},a),{isConsiderationItem:!0})}),operator:u});if(c.length>0)throw new Error("The fulfiller does not have the balances needed to fulfill.");return d};e.validateStandardFulfillBalancesAndApprovals=({offer:t,consideration:n,offerCriteria:r,considerationCriteria:i,offererBalancesAndApprovals:a,fulfillerBalancesAndApprovals:o,timeBasedItemParams:u,offererOperator:c,fulfillerOperator:d})=>{(0,e.validateOfferBalancesAndApprovals)({offer:t,criterias:r,balancesAndApprovals:a,timeBasedItemParams:u,throwOnInsufficientApprovals:!0,operator:c});const f=l({items:t,criterias:r,balancesAndApprovals:o,timeBasedItemParams:u}),{insufficientBalances:p,insufficientApprovals:h}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:f,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:n,criterias:i,timeBasedItemParams:Object.assign(Object.assign({},u),{isConsiderationItem:!0})}),operator:d});if(p.length>0)throw new Error("The fulfiller does not have the balances needed to fulfill.");return h};const l=({items:e,criterias:t,timeBasedItemParams:n,balancesAndApprovals:r})=>{const i=(0,s.getSummedTokenAndIdentifierAmounts)({items:e,criterias:t,timeBasedItemParams:Object.assign(Object.assign({},n),{isConsiderationItem:!1})}),a=r.map((e=>Object.assign({},e)));return Object.entries(i).forEach((([e,t])=>Object.entries(t).forEach((([t,n])=>{const r=u(a,e,t),i=a.indexOf(r);a[i].balance=a[i].balance.add(n)})))),a}}(mR);var CR={},IR={},SR={},kR={},OR={exports:{}};function RR(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var PR,NR={exports:{}},LR=ot(Object.freeze({__proto__:null,default:{}}));function MR(){return PR||(PR=1,function(e,t){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==it&&it.crypto&&(n=it.crypto),!n)try{n=LR}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},o=a.lib={},s=o.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=o.WordArray=s.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var a=0;a<i;a++){var o=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=o<<24-(r+a)%4*8}else for(var s=0;s<i;s+=4)t[r+s>>>2]=n[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new u.init(t,e)}}),l=a.enc={},c=l.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},f=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,i=r.words,a=r.sigBytes,o=this.blockSize,s=a/(4*o),l=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*o,c=e.min(4*l,a);if(l){for(var d=0;d<l;d+=o)this._doProcessBlock(i,d);n=i.splice(0,l),r.sigBytes-=c}return new u.init(n,c)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new h.HMAC.init(e,n).finalize(t)}}});var h=a.algo={};return a}(Math),n)}(NR)),NR.exports}!function(e,t){var n;e.exports=(n=MR(),function(e){var t=n,r=t.lib,i=r.WordArray,a=r.Hasher,o=t.algo,s=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(s[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var l=[],c=o.SHA256=a.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],d=n[6],f=n[7],p=0;p<64;p++){if(p<16)l[p]=0|e[t+p];else{var h=l[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,y=l[p-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;l[p]=m+l[p-7]+g+l[p-16]}var A=r&i^r&a^i&a,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),v=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&d)+u[p]+l[p];f=d,d=c,c=s,s=o+v|0,o=a,a=i,i=r,r=v+(b+A)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+s|0,n[5]=n[5]+c|0,n[6]=n[6]+d|0,n[7]=n[7]+f|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(c),t.HmacSHA256=a._createHmacHelper(c)}(Math),n.SHA256)}(OR);var DR=OR.exports,FR={exports:{}};!function(e,t){e.exports=function(){function e(e,t){var n=t?"└":"├";return n+=e?"─ ":"──┐"}function t(e,t){var n=[];for(var r in e)e.hasOwnProperty(r)&&(t&&"function"==typeof e[r]||n.push(r));return n}function n(r,i,a,o,s,u,l){var c,d,f="",p=0,h=o.slice(0);if(h.push([i,a])&&o.length>0&&(o.forEach((function(e,t){t>0&&(f+=(e[1]?" ":"│")+" "),d||e[0]!==i||(d=!0)})),f+=e(r,a)+r,s&&("object"!=typeof i||i instanceof Date)&&(f+=": "+i),d&&(f+=" (circular ref.)"),l(f)),!d&&"object"==typeof i){var m=t(i,u);m.forEach((function(e){c=++p===m.length,n(e,i[e],c,h,s,u,l)}))}}var r={asLines:function(e,t,r,i){n(".",e,!1,[],t,"function"!=typeof r&&r,i||r)},asTree:function(e,t,r){var i="";return n(".",e,!1,[],t,r,(function(e){i+=e+"\n"})),i}};return r}()}(FR);var jR,BR=FR.exports,_R={},zR={exports:{}},UR={exports:{}};function WR(){return jR||(jR=1,function(e,t){var n;e.exports=(n=MR(),function(e){var t=n,r=t.lib,i=r.Base,a=r.WordArray,o=t.x64={};o.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),o.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var e=this.words,t=e.length,n=[],r=0;r<t;r++){var i=e[r];n.push(i.high),n.push(i.low)}return a.create(n,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),n=t.length,r=0;r<n;r++)t[r]=t[r].clone();return e}})}(),n)}(UR)),UR.exports}var HR,VR={exports:{}};function qR(){return HR||(HR=1,function(e,t){var n;e.exports=(n=MR(),function(){if("function"==typeof ArrayBuffer){var e=n.lib.WordArray,t=e.init,r=e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,r=[],i=0;i<n;i++)r[i>>>2]|=e[i]<<24-i%4*8;t.call(this,r,n)}else t.apply(this,arguments)};r.prototype=e}}(),n.lib.WordArray)}(VR)),VR.exports}var GR,XR={exports:{}};function ZR(){return GR||(GR=1,function(e,t){var n;e.exports=(n=MR(),function(){var e=n,t=e.lib.WordArray,r=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i+=2){var a=t[i>>>2]>>>16-i%4*8&65535;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var n=e.length,r=[],i=0;i<n;i++)r[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return t.create(r,2*n)}},r.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],a=0;a<n;a+=2){var o=i(t[a>>>2]>>>16-a%4*8&65535);r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var n=e.length,r=[],a=0;a<n;a++)r[a>>>1]|=i(e.charCodeAt(a)<<16-a%2*16);return t.create(r,2*n)}}}(),n.enc.Utf16)}(XR)),XR.exports}var YR,KR={exports:{}};function QR(){return YR||(YR=1,function(e,t){var n;e.exports=(n=MR(),function(){var e=n,t=e.lib.WordArray;function r(e,n,r){for(var i=[],a=0,o=0;o<n;o++)if(o%4){var s=r[e.charCodeAt(o-1)]<<o%4*2|r[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=s<<24-a%4*8,a++}return t.create(i,a)}e.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],a=0;a<n;a+=3)for(var o=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<n;s++)i.push(r.charAt(o>>>6*(3-s)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<n.length;a++)i[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(t=s)}return r(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),n.enc.Base64)}(KR)),KR.exports}var JR,$R={exports:{}};function eP(){return JR||(JR=1,function(e,t){var n;e.exports=(n=MR(),function(){var e=n,t=e.lib.WordArray;function r(e,n,r){for(var i=[],a=0,o=0;o<n;o++)if(o%4){var s=r[e.charCodeAt(o-1)]<<o%4*2|r[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=s<<24-a%4*8,a++}return t.create(i,a)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var n=e.words,r=e.sigBytes,i=t?this._safe_map:this._map;e.clamp();for(var a=[],o=0;o<r;o+=3)for(var s=(n[o>>>2]>>>24-o%4*8&255)<<16|(n[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|n[o+2>>>2]>>>24-(o+2)%4*8&255,u=0;u<4&&o+.75*u<r;u++)a.push(i.charAt(s>>>6*(3-u)&63));var l=i.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e,t){void 0===t&&(t=!0);var n=e.length,i=t?this._safe_map:this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var o=0;o<i.length;o++)a[i.charCodeAt(o)]=o}var s=i.charAt(64);if(s){var u=e.indexOf(s);-1!==u&&(n=u)}return r(e,n,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),n.enc.Base64url)}($R)),$R.exports}var tP,nP={exports:{}};function rP(){return tP||(tP=1,function(e,t){var n;e.exports=(n=MR(),function(e){var t=n,r=t.lib,i=r.WordArray,a=r.Hasher,o=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=o.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,i=e[r];e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,o=e[t+0],u=e[t+1],p=e[t+2],h=e[t+3],m=e[t+4],y=e[t+5],g=e[t+6],A=e[t+7],b=e[t+8],v=e[t+9],w=e[t+10],x=e[t+11],E=e[t+12],T=e[t+13],C=e[t+14],I=e[t+15],S=a[0],k=a[1],O=a[2],R=a[3];S=l(S,k,O,R,o,7,s[0]),R=l(R,S,k,O,u,12,s[1]),O=l(O,R,S,k,p,17,s[2]),k=l(k,O,R,S,h,22,s[3]),S=l(S,k,O,R,m,7,s[4]),R=l(R,S,k,O,y,12,s[5]),O=l(O,R,S,k,g,17,s[6]),k=l(k,O,R,S,A,22,s[7]),S=l(S,k,O,R,b,7,s[8]),R=l(R,S,k,O,v,12,s[9]),O=l(O,R,S,k,w,17,s[10]),k=l(k,O,R,S,x,22,s[11]),S=l(S,k,O,R,E,7,s[12]),R=l(R,S,k,O,T,12,s[13]),O=l(O,R,S,k,C,17,s[14]),S=c(S,k=l(k,O,R,S,I,22,s[15]),O,R,u,5,s[16]),R=c(R,S,k,O,g,9,s[17]),O=c(O,R,S,k,x,14,s[18]),k=c(k,O,R,S,o,20,s[19]),S=c(S,k,O,R,y,5,s[20]),R=c(R,S,k,O,w,9,s[21]),O=c(O,R,S,k,I,14,s[22]),k=c(k,O,R,S,m,20,s[23]),S=c(S,k,O,R,v,5,s[24]),R=c(R,S,k,O,C,9,s[25]),O=c(O,R,S,k,h,14,s[26]),k=c(k,O,R,S,b,20,s[27]),S=c(S,k,O,R,T,5,s[28]),R=c(R,S,k,O,p,9,s[29]),O=c(O,R,S,k,A,14,s[30]),S=d(S,k=c(k,O,R,S,E,20,s[31]),O,R,y,4,s[32]),R=d(R,S,k,O,b,11,s[33]),O=d(O,R,S,k,x,16,s[34]),k=d(k,O,R,S,C,23,s[35]),S=d(S,k,O,R,u,4,s[36]),R=d(R,S,k,O,m,11,s[37]),O=d(O,R,S,k,A,16,s[38]),k=d(k,O,R,S,w,23,s[39]),S=d(S,k,O,R,T,4,s[40]),R=d(R,S,k,O,o,11,s[41]),O=d(O,R,S,k,h,16,s[42]),k=d(k,O,R,S,g,23,s[43]),S=d(S,k,O,R,v,4,s[44]),R=d(R,S,k,O,E,11,s[45]),O=d(O,R,S,k,I,16,s[46]),S=f(S,k=d(k,O,R,S,p,23,s[47]),O,R,o,6,s[48]),R=f(R,S,k,O,A,10,s[49]),O=f(O,R,S,k,C,15,s[50]),k=f(k,O,R,S,y,21,s[51]),S=f(S,k,O,R,E,6,s[52]),R=f(R,S,k,O,h,10,s[53]),O=f(O,R,S,k,w,15,s[54]),k=f(k,O,R,S,u,21,s[55]),S=f(S,k,O,R,b,6,s[56]),R=f(R,S,k,O,I,10,s[57]),O=f(O,R,S,k,g,15,s[58]),k=f(k,O,R,S,T,21,s[59]),S=f(S,k,O,R,m,6,s[60]),R=f(R,S,k,O,x,10,s[61]),O=f(O,R,S,k,p,15,s[62]),k=f(k,O,R,S,v,21,s[63]),a[0]=a[0]+S|0,a[1]=a[1]+k|0,a[2]=a[2]+O|0,a[3]=a[3]+R|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var a=e.floor(r/4294967296),o=r;n[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),n[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(n.length+1),this._process();for(var s=this._hash,u=s.words,l=0;l<4;l++){var c=u[l];u[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,n,r,i,a,o){var s=e+(t&n|~t&r)+i+o;return(s<<a|s>>>32-a)+t}function c(e,t,n,r,i,a,o){var s=e+(t&r|n&~r)+i+o;return(s<<a|s>>>32-a)+t}function d(e,t,n,r,i,a,o){var s=e+(t^n^r)+i+o;return(s<<a|s>>>32-a)+t}function f(e,t,n,r,i,a,o){var s=e+(n^(t|~r))+i+o;return(s<<a|s>>>32-a)+t}t.MD5=a._createHelper(u),t.HmacMD5=a._createHmacHelper(u)}(Math),n.MD5)}(nP)),nP.exports}var iP,aP={exports:{}};function oP(){return iP||(iP=1,function(e,t){var n;e.exports=(n=MR(),function(){var e=n,t=e.lib,r=t.WordArray,i=t.Hasher,a=e.algo,o=[],s=a.SHA1=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],s=n[3],u=n[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var d=(r<<5|r>>>27)+u+o[l];d+=l<20?1518500249+(i&a|~i&s):l<40?1859775393+(i^a^s):l<60?(i&a|i&s|a&s)-1894007588:(i^a^s)-899497514,u=s,s=a,a=i<<30|i>>>2,i=r,r=d}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=i._createHelper(s),e.HmacSHA1=i._createHmacHelper(s)}(),n.SHA1)}(aP)),aP.exports}var sP,uP={exports:{}};var lP,cP={exports:{}};function dP(){return lP||(lP=1,function(e,t){var n;e.exports=(n=MR(),WR(),function(){var e=n,t=e.lib.Hasher,r=e.x64,i=r.Word,a=r.WordArray,o=e.algo;function s(){return i.create.apply(i,arguments)}var u=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=s()}();var c=o.SHA512=t.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],d=n[6],f=n[7],p=r.high,h=r.low,m=i.high,y=i.low,g=a.high,A=a.low,b=o.high,v=o.low,w=s.high,x=s.low,E=c.high,T=c.low,C=d.high,I=d.low,S=f.high,k=f.low,O=p,R=h,P=m,N=y,L=g,M=A,D=b,F=v,j=w,B=x,_=E,z=T,U=C,W=I,H=S,V=k,q=0;q<80;q++){var G,X,Z=l[q];if(q<16)X=Z.high=0|e[t+2*q],G=Z.low=0|e[t+2*q+1];else{var Y=l[q-15],K=Y.high,Q=Y.low,J=(K>>>1|Q<<31)^(K>>>8|Q<<24)^K>>>7,$=(Q>>>1|K<<31)^(Q>>>8|K<<24)^(Q>>>7|K<<25),ee=l[q-2],te=ee.high,ne=ee.low,re=(te>>>19|ne<<13)^(te<<3|ne>>>29)^te>>>6,ie=(ne>>>19|te<<13)^(ne<<3|te>>>29)^(ne>>>6|te<<26),ae=l[q-7],oe=ae.high,se=ae.low,ue=l[q-16],le=ue.high,ce=ue.low;X=(X=(X=J+oe+((G=$+se)>>>0<$>>>0?1:0))+re+((G+=ie)>>>0<ie>>>0?1:0))+le+((G+=ce)>>>0<ce>>>0?1:0),Z.high=X,Z.low=G}var de,fe=j&_^~j&U,pe=B&z^~B&W,he=O&P^O&L^P&L,me=R&N^R&M^N&M,ye=(O>>>28|R<<4)^(O<<30|R>>>2)^(O<<25|R>>>7),ge=(R>>>28|O<<4)^(R<<30|O>>>2)^(R<<25|O>>>7),Ae=(j>>>14|B<<18)^(j>>>18|B<<14)^(j<<23|B>>>9),be=(B>>>14|j<<18)^(B>>>18|j<<14)^(B<<23|j>>>9),ve=u[q],we=ve.high,xe=ve.low,Ee=H+Ae+((de=V+be)>>>0<V>>>0?1:0),Te=ge+me;H=U,V=W,U=_,W=z,_=j,z=B,j=D+(Ee=(Ee=(Ee=Ee+fe+((de+=pe)>>>0<pe>>>0?1:0))+we+((de+=xe)>>>0<xe>>>0?1:0))+X+((de+=G)>>>0<G>>>0?1:0))+((B=F+de|0)>>>0<F>>>0?1:0)|0,D=L,F=M,L=P,M=N,P=O,N=R,O=Ee+(ye+he+(Te>>>0<ge>>>0?1:0))+((R=de+Te|0)>>>0<de>>>0?1:0)|0}h=r.low=h+R,r.high=p+O+(h>>>0<R>>>0?1:0),y=i.low=y+N,i.high=m+P+(y>>>0<N>>>0?1:0),A=a.low=A+M,a.high=g+L+(A>>>0<M>>>0?1:0),v=o.low=v+F,o.high=b+D+(v>>>0<F>>>0?1:0),x=s.low=x+B,s.high=w+j+(x>>>0<B>>>0?1:0),T=c.low=T+z,c.high=E+_+(T>>>0<z>>>0?1:0),I=d.low=I+W,d.high=C+U+(I>>>0<W>>>0?1:0),k=f.low=k+V,f.high=S+H+(k>>>0<V>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(r+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),n.SHA512)}(cP)),cP.exports}var fP,pP={exports:{}};var hP,mP={exports:{}};function yP(){return hP||(hP=1,function(e,t){var n;e.exports=(n=MR(),WR(),function(e){var t=n,r=t.lib,i=r.WordArray,a=r.Hasher,o=t.x64.Word,s=t.algo,u=[],l=[],c=[];!function(){for(var e=1,t=0,n=0;n<24;n++){u[e+5*t]=(n+1)*(n+2)/2%64;var r=(2*e+3*t)%5;e=t%5,t=r}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,a=0;a<24;a++){for(var s=0,d=0,f=0;f<7;f++){if(1&i){var p=(1<<f)-1;p<32?d^=1<<p:s^=1<<p-32}128&i?i=i<<1^113:i<<=1}c[a]=o.create(s,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=o.create()}();var f=s.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var n=this._state,r=this.blockSize/2,i=0;i<r;i++){var a=e[t+2*i],o=e[t+2*i+1];a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(k=n[i]).high^=o,k.low^=a}for(var s=0;s<24;s++){for(var f=0;f<5;f++){for(var p=0,h=0,m=0;m<5;m++)p^=(k=n[f+5*m]).high,h^=k.low;var y=d[f];y.high=p,y.low=h}for(f=0;f<5;f++){var g=d[(f+4)%5],A=d[(f+1)%5],b=A.high,v=A.low;for(p=g.high^(b<<1|v>>>31),h=g.low^(v<<1|b>>>31),m=0;m<5;m++)(k=n[f+5*m]).high^=p,k.low^=h}for(var w=1;w<25;w++){var x=(k=n[w]).high,E=k.low,T=u[w];T<32?(p=x<<T|E>>>32-T,h=E<<T|x>>>32-T):(p=E<<T-32|x>>>64-T,h=x<<T-32|E>>>64-T);var C=d[l[w]];C.high=p,C.low=h}var I=d[0],S=n[0];for(I.high=S.high,I.low=S.low,f=0;f<5;f++)for(m=0;m<5;m++){var k=n[w=f+5*m],O=d[w],R=d[(f+1)%5+5*m],P=d[(f+2)%5+5*m];k.high=O.high^~R.high&P.high,k.low=O.low^~R.low&P.low}k=n[0];var N=c[s];k.high^=N.high,k.low^=N.low}},_doFinalize:function(){var t=this._data,n=t.words;this._nDataBytes;var r=8*t.sigBytes,a=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/a)*a>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,u=s/8,l=[],c=0;c<u;c++){var d=o[c],f=d.high,p=d.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),l.push(p),l.push(f)}return new i.init(l,s)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),n=0;n<25;n++)t[n]=t[n].clone();return e}});t.SHA3=a._createHelper(f),t.HmacSHA3=a._createHmacHelper(f)}(Math),n.SHA3)}(mP)),mP.exports}var gP,AP={exports:{}};var bP,vP={exports:{}};function wP(){return bP||(bP=1,function(e,t){var n;e.exports=(n=MR(),void function(){var e=n,t=e.lib.Base,r=e.enc.Utf8;e.algo.HMAC=t.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),s=a.words,u=o.words,l=0;l<n;l++)s[l]^=1549556828,u[l]^=909522486;a.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})}())}(vP)),vP.exports}var xP,EP={exports:{}};var TP,CP={exports:{}};function IP(){return TP||(TP=1,function(e,t){var n;e.exports=(n=MR(),oP(),wP(),function(){var e=n,t=e.lib,r=t.Base,i=t.WordArray,a=e.algo,o=a.MD5,s=a.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:o,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n,r=this.cfg,a=r.hasher.create(),o=i.create(),s=o.words,u=r.keySize,l=r.iterations;s.length<u;){n&&a.update(n),n=a.update(e).finalize(t),a.reset();for(var c=1;c<l;c++)n=a.finalize(n),a.reset();o.concat(n)}return o.sigBytes=4*u,o}});e.EvpKDF=function(e,t,n){return s.create(n).compute(e,t)}}(),n.EvpKDF)}(CP)),CP.exports}var SP,kP={exports:{}};function OP(){return SP||(SP=1,function(e,t){var n;e.exports=(n=MR(),IP(),void(n.lib.Cipher||function(e){var t=n,r=t.lib,i=r.Base,a=r.WordArray,o=r.BufferedBlockAlgorithm,s=t.enc;s.Utf8;var u=s.Base64,l=t.algo.EvpKDF,c=r.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?b:g}return function(t){return{encrypt:function(n,r,i){return e(r).encrypt(t,n,r,i)},decrypt:function(n,r,i){return e(r).decrypt(t,n,r,i)}}}}()});r.StreamCipher=c.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=t.mode={},f=r.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=d.CBC=function(){var t=f.extend();function n(t,n,r){var i,a=this._iv;a?(i=a,this._iv=e):i=this._prevBlock;for(var o=0;o<r;o++)t[n+o]^=i[o]}return t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize;n.call(this,e,t,i),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,a=e.slice(t,t+i);r.decryptBlock(e,t),n.call(this,e,t,i),this._prevBlock=a}}),t}(),h=(t.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,r=n-e.sigBytes%n,i=r<<24|r<<16|r<<8|r,o=[],s=0;s<r;s+=4)o.push(i);var u=a.create(o,r);e.concat(u)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};r.BlockCipher=c.extend({cfg:c.cfg.extend({mode:p,padding:h}),reset:function(){var e;c.reset.call(this);var t=this.cfg,n=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(r,this,n&&n.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),y=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?a.create([1398893684,1701076831]).concat(n).concat(t):t).toString(u)},parse:function(e){var t,n=u.parse(e),r=n.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=a.create(r.slice(2,4)),r.splice(0,4),n.sigBytes-=16),m.create({ciphertext:n,salt:t})}},g=r.SerializableCipher=i.extend({cfg:i.extend({format:y}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r),a=i.finalize(t),o=i.cfg;return m.create({ciphertext:a,key:n,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),A=(t.kdf={}).OpenSSL={execute:function(e,t,n,r,i){if(r||(r=a.random(8)),i)o=l.create({keySize:t+n,hasher:i}).compute(e,r);else var o=l.create({keySize:t+n}).compute(e,r);var s=a.create(o.words.slice(t),4*n);return o.sigBytes=4*t,m.create({key:o,iv:s,salt:r})}},b=r.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:A}),encrypt:function(e,t,n,r){var i=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize,r.salt,r.hasher);r.iv=i.iv;var a=g.encrypt.call(this,e,t,i.key,r);return a.mixIn(i),a},decrypt:function(e,t,n,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var i=r.kdf.execute(n,e.keySize,e.ivSize,t.salt,r.hasher);return r.iv=i.iv,g.decrypt.call(this,e,t,i.key,r)}})}()))}(kP)),kP.exports}var RP,PP={exports:{}};function NP(){return RP||(RP=1,function(e,t){var n;e.exports=(n=MR(),OP(),n.mode.CFB=function(){var e=n.lib.BlockCipherMode.extend();function t(e,t,n,r){var i,a=this._iv;a?(i=a.slice(0),this._iv=void 0):i=this._prevBlock,r.encryptBlock(i,0);for(var o=0;o<n;o++)e[t+o]^=i[o]}return e.Encryptor=e.extend({processBlock:function(e,n){var r=this._cipher,i=r.blockSize;t.call(this,e,n,i,r),this._prevBlock=e.slice(n,n+i)}}),e.Decryptor=e.extend({processBlock:function(e,n){var r=this._cipher,i=r.blockSize,a=e.slice(n,n+i);t.call(this,e,n,i,r),this._prevBlock=a}}),e}(),n.mode.CFB)}(PP)),PP.exports}var LP,MP={exports:{}};function DP(){return LP||(LP=1,function(e,t){var n,r,i;e.exports=(i=MR(),OP(),i.mode.CTR=(n=i.lib.BlockCipherMode.extend(),r=n.Encryptor=n.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);n.encryptBlock(o,0),a[r-1]=a[r-1]+1|0;for(var s=0;s<r;s++)e[t+s]^=o[s]}}),n.Decryptor=r,n),i.mode.CTR)}(MP)),MP.exports}var FP,jP={exports:{}};function BP(){return FP||(FP=1,function(e,t){var n;e.exports=(n=MR(),OP(),
|
|
35
35
|
/** @preserve
|
|
36
36
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|