@imtbl/sdk 0.28.8 → 0.28.10
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 +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.js +1 -1
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +3 -3
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/index.browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).immutable={})}(this,(function(e){"use strict";function t(e,t){return function(){return e.apply(t,arguments)}}const{toString:r}=Object.prototype,{getPrototypeOf:n}=Object,i=(a=Object.create(null),e=>{const t=r.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const o=e=>(e=e.toLowerCase(),t=>i(t)===e),s=e=>t=>typeof t===e,{isArray:c}=Array,u=s("undefined");const f=o("ArrayBuffer");const d=s("string"),l=s("function"),h=s("number"),p=e=>null!==e&&"object"==typeof e,m=e=>{if("object"!==i(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},b=o("Date"),y=o("File"),g=o("Blob"),v=o("FileList"),w=o("URLSearchParams");function _(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),c(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function E(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,A=e=>!u(e)&&e!==T;const S=(R="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>R&&e instanceof R);var R;const k=o("HTMLFormElement"),O=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),I=o("RegExp"),x=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};_(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},C="abcdefghijklmnopqrstuvwxyz",M="0123456789",P={DIGIT:M,ALPHA:C,ALPHA_DIGIT:C+C.toUpperCase()+M};const N=o("AsyncFunction");var B={isArray:c,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&l(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||l(e.append)&&("formdata"===(t=i(e))||"object"===t&&l(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:d,isNumber:h,isBoolean:e=>!0===e||!1===e,isObject:p,isPlainObject:m,isUndefined:u,isDate:b,isFile:y,isBlob:g,isRegExp:I,isFunction:l,isStream:e=>p(e)&&l(e.pipe),isURLSearchParams:w,isTypedArray:S,isFileList:v,forEach:_,merge:function e(){const{caseless:t}=A(this)&&this||{},r={},n=(n,i)=>{const a=t&&E(r,i)||i;m(r[a])&&m(n)?r[a]=e(r[a],n):m(n)?r[a]=e({},n):c(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&_(arguments[e],n);return r},extend:(e,r,n,{allOwnKeys:i}={})=>(_(r,((r,i)=>{n&&l(r)?e[i]=t(r,n):e[i]=r}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,i)=>{let a,o,s;const c={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)s=a[o],i&&!i(s,e,t)||c[s]||(t[s]=e[s],c[s]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:i,kindOfTest:o,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(c(e))return e;let t=e.length;if(!h(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:k,hasOwnProperty:O,hasOwnProp:O,reduceDescriptors:x,freezeMethods:e=>{x(e,((t,r)=>{if(l(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];l(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return c(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:E,global:T,isContextDefined:A,ALPHABET:P,generateString:(e=16,t=P.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&l(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(p(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=c(e)?[]:{};return _(e,((e,t)=>{const a=r(e,n+1);!u(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:N,isThenable:e=>e&&(p(e)||l(e))&&l(e.then)&&l(e.catch)};function D(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}B.inherits(D,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const F=D.prototype,L={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{L[e]={value:e}})),Object.defineProperties(D,L),Object.defineProperty(F,"isAxiosError",{value:!0}),D.from=(e,t,r,n,i,a)=>{const o=Object.create(F);return B.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),D.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function U(e){return B.isPlainObject(e)||B.isArray(e)}function j(e){return B.endsWith(e,"[]")?e.slice(0,-2):e}function q(e,t,r){return e?e.concat(t).map((function(e,t){return e=j(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const z=B.toFlatObject(B,{},null,(function(e){return/^is[A-Z]/.test(e)}));function H(e,t,r){if(!B.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=B.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!B.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(B.isDate(e))return e.toISOString();if(!s&&B.isBlob(e))throw new D("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(e)||B.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(B.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(B.isArray(e)&&function(e){return B.isArray(e)&&!e.some(U)}(e)||(B.isFileList(e)||B.endsWith(r,"[]"))&&(s=B.toArray(e)))return r=j(r),s.forEach((function(e,n){!B.isUndefined(e)&&null!==e&&t.append(!0===o?q([r],n,a):null===o?r:r+"[]",c(e))})),!1;return!!U(e)||(t.append(q(i,r,a),c(e)),!1)}const f=[],d=Object.assign(z,{defaultVisitor:u,convertValue:c,isVisitable:U});if(!B.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!B.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),B.forEach(r,(function(r,a){!0===(!(B.isUndefined(r)||null===r)&&i.call(t,r,B.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),f.pop()}}(e),t}function G(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function V(e,t){this._pairs=[],e&&H(e,this,t)}const W=V.prototype;function K(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function X(e,t,r){if(!t)return e;const n=r&&r.encode||K,i=r&&r.serialize;let a;if(a=i?i(t,r):B.isURLSearchParams(t)?t.toString():new V(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}W.append=function(e,t){this._pairs.push([e,t])},W.toString=function(e){const t=e?function(t){return e.call(this,t,G)}:G;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var $=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){B.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},J={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Y={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:V,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function Q(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&B.isArray(n)?n.length:a,s)return B.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&B.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&B.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(B.isFormData(e)&&B.isFunction(e.entries)){const r={};return B.forEachEntry(e,((e,n)=>{t(function(e){return B.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const Z={"Content-Type":void 0};const ee={transitional:J,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=B.isObject(e);i&&B.isHTMLForm(e)&&(e=new FormData(e));if(B.isFormData(e))return n&&n?JSON.stringify(Q(e)):e;if(B.isArrayBuffer(e)||B.isBuffer(e)||B.isStream(e)||B.isFile(e)||B.isBlob(e))return e;if(B.isArrayBufferView(e))return e.buffer;if(B.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return H(e,new Y.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Y.isNode&&B.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=B.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return H(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(B.isString(e))try{return(t||JSON.parse)(e),B.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ee.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&B.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw D.from(e,D.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Y.classes.FormData,Blob:Y.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};B.forEach(["delete","get","head"],(function(e){ee.headers[e]={}})),B.forEach(["post","put","patch"],(function(e){ee.headers[e]=B.merge(Z)}));var te=ee;const re=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ne=Symbol("internals");function ie(e){return e&&String(e).trim().toLowerCase()}function ae(e){return!1===e||null==e?e:B.isArray(e)?e.map(ae):String(e)}function oe(e,t,r,n,i){return B.isFunction(n)?n.call(this,t,r):(i&&(t=r),B.isString(t)?B.isString(n)?-1!==t.indexOf(n):B.isRegExp(n)?n.test(t):void 0:void 0)}let se=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=ie(t);if(!i)throw new Error("header name must be a non-empty string");const a=B.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=ae(e))}const a=(e,t)=>B.forEach(e,((e,r)=>i(e,r,t)));return B.isPlainObject(e)||e instanceof this.constructor?a(e,t):B.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&re[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=ie(e)){const r=B.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(B.isFunction(t))return t.call(this,e,r);if(B.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ie(e)){const r=B.findKey(this,e);return!(!r||void 0===this[r]||t&&!oe(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=ie(e)){const i=B.findKey(r,e);!i||t&&!oe(0,r[i],i,t)||(delete r[i],n=!0)}}return B.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!oe(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return B.forEach(this,((n,i)=>{const a=B.findKey(r,i);if(a)return t[a]=ae(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=ae(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return B.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&B.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[ne]=this[ne]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ie(e);t[n]||(!function(e,t){const r=B.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return B.isArray(e)?e.forEach(n):n(e),this}};se.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),B.freezeMethods(se.prototype),B.freezeMethods(se);var ce=se;function ue(e,t){const r=this||te,n=t||r,i=ce.from(n.headers);let a=n.data;return B.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function fe(e){return!(!e||!e.__CANCEL__)}function de(e,t,r){D.call(this,null==e?"canceled":e,D.ERR_CANCELED,t,r),this.name="CanceledError"}B.inherits(de,D,{__CANCEL__:!0});var le=Y.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),B.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),B.isString(n)&&o.push("path="+n),B.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function he(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var pe=Y.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=B.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function me(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=n[o];i||(i=c),r[a]=s,n[a]=c;let f=o,d=0;for(;f!==a;)d+=r[f++],f%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),c-i<t)return;const l=u&&c-u;return l?Math.round(1e3*d/l):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,c=n(s);r=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:c||void 0,estimated:c&&o&&a<=o?(o-a)/c:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var be="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=ce.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}B.isFormData(n)&&(Y.isStandardBrowserEnv||Y.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=he(e.baseURL,e.url);function f(){if(!c)return;const n=ce.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new D("Request failed with status code "+r.status,[D.ERR_BAD_REQUEST,D.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),X(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=f:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(f)},c.onabort=function(){c&&(r(new D("Request aborted",D.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new D("Network Error",D.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||J;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new D(t,n.clarifyTimeoutError?D.ETIMEDOUT:D.ECONNABORTED,e,c)),c=null},Y.isStandardBrowserEnv){const t=(e.withCredentials||pe(u))&&e.xsrfCookieName&&le.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&B.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),B.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",me(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",me(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{c&&(r(!t||t.type?new de(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===Y.protocols.indexOf(d)?r(new D("Unsupported protocol "+d+":",D.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const ye={http:null,xhr:be};B.forEach(ye,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var ge=e=>{e=B.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=B.isString(r)?ye[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new D(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(B.hasOwnProp(ye,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!B.isFunction(n))throw new TypeError("adapter is not a function");return n};function ve(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new de(null,e)}function we(e){ve(e),e.headers=ce.from(e.headers),e.data=ue.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ge(e.adapter||te.adapter)(e).then((function(t){return ve(e),t.data=ue.call(e,e.transformResponse,t),t.headers=ce.from(t.headers),t}),(function(t){return fe(t)||(ve(e),t&&t.response&&(t.response.data=ue.call(e,e.transformResponse,t.response),t.response.headers=ce.from(t.response.headers))),Promise.reject(t)}))}const _e=e=>e instanceof ce?e.toJSON():e;function Ee(e,t){t=t||{};const r={};function n(e,t,r){return B.isPlainObject(e)&&B.isPlainObject(t)?B.merge.call({caseless:r},e,t):B.isPlainObject(t)?B.merge({},t):B.isArray(t)?t.slice():t}function i(e,t,r){return B.isUndefined(t)?B.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!B.isUndefined(t))return n(void 0,t)}function o(e,t){return B.isUndefined(t)?B.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t)=>i(_e(e),_e(t),!0)};return B.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||i,o=a(e[n],t[n],n);B.isUndefined(o)&&a!==s||(r[n]=o)})),r}const Te="1.4.0",Ae={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Ae[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Se={};Ae.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new D(n(i," has been removed"+(t?" in "+t:"")),D.ERR_DEPRECATED);return t&&!Se[i]&&(Se[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}};var Re={assertOptions:function(e,t,r){if("object"!=typeof e)throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new D("option "+a+" must be "+r,D.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new D("Unknown option "+a,D.ERR_BAD_OPTION)}},validators:Ae};const ke=Re.validators;let Oe=class{constructor(e){this.defaults=e,this.interceptors={request:new $,response:new $}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ee(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Re.assertOptions(r,{silentJSONParsing:ke.transitional(ke.boolean),forcedJSONParsing:ke.transitional(ke.boolean),clarifyTimeoutError:ke.transitional(ke.boolean)},!1),null!=n&&(B.isFunction(n)?t.paramsSerializer={serialize:n}:Re.assertOptions(n,{encode:ke.function,serialize:ke.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&B.merge(i.common,i[t.method]),a&&B.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=ce.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let f,d=0;if(!s){const e=[we.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,c),f=e.length,u=Promise.resolve(t);d<f;)u=u.then(e[d++],e[d++]);return u}f=o.length;let l=t;for(d=0;d<f;){const e=o[d++],t=o[d++];try{l=e(l)}catch(e){t.call(this,e);break}}try{u=we.call(this,l)}catch(e){return Promise.reject(e)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(e){return X(he((e=Ee(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};B.forEach(["delete","get","head","options"],(function(e){Oe.prototype[e]=function(t,r){return this.request(Ee(r||{},{method:e,url:t,data:(r||{}).data}))}})),B.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Ee(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Oe.prototype[e]=t(),Oe.prototype[e+"Form"]=t(!0)}));var Ie=Oe;var xe=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new de(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let t;const r=new e((function(e){t=e}));return{token:r,cancel:t}}};const Ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ce).forEach((([e,t])=>{Ce[t]=e}));var Me=Ce;const Pe=function e(r){const n=new Ie(r),i=t(Ie.prototype.request,n);return B.extend(i,Ie.prototype,n,{allOwnKeys:!0}),B.extend(i,n,null,{allOwnKeys:!0}),i.create=function(t){return e(Ee(r,t))},i}(te);Pe.Axios=Ie,Pe.CanceledError=de,Pe.CancelToken=xe,Pe.isCancel=fe,Pe.VERSION=Te,Pe.toFormData=H,Pe.AxiosError=D,Pe.Cancel=Pe.CanceledError,Pe.all=function(e){return Promise.all(e)},Pe.spread=function(e){return function(t){return e.apply(null,t)}},Pe.isAxiosError=function(e){return B.isObject(e)&&!0===e.isAxiosError},Pe.mergeConfig=Ee,Pe.AxiosHeaders=ce,Pe.formToJSON=e=>Q(B.isHTMLForm(e)?new FormData(e):e),Pe.HttpStatusCode=Me,Pe.default=Pe;var Ne=Pe;const{Axios:Be,AxiosError:De,CanceledError:Fe,isCancel:Le,CancelToken:Ue,VERSION:je,all:qe,Cancel:ze,isAxiosError:He,spread:Ge,toFormData:Ve,AxiosHeaders:We,HttpStatusCode:Ke,formToJSON:Xe,mergeConfig:$e}=Ne;var Je;!function(e){e.PRODUCTION="production",e.SANDBOX="sandbox"}(Je||(Je={}));class Ye{environment;rateLimitingKey;apiKey;clientAppId;constructor(e){if(this.environment=e.environment,e.rateLimitingKey&&(this.rateLimitingKey=e.rateLimitingKey,Ne.defaults.headers.common["x-api-key"]=this.rateLimitingKey),e.apiKey){if(!e.apiKey.startsWith("sk_imapik-"))throw new Error("Invalid API key");this.apiKey=e.apiKey,Ne.defaults.headers.common["x-immutable-api-key"]=this.apiKey}if(e.clientAppId){if(!e.clientAppId.startsWith("cai_imapik-"))throw new Error("Invalid Client App Id");this.clientAppId=e.clientAppId,Ne.defaults.headers.common["x-immutable-client-app-id"]=this.clientAppId}}}var Qe=Object.freeze({__proto__:null,get Environment(){return Je},ImmutableConfiguration:Ye});const Ze="https://api.sandbox.immutable.com".replace(/\/+$/,"");let et=class{basePath;axios;configuration;constructor(e,t=Ze,r=Ne){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}},tt=class extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}};const rt="https://example.com",nt=function(e,t,r){if(null==r)throw new tt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},it=async function(e,t,r){if(r&&r.apiKey){const n="function"==typeof r.apiKey?await r.apiKey(t):await r.apiKey;e[t]=n}},at=async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}};function ot(e,t,r=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>ot(e,t,r))):Object.keys(t).forEach((n=>ot(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t))}const st=function(e,...t){const r=new URLSearchParams(e.search);ot(r,t),e.search=r.toString()},ct=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},ut=function(e){return e.pathname+e.search+e.hash},ft=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||i.defaults.baseURL||a)+e.url};return i.request(o)}},dt=function(e){return{getActivity:async(t,r,n={})=>{nt("getActivity","chainName",t),nt("getActivity","activityId",r);const i="/v1/chains/{chain_name}/activities/{activity_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{activity_id}",encodeURIComponent(String(r))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};st(a,{});let c=o&&o.headers?o.headers:{};return s.headers={...c,...n.headers},{url:ut(a),options:s}},listActivities:async(t,r,n,i,a,o,s,c,u,f,d={})=>{nt("listActivities","chainName",t);const l="/v1/chains/{chain_name}/activities".replace("{chain_name}",encodeURIComponent(String(t))),h=new URL(l,rt);let p;e&&(p=e.baseOptions);const m={method:"GET",...p,...d},b={};void 0!==r&&(b.contract_address=r),void 0!==n&&(b.token_id=n),void 0!==i&&(b.account_address=i),void 0!==a&&(b.activity_type=a),void 0!==o&&(b.from_indexed_at=o instanceof Date?o.toISOString():o),void 0!==s&&(b.to_indexed_at=s instanceof Date?s.toISOString():s),void 0!==c&&(b.transaction_hash=c),void 0!==u&&(b.page_cursor=u),void 0!==f&&(b.page_size=f),st(h,b);let y=p&&p.headers?p.headers:{};return m.headers={...y,...d.headers},{url:ut(h),options:m}}}},lt=function(e){const t=dt(e);return{async getActivity(r,n,i){const a=await t.getActivity(r,n,i);return ft(a,Ne,Ze,e)},async listActivities(r,n,i,a,o,s,c,u,f,d,l){const h=await t.listActivities(r,n,i,a,o,s,c,u,f,d,l);return ft(h,Ne,Ze,e)}}};class ht extends et{getActivity(e,t){return lt(this.configuration).getActivity(e.chainName,e.activityId,t).then((e=>e(this.axios,this.basePath)))}listActivities(e,t){return lt(this.configuration).listActivities(e.chainName,e.contractAddress,e.tokenId,e.accountAddress,e.activityType,e.fromIndexedAt,e.toIndexedAt,e.transactionHash,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const pt=function(e){return{listChains:async(t,r,n={})=>{const i=new URL("/v1/chains",rt);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...n},s={};void 0!==t&&(s.page_cursor=t),void 0!==r&&(s.page_size=r),st(i,s);let c=a&&a.headers?a.headers:{};return o.headers={...c,...n.headers},{url:ut(i),options:o}}}},mt=function(e){const t=pt(e);return{async listChains(r,n,i){const a=await t.listChains(r,n,i);return ft(a,Ne,Ze,e)}}};class bt extends et{listChains(e={},t){return mt(this.configuration).listChains(e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const yt=function(e){return{getCollection:async(t,r,n={})=>{nt("getCollection","contractAddress",t),nt("getCollection","chainName",r);const i="/v1/chains/{chain_name}/collections/{contract_address}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};st(a,{});let c=o&&o.headers?o.headers:{};return s.headers={...c,...n.headers},{url:ut(a),options:s}},listCollections:async(t,r,n,i,a,o={})=>{nt("listCollections","chainName",t);const s="/v1/chains/{chain_name}/collections".replace("{chain_name}",encodeURIComponent(String(t))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};r&&(d.contract_address=r),void 0!==n&&(d.from_updated_at=n instanceof Date?n.toISOString():n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}},listCollectionsByNFTOwner:async(t,r,n,i,a={})=>{nt("listCollectionsByNFTOwner","accountAddress",t),nt("listCollectionsByNFTOwner","chainName",r);const o="/v1/chains/{chain_name}/accounts/{account_address}/collections".replace("{account_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),s=new URL(o,rt);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...a},f={};void 0!==n&&(f.page_cursor=n),void 0!==i&&(f.page_size=i),st(s,f);let d=c&&c.headers?c.headers:{};return u.headers={...d,...a.headers},{url:ut(s),options:u}},refreshCollectionMetadata:async(t,r,n,i={})=>{nt("refreshCollectionMetadata","contractAddress",t),nt("refreshCollectionMetadata","chainName",r),nt("refreshCollectionMetadata","refreshCollectionMetadataRequest",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/refresh-metadata".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...i},u={};await it(u,"x-immutable-api-Key",e),u["Content-Type"]="application/json",st(o,{});let f=s&&s.headers?s.headers:{};return c.headers={...u,...f,...i.headers},c.data=ct(n,c,e),{url:ut(o),options:c}}}},gt=function(e){const t=yt(e);return{async getCollection(r,n,i){const a=await t.getCollection(r,n,i);return ft(a,Ne,Ze,e)},async listCollections(r,n,i,a,o,s){const c=await t.listCollections(r,n,i,a,o,s);return ft(c,Ne,Ze,e)},async listCollectionsByNFTOwner(r,n,i,a,o){const s=await t.listCollectionsByNFTOwner(r,n,i,a,o);return ft(s,Ne,Ze,e)},async refreshCollectionMetadata(r,n,i,a){const o=await t.refreshCollectionMetadata(r,n,i,a);return ft(o,Ne,Ze,e)}}};class vt extends et{getCollection(e,t){return gt(this.configuration).getCollection(e.contractAddress,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listCollections(e,t){return gt(this.configuration).listCollections(e.chainName,e.contractAddress,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listCollectionsByNFTOwner(e,t){return gt(this.configuration).listCollectionsByNFTOwner(e.accountAddress,e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}refreshCollectionMetadata(e,t){return gt(this.configuration).refreshCollectionMetadata(e.contractAddress,e.chainName,e.refreshCollectionMetadataRequest,t).then((e=>e(this.axios,this.basePath)))}}const wt=function(e){return{getMetadata:async(t,r,n,i={})=>{nt("getMetadata","chainName",t),nt("getMetadata","contractAddress",r),nt("getMetadata","metadataId",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/metadata/{metadata_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{contract_address}",encodeURIComponent(String(r))).replace("{metadata_id}",encodeURIComponent(String(n))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i};st(o,{});let u=s&&s.headers?s.headers:{};return c.headers={...u,...i.headers},{url:ut(o),options:c}},listMetadata:async(t,r,n,i,a,o={})=>{nt("listMetadata","chainName",t),nt("listMetadata","contractAddress",r);const s="/v1/chains/{chain_name}/collections/{contract_address}/metadata".replace("{chain_name}",encodeURIComponent(String(t))).replace("{contract_address}",encodeURIComponent(String(r))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};void 0!==n&&(d.from_updated_at=n instanceof Date?n.toISOString():n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}},refreshMetadataByID:async(t,r,n,i={})=>{nt("refreshMetadataByID","chainName",t),nt("refreshMetadataByID","contractAddress",r),nt("refreshMetadataByID","refreshMetadataByIDRequest",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/metadata/refresh-metadata".replace("{chain_name}",encodeURIComponent(String(t))).replace("{contract_address}",encodeURIComponent(String(r))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...i},u={};await it(u,"x-immutable-api-Key",e),u["Content-Type"]="application/json",st(o,{});let f=s&&s.headers?s.headers:{};return c.headers={...u,...f,...i.headers},c.data=ct(n,c,e),{url:ut(o),options:c}},refreshNFTMetadataByTokenID:async(t,r,n,i={})=>{nt("refreshNFTMetadataByTokenID","contractAddress",t),nt("refreshNFTMetadataByTokenID","chainName",r),nt("refreshNFTMetadataByTokenID","refreshNFTMetadataByTokenIDRequest",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/nfts/refresh-metadata".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...i},u={};await it(u,"x-immutable-api-Key",e),u["Content-Type"]="application/json",st(o,{});let f=s&&s.headers?s.headers:{};return c.headers={...u,...f,...i.headers},c.data=ct(n,c,e),{url:ut(o),options:c}}}},_t=function(e){const t=wt(e);return{async getMetadata(r,n,i,a){const o=await t.getMetadata(r,n,i,a);return ft(o,Ne,Ze,e)},async listMetadata(r,n,i,a,o,s){const c=await t.listMetadata(r,n,i,a,o,s);return ft(c,Ne,Ze,e)},async refreshMetadataByID(r,n,i,a){const o=await t.refreshMetadataByID(r,n,i,a);return ft(o,Ne,Ze,e)},async refreshNFTMetadataByTokenID(r,n,i,a){const o=await t.refreshNFTMetadataByTokenID(r,n,i,a);return ft(o,Ne,Ze,e)}}};const Et=function(e){return{listNFTOwners:async(t,r,n,i,a,o={})=>{nt("listNFTOwners","contractAddress",t),nt("listNFTOwners","tokenId",r),nt("listNFTOwners","chainName",n);const s="/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}/owners".replace("{contract_address}",encodeURIComponent(String(t))).replace("{token_id}",encodeURIComponent(String(r))).replace("{chain_name}",encodeURIComponent(String(n))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}},listOwnersByContractAddress:async(t,r,n,i,a,o={})=>{nt("listOwnersByContractAddress","contractAddress",t),nt("listOwnersByContractAddress","chainName",r);const s="/v1/chains/{chain_name}/collections/{contract_address}/owners".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};void 0!==n&&(d.from_updated_at=n instanceof Date?n.toISOString():n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}}}},Tt=function(e){const t=Et(e);return{async listNFTOwners(r,n,i,a,o,s){const c=await t.listNFTOwners(r,n,i,a,o,s);return ft(c,Ne,Ze,e)},async listOwnersByContractAddress(r,n,i,a,o,s){const c=await t.listOwnersByContractAddress(r,n,i,a,o,s);return ft(c,Ne,Ze,e)}}};class At extends et{listNFTOwners(e,t){return Tt(this.configuration).listNFTOwners(e.contractAddress,e.tokenId,e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listOwnersByContractAddress(e,t){return Tt(this.configuration).listOwnersByContractAddress(e.contractAddress,e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const St=function(e){return{getNFT:async(t,r,n,i={})=>{nt("getNFT","contractAddress",t),nt("getNFT","tokenId",r),nt("getNFT","chainName",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{token_id}",encodeURIComponent(String(r))).replace("{chain_name}",encodeURIComponent(String(n))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i};st(o,{});let u=s&&s.headers?s.headers:{};return c.headers={...u,...i.headers},{url:ut(o),options:c}},listAllNFTOwners:async(t,r,n,i,a={})=>{nt("listAllNFTOwners","chainName",t),nt("listAllNFTOwners","fromUpdatedAt",r);const o="/v1/chains/{chain_name}/nft-owners".replace("{chain_name}",encodeURIComponent(String(t))),s=new URL(o,rt);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...a},f={};void 0!==r&&(f.from_updated_at=r instanceof Date?r.toISOString():r),void 0!==n&&(f.page_cursor=n),void 0!==i&&(f.page_size=i),st(s,f);let d=c&&c.headers?c.headers:{};return u.headers={...d,...a.headers},{url:ut(s),options:u}},listAllNFTs:async(t,r,n,i,a={})=>{nt("listAllNFTs","chainName",t);const o="/v1/chains/{chain_name}/nfts".replace("{chain_name}",encodeURIComponent(String(t))),s=new URL(o,rt);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...a},f={};void 0!==r&&(f.from_updated_at=r instanceof Date?r.toISOString():r),void 0!==n&&(f.page_cursor=n),void 0!==i&&(f.page_size=i),st(s,f);let d=c&&c.headers?c.headers:{};return u.headers={...d,...a.headers},{url:ut(s),options:u}},listNFTs:async(t,r,n,i,a,o={})=>{nt("listNFTs","contractAddress",t),nt("listNFTs","chainName",r);const s="/v1/chains/{chain_name}/collections/{contract_address}/nfts".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};void 0!==n&&(d.from_updated_at=n instanceof Date?n.toISOString():n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}},listNFTsByAccountAddress:async(t,r,n,i,a,o={})=>{nt("listNFTsByAccountAddress","accountAddress",t),nt("listNFTsByAccountAddress","chainName",r);const s="/v1/chains/{chain_name}/accounts/{account_address}/nfts".replace("{account_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};void 0!==n&&(d.contract_address=n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}}}},Rt=function(e){const t=St(e);return{async getNFT(r,n,i,a){const o=await t.getNFT(r,n,i,a);return ft(o,Ne,Ze,e)},async listAllNFTOwners(r,n,i,a,o){const s=await t.listAllNFTOwners(r,n,i,a,o);return ft(s,Ne,Ze,e)},async listAllNFTs(r,n,i,a,o){const s=await t.listAllNFTs(r,n,i,a,o);return ft(s,Ne,Ze,e)},async listNFTs(r,n,i,a,o,s){const c=await t.listNFTs(r,n,i,a,o,s);return ft(c,Ne,Ze,e)},async listNFTsByAccountAddress(r,n,i,a,o,s){const c=await t.listNFTsByAccountAddress(r,n,i,a,o,s);return ft(c,Ne,Ze,e)}}};class kt extends et{getNFT(e,t){return Rt(this.configuration).getNFT(e.contractAddress,e.tokenId,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listAllNFTOwners(e,t){return Rt(this.configuration).listAllNFTOwners(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listAllNFTs(e,t){return Rt(this.configuration).listAllNFTs(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listNFTs(e,t){return Rt(this.configuration).listNFTs(e.contractAddress,e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listNFTsByAccountAddress(e,t){return Rt(this.configuration).listNFTsByAccountAddress(e.accountAddress,e.chainName,e.contractAddress,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const Ot=function(e){return{cancelOrders:async(t,r,n={})=>{nt("cancelOrders","chainName",t),nt("cancelOrders","cancelOrdersRequestBody",r);const i="/v1/chains/{chain_name}/orders/cancel".replace("{chain_name}",encodeURIComponent(String(t))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};c["Content-Type"]="application/json",st(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=ct(r,s,e),{url:ut(a),options:s}},createListing:async(t,r,n={})=>{nt("createListing","chainName",t),nt("createListing","createListingRequestBody",r);const i="/v1/chains/{chain_name}/orders/listings".replace("{chain_name}",encodeURIComponent(String(t))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};c["Content-Type"]="application/json",st(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=ct(r,s,e),{url:ut(a),options:s}},fulfillmentData:async(t,r,n={})=>{nt("fulfillmentData","chainName",t),nt("fulfillmentData","fulfillmentDataRequest",r);const i="/v1/chains/{chain_name}/orders/fulfillment-data".replace("{chain_name}",encodeURIComponent(String(t))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};c["Content-Type"]="application/json",st(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=ct(r,s,e),{url:ut(a),options:s}},getListing:async(t,r,n={})=>{nt("getListing","chainName",t),nt("getListing","listingId",r);const i="/v1/chains/{chain_name}/orders/listings/{listing_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{listing_id}",encodeURIComponent(String(r))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};st(a,{});let c=o&&o.headers?o.headers:{};return s.headers={...c,...n.headers},{url:ut(a),options:s}},getTrade:async(t,r,n={})=>{nt("getTrade","chainName",t),nt("getTrade","tradeId",r);const i="/v1/chains/{chain_name}/trades/{trade_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{trade_id}",encodeURIComponent(String(r))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};st(a,{});let c=o&&o.headers?o.headers:{};return s.headers={...c,...n.headers},{url:ut(a),options:s}},listListings:async(t,r,n,i,a,o,s,c,u,f={})=>{nt("listListings","chainName",t);const d="/v1/chains/{chain_name}/orders/listings".replace("{chain_name}",encodeURIComponent(String(t))),l=new URL(d,rt);let h;e&&(h=e.baseOptions);const p={method:"GET",...h,...f},m={};void 0!==r&&(m.status=r),void 0!==n&&(m.sell_item_contract_address=n),void 0!==i&&(m.buy_item_contract_address=i),void 0!==a&&(m.sell_item_token_id=a),void 0!==o&&(m.page_size=o),void 0!==s&&(m.sort_by=s),void 0!==c&&(m.sort_direction=c),void 0!==u&&(m.page_cursor=u),st(l,m);let b=h&&h.headers?h.headers:{};return p.headers={...b,...f.headers},{url:ut(l),options:p}},listTrades:async(t,r,n,i,a,o,s={})=>{nt("listTrades","chainName",t);const c="/v1/chains/{chain_name}/trades".replace("{chain_name}",encodeURIComponent(String(t))),u=new URL(c,rt);let f;e&&(f=e.baseOptions);const d={method:"GET",...f,...s},l={};void 0!==r&&(l.account_address=r),void 0!==n&&(l.page_size=n),void 0!==i&&(l.sort_by=i),void 0!==a&&(l.sort_direction=a),void 0!==o&&(l.page_cursor=o),st(u,l);let h=f&&f.headers?f.headers:{};return d.headers={...h,...s.headers},{url:ut(u),options:d}}}},It=function(e){const t=Ot(e);return{async cancelOrders(r,n,i){const a=await t.cancelOrders(r,n,i);return ft(a,Ne,Ze,e)},async createListing(r,n,i){const a=await t.createListing(r,n,i);return ft(a,Ne,Ze,e)},async fulfillmentData(r,n,i){const a=await t.fulfillmentData(r,n,i);return ft(a,Ne,Ze,e)},async getListing(r,n,i){const a=await t.getListing(r,n,i);return ft(a,Ne,Ze,e)},async getTrade(r,n,i){const a=await t.getTrade(r,n,i);return ft(a,Ne,Ze,e)},async listListings(r,n,i,a,o,s,c,u,f,d){const l=await t.listListings(r,n,i,a,o,s,c,u,f,d);return ft(l,Ne,Ze,e)},async listTrades(r,n,i,a,o,s,c){const u=await t.listTrades(r,n,i,a,o,s,c);return ft(u,Ne,Ze,e)}}};class xt extends et{cancelOrders(e,t){return It(this.configuration).cancelOrders(e.chainName,e.cancelOrdersRequestBody,t).then((e=>e(this.axios,this.basePath)))}createListing(e,t){return It(this.configuration).createListing(e.chainName,e.createListingRequestBody,t).then((e=>e(this.axios,this.basePath)))}fulfillmentData(e,t){return It(this.configuration).fulfillmentData(e.chainName,e.fulfillmentDataRequest,t).then((e=>e(this.axios,this.basePath)))}getListing(e,t){return It(this.configuration).getListing(e.chainName,e.listingId,t).then((e=>e(this.axios,this.basePath)))}getTrade(e,t){return It(this.configuration).getTrade(e.chainName,e.tradeId,t).then((e=>e(this.axios,this.basePath)))}listListings(e,t){return It(this.configuration).listListings(e.chainName,e.status,e.sellItemContractAddress,e.buyItemContractAddress,e.sellItemTokenId,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,t).then((e=>e(this.axios,this.basePath)))}listTrades(e,t){return It(this.configuration).listTrades(e.chainName,e.accountAddress,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,t).then((e=>e(this.axios,this.basePath)))}}const Ct=function(e){return{createCounterfactualAddress:async(t,r={})=>{nt("createCounterfactualAddress","createCounterfactualAddressRequest",t);const n=new URL("/passport-mr/v1/counterfactual-address",rt);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...r},o={};await at(o,e),o["Content-Type"]="application/json",st(n,{});let s=i&&i.headers?i.headers:{};return a.headers={...o,...s,...r.headers},a.data=ct(t,a,e),{url:ut(n),options:a}},getLinkedAddresses:async(t,r={})=>{nt("getLinkedAddresses","userId",t);const n="/passport-mr/v1/users/{userId}/linked-addresses".replace("{userId}",encodeURIComponent(String(t))),i=new URL(n,rt);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...r},s={};await at(s,e),st(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:ut(i),options:o}}}},Mt=function(e){const t=Ct(e);return{async createCounterfactualAddress(r,n){const i=await t.createCounterfactualAddress(r,n);return ft(i,Ne,Ze,e)},async getLinkedAddresses(r,n){const i=await t.getLinkedAddresses(r,n);return ft(i,Ne,Ze,e)}}};class Pt extends et{createCounterfactualAddress(e,t){return Mt(this.configuration).createCounterfactualAddress(e.createCounterfactualAddressRequest,t).then((e=>e(this.axios,this.basePath)))}getLinkedAddresses(e,t){return Mt(this.configuration).getLinkedAddresses(e.userId,t).then((e=>e(this.axios,this.basePath)))}}const Nt=function(e){return{getERC20Token:async(t,r,n={})=>{nt("getERC20Token","contractAddress",t),nt("getERC20Token","chainName",r);const i="/v1/chains/{chain_name}/tokens/{contract_address}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};st(a,{});let c=o&&o.headers?o.headers:{};return s.headers={...c,...n.headers},{url:ut(a),options:s}},listERC20Tokens:async(t,r,n,i,a={})=>{nt("listERC20Tokens","chainName",t);const o="/v1/chains/{chain_name}/tokens".replace("{chain_name}",encodeURIComponent(String(t))),s=new URL(o,rt);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...a},f={};void 0!==r&&(f.from_updated_at=r instanceof Date?r.toISOString():r),void 0!==n&&(f.page_cursor=n),void 0!==i&&(f.page_size=i),st(s,f);let d=c&&c.headers?c.headers:{};return u.headers={...d,...a.headers},{url:ut(s),options:u}}}},Bt=function(e){const t=Nt(e);return{async getERC20Token(r,n,i){const a=await t.getERC20Token(r,n,i);return ft(a,Ne,Ze,e)},async listERC20Tokens(r,n,i,a,o){const s=await t.listERC20Tokens(r,n,i,a,o);return ft(s,Ne,Ze,e)}}};const Dt={Mint:"mint",Burn:"burn",Transfer:"transfer",Sale:"sale",Deposit:"deposit",Withdrawal:"withdrawal"};var Ft=Object.freeze({__proto__:null,ActiveOrderStatusNameEnum:{Active:"ACTIVE"},ActivitiesApi:ht,ActivitiesApiAxiosParamCreator:dt,ActivitiesApiFactory:function(e,t,r){const n=lt(e);return{getActivity:(e,i)=>n.getActivity(e.chainName,e.activityId,i).then((e=>e(r,t))),listActivities:(e,i)=>n.listActivities(e.chainName,e.contractAddress,e.tokenId,e.accountAddress,e.activityType,e.fromIndexedAt,e.toIndexedAt,e.transactionHash,e.pageCursor,e.pageSize,i).then((e=>e(r,t)))}},ActivitiesApiFp:lt,ActivityType:Dt,CancelledOrderStatusCancellationTypeEnum:{OnChain:"ON_CHAIN",OffChain:"OFF_CHAIN"},CancelledOrderStatusNameEnum:{Cancelled:"CANCELLED"},ChainsApi:bt,ChainsApiAxiosParamCreator:pt,ChainsApiFactory:function(e,t,r){const n=mt(e);return{listChains:(e={},i)=>n.listChains(e.pageCursor,e.pageSize,i).then((e=>e(r,t)))}},ChainsApiFp:mt,CollectionContractType:{Erc721:"ERC721"},CollectionsApi:vt,CollectionsApiAxiosParamCreator:yt,CollectionsApiFactory:function(e,t,r){const n=gt(e);return{getCollection:(e,i)=>n.getCollection(e.contractAddress,e.chainName,i).then((e=>e(r,t))),listCollections:(e,i)=>n.listCollections(e.chainName,e.contractAddress,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),listCollectionsByNFTOwner:(e,i)=>n.listCollectionsByNFTOwner(e.accountAddress,e.chainName,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),refreshCollectionMetadata:(e,i)=>n.refreshCollectionMetadata(e.contractAddress,e.chainName,e.refreshCollectionMetadataRequest,i).then((e=>e(r,t)))}},CollectionsApiFp:gt,Configuration:class{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}},ERC20ItemItemTypeEnum:{Erc20:"ERC20"},ERC721ItemItemTypeEnum:{Erc721:"ERC721"},ExpiredOrderStatusNameEnum:{Expired:"EXPIRED"},FailedOrderCancellationReasonCodeEnum:{AlreadyFilled:"ALREADY_FILLED"},FeeFeeTypeEnum:{Royalty:"ROYALTY",MakerEcosystem:"MAKER_ECOSYSTEM",TakerEcosystem:"TAKER_ECOSYSTEM",Protocol:"PROTOCOL"},FilledOrderStatusNameEnum:{Filled:"FILLED"},InactiveOrderStatusNameEnum:{Inactive:"INACTIVE"},ListListingsSortByEnum:{CreatedAt:"created_at",UpdatedAt:"updated_at",BuyItemAmount:"buy_item_amount"},ListListingsSortDirectionEnum:{Asc:"asc",Desc:"desc"},ListTradesSortByEnum:{IndexedAt:"indexed_at"},ListTradesSortDirectionEnum:{Asc:"asc",Desc:"desc"},MetadataApi:class extends et{getMetadata(e,t){return _t(this.configuration).getMetadata(e.chainName,e.contractAddress,e.metadataId,t).then((e=>e(this.axios,this.basePath)))}listMetadata(e,t){return _t(this.configuration).listMetadata(e.chainName,e.contractAddress,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}refreshMetadataByID(e,t){return _t(this.configuration).refreshMetadataByID(e.chainName,e.contractAddress,e.refreshMetadataByIDRequest,t).then((e=>e(this.axios,this.basePath)))}refreshNFTMetadataByTokenID(e,t){return _t(this.configuration).refreshNFTMetadataByTokenID(e.contractAddress,e.chainName,e.refreshNFTMetadataByTokenIDRequest,t).then((e=>e(this.axios,this.basePath)))}},MetadataApiAxiosParamCreator:wt,MetadataApiFactory:function(e,t,r){const n=_t(e);return{getMetadata:(e,i)=>n.getMetadata(e.chainName,e.contractAddress,e.metadataId,i).then((e=>e(r,t))),listMetadata:(e,i)=>n.listMetadata(e.chainName,e.contractAddress,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),refreshMetadataByID:(e,i)=>n.refreshMetadataByID(e.chainName,e.contractAddress,e.refreshMetadataByIDRequest,i).then((e=>e(r,t))),refreshNFTMetadataByTokenID:(e,i)=>n.refreshNFTMetadataByTokenID(e.contractAddress,e.chainName,e.refreshNFTMetadataByTokenIDRequest,i).then((e=>e(r,t)))}},MetadataApiFp:_t,NFTContractType:{Erc721:"ERC721"},NativeItemItemTypeEnum:{Native:"NATIVE"},NftOwnersApi:At,NftOwnersApiAxiosParamCreator:Et,NftOwnersApiFactory:function(e,t,r){const n=Tt(e);return{listNFTOwners:(e,i)=>n.listNFTOwners(e.contractAddress,e.tokenId,e.chainName,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),listOwnersByContractAddress:(e,i)=>n.listOwnersByContractAddress(e.contractAddress,e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t)))}},NftOwnersApiFp:Tt,NftsApi:kt,NftsApiAxiosParamCreator:St,NftsApiFactory:function(e,t,r){const n=Rt(e);return{getNFT:(e,i)=>n.getNFT(e.contractAddress,e.tokenId,e.chainName,i).then((e=>e(r,t))),listAllNFTOwners:(e,i)=>n.listAllNFTOwners(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),listAllNFTs:(e,i)=>n.listAllNFTs(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),listNFTs:(e,i)=>n.listNFTs(e.contractAddress,e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),listNFTsByAccountAddress:(e,i)=>n.listNFTsByAccountAddress(e.accountAddress,e.chainName,e.contractAddress,e.pageCursor,e.pageSize,i).then((e=>e(r,t)))}},NftsApiFp:Rt,OrderStatusName:{Pending:"PENDING",Active:"ACTIVE",Inactive:"INACTIVE",Filled:"FILLED",Expired:"EXPIRED",Cancelled:"CANCELLED"},OrdersApi:xt,OrdersApiAxiosParamCreator:Ot,OrdersApiFactory:function(e,t,r){const n=It(e);return{cancelOrders:(e,i)=>n.cancelOrders(e.chainName,e.cancelOrdersRequestBody,i).then((e=>e(r,t))),createListing:(e,i)=>n.createListing(e.chainName,e.createListingRequestBody,i).then((e=>e(r,t))),fulfillmentData:(e,i)=>n.fulfillmentData(e.chainName,e.fulfillmentDataRequest,i).then((e=>e(r,t))),getListing:(e,i)=>n.getListing(e.chainName,e.listingId,i).then((e=>e(r,t))),getTrade:(e,i)=>n.getTrade(e.chainName,e.tradeId,i).then((e=>e(r,t))),listListings:(e,i)=>n.listListings(e.chainName,e.status,e.sellItemContractAddress,e.buyItemContractAddress,e.sellItemTokenId,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,i).then((e=>e(r,t))),listTrades:(e,i)=>n.listTrades(e.chainName,e.accountAddress,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,i).then((e=>e(r,t)))}},OrdersApiFp:It,PassportApi:Pt,PassportApiAxiosParamCreator:Ct,PassportApiFactory:function(e,t,r){const n=Mt(e);return{createCounterfactualAddress:(e,i)=>n.createCounterfactualAddress(e.createCounterfactualAddressRequest,i).then((e=>e(r,t))),getLinkedAddresses:(e,i)=>n.getLinkedAddresses(e.userId,i).then((e=>e(r,t)))}},PassportApiFp:Mt,PendingOrderStatusNameEnum:{Pending:"PENDING"},ProtocolDataOrderTypeEnum:{FullRestricted:"FULL_RESTRICTED"},SaleFeeTypeEnum:{Royalty:"ROYALTY"},TokenContractType:{Erc20:"ERC20"},TokensApi:class extends et{getERC20Token(e,t){return Bt(this.configuration).getERC20Token(e.contractAddress,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listERC20Tokens(e,t){return Bt(this.configuration).listERC20Tokens(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}},TokensApiAxiosParamCreator:Nt,TokensApiFactory:function(e,t,r){const n=Bt(e);return{getERC20Token:(e,i)=>n.getERC20Token(e.contractAddress,e.chainName,i).then((e=>e(r,t))),listERC20Tokens:(e,i)=>n.listERC20Tokens(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t)))}},TokensApiFp:Bt}),Lt=Object.freeze({__proto__:null,ActivityType:Dt}),Ut=Object.freeze({__proto__:null}),jt=Object.freeze({__proto__:null}),qt=Object.freeze({__proto__:null}),zt=Object.freeze({__proto__:null}),Ht=Object.freeze({__proto__:null}),Gt=Object.freeze({__proto__:null});class Vt{config;activitiesApi;chainsApi;collectionApi;nftOwnersApi;nftsApi;ordersApi;passportApi;constructor(e){this.config=e,this.activitiesApi=new ht(e.indexer),this.chainsApi=new bt(e.indexer),this.collectionApi=new vt(e.indexer),this.nftOwnersApi=new At(e.indexer),this.nftsApi=new kt(e.indexer),this.ordersApi=new xt(e.orderBook),this.passportApi=new Pt(e.passport)}}const Wt={"x-sdk-version":"ts-immutable-sdk-0.28.8"},Kt=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...Wt,...t||{}}}};return new class{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}(r)},Xt=()=>({indexer:Kt({basePath:"https://indexer-mr.imtbl.com"}),orderBook:Kt({basePath:"https://order-book-mr.imtbl.com"}),passport:Kt({basePath:"https://api.immutable.com"})}),$t=()=>({indexer:Kt({basePath:"https://api.sandbox.immutable.com"}),orderBook:Kt({basePath:"https://api.sandbox.immutable.com"}),passport:Kt({basePath:"https://api.sandbox.immutable.com"})});class Jt extends Error{code;details;link;traceId;constructor({message:e,code:t,details:r,link:n,trace_id:i}){super(e),this.code=t,this.details=r,this.link=n,this.traceId=i}}const Yt={sdkVersion:"ts-immutable-sdk-multi-rollup-api-client-0.28.8"},Qt=({baseConfig:e,basePath:t,headers:r})=>{if(!t.trim())throw Error("basePath can not be empty");const n={...e,basePath:t,baseOptions:{headers:{...r||{},...Yt}}};return new Ft.Configuration(n)};class Zt{apiConfig;baseConfig;constructor({baseConfig:e,overrides:t}){if(this.baseConfig=e,t)this.apiConfig=Qt(t);else switch(e.environment){case Je.SANDBOX:this.apiConfig=Qt({basePath:"https://api.sandbox.immutable.com",baseConfig:e});break;case Je.PRODUCTION:this.apiConfig=Qt({basePath:"https://indexer-mr.imtbl.com",baseConfig:e});break;default:this.apiConfig=Qt({basePath:"https://api.sandbox.immutable.com",baseConfig:e})}}}function er(e){if(Ne.isAxiosError(e)&&e.response){const t=e.response.data;return t.code&&t.message?new Jt({code:t.code,message:t.message,details:t.details||null,link:t.link||"",trace_id:t.trace_id||""}):new Jt({code:e.code??e.response?.status.toString()??"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}return new Jt({code:"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}class tr{config;activities;chains;collections;nfts;nftOwners;tokens;metadata;constructor(e){this.config=new Zt(e),this.activities=new Ft.ActivitiesApi(this.config.apiConfig),this.chains=new Ft.ChainsApi(this.config.apiConfig),this.collections=new Ft.CollectionsApi(this.config.apiConfig),this.nfts=new Ft.NftsApi(this.config.apiConfig),this.nftOwners=new Ft.NftOwnersApi(this.config.apiConfig),this.tokens=new Ft.TokensApi(this.config.apiConfig),this.metadata=new Ft.MetadataApi(this.config.apiConfig)}async listActivities(e){return await this.activities.listActivities(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async getActivity(e){return await this.activities.getActivity(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listChains(e){return await this.chains.listChains(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listCollections(e){return await this.collections.listCollections(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listCollectionsByNFTOwner(e){return await this.collections.listCollectionsByNFTOwner(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async getCollection(e){return await this.collections.getCollection(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async getNFT(e){return await this.nfts.getNFT(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listNFTs(e){return await this.nfts.listNFTs(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listAllNFTs(e){return await this.nfts.listAllNFTs(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listNFTOwnersByContractAddress(e){return await this.nftOwners.listOwnersByContractAddress(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listAllNFTOwners(e){return await this.nfts.listAllNFTOwners(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listTokens(e){return await this.tokens.listERC20Tokens(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async getToken(e){return await this.tokens.getERC20Token(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async getMetadata(e){return await this.metadata.getMetadata(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listNFTMetadataByContractAddress(e){return await this.metadata.listMetadata(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async refreshCollectionMetadata(e){return await this.collections.refreshCollectionMetadata(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async refreshNFTMetadata(e){return await this.metadata.refreshNFTMetadataByTokenID(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async refreshStackedMetadata(e){return await this.metadata.refreshMetadataByID(e).then((e=>e.data)).catch((e=>{throw er(e)}))}}var rr=Object.freeze({__proto__:null,APIError:Jt,ActivitiesTypes:Lt,BlockchainData:tr,ChainsTypes:Ut,CollectionsTypes:jt,MetadataTypes:qt,NFTOwnersTypes:zt,NFTsTypes:Ht,TokensTypes:Gt}),nr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ir(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ar(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(t,r))}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var or={exports:{}},sr="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},cr=[],ur=[],fr="undefined"!=typeof Uint8Array?Uint8Array:Array,dr=!1;function lr(){dr=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)cr[t]=e[t],ur[e.charCodeAt(t)]=t;ur["-".charCodeAt(0)]=62,ur["_".charCodeAt(0)]=63}function hr(e,t,r){for(var n,i,a=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],a.push(cr[(i=n)>>18&63]+cr[i>>12&63]+cr[i>>6&63]+cr[63&i]);return a.join("")}function pr(e){var t;dr||lr();for(var r=e.length,n=r%3,i="",a=[],o=16383,s=0,c=r-n;s<c;s+=o)a.push(hr(e,s,s+o>c?c:s+o));return 1===n?(t=e[r-1],i+=cr[t>>2],i+=cr[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=cr[t>>10],i+=cr[t>>4&63],i+=cr[t<<2&63],i+="="),a.push(i),a.join("")}function mr(e,t,r,n,i){var a,o,s=8*i-n-1,c=(1<<s)-1,u=c>>1,f=-7,d=r?i-1:0,l=r?-1:1,h=e[t+d];for(d+=l,a=h&(1<<-f)-1,h>>=-f,f+=s;f>0;a=256*a+e[t+d],d+=l,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=n;f>0;o=256*o+e[t+d],d+=l,f-=8);if(0===a)a=1-u;else{if(a===c)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),a-=u}return(h?-1:1)*o*Math.pow(2,a-n)}function br(e,t,r,n,i,a){var o,s,c,u=8*a-i-1,f=(1<<u)-1,d=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,p=n?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=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?l/c:l*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=f?(s=0,o=f):o+d>=1?(s=(t*c-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+h]=255&s,h+=p,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+h]=255&o,h+=p,o/=256,u-=8);e[r+h-p]|=128*m}var yr={}.toString,gr=Array.isArray||function(e){return"[object Array]"==yr.call(e)};Er.TYPED_ARRAY_SUPPORT=void 0===sr.TYPED_ARRAY_SUPPORT||sr.TYPED_ARRAY_SUPPORT;var vr=wr();function wr(){return Er.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function _r(e,t){if(wr()<t)throw new RangeError("Invalid typed array length");return Er.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Er.prototype:(null===e&&(e=new Er(t)),e.length=t),e}function Er(e,t,r){if(!(Er.TYPED_ARRAY_SUPPORT||this instanceof Er))return new Er(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Sr(this,e)}return Tr(this,e,t,r)}function Tr(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);Er.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Er.prototype:e=Rr(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!Er.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Ir(t,r);e=_r(e,n);var i=e.write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(Or(t)){var r=0|kr(t.length);return 0===(e=_r(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?_r(e,0):Rr(e,t);if("Buffer"===t.type&&gr(t.data))return Rr(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Ar(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 Sr(e,t){if(Ar(t),e=_r(e,t<0?0:0|kr(t)),!Er.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function Rr(e,t){var r=t.length<0?0:0|kr(t.length);e=_r(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function kr(e){if(e>=wr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+wr().toString(16)+" bytes");return 0|e}function Or(e){return!(null==e||!e._isBuffer)}function Ir(e,t){if(Or(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 r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return rn(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return nn(e).length;default:if(n)return rn(e).length;t=(""+t).toLowerCase(),n=!0}}function xr(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Vr(this,t,r);case"utf8":case"utf-8":return qr(this,t,r);case"ascii":return Hr(this,t,r);case"latin1":case"binary":return Gr(this,t,r);case"base64":return jr(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wr(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Cr(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Mr(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=Er.from(t,n)),Or(t))return 0===t.length?-1:Pr(e,t,r,n,i);if("number"==typeof t)return t&=255,Er.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Pr(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Pr(e,t,r,n,i){var a,o=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(a=r;a<s;a++)if(u(e,a)===u(t,-1===f?0:a-f)){if(-1===f&&(f=a),a-f+1===c)return f*o}else-1!==f&&(a-=a-f),f=-1}else for(r+c>s&&(r=s-c),a=r;a>=0;a--){for(var d=!0,l=0;l<c;l++)if(u(e,a+l)!==u(t,l)){d=!1;break}if(d)return a}return-1}function Nr(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function Br(e,t,r,n){return an(rn(t,e.length-r),e,r,n)}function Dr(e,t,r,n){return an(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function Fr(e,t,r,n){return Dr(e,t,r,n)}function Lr(e,t,r,n){return an(nn(t),e,r,n)}function Ur(e,t,r,n){return an(function(e,t){for(var r,n,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function jr(e,t,r){return 0===t&&r===e.length?pr(e):pr(e.slice(t,r))}function qr(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,c,u=e[i],f=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(f=u);break;case 2:128==(192&(a=e[i+1]))&&(c=(31&u)<<6|63&a)>127&&(f=c);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(c=(15&u)<<12|(63&a)<<6|63&o)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(c=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&c<1114112&&(f=c)}null===f?(f=65533,d=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=d}return function(e){var t=e.length;if(t<=zr)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=zr));return r}(n)}Er.poolSize=8192,Er._augment=function(e){return e.__proto__=Er.prototype,e},Er.from=function(e,t,r){return Tr(null,e,t,r)},Er.TYPED_ARRAY_SUPPORT&&(Er.prototype.__proto__=Uint8Array.prototype,Er.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Er[Symbol.species]),Er.alloc=function(e,t,r){return function(e,t,r,n){return Ar(t),t<=0?_r(e,t):void 0!==r?"string"==typeof n?_r(e,t).fill(r,n):_r(e,t).fill(r):_r(e,t)}(null,e,t,r)},Er.allocUnsafe=function(e){return Sr(null,e)},Er.allocUnsafeSlow=function(e){return Sr(null,e)},Er.isBuffer=on,Er.compare=function(e,t){if(!Or(e)||!Or(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},Er.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}},Er.concat=function(e,t){if(!gr(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Er.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=Er.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!Or(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},Er.byteLength=Ir,Er.prototype._isBuffer=!0,Er.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)Cr(this,t,t+1);return this},Er.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)Cr(this,t,t+3),Cr(this,t+1,t+2);return this},Er.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)Cr(this,t,t+7),Cr(this,t+1,t+6),Cr(this,t+2,t+5),Cr(this,t+3,t+4);return this},Er.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?qr(this,0,e):xr.apply(this,arguments)},Er.prototype.equals=function(e){if(!Or(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Er.compare(this,e)},Er.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+">"},Er.prototype.compare=function(e,t,r,n,i){if(!Or(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),c=this.slice(n,i),u=e.slice(t,r),f=0;f<s;++f)if(c[f]!==u[f]){a=c[f],o=u[f];break}return a<o?-1:o<a?1:0},Er.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Er.prototype.indexOf=function(e,t,r){return Mr(this,e,t,r,!0)},Er.prototype.lastIndexOf=function(e,t,r){return Mr(this,e,t,r,!1)},Er.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return Nr(this,e,t,r);case"utf8":case"utf-8":return Br(this,e,t,r);case"ascii":return Dr(this,e,t,r);case"latin1":case"binary":return Fr(this,e,t,r);case"base64":return Lr(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ur(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},Er.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var zr=4096;function Hr(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function Gr(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Vr(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=tn(e[a]);return i}function Wr(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function Kr(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function Xr(e,t,r,n,i,a){if(!Or(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(r+n>e.length)throw new RangeError("Index out of range")}function $r(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i<a;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Jr(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i<a;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function Yr(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Qr(e,t,r,n,i){return i||Yr(e,0,r,4),br(e,t,r,n,23,4),r+4}function Zr(e,t,r,n,i){return i||Yr(e,0,r,8),br(e,t,r,n,52,8),r+8}Er.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Er.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Er.prototype;else{var i=t-e;r=new Er(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},Er.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Kr(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},Er.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Kr(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},Er.prototype.readUInt8=function(e,t){return t||Kr(e,1,this.length),this[e]},Er.prototype.readUInt16LE=function(e,t){return t||Kr(e,2,this.length),this[e]|this[e+1]<<8},Er.prototype.readUInt16BE=function(e,t){return t||Kr(e,2,this.length),this[e]<<8|this[e+1]},Er.prototype.readUInt32LE=function(e,t){return t||Kr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Er.prototype.readUInt32BE=function(e,t){return t||Kr(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Er.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Kr(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},Er.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Kr(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},Er.prototype.readInt8=function(e,t){return t||Kr(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Er.prototype.readInt16LE=function(e,t){t||Kr(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Er.prototype.readInt16BE=function(e,t){t||Kr(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Er.prototype.readInt32LE=function(e,t){return t||Kr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Er.prototype.readInt32BE=function(e,t){return t||Kr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Er.prototype.readFloatLE=function(e,t){return t||Kr(e,4,this.length),mr(this,e,!0,23,4)},Er.prototype.readFloatBE=function(e,t){return t||Kr(e,4,this.length),mr(this,e,!1,23,4)},Er.prototype.readDoubleLE=function(e,t){return t||Kr(e,8,this.length),mr(this,e,!0,52,8)},Er.prototype.readDoubleBE=function(e,t){return t||Kr(e,8,this.length),mr(this,e,!1,52,8)},Er.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Xr(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},Er.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Xr(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},Er.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,1,255,0),Er.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Er.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,2,65535,0),Er.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):$r(this,e,t,!0),t+2},Er.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,2,65535,0),Er.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):$r(this,e,t,!1),t+2},Er.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,4,4294967295,0),Er.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Jr(this,e,t,!0),t+4},Er.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,4,4294967295,0),Er.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Jr(this,e,t,!1),t+4},Er.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Xr(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},Er.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Xr(this,e,t,r,i-1,-i)}var a=r-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+r},Er.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,1,127,-128),Er.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Er.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,2,32767,-32768),Er.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):$r(this,e,t,!0),t+2},Er.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,2,32767,-32768),Er.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):$r(this,e,t,!1),t+2},Er.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,4,2147483647,-2147483648),Er.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Jr(this,e,t,!0),t+4},Er.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Er.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Jr(this,e,t,!1),t+4},Er.prototype.writeFloatLE=function(e,t,r){return Qr(this,e,t,!0,r)},Er.prototype.writeFloatBE=function(e,t,r){return Qr(this,e,t,!1,r)},Er.prototype.writeDoubleLE=function(e,t,r){return Zr(this,e,t,!0,r)},Er.prototype.writeDoubleBE=function(e,t,r){return Zr(this,e,t,!1,r)},Er.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&r<t&&t<n)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(a<1e3||!Er.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},Er.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Er.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=Or(e)?e:rn(new Er(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var en=/[^+\/0-9A-Za-z-_]/g;function tn(e){return e<16?"0"+e.toString(16):e.toString(16)}function rn(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function nn(e){return function(e){var t,r,n,i,a,o;dr||lr();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 fr(3*s/4-a),n=a>0?s-4:s;var c=0;for(t=0,r=0;t<n;t+=4,r+=3)i=ur[e.charCodeAt(t)]<<18|ur[e.charCodeAt(t+1)]<<12|ur[e.charCodeAt(t+2)]<<6|ur[e.charCodeAt(t+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=255&i;return 2===a?(i=ur[e.charCodeAt(t)]<<2|ur[e.charCodeAt(t+1)]>>4,o[c++]=255&i):1===a&&(i=ur[e.charCodeAt(t)]<<10|ur[e.charCodeAt(t+1)]<<4|ur[e.charCodeAt(t+2)]>>2,o[c++]=i>>8&255,o[c++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(en,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function an(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function on(e){return null!=e&&(!!e._isBuffer||sn(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&sn(e.slice(0,0))}(e))}function sn(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var cn=ar(Object.freeze({__proto__:null,Buffer:Er,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),Er.alloc(+e)},isBuffer:on,kMaxLength:vr}));!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"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:cn.Buffer}catch(e){}function o(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var n=o(e,r);return r-1>=t&&(n|=o(e,r-1)<<4),n}function c(e,t,n,i){for(var a=0,o=0,s=Math.min(e.length,n),c=t;c<s;c++){var u=e.charCodeAt(c)-48;a*=i,o=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&o<i,"Invalid character"),a+=o}return a}function u(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,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(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,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("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"===n)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"===n)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,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,a=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=s(e,t,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=s(e,t,n)<<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,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var a=e.length-r,o=a%n,s=Math.min(a,a-o)+r,u=0,f=r;f<s;f+=n)u=c(e,f,f+n,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var d=1;for(u=c(e,f,e.length,t),f=0;f<o;f++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}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){u(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")]=f}catch(e){i.prototype.inspect=f}else i.prototype.inspect=f;function f(){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"],l=[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],h=[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 n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=(16777215&(s<<i|a)).toString(16);a=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),n=0!==a||o!==this.length-1?d[6-c.length]+c+n:c+n}for(0!==a&&(n=a.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=l[e],f=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(f).toString(e);n=(p=p.idivn(f)).isZero()?m+n:d[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!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&&r(!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 p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,c=o/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var f=c>>>26,d=67108863&c,l=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=l;h++){var p=u-h|0;f+=(o=(i=0|e.words[p])*(a=0|t.words[h])+d)/67108864|0,d=67108863&o}r.words[u]=0|d,c=0|f}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),a=n||Math.max(1,i);r(i<=a,"byte array longer than desired length"),r(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 r=0,n=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|n;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===a?(r<e.length&&(e[r++]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|n;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===a?(r>=0&&(e[r--]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},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 r=this._zeroBits(this.words[t]);if(e+=r,26!==r)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 r(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 r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(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,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(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){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,r,n;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?(r=this,n=e):(r=e,n=this);for(var i=0,a=0;a<n.length;a++)t=(0|r.words[a])+(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!==i&&a<r.length;a++)t=(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.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 r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var a=0,o=0;o<n.length;o++)a=(t=(0|r.words[o])-(0|n.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,i,a,o=e.words,s=t.words,c=r.words,u=0,f=0|o[0],d=8191&f,l=f>>>13,h=0|o[1],p=8191&h,m=h>>>13,b=0|o[2],y=8191&b,g=b>>>13,v=0|o[3],w=8191&v,_=v>>>13,E=0|o[4],T=8191&E,A=E>>>13,S=0|o[5],R=8191&S,k=S>>>13,O=0|o[6],I=8191&O,x=O>>>13,C=0|o[7],M=8191&C,P=C>>>13,N=0|o[8],B=8191&N,D=N>>>13,F=0|o[9],L=8191&F,U=F>>>13,j=0|s[0],q=8191&j,z=j>>>13,H=0|s[1],G=8191&H,V=H>>>13,W=0|s[2],K=8191&W,X=W>>>13,$=0|s[3],J=8191&$,Y=$>>>13,Q=0|s[4],Z=8191&Q,ee=Q>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,fe=0|s[8],de=8191&fe,le=fe>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(d,q))|0)+((8191&(i=(i=Math.imul(d,z))+Math.imul(l,q)|0))<<13)|0;u=((a=Math.imul(l,z))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,a=Math.imul(m,z);var ye=(u+(n=n+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(l,G)|0))<<13)|0;u=((a=a+Math.imul(l,V)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,z))+Math.imul(g,q)|0,a=Math.imul(g,z),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,V)|0;var ge=(u+(n=n+Math.imul(d,K)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(l,K)|0))<<13)|0;u=((a=a+Math.imul(l,X)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,a=Math.imul(_,z),n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,V)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,X)|0;var ve=(u+(n=n+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(l,J)|0))<<13)|0;u=((a=a+Math.imul(l,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(A,q)|0,a=Math.imul(A,z),n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,V)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(g,K)|0,a=a+Math.imul(g,X)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,J)|0,a=a+Math.imul(m,Y)|0;var we=(u+(n=n+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(l,Z)|0))<<13)|0;u=((a=a+Math.imul(l,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(R,q),i=(i=Math.imul(R,z))+Math.imul(k,q)|0,a=Math.imul(k,z),n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(A,G)|0,a=a+Math.imul(A,V)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,K)|0,a=a+Math.imul(_,X)|0,n=n+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(g,J)|0,a=a+Math.imul(g,Y)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Z)|0,a=a+Math.imul(m,ee)|0;var _e=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(l,re)|0))<<13)|0;u=((a=a+Math.imul(l,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(x,q)|0,a=Math.imul(x,z),n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,V)|0,n=n+Math.imul(T,K)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(A,K)|0,a=a+Math.imul(A,X)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,J)|0,a=a+Math.imul(_,Y)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(g,Z)|0,a=a+Math.imul(g,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ne)|0;var Ee=(u+(n=n+Math.imul(d,ae)|0)|0)+((8191&(i=(i=i+Math.imul(d,oe)|0)+Math.imul(l,ae)|0))<<13)|0;u=((a=a+Math.imul(l,oe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(M,q),i=(i=Math.imul(M,z))+Math.imul(P,q)|0,a=Math.imul(P,z),n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,V)|0,n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(k,K)|0,a=a+Math.imul(k,X)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(A,J)|0,a=a+Math.imul(A,Y)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,a=a+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(g,re)|0,a=a+Math.imul(g,ne)|0,n=n+Math.imul(p,ae)|0,i=(i=i+Math.imul(p,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Te=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(l,ce)|0))<<13)|0;u=((a=a+Math.imul(l,ue)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,z))+Math.imul(D,q)|0,a=Math.imul(D,z),n=n+Math.imul(M,G)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(P,G)|0,a=a+Math.imul(P,V)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,K)|0,a=a+Math.imul(x,X)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(k,J)|0,a=a+Math.imul(k,Y)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(A,Z)|0,a=a+Math.imul(A,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,a=a+Math.imul(_,ne)|0,n=n+Math.imul(y,ae)|0,i=(i=i+Math.imul(y,oe)|0)+Math.imul(g,ae)|0,a=a+Math.imul(g,oe)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,a=a+Math.imul(m,ue)|0;var Ae=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(l,de)|0))<<13)|0;u=((a=a+Math.imul(l,le)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,z))+Math.imul(U,q)|0,a=Math.imul(U,z),n=n+Math.imul(B,G)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(D,G)|0,a=a+Math.imul(D,V)|0,n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(P,K)|0,a=a+Math.imul(P,X)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(x,J)|0,a=a+Math.imul(x,Y)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(k,Z)|0,a=a+Math.imul(k,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(A,re)|0,a=a+Math.imul(A,ne)|0,n=n+Math.imul(w,ae)|0,i=(i=i+Math.imul(w,oe)|0)+Math.imul(_,ae)|0,a=a+Math.imul(_,oe)|0,n=n+Math.imul(y,ce)|0,i=(i=i+Math.imul(y,ue)|0)+Math.imul(g,ce)|0,a=a+Math.imul(g,ue)|0,n=n+Math.imul(p,de)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,de)|0,a=a+Math.imul(m,le)|0;var Se=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(l,pe)|0))<<13)|0;u=((a=a+Math.imul(l,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,G),i=(i=Math.imul(L,V))+Math.imul(U,G)|0,a=Math.imul(U,V),n=n+Math.imul(B,K)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(D,K)|0,a=a+Math.imul(D,X)|0,n=n+Math.imul(M,J)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(P,J)|0,a=a+Math.imul(P,Y)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(x,Z)|0,a=a+Math.imul(x,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(k,re)|0,a=a+Math.imul(k,ne)|0,n=n+Math.imul(T,ae)|0,i=(i=i+Math.imul(T,oe)|0)+Math.imul(A,ae)|0,a=a+Math.imul(A,oe)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(_,ce)|0,a=a+Math.imul(_,ue)|0,n=n+Math.imul(y,de)|0,i=(i=i+Math.imul(y,le)|0)+Math.imul(g,de)|0,a=a+Math.imul(g,le)|0;var Re=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((a=a+Math.imul(m,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,K),i=(i=Math.imul(L,X))+Math.imul(U,K)|0,a=Math.imul(U,X),n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(D,J)|0,a=a+Math.imul(D,Y)|0,n=n+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(P,Z)|0,a=a+Math.imul(P,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(x,re)|0,a=a+Math.imul(x,ne)|0,n=n+Math.imul(R,ae)|0,i=(i=i+Math.imul(R,oe)|0)+Math.imul(k,ae)|0,a=a+Math.imul(k,oe)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(A,ce)|0,a=a+Math.imul(A,ue)|0,n=n+Math.imul(w,de)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(_,de)|0,a=a+Math.imul(_,le)|0;var ke=(u+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,me)|0)+Math.imul(g,pe)|0))<<13)|0;u=((a=a+Math.imul(g,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,J),i=(i=Math.imul(L,Y))+Math.imul(U,J)|0,a=Math.imul(U,Y),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(D,Z)|0,a=a+Math.imul(D,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(P,re)|0,a=a+Math.imul(P,ne)|0,n=n+Math.imul(I,ae)|0,i=(i=i+Math.imul(I,oe)|0)+Math.imul(x,ae)|0,a=a+Math.imul(x,oe)|0,n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(k,ce)|0,a=a+Math.imul(k,ue)|0,n=n+Math.imul(T,de)|0,i=(i=i+Math.imul(T,le)|0)+Math.imul(A,de)|0,a=a+Math.imul(A,le)|0;var Oe=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(_,pe)|0))<<13)|0;u=((a=a+Math.imul(_,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,ee))+Math.imul(U,Z)|0,a=Math.imul(U,ee),n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(D,re)|0,a=a+Math.imul(D,ne)|0,n=n+Math.imul(M,ae)|0,i=(i=i+Math.imul(M,oe)|0)+Math.imul(P,ae)|0,a=a+Math.imul(P,oe)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(x,ce)|0,a=a+Math.imul(x,ue)|0,n=n+Math.imul(R,de)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(k,de)|0,a=a+Math.imul(k,le)|0;var Ie=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((a=a+Math.imul(A,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(U,re)|0,a=Math.imul(U,ne),n=n+Math.imul(B,ae)|0,i=(i=i+Math.imul(B,oe)|0)+Math.imul(D,ae)|0,a=a+Math.imul(D,oe)|0,n=n+Math.imul(M,ce)|0,i=(i=i+Math.imul(M,ue)|0)+Math.imul(P,ce)|0,a=a+Math.imul(P,ue)|0,n=n+Math.imul(I,de)|0,i=(i=i+Math.imul(I,le)|0)+Math.imul(x,de)|0,a=a+Math.imul(x,le)|0;var xe=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(k,pe)|0))<<13)|0;u=((a=a+Math.imul(k,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(L,ae),i=(i=Math.imul(L,oe))+Math.imul(U,ae)|0,a=Math.imul(U,oe),n=n+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,a=a+Math.imul(D,ue)|0,n=n+Math.imul(M,de)|0,i=(i=i+Math.imul(M,le)|0)+Math.imul(P,de)|0,a=a+Math.imul(P,le)|0;var Ce=(u+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((a=a+Math.imul(x,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,ce),i=(i=Math.imul(L,ue))+Math.imul(U,ce)|0,a=Math.imul(U,ue),n=n+Math.imul(B,de)|0,i=(i=i+Math.imul(B,le)|0)+Math.imul(D,de)|0,a=a+Math.imul(D,le)|0;var Me=(u+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(P,pe)|0))<<13)|0;u=((a=a+Math.imul(P,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(L,de),i=(i=Math.imul(L,le))+Math.imul(U,de)|0,a=Math.imul(U,le);var Pe=(u+(n=n+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,me)|0)+Math.imul(D,pe)|0))<<13)|0;u=((a=a+Math.imul(D,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(n=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return u=((a=Math.imul(U,me))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=be,c[1]=ye,c[2]=ge,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ee,c[7]=Te,c[8]=Ae,c[9]=Se,c[10]=Re,c[11]=ke,c[12]=Oe,c[13]=Ie,c[14]=xe,c[15]=Ce,c[16]=Me,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,a=0;a<r.length-1;a++){var o=i;i=0;for(var s=67108863&n,c=Math.min(a,t.length-1),u=Math.max(0,a-e.length+1);u<=c;u++){var f=a-u,d=(0|e.words[f])*(0|t.words[u]),l=67108863&d;s=67108863&(l=l+s|0),i+=(o=(o=o+(d/67108864|0)|0)+(l>>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r._strip()}function y(e,t,r){return b(e,t,r)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?b(this,e,t):y(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),y(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),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i<this.length;i++){var a=(0|this.words[i])*e,o=(67108863&a)+(67108863&n);n>>=26,n+=a/67108864|0,n+=o>>>26,this.words[i]=67108863&o}return 0!==n&&(this.words[i]=n,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()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var a=r.sqr();n<t.length;n++,a=a.sqr())0!==t[n]&&(r=r.mul(a));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,c=(0|this.words[t])-s<<n;this.words[t]=c|o,o=s>>>26-n}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 r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("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,c=n;if(i-=o,i=Math.max(0,i),c){for(var u=0;u<o;u++)c.words[u]=this.words[u];c.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=i);u--){var d=0|this.words[u];this.words[u]=f<<26-a|d>>>a,f=d&s}return c&&0!==f&&(c.words[c.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},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){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,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 r("number"==typeof e),r(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(r("number"==typeof e),r(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,n){var i,a,o=e.length+n;this._expand(o);var s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+n])+s;var c=(0|e.words[i])*t;s=((a-=67108863&c)>>26)-(c/67108864|0),this.words[i+n]=67108863&a}for(;i<this.length-n;i++)s=(a=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&a;if(0===s)return this._strip();for(r(-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 r=(this.length,e.length),n=this.clone(),a=e,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,c=n.length-a.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var f=n.clone()._ishlnsubmul(a,1,c);0===f.negative&&(n=f,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var l=67108864*(0|n.words[a.length+d])+(0|n.words[a.length+d-1]);for(l=Math.min(l/o|0,67108863),n._ishlnsubmul(a,l,d);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(a,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=l)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!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(),n&&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(),n&&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 r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),a=r.cmp(n);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),r(e<=67108863);for(var n=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(n*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),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var a=(0|this.words[i])+67108864*n;this.words[i]=a/e|0,n=a%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=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),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var f=n.clone(),d=t.clone();!t.isZero();){for(var l=0,h=1;0==(t.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(f),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(f),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s),o.isub(c)):(n.isub(t),s.isub(a),c.isub(o))}return{a:s,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,o=new i(1),s=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,f=1;0==(t.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(t.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var d=0,l=1;0==(n.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s)):(n.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(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var a=t;t=r,r=a}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},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){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a=i,o=n;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,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(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,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>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 A(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(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 r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(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 w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function T(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){A.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)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(w,v),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&r)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(E,v),n(T,v),T.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new _;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new T}return g[e]=t,t},A.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);r(!a.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,u).cmp(c);)f.redIAdd(c);for(var d=this.pow(f,a),l=this.pow(e,a.addn(1).iushrn(1)),h=this.pow(e,a),p=o;0!==h.cmp(s);){for(var m=h,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<p);var y=this.pow(d,new i(1).iushln(p-b-1));l=l.redMul(y),d=y.redSqr(),h=h.redMul(d),p=b}return l},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var a=r[0],o=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],f=c-1;f>=0;f--){var d=u>>f&1;a!==r[0]&&(a=this.sqr(a)),0!==d||0!==o?(o<<=1,o|=d,(4===++s||0===n&&0===f)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}c=26}return a},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},n(S,A),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).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)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).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)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,nr)}(or);var un=or.exports,fn=ir(un);let dn=!1,ln=!1;const hn={debug:1,default:2,info:2,warning:3,error:4,off:5};let pn=hn.default,mn=null;const bn=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){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 yn,gn;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(yn||(yn={})),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"}(gn||(gn={}));const vn="0123456789abcdef";let wn=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==hn[r]&&this.throwArgumentError("invalid log level name","logLevel",e),pn>hn[r]||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,r,n){if(ln)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=vn[t[e]>>4],r+=vn[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const a=t;let o="";switch(r){case gn.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 gn.CALL_EXCEPTION:case gn.INSUFFICIENT_FUNDS:case gn.MISSING_NEW:case gn.NONCE_EXPIRED:case gn.REPLACEMENT_UNDERPRICED:case gn.TRANSACTION_REPLACED:case gn.UNPREDICTABLE_GAS_LIMIT:o=r}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=r,Object.keys(n).forEach((function(e){s[e]=n[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){bn&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:bn})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.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:r.name})}static globalLogger(){return mn||(mn=new e("logger/5.7.0")),mn}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),dn){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ln=!!t,dn=!!r}static setLogLevel(t){const r=hn[t.toLowerCase()];null!=r?pn=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};wn.errors=gn,wn.levels=yn;var _n=Object.freeze({__proto__:null,get ErrorCode(){return gn},get LogLevel(){return yn},Logger:wn});const En=new wn("bytes/5.7.0");function Tn(e){return!!e.toHexString}function An(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return An(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Sn(e){return Mn(e)&&!(e.length%2)||kn(e)}function Rn(e){return"number"==typeof e&&e==e&&e%1==0}function kn(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Rn(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Rn(r)||r<0||r>=256)return!1}return!0}function On(e,t){if(t||(t={}),"number"==typeof e){En.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),An(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Tn(e)&&(e=e.toHexString()),Mn(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":En.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return An(new Uint8Array(n))}return kn(e)?An(new Uint8Array(e)):En.throwArgumentError("invalid arrayify value","value",e)}function In(e){const t=e.map((e=>On(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),An(n)}function xn(e){let t=On(e);if(0===t.length)return t;let r=0;for(;r<t.length&&0===t[r];)r++;return r&&(t=t.slice(r)),t}function Cn(e,t){(e=On(e)).length>t&&En.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),An(r)}function Mn(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Pn="0123456789abcdef";function Nn(e,t){if(t||(t={}),"number"==typeof e){En.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Pn[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),Tn(e))return e.toHexString();if(Mn(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":En.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(kn(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Pn[(240&n)>>4]+Pn[15&n]}return t}return En.throwArgumentError("invalid hexlify value","value",e)}function Bn(e){if("string"!=typeof e)e=Nn(e);else if(!Mn(e)||e.length%2)return null;return(e.length-2)/2}function Dn(e,t,r){return"string"!=typeof e?e=Nn(e):(!Mn(e)||e.length%2)&&En.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function Fn(e){let t="0x";return e.forEach((e=>{t+=Nn(e).substring(2)})),t}function Ln(e){const t=Un(Nn(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function Un(e){"string"!=typeof e&&(e=Nn(e)),Mn(e)||En.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 jn(e,t){for("string"!=typeof e?e=Nn(e):Mn(e)||En.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&En.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function qn(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Sn(e)){let r=On(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Nn(r.slice(0,32)),t.s=Nn(r.slice(32,64))):65===r.length?(t.r=Nn(r.slice(0,32)),t.s=Nn(r.slice(32,64)),t.v=r[64]):En.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:En.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Nn(r.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 r=Cn(On(t._vs),32);t._vs=Nn(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&En.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=Nn(r);null==t.s?t.s=i:t.s!==i&&En.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?En.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 r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&En.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Mn(t.r)?t.r=jn(t.r,32):En.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Mn(t.s)?t.s=jn(t.s,32):En.throwArgumentError("signature missing or invalid s","signature",e);const r=On(t.s);r[0]>=128&&En.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Nn(r);t._vs&&(Mn(t._vs)||En.throwArgumentError("signature invalid _vs","signature",e),t._vs=jn(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&En.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function zn(e){return Nn(In([(e=qn(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var Hn=Object.freeze({__proto__:null,arrayify:On,concat:In,hexConcat:Fn,hexDataLength:Bn,hexDataSlice:Dn,hexStripZeros:Un,hexValue:Ln,hexZeroPad:jn,hexlify:Nn,isBytes:kn,isBytesLike:Sn,isHexString:Mn,joinSignature:zn,splitSignature:qn,stripZeros:xn,zeroPad:Cn});const Gn="bignumber/5.7.0";var Vn=fn.BN;const Wn=new wn(Gn),Kn={},Xn=9007199254740991;let $n=!1,Jn=class e{constructor(e,t){e!==Kn&&Wn.throwError("cannot call constructor directly; use BigNumber.from",wn.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Qn(Zn(this).fromTwos(e))}toTwos(e){return Qn(Zn(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Qn(Zn(this).add(Zn(e)))}sub(e){return Qn(Zn(this).sub(Zn(e)))}div(t){return e.from(t).isZero()&&ei("division-by-zero","div"),Qn(Zn(this).div(Zn(t)))}mul(e){return Qn(Zn(this).mul(Zn(e)))}mod(e){const t=Zn(e);return t.isNeg()&&ei("division-by-zero","mod"),Qn(Zn(this).umod(t))}pow(e){const t=Zn(e);return t.isNeg()&&ei("negative-power","pow"),Qn(Zn(this).pow(t))}and(e){const t=Zn(e);return(this.isNegative()||t.isNeg())&&ei("unbound-bitwise-result","and"),Qn(Zn(this).and(t))}or(e){const t=Zn(e);return(this.isNegative()||t.isNeg())&&ei("unbound-bitwise-result","or"),Qn(Zn(this).or(t))}xor(e){const t=Zn(e);return(this.isNegative()||t.isNeg())&&ei("unbound-bitwise-result","xor"),Qn(Zn(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&ei("negative-width","mask"),Qn(Zn(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ei("negative-width","shl"),Qn(Zn(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ei("negative-width","shr"),Qn(Zn(this).shrn(e))}eq(e){return Zn(this).eq(Zn(e))}lt(e){return Zn(this).lt(Zn(e))}lte(e){return Zn(this).lte(Zn(e))}gt(e){return Zn(this).gt(Zn(e))}gte(e){return Zn(this).gte(Zn(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Zn(this).isZero()}toNumber(){try{return Zn(this).toNumber()}catch(e){ei("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Wn.throwError("this platform does not support BigInt",wn.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?$n||($n=!0,Wn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Wn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",wn.errors.UNEXPECTED_ARGUMENT,{}):Wn.throwError("BigNumber.toString does not accept parameters",wn.errors.UNEXPECTED_ARGUMENT,{})),Zn(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(Kn,Yn(t)):t.match(/^-?[0-9]+$/)?new e(Kn,Yn(new Vn(t))):Wn.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&ei("underflow","BigNumber.from",t),(t>=Xn||t<=-Xn)&&ei("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(kn(r))return e.from(Nn(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Mn(t)||"-"===t[0]&&Mn(t.substring(1))))return e.from(t)}return Wn.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Yn(e){if("string"!=typeof e)return Yn(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Wn.throwArgumentError("invalid hex","value",e),"0x00"===(e=Yn(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 Qn(e){return Jn.from(Yn(e))}function Zn(e){const t=Jn.from(e).toHexString();return"-"===t[0]?new Vn("-"+t.substring(3),16):new Vn(t.substring(2),16)}function ei(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Wn.throwError(e,wn.errors.NUMERIC_FAULT,n)}const ti=new wn(Gn),ri={},ni=Jn.from(0),ii=Jn.from(-1);function ai(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),ti.throwError(e,wn.errors.NUMERIC_FAULT,i)}let oi="0";for(;oi.length<256;)oi+=oi;function si(e){if("number"!=typeof e)try{e=Jn.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+oi.substring(0,e):ti.throwArgumentError("invalid decimal size","decimals",e)}function ci(e,t){null==t&&(t=0);const r=si(t),n=(e=Jn.from(e)).lt(ni);n&&(e=e.mul(ii));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(r).toString();return e=1===r.length?a:a+"."+i,n&&(e="-"+e),e}function ui(e,t){null==t&&(t=0);const r=si(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||ti.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&ti.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&ti.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>r.length-1&&ai("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=Jn.from(a),c=Jn.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(ii)),u}class fi{constructor(e,t,r,n){e!==ri&&ti.throwError("cannot use FixedFormat constructor; use FixedFormat.from",wn.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=si(n),Object.freeze(this)}static from(e){if(e instanceof fi)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=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||ti.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&ti.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&ti.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&ti.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new fi(ri,t,r,n)}}class di{constructor(e,t,r,n){e!==ri&&ti.throwError("cannot use FixedNumber constructor; use FixedNumber.from",wn.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&ti.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ui(this._value,this.format.decimals),r=ui(e._value,e.format.decimals);return di.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ui(this._value,this.format.decimals),r=ui(e._value,e.format.decimals);return di.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ui(this._value,this.format.decimals),r=ui(e._value,e.format.decimals);return di.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ui(this._value,this.format.decimals),r=ui(e._value,e.format.decimals);return di.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=di.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(li.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=di.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(li.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)&&ti.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=di.from("1"+oi.substring(0,e),this.format),n=hi.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}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&&ti.throwArgumentError("invalid byte width","width",e);return jn(Jn.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return di.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Jn.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Mn(e)||"bigint"==typeof e||kn(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),di.fromString(ci(e,t),fi.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=fi.from(t),n=ui(e,r.decimals);!r.signed&&n.lt(ni)&&ai("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=jn(i,r.width/8));const a=ci(n,r.decimals);return new di(ri,i,a,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=fi.from(t);if(On(e).length>r.width/8)throw new Error("overflow");let n=Jn.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),a=ci(n,r.decimals);return new di(ri,i,a,r)}static from(e,t){if("string"==typeof e)return di.fromString(e,t);if(kn(e))return di.fromBytes(e,t);try{return di.fromValue(e,0,t)}catch(e){if(e.code!==wn.errors.INVALID_ARGUMENT)throw e}return ti.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const li=di.from(1),hi=di.from("0.5");var pi=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};const mi=new wn("properties/5.7.0");function bi(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function yi(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function gi(e){return pi(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function vi(e,t){e&&"object"==typeof e||mi.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||mi.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function wi(e){const t={};for(const r in e)t[r]=e[r];return t}const _i={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Ei(e){if(null==e||_i[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!Ei(n))return!1}return!0}return mi.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Ti(e){if(Ei(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>Ai(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&bi(t,r,Ai(n))}return t}return mi.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Ai(e){return Ti(e)}let Si=class{constructor(e){for(const t in e)this[t]=Ai(e[t])}};var Ri=Object.freeze({__proto__:null,Description:Si,checkProperties:vi,deepCopy:Ai,defineReadOnly:bi,getStatic:yi,resolveProperties:gi,shallowCopy:wi});const ki="abi/5.7.0",Oi=new wn(ki),Ii={};let xi={calldata:!0,memory:!0,storage:!0},Ci={calldata:!0,memory:!0};function Mi(e,t){if("bytes"===e||"string"===e){if(xi[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Ci[t])return!0;return(xi[t]||"payable"===t)&&Oi.throwArgumentError("invalid modifier","name",t),!1}function Pi(e,t){for(let r in t)bi(e,r,t[r])}const Ni=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Bi=new RegExp(/^(.*)\[([0-9]*)\]$/);let Di=class e{constructor(t,r){t!==Ii&&Oi.throwError("use fromString",wn.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Pi(this,r);let n=this.type.match(Bi);Pi(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[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=Ni.sighash),Ni[e]||Oi.throwArgumentError("invalid format type","format",e),e===Ni.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!==Ni.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Ni.full?", ":",")+")"):t+=this.type,e!==Ni.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Ni.full&&this.name&&(t+=" "+this.name)),t}static from(t,r){return"string"==typeof t?e.fromString(t,r):e.fromObject(t)}static fromObject(t){return e.isParamType(t)?t:new e(Ii,{name:t.name||null,type:Ki(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}static fromString(t,r){return n=function(e,t){let r=e;function n(t){Oi.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let a={type:"",name:"",state:{allowType:!0}},o=a;for(let r=0;r<e.length;r++){let a=e[r];switch(a){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||n(r),o.state.allowType=!1,o.type=Ki(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),Mi(o.type,o.name)&&(o.name=""),o.type=Ki(o.type);let e=o;o=o.parent,o||n(r),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),Mi(o.type,o.name)&&(o.name=""),o.type=Ki(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=Ki(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||n(r),o.indexed&&n(r),o.indexed=!0,o.name=""):Mi(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||n(r),o.type+=a,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(r),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:n(r)}}return o.parent&&Oi.throwArgumentError("unexpected eof","param",e),delete a.state,"indexed"===o.name?(t||n(r.length-7),o.indexed&&n(r.length-7),o.indexed=!0,o.name=""):Mi(o.type,o.name)&&(o.name=""),a.type=Ki(a.type),a}(t,!!r),e.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}};function Fi(e,t){return function(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];","===a&&0===n?(t.push(r),r=""):(r+=a,"("===a?n++:")"===a&&(n--,-1===n&&Oi.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>Di.fromString(e,t)))}let Li=class e{constructor(e,t){e!==Ii&&Oi.throwError("use a static from method",wn.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Pi(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 Gi.fromObject(t);case"event":return Ui.fromObject(t);case"constructor":return Hi.fromObject(t);case"error":return Wi.fromObject(t);case"fallback":case"receive":return null}return Oi.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]?Ui.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Gi.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Hi.fromString(e.trim()):"error"===e.split(" ")[0]?Wi.fromString(e.substring(5).trim()):Oi.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}},Ui=class e extends Li{format(e){if(e||(e=Ni.sighash),Ni[e]||Oi.throwArgumentError("invalid format type","format",e),e===Ni.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!==Ni.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ni.full?", ":",")+") ",e!==Ni.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&&Oi.throwArgumentError("invalid event object","value",t);const r={name:$i(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Di.fromObject):[],type:"event"};return new e(Ii,r)}static fromString(t){let r=t.match(Ji);r||Oi.throwArgumentError("invalid event string","value",t);let n=!1;return r[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:Oi.warn("unknown modifier: "+e)}})),e.fromObject({name:r[1].trim(),anonymous:n,inputs:Fi(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}};function ji(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&Oi.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||Oi.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Jn.from(r[1]),r[0]):e}function qi(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 zi(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&&Oi.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&Oi.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||Oi.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&&Oi.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&&Oi.throwArgumentError("unable to determine stateMutability","value",e),t}let Hi=class e extends Li{format(e){if(e||(e=Ni.sighash),Ni[e]||Oi.throwArgumentError("invalid format type","format",e),e===Ni.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===Ni.sighash&&Oi.throwError("cannot format a constructor for sighash",wn.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Ni.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&&Oi.throwArgumentError("invalid constructor object","value",t);let r=zi(t);r.constant&&Oi.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Di.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Jn.from(t.gas):null};return new e(Ii,n)}static fromString(t){let r={type:"constructor"},n=(t=ji(t,r)).match(Ji);return n&&"constructor"===n[1].trim()||Oi.throwArgumentError("invalid constructor string","value",t),r.inputs=Fi(n[2].trim(),!1),qi(n[3].trim(),r),e.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}},Gi=class e extends Hi{format(e){if(e||(e=Ni.sighash),Ni[e]||Oi.throwArgumentError("invalid format type","format",e),e===Ni.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!==Ni.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ni.full?", ":",")+") ",e!==Ni.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&&Oi.throwArgumentError("invalid function object","value",t);let r=zi(t);const n={type:t.type,name:$i(t.name),constant:r.constant,inputs:t.inputs?t.inputs.map(Di.fromObject):[],outputs:t.outputs?t.outputs.map(Di.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Jn.from(t.gas):null};return new e(Ii,n)}static fromString(t){let r={type:"function"},n=(t=ji(t,r)).split(" returns ");n.length>2&&Oi.throwArgumentError("invalid function string","value",t);let i=n[0].match(Ji);if(i||Oi.throwArgumentError("invalid function signature","value",t),r.name=i[1].trim(),r.name&&$i(r.name),r.inputs=Fi(i[2],!1),qi(i[3].trim(),r),n.length>1){let e=n[1].match(Ji);""==e[1].trim()&&""==e[3].trim()||Oi.throwArgumentError("unexpected tokens","value",t),r.outputs=Fi(e[2],!1)}else r.outputs=[];return e.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}};function Vi(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||Oi.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}let Wi=class e extends Li{format(e){if(e||(e=Ni.sighash),Ni[e]||Oi.throwArgumentError("invalid format type","format",e),e===Ni.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ni.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ni.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&&Oi.throwArgumentError("invalid error object","value",t);const r={type:t.type,name:$i(t.name),inputs:t.inputs?t.inputs.map(Di.fromObject):[]};return Vi(new e(Ii,r))}static fromString(t){let r={type:"error"},n=t.match(Ji);return n||Oi.throwArgumentError("invalid error signature","value",t),r.name=n[1].trim(),r.name&&$i(r.name),r.inputs=Fi(n[2],!1),Vi(e.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}};function Ki(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Xi=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function $i(e){return e&&e.match(Xi)||Oi.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Ji=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Yi=new wn(ki);function Qi(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){const a=e.slice();a.push(i);try{r(a,n[i])}catch(e){t.push({path:a,error:e})}}};return r([],e),t}let Zi=class{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Yi.throwArgumentError(e,this.localName,t)}},ea=class{constructor(e){bi(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return Fn(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(In(e._data))}writeBytes(e){let t=On(e);const r=t.length%this.wordSize;return r&&(t=In([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=On(Jn.from(e));return t.length>this.wordSize&&Yi.throwError("value out-of-bounds",wn.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=In([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 ta={exports:{}};
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).immutable={})}(this,(function(e){"use strict";function t(e,t){return function(){return e.apply(t,arguments)}}const{toString:r}=Object.prototype,{getPrototypeOf:n}=Object,i=(a=Object.create(null),e=>{const t=r.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const o=e=>(e=e.toLowerCase(),t=>i(t)===e),s=e=>t=>typeof t===e,{isArray:c}=Array,u=s("undefined");const f=o("ArrayBuffer");const d=s("string"),l=s("function"),h=s("number"),p=e=>null!==e&&"object"==typeof e,m=e=>{if("object"!==i(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},b=o("Date"),y=o("File"),g=o("Blob"),v=o("FileList"),w=o("URLSearchParams");function _(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),c(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function E(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,A=e=>!u(e)&&e!==T;const S=(R="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>R&&e instanceof R);var R;const k=o("HTMLFormElement"),O=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),I=o("RegExp"),x=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};_(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},C="abcdefghijklmnopqrstuvwxyz",M="0123456789",P={DIGIT:M,ALPHA:C,ALPHA_DIGIT:C+C.toUpperCase()+M};const N=o("AsyncFunction");var B={isArray:c,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&l(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||l(e.append)&&("formdata"===(t=i(e))||"object"===t&&l(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:d,isNumber:h,isBoolean:e=>!0===e||!1===e,isObject:p,isPlainObject:m,isUndefined:u,isDate:b,isFile:y,isBlob:g,isRegExp:I,isFunction:l,isStream:e=>p(e)&&l(e.pipe),isURLSearchParams:w,isTypedArray:S,isFileList:v,forEach:_,merge:function e(){const{caseless:t}=A(this)&&this||{},r={},n=(n,i)=>{const a=t&&E(r,i)||i;m(r[a])&&m(n)?r[a]=e(r[a],n):m(n)?r[a]=e({},n):c(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&_(arguments[e],n);return r},extend:(e,r,n,{allOwnKeys:i}={})=>(_(r,((r,i)=>{n&&l(r)?e[i]=t(r,n):e[i]=r}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,i)=>{let a,o,s;const c={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)s=a[o],i&&!i(s,e,t)||c[s]||(t[s]=e[s],c[s]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:i,kindOfTest:o,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(c(e))return e;let t=e.length;if(!h(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:k,hasOwnProperty:O,hasOwnProp:O,reduceDescriptors:x,freezeMethods:e=>{x(e,((t,r)=>{if(l(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];l(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return c(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:E,global:T,isContextDefined:A,ALPHABET:P,generateString:(e=16,t=P.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&l(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(p(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=c(e)?[]:{};return _(e,((e,t)=>{const a=r(e,n+1);!u(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:N,isThenable:e=>e&&(p(e)||l(e))&&l(e.then)&&l(e.catch)};function D(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}B.inherits(D,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const F=D.prototype,L={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{L[e]={value:e}})),Object.defineProperties(D,L),Object.defineProperty(F,"isAxiosError",{value:!0}),D.from=(e,t,r,n,i,a)=>{const o=Object.create(F);return B.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),D.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function U(e){return B.isPlainObject(e)||B.isArray(e)}function j(e){return B.endsWith(e,"[]")?e.slice(0,-2):e}function q(e,t,r){return e?e.concat(t).map((function(e,t){return e=j(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const z=B.toFlatObject(B,{},null,(function(e){return/^is[A-Z]/.test(e)}));function H(e,t,r){if(!B.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=B.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!B.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(B.isDate(e))return e.toISOString();if(!s&&B.isBlob(e))throw new D("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(e)||B.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(B.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(B.isArray(e)&&function(e){return B.isArray(e)&&!e.some(U)}(e)||(B.isFileList(e)||B.endsWith(r,"[]"))&&(s=B.toArray(e)))return r=j(r),s.forEach((function(e,n){!B.isUndefined(e)&&null!==e&&t.append(!0===o?q([r],n,a):null===o?r:r+"[]",c(e))})),!1;return!!U(e)||(t.append(q(i,r,a),c(e)),!1)}const f=[],d=Object.assign(z,{defaultVisitor:u,convertValue:c,isVisitable:U});if(!B.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!B.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),B.forEach(r,(function(r,a){!0===(!(B.isUndefined(r)||null===r)&&i.call(t,r,B.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),f.pop()}}(e),t}function G(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function V(e,t){this._pairs=[],e&&H(e,this,t)}const W=V.prototype;function K(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function X(e,t,r){if(!t)return e;const n=r&&r.encode||K,i=r&&r.serialize;let a;if(a=i?i(t,r):B.isURLSearchParams(t)?t.toString():new V(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}W.append=function(e,t){this._pairs.push([e,t])},W.toString=function(e){const t=e?function(t){return e.call(this,t,G)}:G;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var $=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){B.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},J={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Y={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:V,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function Q(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&B.isArray(n)?n.length:a,s)return B.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&B.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&B.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(B.isFormData(e)&&B.isFunction(e.entries)){const r={};return B.forEachEntry(e,((e,n)=>{t(function(e){return B.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const Z={"Content-Type":void 0};const ee={transitional:J,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=B.isObject(e);i&&B.isHTMLForm(e)&&(e=new FormData(e));if(B.isFormData(e))return n&&n?JSON.stringify(Q(e)):e;if(B.isArrayBuffer(e)||B.isBuffer(e)||B.isStream(e)||B.isFile(e)||B.isBlob(e))return e;if(B.isArrayBufferView(e))return e.buffer;if(B.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return H(e,new Y.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Y.isNode&&B.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=B.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return H(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(B.isString(e))try{return(t||JSON.parse)(e),B.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ee.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&B.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw D.from(e,D.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Y.classes.FormData,Blob:Y.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};B.forEach(["delete","get","head"],(function(e){ee.headers[e]={}})),B.forEach(["post","put","patch"],(function(e){ee.headers[e]=B.merge(Z)}));var te=ee;const re=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ne=Symbol("internals");function ie(e){return e&&String(e).trim().toLowerCase()}function ae(e){return!1===e||null==e?e:B.isArray(e)?e.map(ae):String(e)}function oe(e,t,r,n,i){return B.isFunction(n)?n.call(this,t,r):(i&&(t=r),B.isString(t)?B.isString(n)?-1!==t.indexOf(n):B.isRegExp(n)?n.test(t):void 0:void 0)}let se=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=ie(t);if(!i)throw new Error("header name must be a non-empty string");const a=B.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=ae(e))}const a=(e,t)=>B.forEach(e,((e,r)=>i(e,r,t)));return B.isPlainObject(e)||e instanceof this.constructor?a(e,t):B.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&re[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=ie(e)){const r=B.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(B.isFunction(t))return t.call(this,e,r);if(B.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ie(e)){const r=B.findKey(this,e);return!(!r||void 0===this[r]||t&&!oe(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=ie(e)){const i=B.findKey(r,e);!i||t&&!oe(0,r[i],i,t)||(delete r[i],n=!0)}}return B.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!oe(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return B.forEach(this,((n,i)=>{const a=B.findKey(r,i);if(a)return t[a]=ae(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=ae(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return B.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&B.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[ne]=this[ne]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ie(e);t[n]||(!function(e,t){const r=B.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return B.isArray(e)?e.forEach(n):n(e),this}};se.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),B.freezeMethods(se.prototype),B.freezeMethods(se);var ce=se;function ue(e,t){const r=this||te,n=t||r,i=ce.from(n.headers);let a=n.data;return B.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function fe(e){return!(!e||!e.__CANCEL__)}function de(e,t,r){D.call(this,null==e?"canceled":e,D.ERR_CANCELED,t,r),this.name="CanceledError"}B.inherits(de,D,{__CANCEL__:!0});var le=Y.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),B.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),B.isString(n)&&o.push("path="+n),B.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function he(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var pe=Y.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=B.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function me(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=n[o];i||(i=c),r[a]=s,n[a]=c;let f=o,d=0;for(;f!==a;)d+=r[f++],f%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),c-i<t)return;const l=u&&c-u;return l?Math.round(1e3*d/l):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,c=n(s);r=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:c||void 0,estimated:c&&o&&a<=o?(o-a)/c:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var be="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=ce.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}B.isFormData(n)&&(Y.isStandardBrowserEnv||Y.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=he(e.baseURL,e.url);function f(){if(!c)return;const n=ce.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new D("Request failed with status code "+r.status,[D.ERR_BAD_REQUEST,D.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),X(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=f:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(f)},c.onabort=function(){c&&(r(new D("Request aborted",D.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new D("Network Error",D.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||J;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new D(t,n.clarifyTimeoutError?D.ETIMEDOUT:D.ECONNABORTED,e,c)),c=null},Y.isStandardBrowserEnv){const t=(e.withCredentials||pe(u))&&e.xsrfCookieName&&le.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&B.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),B.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",me(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",me(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{c&&(r(!t||t.type?new de(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===Y.protocols.indexOf(d)?r(new D("Unsupported protocol "+d+":",D.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const ye={http:null,xhr:be};B.forEach(ye,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var ge=e=>{e=B.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=B.isString(r)?ye[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new D(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(B.hasOwnProp(ye,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!B.isFunction(n))throw new TypeError("adapter is not a function");return n};function ve(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new de(null,e)}function we(e){ve(e),e.headers=ce.from(e.headers),e.data=ue.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ge(e.adapter||te.adapter)(e).then((function(t){return ve(e),t.data=ue.call(e,e.transformResponse,t),t.headers=ce.from(t.headers),t}),(function(t){return fe(t)||(ve(e),t&&t.response&&(t.response.data=ue.call(e,e.transformResponse,t.response),t.response.headers=ce.from(t.response.headers))),Promise.reject(t)}))}const _e=e=>e instanceof ce?e.toJSON():e;function Ee(e,t){t=t||{};const r={};function n(e,t,r){return B.isPlainObject(e)&&B.isPlainObject(t)?B.merge.call({caseless:r},e,t):B.isPlainObject(t)?B.merge({},t):B.isArray(t)?t.slice():t}function i(e,t,r){return B.isUndefined(t)?B.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!B.isUndefined(t))return n(void 0,t)}function o(e,t){return B.isUndefined(t)?B.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t)=>i(_e(e),_e(t),!0)};return B.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||i,o=a(e[n],t[n],n);B.isUndefined(o)&&a!==s||(r[n]=o)})),r}const Te="1.4.0",Ae={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Ae[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Se={};Ae.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new D(n(i," has been removed"+(t?" in "+t:"")),D.ERR_DEPRECATED);return t&&!Se[i]&&(Se[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}};var Re={assertOptions:function(e,t,r){if("object"!=typeof e)throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new D("option "+a+" must be "+r,D.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new D("Unknown option "+a,D.ERR_BAD_OPTION)}},validators:Ae};const ke=Re.validators;let Oe=class{constructor(e){this.defaults=e,this.interceptors={request:new $,response:new $}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ee(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Re.assertOptions(r,{silentJSONParsing:ke.transitional(ke.boolean),forcedJSONParsing:ke.transitional(ke.boolean),clarifyTimeoutError:ke.transitional(ke.boolean)},!1),null!=n&&(B.isFunction(n)?t.paramsSerializer={serialize:n}:Re.assertOptions(n,{encode:ke.function,serialize:ke.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&B.merge(i.common,i[t.method]),a&&B.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=ce.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let f,d=0;if(!s){const e=[we.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,c),f=e.length,u=Promise.resolve(t);d<f;)u=u.then(e[d++],e[d++]);return u}f=o.length;let l=t;for(d=0;d<f;){const e=o[d++],t=o[d++];try{l=e(l)}catch(e){t.call(this,e);break}}try{u=we.call(this,l)}catch(e){return Promise.reject(e)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(e){return X(he((e=Ee(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};B.forEach(["delete","get","head","options"],(function(e){Oe.prototype[e]=function(t,r){return this.request(Ee(r||{},{method:e,url:t,data:(r||{}).data}))}})),B.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Ee(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Oe.prototype[e]=t(),Oe.prototype[e+"Form"]=t(!0)}));var Ie=Oe;var xe=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new de(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let t;const r=new e((function(e){t=e}));return{token:r,cancel:t}}};const Ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ce).forEach((([e,t])=>{Ce[t]=e}));var Me=Ce;const Pe=function e(r){const n=new Ie(r),i=t(Ie.prototype.request,n);return B.extend(i,Ie.prototype,n,{allOwnKeys:!0}),B.extend(i,n,null,{allOwnKeys:!0}),i.create=function(t){return e(Ee(r,t))},i}(te);Pe.Axios=Ie,Pe.CanceledError=de,Pe.CancelToken=xe,Pe.isCancel=fe,Pe.VERSION=Te,Pe.toFormData=H,Pe.AxiosError=D,Pe.Cancel=Pe.CanceledError,Pe.all=function(e){return Promise.all(e)},Pe.spread=function(e){return function(t){return e.apply(null,t)}},Pe.isAxiosError=function(e){return B.isObject(e)&&!0===e.isAxiosError},Pe.mergeConfig=Ee,Pe.AxiosHeaders=ce,Pe.formToJSON=e=>Q(B.isHTMLForm(e)?new FormData(e):e),Pe.HttpStatusCode=Me,Pe.default=Pe;var Ne=Pe;const{Axios:Be,AxiosError:De,CanceledError:Fe,isCancel:Le,CancelToken:Ue,VERSION:je,all:qe,Cancel:ze,isAxiosError:He,spread:Ge,toFormData:Ve,AxiosHeaders:We,HttpStatusCode:Ke,formToJSON:Xe,mergeConfig:$e}=Ne;var Je;!function(e){e.PRODUCTION="production",e.SANDBOX="sandbox"}(Je||(Je={}));class Ye{environment;rateLimitingKey;apiKey;clientAppId;constructor(e){if(this.environment=e.environment,e.rateLimitingKey&&(this.rateLimitingKey=e.rateLimitingKey,Ne.defaults.headers.common["x-api-key"]=this.rateLimitingKey),e.apiKey){if(!e.apiKey.startsWith("sk_imapik-"))throw new Error("Invalid API key");this.apiKey=e.apiKey,Ne.defaults.headers.common["x-immutable-api-key"]=this.apiKey}if(e.clientAppId){if(!e.clientAppId.startsWith("cai_imapik-"))throw new Error("Invalid Client App Id");this.clientAppId=e.clientAppId,Ne.defaults.headers.common["x-immutable-client-app-id"]=this.clientAppId}}}var Qe=Object.freeze({__proto__:null,get Environment(){return Je},ImmutableConfiguration:Ye});const Ze="https://api.sandbox.immutable.com".replace(/\/+$/,"");let et=class{basePath;axios;configuration;constructor(e,t=Ze,r=Ne){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}},tt=class extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}};const rt="https://example.com",nt=function(e,t,r){if(null==r)throw new tt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},it=async function(e,t,r){if(r&&r.apiKey){const n="function"==typeof r.apiKey?await r.apiKey(t):await r.apiKey;e[t]=n}},at=async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}};function ot(e,t,r=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>ot(e,t,r))):Object.keys(t).forEach((n=>ot(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t))}const st=function(e,...t){const r=new URLSearchParams(e.search);ot(r,t),e.search=r.toString()},ct=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},ut=function(e){return e.pathname+e.search+e.hash},ft=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||i.defaults.baseURL||a)+e.url};return i.request(o)}},dt=function(e){return{getActivity:async(t,r,n={})=>{nt("getActivity","chainName",t),nt("getActivity","activityId",r);const i="/v1/chains/{chain_name}/activities/{activity_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{activity_id}",encodeURIComponent(String(r))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};st(a,{});let c=o&&o.headers?o.headers:{};return s.headers={...c,...n.headers},{url:ut(a),options:s}},listActivities:async(t,r,n,i,a,o,s,c,u,f,d={})=>{nt("listActivities","chainName",t);const l="/v1/chains/{chain_name}/activities".replace("{chain_name}",encodeURIComponent(String(t))),h=new URL(l,rt);let p;e&&(p=e.baseOptions);const m={method:"GET",...p,...d},b={};void 0!==r&&(b.contract_address=r),void 0!==n&&(b.token_id=n),void 0!==i&&(b.account_address=i),void 0!==a&&(b.activity_type=a),void 0!==o&&(b.from_indexed_at=o instanceof Date?o.toISOString():o),void 0!==s&&(b.to_indexed_at=s instanceof Date?s.toISOString():s),void 0!==c&&(b.transaction_hash=c),void 0!==u&&(b.page_cursor=u),void 0!==f&&(b.page_size=f),st(h,b);let y=p&&p.headers?p.headers:{};return m.headers={...y,...d.headers},{url:ut(h),options:m}}}},lt=function(e){const t=dt(e);return{async getActivity(r,n,i){const a=await t.getActivity(r,n,i);return ft(a,Ne,Ze,e)},async listActivities(r,n,i,a,o,s,c,u,f,d,l){const h=await t.listActivities(r,n,i,a,o,s,c,u,f,d,l);return ft(h,Ne,Ze,e)}}};class ht extends et{getActivity(e,t){return lt(this.configuration).getActivity(e.chainName,e.activityId,t).then((e=>e(this.axios,this.basePath)))}listActivities(e,t){return lt(this.configuration).listActivities(e.chainName,e.contractAddress,e.tokenId,e.accountAddress,e.activityType,e.fromIndexedAt,e.toIndexedAt,e.transactionHash,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const pt=function(e){return{listChains:async(t,r,n={})=>{const i=new URL("/v1/chains",rt);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...n},s={};void 0!==t&&(s.page_cursor=t),void 0!==r&&(s.page_size=r),st(i,s);let c=a&&a.headers?a.headers:{};return o.headers={...c,...n.headers},{url:ut(i),options:o}}}},mt=function(e){const t=pt(e);return{async listChains(r,n,i){const a=await t.listChains(r,n,i);return ft(a,Ne,Ze,e)}}};class bt extends et{listChains(e={},t){return mt(this.configuration).listChains(e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const yt=function(e){return{getCollection:async(t,r,n={})=>{nt("getCollection","contractAddress",t),nt("getCollection","chainName",r);const i="/v1/chains/{chain_name}/collections/{contract_address}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};st(a,{});let c=o&&o.headers?o.headers:{};return s.headers={...c,...n.headers},{url:ut(a),options:s}},listCollections:async(t,r,n,i,a,o={})=>{nt("listCollections","chainName",t);const s="/v1/chains/{chain_name}/collections".replace("{chain_name}",encodeURIComponent(String(t))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};r&&(d.contract_address=r),void 0!==n&&(d.from_updated_at=n instanceof Date?n.toISOString():n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}},listCollectionsByNFTOwner:async(t,r,n,i,a={})=>{nt("listCollectionsByNFTOwner","accountAddress",t),nt("listCollectionsByNFTOwner","chainName",r);const o="/v1/chains/{chain_name}/accounts/{account_address}/collections".replace("{account_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),s=new URL(o,rt);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...a},f={};void 0!==n&&(f.page_cursor=n),void 0!==i&&(f.page_size=i),st(s,f);let d=c&&c.headers?c.headers:{};return u.headers={...d,...a.headers},{url:ut(s),options:u}},refreshCollectionMetadata:async(t,r,n,i={})=>{nt("refreshCollectionMetadata","contractAddress",t),nt("refreshCollectionMetadata","chainName",r),nt("refreshCollectionMetadata","refreshCollectionMetadataRequest",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/refresh-metadata".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...i},u={};await it(u,"x-immutable-api-Key",e),u["Content-Type"]="application/json",st(o,{});let f=s&&s.headers?s.headers:{};return c.headers={...u,...f,...i.headers},c.data=ct(n,c,e),{url:ut(o),options:c}}}},gt=function(e){const t=yt(e);return{async getCollection(r,n,i){const a=await t.getCollection(r,n,i);return ft(a,Ne,Ze,e)},async listCollections(r,n,i,a,o,s){const c=await t.listCollections(r,n,i,a,o,s);return ft(c,Ne,Ze,e)},async listCollectionsByNFTOwner(r,n,i,a,o){const s=await t.listCollectionsByNFTOwner(r,n,i,a,o);return ft(s,Ne,Ze,e)},async refreshCollectionMetadata(r,n,i,a){const o=await t.refreshCollectionMetadata(r,n,i,a);return ft(o,Ne,Ze,e)}}};class vt extends et{getCollection(e,t){return gt(this.configuration).getCollection(e.contractAddress,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listCollections(e,t){return gt(this.configuration).listCollections(e.chainName,e.contractAddress,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listCollectionsByNFTOwner(e,t){return gt(this.configuration).listCollectionsByNFTOwner(e.accountAddress,e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}refreshCollectionMetadata(e,t){return gt(this.configuration).refreshCollectionMetadata(e.contractAddress,e.chainName,e.refreshCollectionMetadataRequest,t).then((e=>e(this.axios,this.basePath)))}}const wt=function(e){return{getMetadata:async(t,r,n,i={})=>{nt("getMetadata","chainName",t),nt("getMetadata","contractAddress",r),nt("getMetadata","metadataId",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/metadata/{metadata_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{contract_address}",encodeURIComponent(String(r))).replace("{metadata_id}",encodeURIComponent(String(n))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i};st(o,{});let u=s&&s.headers?s.headers:{};return c.headers={...u,...i.headers},{url:ut(o),options:c}},listMetadata:async(t,r,n,i,a,o={})=>{nt("listMetadata","chainName",t),nt("listMetadata","contractAddress",r);const s="/v1/chains/{chain_name}/collections/{contract_address}/metadata".replace("{chain_name}",encodeURIComponent(String(t))).replace("{contract_address}",encodeURIComponent(String(r))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};void 0!==n&&(d.from_updated_at=n instanceof Date?n.toISOString():n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}},refreshMetadataByID:async(t,r,n,i={})=>{nt("refreshMetadataByID","chainName",t),nt("refreshMetadataByID","contractAddress",r),nt("refreshMetadataByID","refreshMetadataByIDRequest",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/metadata/refresh-metadata".replace("{chain_name}",encodeURIComponent(String(t))).replace("{contract_address}",encodeURIComponent(String(r))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...i},u={};await it(u,"x-immutable-api-Key",e),u["Content-Type"]="application/json",st(o,{});let f=s&&s.headers?s.headers:{};return c.headers={...u,...f,...i.headers},c.data=ct(n,c,e),{url:ut(o),options:c}},refreshNFTMetadataByTokenID:async(t,r,n,i={})=>{nt("refreshNFTMetadataByTokenID","contractAddress",t),nt("refreshNFTMetadataByTokenID","chainName",r),nt("refreshNFTMetadataByTokenID","refreshNFTMetadataByTokenIDRequest",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/nfts/refresh-metadata".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...i},u={};await it(u,"x-immutable-api-Key",e),u["Content-Type"]="application/json",st(o,{});let f=s&&s.headers?s.headers:{};return c.headers={...u,...f,...i.headers},c.data=ct(n,c,e),{url:ut(o),options:c}}}},_t=function(e){const t=wt(e);return{async getMetadata(r,n,i,a){const o=await t.getMetadata(r,n,i,a);return ft(o,Ne,Ze,e)},async listMetadata(r,n,i,a,o,s){const c=await t.listMetadata(r,n,i,a,o,s);return ft(c,Ne,Ze,e)},async refreshMetadataByID(r,n,i,a){const o=await t.refreshMetadataByID(r,n,i,a);return ft(o,Ne,Ze,e)},async refreshNFTMetadataByTokenID(r,n,i,a){const o=await t.refreshNFTMetadataByTokenID(r,n,i,a);return ft(o,Ne,Ze,e)}}};const Et=function(e){return{listNFTOwners:async(t,r,n,i,a,o={})=>{nt("listNFTOwners","contractAddress",t),nt("listNFTOwners","tokenId",r),nt("listNFTOwners","chainName",n);const s="/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}/owners".replace("{contract_address}",encodeURIComponent(String(t))).replace("{token_id}",encodeURIComponent(String(r))).replace("{chain_name}",encodeURIComponent(String(n))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}},listOwnersByContractAddress:async(t,r,n,i,a,o={})=>{nt("listOwnersByContractAddress","contractAddress",t),nt("listOwnersByContractAddress","chainName",r);const s="/v1/chains/{chain_name}/collections/{contract_address}/owners".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};void 0!==n&&(d.from_updated_at=n instanceof Date?n.toISOString():n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}}}},Tt=function(e){const t=Et(e);return{async listNFTOwners(r,n,i,a,o,s){const c=await t.listNFTOwners(r,n,i,a,o,s);return ft(c,Ne,Ze,e)},async listOwnersByContractAddress(r,n,i,a,o,s){const c=await t.listOwnersByContractAddress(r,n,i,a,o,s);return ft(c,Ne,Ze,e)}}};class At extends et{listNFTOwners(e,t){return Tt(this.configuration).listNFTOwners(e.contractAddress,e.tokenId,e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listOwnersByContractAddress(e,t){return Tt(this.configuration).listOwnersByContractAddress(e.contractAddress,e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const St=function(e){return{getNFT:async(t,r,n,i={})=>{nt("getNFT","contractAddress",t),nt("getNFT","tokenId",r),nt("getNFT","chainName",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{token_id}",encodeURIComponent(String(r))).replace("{chain_name}",encodeURIComponent(String(n))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i};st(o,{});let u=s&&s.headers?s.headers:{};return c.headers={...u,...i.headers},{url:ut(o),options:c}},listAllNFTOwners:async(t,r,n,i,a={})=>{nt("listAllNFTOwners","chainName",t),nt("listAllNFTOwners","fromUpdatedAt",r);const o="/v1/chains/{chain_name}/nft-owners".replace("{chain_name}",encodeURIComponent(String(t))),s=new URL(o,rt);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...a},f={};void 0!==r&&(f.from_updated_at=r instanceof Date?r.toISOString():r),void 0!==n&&(f.page_cursor=n),void 0!==i&&(f.page_size=i),st(s,f);let d=c&&c.headers?c.headers:{};return u.headers={...d,...a.headers},{url:ut(s),options:u}},listAllNFTs:async(t,r,n,i,a={})=>{nt("listAllNFTs","chainName",t);const o="/v1/chains/{chain_name}/nfts".replace("{chain_name}",encodeURIComponent(String(t))),s=new URL(o,rt);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...a},f={};void 0!==r&&(f.from_updated_at=r instanceof Date?r.toISOString():r),void 0!==n&&(f.page_cursor=n),void 0!==i&&(f.page_size=i),st(s,f);let d=c&&c.headers?c.headers:{};return u.headers={...d,...a.headers},{url:ut(s),options:u}},listNFTs:async(t,r,n,i,a,o={})=>{nt("listNFTs","contractAddress",t),nt("listNFTs","chainName",r);const s="/v1/chains/{chain_name}/collections/{contract_address}/nfts".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};void 0!==n&&(d.from_updated_at=n instanceof Date?n.toISOString():n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}},listNFTsByAccountAddress:async(t,r,n,i,a,o={})=>{nt("listNFTsByAccountAddress","accountAddress",t),nt("listNFTsByAccountAddress","chainName",r);const s="/v1/chains/{chain_name}/accounts/{account_address}/nfts".replace("{account_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),c=new URL(s,rt);let u;e&&(u=e.baseOptions);const f={method:"GET",...u,...o},d={};void 0!==n&&(d.contract_address=n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),st(c,d);let l=u&&u.headers?u.headers:{};return f.headers={...l,...o.headers},{url:ut(c),options:f}}}},Rt=function(e){const t=St(e);return{async getNFT(r,n,i,a){const o=await t.getNFT(r,n,i,a);return ft(o,Ne,Ze,e)},async listAllNFTOwners(r,n,i,a,o){const s=await t.listAllNFTOwners(r,n,i,a,o);return ft(s,Ne,Ze,e)},async listAllNFTs(r,n,i,a,o){const s=await t.listAllNFTs(r,n,i,a,o);return ft(s,Ne,Ze,e)},async listNFTs(r,n,i,a,o,s){const c=await t.listNFTs(r,n,i,a,o,s);return ft(c,Ne,Ze,e)},async listNFTsByAccountAddress(r,n,i,a,o,s){const c=await t.listNFTsByAccountAddress(r,n,i,a,o,s);return ft(c,Ne,Ze,e)}}};class kt extends et{getNFT(e,t){return Rt(this.configuration).getNFT(e.contractAddress,e.tokenId,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listAllNFTOwners(e,t){return Rt(this.configuration).listAllNFTOwners(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listAllNFTs(e,t){return Rt(this.configuration).listAllNFTs(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listNFTs(e,t){return Rt(this.configuration).listNFTs(e.contractAddress,e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listNFTsByAccountAddress(e,t){return Rt(this.configuration).listNFTsByAccountAddress(e.accountAddress,e.chainName,e.contractAddress,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const Ot=function(e){return{cancelOrders:async(t,r,n={})=>{nt("cancelOrders","chainName",t),nt("cancelOrders","cancelOrdersRequestBody",r);const i="/v1/chains/{chain_name}/orders/cancel".replace("{chain_name}",encodeURIComponent(String(t))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};c["Content-Type"]="application/json",st(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=ct(r,s,e),{url:ut(a),options:s}},createListing:async(t,r,n={})=>{nt("createListing","chainName",t),nt("createListing","createListingRequestBody",r);const i="/v1/chains/{chain_name}/orders/listings".replace("{chain_name}",encodeURIComponent(String(t))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};c["Content-Type"]="application/json",st(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=ct(r,s,e),{url:ut(a),options:s}},fulfillmentData:async(t,r,n={})=>{nt("fulfillmentData","chainName",t),nt("fulfillmentData","fulfillmentDataRequest",r);const i="/v1/chains/{chain_name}/orders/fulfillment-data".replace("{chain_name}",encodeURIComponent(String(t))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};c["Content-Type"]="application/json",st(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=ct(r,s,e),{url:ut(a),options:s}},getListing:async(t,r,n={})=>{nt("getListing","chainName",t),nt("getListing","listingId",r);const i="/v1/chains/{chain_name}/orders/listings/{listing_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{listing_id}",encodeURIComponent(String(r))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};st(a,{});let c=o&&o.headers?o.headers:{};return s.headers={...c,...n.headers},{url:ut(a),options:s}},getTrade:async(t,r,n={})=>{nt("getTrade","chainName",t),nt("getTrade","tradeId",r);const i="/v1/chains/{chain_name}/trades/{trade_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{trade_id}",encodeURIComponent(String(r))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};st(a,{});let c=o&&o.headers?o.headers:{};return s.headers={...c,...n.headers},{url:ut(a),options:s}},listListings:async(t,r,n,i,a,o,s,c,u,f={})=>{nt("listListings","chainName",t);const d="/v1/chains/{chain_name}/orders/listings".replace("{chain_name}",encodeURIComponent(String(t))),l=new URL(d,rt);let h;e&&(h=e.baseOptions);const p={method:"GET",...h,...f},m={};void 0!==r&&(m.status=r),void 0!==n&&(m.sell_item_contract_address=n),void 0!==i&&(m.buy_item_contract_address=i),void 0!==a&&(m.sell_item_token_id=a),void 0!==o&&(m.page_size=o),void 0!==s&&(m.sort_by=s),void 0!==c&&(m.sort_direction=c),void 0!==u&&(m.page_cursor=u),st(l,m);let b=h&&h.headers?h.headers:{};return p.headers={...b,...f.headers},{url:ut(l),options:p}},listTrades:async(t,r,n,i,a,o,s={})=>{nt("listTrades","chainName",t);const c="/v1/chains/{chain_name}/trades".replace("{chain_name}",encodeURIComponent(String(t))),u=new URL(c,rt);let f;e&&(f=e.baseOptions);const d={method:"GET",...f,...s},l={};void 0!==r&&(l.account_address=r),void 0!==n&&(l.page_size=n),void 0!==i&&(l.sort_by=i),void 0!==a&&(l.sort_direction=a),void 0!==o&&(l.page_cursor=o),st(u,l);let h=f&&f.headers?f.headers:{};return d.headers={...h,...s.headers},{url:ut(u),options:d}}}},It=function(e){const t=Ot(e);return{async cancelOrders(r,n,i){const a=await t.cancelOrders(r,n,i);return ft(a,Ne,Ze,e)},async createListing(r,n,i){const a=await t.createListing(r,n,i);return ft(a,Ne,Ze,e)},async fulfillmentData(r,n,i){const a=await t.fulfillmentData(r,n,i);return ft(a,Ne,Ze,e)},async getListing(r,n,i){const a=await t.getListing(r,n,i);return ft(a,Ne,Ze,e)},async getTrade(r,n,i){const a=await t.getTrade(r,n,i);return ft(a,Ne,Ze,e)},async listListings(r,n,i,a,o,s,c,u,f,d){const l=await t.listListings(r,n,i,a,o,s,c,u,f,d);return ft(l,Ne,Ze,e)},async listTrades(r,n,i,a,o,s,c){const u=await t.listTrades(r,n,i,a,o,s,c);return ft(u,Ne,Ze,e)}}};class xt extends et{cancelOrders(e,t){return It(this.configuration).cancelOrders(e.chainName,e.cancelOrdersRequestBody,t).then((e=>e(this.axios,this.basePath)))}createListing(e,t){return It(this.configuration).createListing(e.chainName,e.createListingRequestBody,t).then((e=>e(this.axios,this.basePath)))}fulfillmentData(e,t){return It(this.configuration).fulfillmentData(e.chainName,e.fulfillmentDataRequest,t).then((e=>e(this.axios,this.basePath)))}getListing(e,t){return It(this.configuration).getListing(e.chainName,e.listingId,t).then((e=>e(this.axios,this.basePath)))}getTrade(e,t){return It(this.configuration).getTrade(e.chainName,e.tradeId,t).then((e=>e(this.axios,this.basePath)))}listListings(e,t){return It(this.configuration).listListings(e.chainName,e.status,e.sellItemContractAddress,e.buyItemContractAddress,e.sellItemTokenId,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,t).then((e=>e(this.axios,this.basePath)))}listTrades(e,t){return It(this.configuration).listTrades(e.chainName,e.accountAddress,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,t).then((e=>e(this.axios,this.basePath)))}}const Ct=function(e){return{createCounterfactualAddress:async(t,r={})=>{nt("createCounterfactualAddress","createCounterfactualAddressRequest",t);const n=new URL("/passport-mr/v1/counterfactual-address",rt);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...r},o={};await at(o,e),o["Content-Type"]="application/json",st(n,{});let s=i&&i.headers?i.headers:{};return a.headers={...o,...s,...r.headers},a.data=ct(t,a,e),{url:ut(n),options:a}},getLinkedAddresses:async(t,r={})=>{nt("getLinkedAddresses","userId",t);const n="/passport-mr/v1/users/{userId}/linked-addresses".replace("{userId}",encodeURIComponent(String(t))),i=new URL(n,rt);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...r},s={};await at(s,e),st(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:ut(i),options:o}}}},Mt=function(e){const t=Ct(e);return{async createCounterfactualAddress(r,n){const i=await t.createCounterfactualAddress(r,n);return ft(i,Ne,Ze,e)},async getLinkedAddresses(r,n){const i=await t.getLinkedAddresses(r,n);return ft(i,Ne,Ze,e)}}};class Pt extends et{createCounterfactualAddress(e,t){return Mt(this.configuration).createCounterfactualAddress(e.createCounterfactualAddressRequest,t).then((e=>e(this.axios,this.basePath)))}getLinkedAddresses(e,t){return Mt(this.configuration).getLinkedAddresses(e.userId,t).then((e=>e(this.axios,this.basePath)))}}const Nt=function(e){return{getERC20Token:async(t,r,n={})=>{nt("getERC20Token","contractAddress",t),nt("getERC20Token","chainName",r);const i="/v1/chains/{chain_name}/tokens/{contract_address}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),a=new URL(i,rt);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};st(a,{});let c=o&&o.headers?o.headers:{};return s.headers={...c,...n.headers},{url:ut(a),options:s}},listERC20Tokens:async(t,r,n,i,a={})=>{nt("listERC20Tokens","chainName",t);const o="/v1/chains/{chain_name}/tokens".replace("{chain_name}",encodeURIComponent(String(t))),s=new URL(o,rt);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...a},f={};void 0!==r&&(f.from_updated_at=r instanceof Date?r.toISOString():r),void 0!==n&&(f.page_cursor=n),void 0!==i&&(f.page_size=i),st(s,f);let d=c&&c.headers?c.headers:{};return u.headers={...d,...a.headers},{url:ut(s),options:u}}}},Bt=function(e){const t=Nt(e);return{async getERC20Token(r,n,i){const a=await t.getERC20Token(r,n,i);return ft(a,Ne,Ze,e)},async listERC20Tokens(r,n,i,a,o){const s=await t.listERC20Tokens(r,n,i,a,o);return ft(s,Ne,Ze,e)}}};const Dt={Mint:"mint",Burn:"burn",Transfer:"transfer",Sale:"sale",Deposit:"deposit",Withdrawal:"withdrawal"};var Ft=Object.freeze({__proto__:null,ActiveOrderStatusNameEnum:{Active:"ACTIVE"},ActivitiesApi:ht,ActivitiesApiAxiosParamCreator:dt,ActivitiesApiFactory:function(e,t,r){const n=lt(e);return{getActivity:(e,i)=>n.getActivity(e.chainName,e.activityId,i).then((e=>e(r,t))),listActivities:(e,i)=>n.listActivities(e.chainName,e.contractAddress,e.tokenId,e.accountAddress,e.activityType,e.fromIndexedAt,e.toIndexedAt,e.transactionHash,e.pageCursor,e.pageSize,i).then((e=>e(r,t)))}},ActivitiesApiFp:lt,ActivityType:Dt,CancelledOrderStatusCancellationTypeEnum:{OnChain:"ON_CHAIN",OffChain:"OFF_CHAIN"},CancelledOrderStatusNameEnum:{Cancelled:"CANCELLED"},ChainsApi:bt,ChainsApiAxiosParamCreator:pt,ChainsApiFactory:function(e,t,r){const n=mt(e);return{listChains:(e={},i)=>n.listChains(e.pageCursor,e.pageSize,i).then((e=>e(r,t)))}},ChainsApiFp:mt,CollectionContractType:{Erc721:"ERC721"},CollectionsApi:vt,CollectionsApiAxiosParamCreator:yt,CollectionsApiFactory:function(e,t,r){const n=gt(e);return{getCollection:(e,i)=>n.getCollection(e.contractAddress,e.chainName,i).then((e=>e(r,t))),listCollections:(e,i)=>n.listCollections(e.chainName,e.contractAddress,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),listCollectionsByNFTOwner:(e,i)=>n.listCollectionsByNFTOwner(e.accountAddress,e.chainName,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),refreshCollectionMetadata:(e,i)=>n.refreshCollectionMetadata(e.contractAddress,e.chainName,e.refreshCollectionMetadataRequest,i).then((e=>e(r,t)))}},CollectionsApiFp:gt,Configuration:class{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}},ERC20ItemItemTypeEnum:{Erc20:"ERC20"},ERC721ItemItemTypeEnum:{Erc721:"ERC721"},ExpiredOrderStatusNameEnum:{Expired:"EXPIRED"},FailedOrderCancellationReasonCodeEnum:{AlreadyFilled:"ALREADY_FILLED"},FeeFeeTypeEnum:{Royalty:"ROYALTY",MakerEcosystem:"MAKER_ECOSYSTEM",TakerEcosystem:"TAKER_ECOSYSTEM",Protocol:"PROTOCOL"},FilledOrderStatusNameEnum:{Filled:"FILLED"},InactiveOrderStatusNameEnum:{Inactive:"INACTIVE"},ListListingsSortByEnum:{CreatedAt:"created_at",UpdatedAt:"updated_at",BuyItemAmount:"buy_item_amount"},ListListingsSortDirectionEnum:{Asc:"asc",Desc:"desc"},ListTradesSortByEnum:{IndexedAt:"indexed_at"},ListTradesSortDirectionEnum:{Asc:"asc",Desc:"desc"},MetadataApi:class extends et{getMetadata(e,t){return _t(this.configuration).getMetadata(e.chainName,e.contractAddress,e.metadataId,t).then((e=>e(this.axios,this.basePath)))}listMetadata(e,t){return _t(this.configuration).listMetadata(e.chainName,e.contractAddress,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}refreshMetadataByID(e,t){return _t(this.configuration).refreshMetadataByID(e.chainName,e.contractAddress,e.refreshMetadataByIDRequest,t).then((e=>e(this.axios,this.basePath)))}refreshNFTMetadataByTokenID(e,t){return _t(this.configuration).refreshNFTMetadataByTokenID(e.contractAddress,e.chainName,e.refreshNFTMetadataByTokenIDRequest,t).then((e=>e(this.axios,this.basePath)))}},MetadataApiAxiosParamCreator:wt,MetadataApiFactory:function(e,t,r){const n=_t(e);return{getMetadata:(e,i)=>n.getMetadata(e.chainName,e.contractAddress,e.metadataId,i).then((e=>e(r,t))),listMetadata:(e,i)=>n.listMetadata(e.chainName,e.contractAddress,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),refreshMetadataByID:(e,i)=>n.refreshMetadataByID(e.chainName,e.contractAddress,e.refreshMetadataByIDRequest,i).then((e=>e(r,t))),refreshNFTMetadataByTokenID:(e,i)=>n.refreshNFTMetadataByTokenID(e.contractAddress,e.chainName,e.refreshNFTMetadataByTokenIDRequest,i).then((e=>e(r,t)))}},MetadataApiFp:_t,NFTContractType:{Erc721:"ERC721"},NativeItemItemTypeEnum:{Native:"NATIVE"},NftOwnersApi:At,NftOwnersApiAxiosParamCreator:Et,NftOwnersApiFactory:function(e,t,r){const n=Tt(e);return{listNFTOwners:(e,i)=>n.listNFTOwners(e.contractAddress,e.tokenId,e.chainName,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),listOwnersByContractAddress:(e,i)=>n.listOwnersByContractAddress(e.contractAddress,e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t)))}},NftOwnersApiFp:Tt,NftsApi:kt,NftsApiAxiosParamCreator:St,NftsApiFactory:function(e,t,r){const n=Rt(e);return{getNFT:(e,i)=>n.getNFT(e.contractAddress,e.tokenId,e.chainName,i).then((e=>e(r,t))),listAllNFTOwners:(e,i)=>n.listAllNFTOwners(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),listAllNFTs:(e,i)=>n.listAllNFTs(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),listNFTs:(e,i)=>n.listNFTs(e.contractAddress,e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t))),listNFTsByAccountAddress:(e,i)=>n.listNFTsByAccountAddress(e.accountAddress,e.chainName,e.contractAddress,e.pageCursor,e.pageSize,i).then((e=>e(r,t)))}},NftsApiFp:Rt,OrderStatusName:{Pending:"PENDING",Active:"ACTIVE",Inactive:"INACTIVE",Filled:"FILLED",Expired:"EXPIRED",Cancelled:"CANCELLED"},OrdersApi:xt,OrdersApiAxiosParamCreator:Ot,OrdersApiFactory:function(e,t,r){const n=It(e);return{cancelOrders:(e,i)=>n.cancelOrders(e.chainName,e.cancelOrdersRequestBody,i).then((e=>e(r,t))),createListing:(e,i)=>n.createListing(e.chainName,e.createListingRequestBody,i).then((e=>e(r,t))),fulfillmentData:(e,i)=>n.fulfillmentData(e.chainName,e.fulfillmentDataRequest,i).then((e=>e(r,t))),getListing:(e,i)=>n.getListing(e.chainName,e.listingId,i).then((e=>e(r,t))),getTrade:(e,i)=>n.getTrade(e.chainName,e.tradeId,i).then((e=>e(r,t))),listListings:(e,i)=>n.listListings(e.chainName,e.status,e.sellItemContractAddress,e.buyItemContractAddress,e.sellItemTokenId,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,i).then((e=>e(r,t))),listTrades:(e,i)=>n.listTrades(e.chainName,e.accountAddress,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,i).then((e=>e(r,t)))}},OrdersApiFp:It,PassportApi:Pt,PassportApiAxiosParamCreator:Ct,PassportApiFactory:function(e,t,r){const n=Mt(e);return{createCounterfactualAddress:(e,i)=>n.createCounterfactualAddress(e.createCounterfactualAddressRequest,i).then((e=>e(r,t))),getLinkedAddresses:(e,i)=>n.getLinkedAddresses(e.userId,i).then((e=>e(r,t)))}},PassportApiFp:Mt,PendingOrderStatusNameEnum:{Pending:"PENDING"},ProtocolDataOrderTypeEnum:{FullRestricted:"FULL_RESTRICTED"},SaleFeeTypeEnum:{Royalty:"ROYALTY"},TokenContractType:{Erc20:"ERC20"},TokensApi:class extends et{getERC20Token(e,t){return Bt(this.configuration).getERC20Token(e.contractAddress,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listERC20Tokens(e,t){return Bt(this.configuration).listERC20Tokens(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}},TokensApiAxiosParamCreator:Nt,TokensApiFactory:function(e,t,r){const n=Bt(e);return{getERC20Token:(e,i)=>n.getERC20Token(e.contractAddress,e.chainName,i).then((e=>e(r,t))),listERC20Tokens:(e,i)=>n.listERC20Tokens(e.chainName,e.fromUpdatedAt,e.pageCursor,e.pageSize,i).then((e=>e(r,t)))}},TokensApiFp:Bt}),Lt=Object.freeze({__proto__:null,ActivityType:Dt}),Ut=Object.freeze({__proto__:null}),jt=Object.freeze({__proto__:null}),qt=Object.freeze({__proto__:null}),zt=Object.freeze({__proto__:null}),Ht=Object.freeze({__proto__:null}),Gt=Object.freeze({__proto__:null});class Vt{config;activitiesApi;chainsApi;collectionApi;nftOwnersApi;nftsApi;ordersApi;passportApi;constructor(e){this.config=e,this.activitiesApi=new ht(e.indexer),this.chainsApi=new bt(e.indexer),this.collectionApi=new vt(e.indexer),this.nftOwnersApi=new At(e.indexer),this.nftsApi=new kt(e.indexer),this.ordersApi=new xt(e.orderBook),this.passportApi=new Pt(e.passport)}}const Wt={"x-sdk-version":"ts-immutable-sdk-0.28.10"},Kt=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...Wt,...t||{}}}};return new class{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}(r)},Xt=()=>({indexer:Kt({basePath:"https://indexer-mr.imtbl.com"}),orderBook:Kt({basePath:"https://order-book-mr.imtbl.com"}),passport:Kt({basePath:"https://api.immutable.com"})}),$t=()=>({indexer:Kt({basePath:"https://api.sandbox.immutable.com"}),orderBook:Kt({basePath:"https://api.sandbox.immutable.com"}),passport:Kt({basePath:"https://api.sandbox.immutable.com"})});class Jt extends Error{code;details;link;traceId;constructor({message:e,code:t,details:r,link:n,trace_id:i}){super(e),this.code=t,this.details=r,this.link=n,this.traceId=i}}const Yt={sdkVersion:"ts-immutable-sdk-multi-rollup-api-client-0.28.10"},Qt=({baseConfig:e,basePath:t,headers:r})=>{if(!t.trim())throw Error("basePath can not be empty");const n={...e,basePath:t,baseOptions:{headers:{...r||{},...Yt}}};return new Ft.Configuration(n)};class Zt{apiConfig;baseConfig;constructor({baseConfig:e,overrides:t}){if(this.baseConfig=e,t)this.apiConfig=Qt(t);else switch(e.environment){case Je.SANDBOX:this.apiConfig=Qt({basePath:"https://api.sandbox.immutable.com",baseConfig:e});break;case Je.PRODUCTION:this.apiConfig=Qt({basePath:"https://indexer-mr.imtbl.com",baseConfig:e});break;default:this.apiConfig=Qt({basePath:"https://api.sandbox.immutable.com",baseConfig:e})}}}function er(e){if(Ne.isAxiosError(e)&&e.response){const t=e.response.data;return t.code&&t.message?new Jt({code:t.code,message:t.message,details:t.details||null,link:t.link||"",trace_id:t.trace_id||""}):new Jt({code:e.code??e.response?.status.toString()??"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}return new Jt({code:"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}class tr{config;activities;chains;collections;nfts;nftOwners;tokens;metadata;constructor(e){this.config=new Zt(e),this.activities=new Ft.ActivitiesApi(this.config.apiConfig),this.chains=new Ft.ChainsApi(this.config.apiConfig),this.collections=new Ft.CollectionsApi(this.config.apiConfig),this.nfts=new Ft.NftsApi(this.config.apiConfig),this.nftOwners=new Ft.NftOwnersApi(this.config.apiConfig),this.tokens=new Ft.TokensApi(this.config.apiConfig),this.metadata=new Ft.MetadataApi(this.config.apiConfig)}async listActivities(e){return await this.activities.listActivities(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async getActivity(e){return await this.activities.getActivity(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listChains(e){return await this.chains.listChains(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listCollections(e){return await this.collections.listCollections(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listCollectionsByNFTOwner(e){return await this.collections.listCollectionsByNFTOwner(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async getCollection(e){return await this.collections.getCollection(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async getNFT(e){return await this.nfts.getNFT(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listNFTs(e){return await this.nfts.listNFTs(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listAllNFTs(e){return await this.nfts.listAllNFTs(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listNFTOwnersByContractAddress(e){return await this.nftOwners.listOwnersByContractAddress(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listAllNFTOwners(e){return await this.nfts.listAllNFTOwners(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listTokens(e){return await this.tokens.listERC20Tokens(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async getToken(e){return await this.tokens.getERC20Token(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async getMetadata(e){return await this.metadata.getMetadata(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async listNFTMetadataByContractAddress(e){return await this.metadata.listMetadata(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async refreshCollectionMetadata(e){return await this.collections.refreshCollectionMetadata(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async refreshNFTMetadata(e){return await this.metadata.refreshNFTMetadataByTokenID(e).then((e=>e.data)).catch((e=>{throw er(e)}))}async refreshStackedMetadata(e){return await this.metadata.refreshMetadataByID(e).then((e=>e.data)).catch((e=>{throw er(e)}))}}var rr=Object.freeze({__proto__:null,APIError:Jt,ActivitiesTypes:Lt,BlockchainData:tr,ChainsTypes:Ut,CollectionsTypes:jt,MetadataTypes:qt,NFTOwnersTypes:zt,NFTsTypes:Ht,TokensTypes:Gt}),nr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ir(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ar(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(t,r))}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var or={exports:{}},sr="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},cr=[],ur=[],fr="undefined"!=typeof Uint8Array?Uint8Array:Array,dr=!1;function lr(){dr=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)cr[t]=e[t],ur[e.charCodeAt(t)]=t;ur["-".charCodeAt(0)]=62,ur["_".charCodeAt(0)]=63}function hr(e,t,r){for(var n,i,a=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],a.push(cr[(i=n)>>18&63]+cr[i>>12&63]+cr[i>>6&63]+cr[63&i]);return a.join("")}function pr(e){var t;dr||lr();for(var r=e.length,n=r%3,i="",a=[],o=16383,s=0,c=r-n;s<c;s+=o)a.push(hr(e,s,s+o>c?c:s+o));return 1===n?(t=e[r-1],i+=cr[t>>2],i+=cr[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=cr[t>>10],i+=cr[t>>4&63],i+=cr[t<<2&63],i+="="),a.push(i),a.join("")}function mr(e,t,r,n,i){var a,o,s=8*i-n-1,c=(1<<s)-1,u=c>>1,f=-7,d=r?i-1:0,l=r?-1:1,h=e[t+d];for(d+=l,a=h&(1<<-f)-1,h>>=-f,f+=s;f>0;a=256*a+e[t+d],d+=l,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=n;f>0;o=256*o+e[t+d],d+=l,f-=8);if(0===a)a=1-u;else{if(a===c)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),a-=u}return(h?-1:1)*o*Math.pow(2,a-n)}function br(e,t,r,n,i,a){var o,s,c,u=8*a-i-1,f=(1<<u)-1,d=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,p=n?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=f):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?l/c:l*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=f?(s=0,o=f):o+d>=1?(s=(t*c-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+h]=255&s,h+=p,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+h]=255&o,h+=p,o/=256,u-=8);e[r+h-p]|=128*m}var yr={}.toString,gr=Array.isArray||function(e){return"[object Array]"==yr.call(e)};Er.TYPED_ARRAY_SUPPORT=void 0===sr.TYPED_ARRAY_SUPPORT||sr.TYPED_ARRAY_SUPPORT;var vr=wr();function wr(){return Er.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function _r(e,t){if(wr()<t)throw new RangeError("Invalid typed array length");return Er.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Er.prototype:(null===e&&(e=new Er(t)),e.length=t),e}function Er(e,t,r){if(!(Er.TYPED_ARRAY_SUPPORT||this instanceof Er))return new Er(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Sr(this,e)}return Tr(this,e,t,r)}function Tr(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);Er.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Er.prototype:e=Rr(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!Er.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Ir(t,r);e=_r(e,n);var i=e.write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(Or(t)){var r=0|kr(t.length);return 0===(e=_r(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?_r(e,0):Rr(e,t);if("Buffer"===t.type&&gr(t.data))return Rr(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Ar(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 Sr(e,t){if(Ar(t),e=_r(e,t<0?0:0|kr(t)),!Er.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function Rr(e,t){var r=t.length<0?0:0|kr(t.length);e=_r(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function kr(e){if(e>=wr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+wr().toString(16)+" bytes");return 0|e}function Or(e){return!(null==e||!e._isBuffer)}function Ir(e,t){if(Or(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 r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return rn(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return nn(e).length;default:if(n)return rn(e).length;t=(""+t).toLowerCase(),n=!0}}function xr(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Vr(this,t,r);case"utf8":case"utf-8":return qr(this,t,r);case"ascii":return Hr(this,t,r);case"latin1":case"binary":return Gr(this,t,r);case"base64":return jr(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wr(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Cr(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Mr(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=Er.from(t,n)),Or(t))return 0===t.length?-1:Pr(e,t,r,n,i);if("number"==typeof t)return t&=255,Er.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Pr(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Pr(e,t,r,n,i){var a,o=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var f=-1;for(a=r;a<s;a++)if(u(e,a)===u(t,-1===f?0:a-f)){if(-1===f&&(f=a),a-f+1===c)return f*o}else-1!==f&&(a-=a-f),f=-1}else for(r+c>s&&(r=s-c),a=r;a>=0;a--){for(var d=!0,l=0;l<c;l++)if(u(e,a+l)!==u(t,l)){d=!1;break}if(d)return a}return-1}function Nr(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function Br(e,t,r,n){return an(rn(t,e.length-r),e,r,n)}function Dr(e,t,r,n){return an(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function Fr(e,t,r,n){return Dr(e,t,r,n)}function Lr(e,t,r,n){return an(nn(t),e,r,n)}function Ur(e,t,r,n){return an(function(e,t){for(var r,n,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function jr(e,t,r){return 0===t&&r===e.length?pr(e):pr(e.slice(t,r))}function qr(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,c,u=e[i],f=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(f=u);break;case 2:128==(192&(a=e[i+1]))&&(c=(31&u)<<6|63&a)>127&&(f=c);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(c=(15&u)<<12|(63&a)<<6|63&o)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(c=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&c<1114112&&(f=c)}null===f?(f=65533,d=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=d}return function(e){var t=e.length;if(t<=zr)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=zr));return r}(n)}Er.poolSize=8192,Er._augment=function(e){return e.__proto__=Er.prototype,e},Er.from=function(e,t,r){return Tr(null,e,t,r)},Er.TYPED_ARRAY_SUPPORT&&(Er.prototype.__proto__=Uint8Array.prototype,Er.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Er[Symbol.species]),Er.alloc=function(e,t,r){return function(e,t,r,n){return Ar(t),t<=0?_r(e,t):void 0!==r?"string"==typeof n?_r(e,t).fill(r,n):_r(e,t).fill(r):_r(e,t)}(null,e,t,r)},Er.allocUnsafe=function(e){return Sr(null,e)},Er.allocUnsafeSlow=function(e){return Sr(null,e)},Er.isBuffer=on,Er.compare=function(e,t){if(!Or(e)||!Or(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},Er.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}},Er.concat=function(e,t){if(!gr(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Er.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=Er.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!Or(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},Er.byteLength=Ir,Er.prototype._isBuffer=!0,Er.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)Cr(this,t,t+1);return this},Er.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)Cr(this,t,t+3),Cr(this,t+1,t+2);return this},Er.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)Cr(this,t,t+7),Cr(this,t+1,t+6),Cr(this,t+2,t+5),Cr(this,t+3,t+4);return this},Er.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?qr(this,0,e):xr.apply(this,arguments)},Er.prototype.equals=function(e){if(!Or(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Er.compare(this,e)},Er.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+">"},Er.prototype.compare=function(e,t,r,n,i){if(!Or(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),c=this.slice(n,i),u=e.slice(t,r),f=0;f<s;++f)if(c[f]!==u[f]){a=c[f],o=u[f];break}return a<o?-1:o<a?1:0},Er.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Er.prototype.indexOf=function(e,t,r){return Mr(this,e,t,r,!0)},Er.prototype.lastIndexOf=function(e,t,r){return Mr(this,e,t,r,!1)},Er.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return Nr(this,e,t,r);case"utf8":case"utf-8":return Br(this,e,t,r);case"ascii":return Dr(this,e,t,r);case"latin1":case"binary":return Fr(this,e,t,r);case"base64":return Lr(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ur(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},Er.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var zr=4096;function Hr(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function Gr(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Vr(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=tn(e[a]);return i}function Wr(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function Kr(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function Xr(e,t,r,n,i,a){if(!Or(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(r+n>e.length)throw new RangeError("Index out of range")}function $r(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i<a;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Jr(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i<a;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function Yr(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Qr(e,t,r,n,i){return i||Yr(e,0,r,4),br(e,t,r,n,23,4),r+4}function Zr(e,t,r,n,i){return i||Yr(e,0,r,8),br(e,t,r,n,52,8),r+8}Er.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Er.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Er.prototype;else{var i=t-e;r=new Er(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},Er.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Kr(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},Er.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Kr(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},Er.prototype.readUInt8=function(e,t){return t||Kr(e,1,this.length),this[e]},Er.prototype.readUInt16LE=function(e,t){return t||Kr(e,2,this.length),this[e]|this[e+1]<<8},Er.prototype.readUInt16BE=function(e,t){return t||Kr(e,2,this.length),this[e]<<8|this[e+1]},Er.prototype.readUInt32LE=function(e,t){return t||Kr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Er.prototype.readUInt32BE=function(e,t){return t||Kr(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Er.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Kr(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},Er.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Kr(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},Er.prototype.readInt8=function(e,t){return t||Kr(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Er.prototype.readInt16LE=function(e,t){t||Kr(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Er.prototype.readInt16BE=function(e,t){t||Kr(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Er.prototype.readInt32LE=function(e,t){return t||Kr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Er.prototype.readInt32BE=function(e,t){return t||Kr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Er.prototype.readFloatLE=function(e,t){return t||Kr(e,4,this.length),mr(this,e,!0,23,4)},Er.prototype.readFloatBE=function(e,t){return t||Kr(e,4,this.length),mr(this,e,!1,23,4)},Er.prototype.readDoubleLE=function(e,t){return t||Kr(e,8,this.length),mr(this,e,!0,52,8)},Er.prototype.readDoubleBE=function(e,t){return t||Kr(e,8,this.length),mr(this,e,!1,52,8)},Er.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Xr(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},Er.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Xr(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},Er.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,1,255,0),Er.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Er.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,2,65535,0),Er.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):$r(this,e,t,!0),t+2},Er.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,2,65535,0),Er.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):$r(this,e,t,!1),t+2},Er.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,4,4294967295,0),Er.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Jr(this,e,t,!0),t+4},Er.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,4,4294967295,0),Er.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Jr(this,e,t,!1),t+4},Er.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Xr(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},Er.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Xr(this,e,t,r,i-1,-i)}var a=r-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+r},Er.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,1,127,-128),Er.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Er.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,2,32767,-32768),Er.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):$r(this,e,t,!0),t+2},Er.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,2,32767,-32768),Er.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):$r(this,e,t,!1),t+2},Er.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,4,2147483647,-2147483648),Er.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Jr(this,e,t,!0),t+4},Er.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Xr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Er.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Jr(this,e,t,!1),t+4},Er.prototype.writeFloatLE=function(e,t,r){return Qr(this,e,t,!0,r)},Er.prototype.writeFloatBE=function(e,t,r){return Qr(this,e,t,!1,r)},Er.prototype.writeDoubleLE=function(e,t,r){return Zr(this,e,t,!0,r)},Er.prototype.writeDoubleBE=function(e,t,r){return Zr(this,e,t,!1,r)},Er.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&r<t&&t<n)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(a<1e3||!Er.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},Er.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Er.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=Or(e)?e:rn(new Er(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var en=/[^+\/0-9A-Za-z-_]/g;function tn(e){return e<16?"0"+e.toString(16):e.toString(16)}function rn(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function nn(e){return function(e){var t,r,n,i,a,o;dr||lr();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 fr(3*s/4-a),n=a>0?s-4:s;var c=0;for(t=0,r=0;t<n;t+=4,r+=3)i=ur[e.charCodeAt(t)]<<18|ur[e.charCodeAt(t+1)]<<12|ur[e.charCodeAt(t+2)]<<6|ur[e.charCodeAt(t+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=255&i;return 2===a?(i=ur[e.charCodeAt(t)]<<2|ur[e.charCodeAt(t+1)]>>4,o[c++]=255&i):1===a&&(i=ur[e.charCodeAt(t)]<<10|ur[e.charCodeAt(t+1)]<<4|ur[e.charCodeAt(t+2)]>>2,o[c++]=i>>8&255,o[c++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(en,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function an(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function on(e){return null!=e&&(!!e._isBuffer||sn(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&sn(e.slice(0,0))}(e))}function sn(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var cn=ar(Object.freeze({__proto__:null,Buffer:Er,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),Er.alloc(+e)},isBuffer:on,kMaxLength:vr}));!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"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:cn.Buffer}catch(e){}function o(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var n=o(e,r);return r-1>=t&&(n|=o(e,r-1)<<4),n}function c(e,t,n,i){for(var a=0,o=0,s=Math.min(e.length,n),c=t;c<s;c++){var u=e.charCodeAt(c)-48;a*=i,o=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&o<i,"Invalid character"),a+=o}return a}function u(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,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(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,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("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"===n)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"===n)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,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,a=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=s(e,t,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=s(e,t,n)<<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,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var a=e.length-r,o=a%n,s=Math.min(a,a-o)+r,u=0,f=r;f<s;f+=n)u=c(e,f,f+n,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var d=1;for(u=c(e,f,e.length,t),f=0;f<o;f++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}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){u(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")]=f}catch(e){i.prototype.inspect=f}else i.prototype.inspect=f;function f(){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"],l=[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],h=[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 n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=(16777215&(s<<i|a)).toString(16);a=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),n=0!==a||o!==this.length-1?d[6-c.length]+c+n:c+n}for(0!==a&&(n=a.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=l[e],f=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(f).toString(e);n=(p=p.idivn(f)).isZero()?m+n:d[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!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&&r(!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 p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,c=o/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var f=c>>>26,d=67108863&c,l=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=l;h++){var p=u-h|0;f+=(o=(i=0|e.words[p])*(a=0|t.words[h])+d)/67108864|0,d=67108863&o}r.words[u]=0|d,c=0|f}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),a=n||Math.max(1,i);r(i<=a,"byte array longer than desired length"),r(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 r=0,n=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|n;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===a?(r<e.length&&(e[r++]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|n;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===a?(r>=0&&(e[r--]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},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 r=this._zeroBits(this.words[t]);if(e+=r,26!==r)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 r(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 r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(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,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(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){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,r,n;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?(r=this,n=e):(r=e,n=this);for(var i=0,a=0;a<n.length;a++)t=(0|r.words[a])+(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!==i&&a<r.length;a++)t=(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.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 r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var a=0,o=0;o<n.length;o++)a=(t=(0|r.words[o])-(0|n.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,i,a,o=e.words,s=t.words,c=r.words,u=0,f=0|o[0],d=8191&f,l=f>>>13,h=0|o[1],p=8191&h,m=h>>>13,b=0|o[2],y=8191&b,g=b>>>13,v=0|o[3],w=8191&v,_=v>>>13,E=0|o[4],T=8191&E,A=E>>>13,S=0|o[5],R=8191&S,k=S>>>13,O=0|o[6],I=8191&O,x=O>>>13,C=0|o[7],M=8191&C,P=C>>>13,N=0|o[8],B=8191&N,D=N>>>13,F=0|o[9],L=8191&F,U=F>>>13,j=0|s[0],q=8191&j,z=j>>>13,H=0|s[1],G=8191&H,V=H>>>13,W=0|s[2],K=8191&W,X=W>>>13,$=0|s[3],J=8191&$,Y=$>>>13,Q=0|s[4],Z=8191&Q,ee=Q>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,fe=0|s[8],de=8191&fe,le=fe>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(d,q))|0)+((8191&(i=(i=Math.imul(d,z))+Math.imul(l,q)|0))<<13)|0;u=((a=Math.imul(l,z))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(m,q)|0,a=Math.imul(m,z);var ye=(u+(n=n+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(l,G)|0))<<13)|0;u=((a=a+Math.imul(l,V)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,z))+Math.imul(g,q)|0,a=Math.imul(g,z),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,V)|0;var ge=(u+(n=n+Math.imul(d,K)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(l,K)|0))<<13)|0;u=((a=a+Math.imul(l,X)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,a=Math.imul(_,z),n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(g,G)|0,a=a+Math.imul(g,V)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,X)|0;var ve=(u+(n=n+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(l,J)|0))<<13)|0;u=((a=a+Math.imul(l,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(A,q)|0,a=Math.imul(A,z),n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,G)|0,a=a+Math.imul(_,V)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(g,K)|0,a=a+Math.imul(g,X)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,J)|0,a=a+Math.imul(m,Y)|0;var we=(u+(n=n+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(l,Z)|0))<<13)|0;u=((a=a+Math.imul(l,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(R,q),i=(i=Math.imul(R,z))+Math.imul(k,q)|0,a=Math.imul(k,z),n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(A,G)|0,a=a+Math.imul(A,V)|0,n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,K)|0,a=a+Math.imul(_,X)|0,n=n+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(g,J)|0,a=a+Math.imul(g,Y)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Z)|0,a=a+Math.imul(m,ee)|0;var _e=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(l,re)|0))<<13)|0;u=((a=a+Math.imul(l,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(x,q)|0,a=Math.imul(x,z),n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(k,G)|0,a=a+Math.imul(k,V)|0,n=n+Math.imul(T,K)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(A,K)|0,a=a+Math.imul(A,X)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,J)|0,a=a+Math.imul(_,Y)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(g,Z)|0,a=a+Math.imul(g,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ne)|0;var Ee=(u+(n=n+Math.imul(d,ae)|0)|0)+((8191&(i=(i=i+Math.imul(d,oe)|0)+Math.imul(l,ae)|0))<<13)|0;u=((a=a+Math.imul(l,oe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(M,q),i=(i=Math.imul(M,z))+Math.imul(P,q)|0,a=Math.imul(P,z),n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(x,G)|0,a=a+Math.imul(x,V)|0,n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(k,K)|0,a=a+Math.imul(k,X)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(A,J)|0,a=a+Math.imul(A,Y)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,a=a+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(g,re)|0,a=a+Math.imul(g,ne)|0,n=n+Math.imul(p,ae)|0,i=(i=i+Math.imul(p,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Te=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(l,ce)|0))<<13)|0;u=((a=a+Math.imul(l,ue)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,z))+Math.imul(D,q)|0,a=Math.imul(D,z),n=n+Math.imul(M,G)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(P,G)|0,a=a+Math.imul(P,V)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,K)|0,a=a+Math.imul(x,X)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(k,J)|0,a=a+Math.imul(k,Y)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(A,Z)|0,a=a+Math.imul(A,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,a=a+Math.imul(_,ne)|0,n=n+Math.imul(y,ae)|0,i=(i=i+Math.imul(y,oe)|0)+Math.imul(g,ae)|0,a=a+Math.imul(g,oe)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,a=a+Math.imul(m,ue)|0;var Ae=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(l,de)|0))<<13)|0;u=((a=a+Math.imul(l,le)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,z))+Math.imul(U,q)|0,a=Math.imul(U,z),n=n+Math.imul(B,G)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(D,G)|0,a=a+Math.imul(D,V)|0,n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(P,K)|0,a=a+Math.imul(P,X)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(x,J)|0,a=a+Math.imul(x,Y)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(k,Z)|0,a=a+Math.imul(k,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(A,re)|0,a=a+Math.imul(A,ne)|0,n=n+Math.imul(w,ae)|0,i=(i=i+Math.imul(w,oe)|0)+Math.imul(_,ae)|0,a=a+Math.imul(_,oe)|0,n=n+Math.imul(y,ce)|0,i=(i=i+Math.imul(y,ue)|0)+Math.imul(g,ce)|0,a=a+Math.imul(g,ue)|0,n=n+Math.imul(p,de)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,de)|0,a=a+Math.imul(m,le)|0;var Se=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(l,pe)|0))<<13)|0;u=((a=a+Math.imul(l,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,G),i=(i=Math.imul(L,V))+Math.imul(U,G)|0,a=Math.imul(U,V),n=n+Math.imul(B,K)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(D,K)|0,a=a+Math.imul(D,X)|0,n=n+Math.imul(M,J)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(P,J)|0,a=a+Math.imul(P,Y)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(x,Z)|0,a=a+Math.imul(x,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(k,re)|0,a=a+Math.imul(k,ne)|0,n=n+Math.imul(T,ae)|0,i=(i=i+Math.imul(T,oe)|0)+Math.imul(A,ae)|0,a=a+Math.imul(A,oe)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(_,ce)|0,a=a+Math.imul(_,ue)|0,n=n+Math.imul(y,de)|0,i=(i=i+Math.imul(y,le)|0)+Math.imul(g,de)|0,a=a+Math.imul(g,le)|0;var Re=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((a=a+Math.imul(m,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,K),i=(i=Math.imul(L,X))+Math.imul(U,K)|0,a=Math.imul(U,X),n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(D,J)|0,a=a+Math.imul(D,Y)|0,n=n+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(P,Z)|0,a=a+Math.imul(P,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(x,re)|0,a=a+Math.imul(x,ne)|0,n=n+Math.imul(R,ae)|0,i=(i=i+Math.imul(R,oe)|0)+Math.imul(k,ae)|0,a=a+Math.imul(k,oe)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(A,ce)|0,a=a+Math.imul(A,ue)|0,n=n+Math.imul(w,de)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(_,de)|0,a=a+Math.imul(_,le)|0;var ke=(u+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,me)|0)+Math.imul(g,pe)|0))<<13)|0;u=((a=a+Math.imul(g,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,J),i=(i=Math.imul(L,Y))+Math.imul(U,J)|0,a=Math.imul(U,Y),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(D,Z)|0,a=a+Math.imul(D,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(P,re)|0,a=a+Math.imul(P,ne)|0,n=n+Math.imul(I,ae)|0,i=(i=i+Math.imul(I,oe)|0)+Math.imul(x,ae)|0,a=a+Math.imul(x,oe)|0,n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(k,ce)|0,a=a+Math.imul(k,ue)|0,n=n+Math.imul(T,de)|0,i=(i=i+Math.imul(T,le)|0)+Math.imul(A,de)|0,a=a+Math.imul(A,le)|0;var Oe=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(_,pe)|0))<<13)|0;u=((a=a+Math.imul(_,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,ee))+Math.imul(U,Z)|0,a=Math.imul(U,ee),n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(D,re)|0,a=a+Math.imul(D,ne)|0,n=n+Math.imul(M,ae)|0,i=(i=i+Math.imul(M,oe)|0)+Math.imul(P,ae)|0,a=a+Math.imul(P,oe)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(x,ce)|0,a=a+Math.imul(x,ue)|0,n=n+Math.imul(R,de)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(k,de)|0,a=a+Math.imul(k,le)|0;var Ie=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(A,pe)|0))<<13)|0;u=((a=a+Math.imul(A,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(U,re)|0,a=Math.imul(U,ne),n=n+Math.imul(B,ae)|0,i=(i=i+Math.imul(B,oe)|0)+Math.imul(D,ae)|0,a=a+Math.imul(D,oe)|0,n=n+Math.imul(M,ce)|0,i=(i=i+Math.imul(M,ue)|0)+Math.imul(P,ce)|0,a=a+Math.imul(P,ue)|0,n=n+Math.imul(I,de)|0,i=(i=i+Math.imul(I,le)|0)+Math.imul(x,de)|0,a=a+Math.imul(x,le)|0;var xe=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(k,pe)|0))<<13)|0;u=((a=a+Math.imul(k,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(L,ae),i=(i=Math.imul(L,oe))+Math.imul(U,ae)|0,a=Math.imul(U,oe),n=n+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,a=a+Math.imul(D,ue)|0,n=n+Math.imul(M,de)|0,i=(i=i+Math.imul(M,le)|0)+Math.imul(P,de)|0,a=a+Math.imul(P,le)|0;var Ce=(u+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(x,pe)|0))<<13)|0;u=((a=a+Math.imul(x,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,ce),i=(i=Math.imul(L,ue))+Math.imul(U,ce)|0,a=Math.imul(U,ue),n=n+Math.imul(B,de)|0,i=(i=i+Math.imul(B,le)|0)+Math.imul(D,de)|0,a=a+Math.imul(D,le)|0;var Me=(u+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(P,pe)|0))<<13)|0;u=((a=a+Math.imul(P,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(L,de),i=(i=Math.imul(L,le))+Math.imul(U,de)|0,a=Math.imul(U,le);var Pe=(u+(n=n+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,me)|0)+Math.imul(D,pe)|0))<<13)|0;u=((a=a+Math.imul(D,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(n=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return u=((a=Math.imul(U,me))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=be,c[1]=ye,c[2]=ge,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ee,c[7]=Te,c[8]=Ae,c[9]=Se,c[10]=Re,c[11]=ke,c[12]=Oe,c[13]=Ie,c[14]=xe,c[15]=Ce,c[16]=Me,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,a=0;a<r.length-1;a++){var o=i;i=0;for(var s=67108863&n,c=Math.min(a,t.length-1),u=Math.max(0,a-e.length+1);u<=c;u++){var f=a-u,d=(0|e.words[f])*(0|t.words[u]),l=67108863&d;s=67108863&(l=l+s|0),i+=(o=(o=o+(d/67108864|0)|0)+(l>>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r._strip()}function y(e,t,r){return b(e,t,r)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?b(this,e,t):y(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),y(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),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i<this.length;i++){var a=(0|this.words[i])*e,o=(67108863&a)+(67108863&n);n>>=26,n+=a/67108864|0,n+=o>>>26,this.words[i]=67108863&o}return 0!==n&&(this.words[i]=n,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()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var a=r.sqr();n<t.length;n++,a=a.sqr())0!==t[n]&&(r=r.mul(a));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,c=(0|this.words[t])-s<<n;this.words[t]=c|o,o=s>>>26-n}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 r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("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,c=n;if(i-=o,i=Math.max(0,i),c){for(var u=0;u<o;u++)c.words[u]=this.words[u];c.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=i);u--){var d=0|this.words[u];this.words[u]=f<<26-a|d>>>a,f=d&s}return c&&0!==f&&(c.words[c.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},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){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,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 r("number"==typeof e),r(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(r("number"==typeof e),r(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,n){var i,a,o=e.length+n;this._expand(o);var s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+n])+s;var c=(0|e.words[i])*t;s=((a-=67108863&c)>>26)-(c/67108864|0),this.words[i+n]=67108863&a}for(;i<this.length-n;i++)s=(a=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&a;if(0===s)return this._strip();for(r(-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 r=(this.length,e.length),n=this.clone(),a=e,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,c=n.length-a.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var f=n.clone()._ishlnsubmul(a,1,c);0===f.negative&&(n=f,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var l=67108864*(0|n.words[a.length+d])+(0|n.words[a.length+d-1]);for(l=Math.min(l/o|0,67108863),n._ishlnsubmul(a,l,d);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(a,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=l)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!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(),n&&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(),n&&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 r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),a=r.cmp(n);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),r(e<=67108863);for(var n=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(n*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),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var a=(0|this.words[i])+67108864*n;this.words[i]=a/e|0,n=a%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=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),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var f=n.clone(),d=t.clone();!t.isZero();){for(var l=0,h=1;0==(t.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(f),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(f),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s),o.isub(c)):(n.isub(t),s.isub(a),c.isub(o))}return{a:s,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,o=new i(1),s=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,f=1;0==(t.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(t.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var d=0,l=1;0==(n.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s)):(n.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(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var a=t;t=r,r=a}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},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){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a=i,o=n;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,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(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,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>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 A(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(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 r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(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 w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function T(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){A.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)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(w,v),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&r)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(E,v),n(T,v),T.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new _;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new T}return g[e]=t,t},A.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);r(!a.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,u).cmp(c);)f.redIAdd(c);for(var d=this.pow(f,a),l=this.pow(e,a.addn(1).iushrn(1)),h=this.pow(e,a),p=o;0!==h.cmp(s);){for(var m=h,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<p);var y=this.pow(d,new i(1).iushln(p-b-1));l=l.redMul(y),d=y.redSqr(),h=h.redMul(d),p=b}return l},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var a=r[0],o=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],f=c-1;f>=0;f--){var d=u>>f&1;a!==r[0]&&(a=this.sqr(a)),0!==d||0!==o?(o<<=1,o|=d,(4===++s||0===n&&0===f)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}c=26}return a},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},n(S,A),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).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)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).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)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,nr)}(or);var un=or.exports,fn=ir(un);let dn=!1,ln=!1;const hn={debug:1,default:2,info:2,warning:3,error:4,off:5};let pn=hn.default,mn=null;const bn=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){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 yn,gn;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(yn||(yn={})),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"}(gn||(gn={}));const vn="0123456789abcdef";let wn=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==hn[r]&&this.throwArgumentError("invalid log level name","logLevel",e),pn>hn[r]||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,r,n){if(ln)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=vn[t[e]>>4],r+=vn[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const a=t;let o="";switch(r){case gn.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 gn.CALL_EXCEPTION:case gn.INSUFFICIENT_FUNDS:case gn.MISSING_NEW:case gn.NONCE_EXPIRED:case gn.REPLACEMENT_UNDERPRICED:case gn.TRANSACTION_REPLACED:case gn.UNPREDICTABLE_GAS_LIMIT:o=r}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=r,Object.keys(n).forEach((function(e){s[e]=n[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){bn&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:bn})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.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:r.name})}static globalLogger(){return mn||(mn=new e("logger/5.7.0")),mn}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),dn){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ln=!!t,dn=!!r}static setLogLevel(t){const r=hn[t.toLowerCase()];null!=r?pn=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};wn.errors=gn,wn.levels=yn;var _n=Object.freeze({__proto__:null,get ErrorCode(){return gn},get LogLevel(){return yn},Logger:wn});const En=new wn("bytes/5.7.0");function Tn(e){return!!e.toHexString}function An(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return An(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Sn(e){return Mn(e)&&!(e.length%2)||kn(e)}function Rn(e){return"number"==typeof e&&e==e&&e%1==0}function kn(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Rn(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Rn(r)||r<0||r>=256)return!1}return!0}function On(e,t){if(t||(t={}),"number"==typeof e){En.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),An(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Tn(e)&&(e=e.toHexString()),Mn(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":En.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return An(new Uint8Array(n))}return kn(e)?An(new Uint8Array(e)):En.throwArgumentError("invalid arrayify value","value",e)}function In(e){const t=e.map((e=>On(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),An(n)}function xn(e){let t=On(e);if(0===t.length)return t;let r=0;for(;r<t.length&&0===t[r];)r++;return r&&(t=t.slice(r)),t}function Cn(e,t){(e=On(e)).length>t&&En.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),An(r)}function Mn(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Pn="0123456789abcdef";function Nn(e,t){if(t||(t={}),"number"==typeof e){En.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Pn[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),Tn(e))return e.toHexString();if(Mn(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":En.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(kn(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Pn[(240&n)>>4]+Pn[15&n]}return t}return En.throwArgumentError("invalid hexlify value","value",e)}function Bn(e){if("string"!=typeof e)e=Nn(e);else if(!Mn(e)||e.length%2)return null;return(e.length-2)/2}function Dn(e,t,r){return"string"!=typeof e?e=Nn(e):(!Mn(e)||e.length%2)&&En.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function Fn(e){let t="0x";return e.forEach((e=>{t+=Nn(e).substring(2)})),t}function Ln(e){const t=Un(Nn(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function Un(e){"string"!=typeof e&&(e=Nn(e)),Mn(e)||En.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 jn(e,t){for("string"!=typeof e?e=Nn(e):Mn(e)||En.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&En.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function qn(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Sn(e)){let r=On(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Nn(r.slice(0,32)),t.s=Nn(r.slice(32,64))):65===r.length?(t.r=Nn(r.slice(0,32)),t.s=Nn(r.slice(32,64)),t.v=r[64]):En.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:En.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Nn(r.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 r=Cn(On(t._vs),32);t._vs=Nn(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&En.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=Nn(r);null==t.s?t.s=i:t.s!==i&&En.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?En.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 r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&En.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Mn(t.r)?t.r=jn(t.r,32):En.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Mn(t.s)?t.s=jn(t.s,32):En.throwArgumentError("signature missing or invalid s","signature",e);const r=On(t.s);r[0]>=128&&En.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Nn(r);t._vs&&(Mn(t._vs)||En.throwArgumentError("signature invalid _vs","signature",e),t._vs=jn(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&En.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function zn(e){return Nn(In([(e=qn(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var Hn=Object.freeze({__proto__:null,arrayify:On,concat:In,hexConcat:Fn,hexDataLength:Bn,hexDataSlice:Dn,hexStripZeros:Un,hexValue:Ln,hexZeroPad:jn,hexlify:Nn,isBytes:kn,isBytesLike:Sn,isHexString:Mn,joinSignature:zn,splitSignature:qn,stripZeros:xn,zeroPad:Cn});const Gn="bignumber/5.7.0";var Vn=fn.BN;const Wn=new wn(Gn),Kn={},Xn=9007199254740991;let $n=!1,Jn=class e{constructor(e,t){e!==Kn&&Wn.throwError("cannot call constructor directly; use BigNumber.from",wn.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Qn(Zn(this).fromTwos(e))}toTwos(e){return Qn(Zn(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Qn(Zn(this).add(Zn(e)))}sub(e){return Qn(Zn(this).sub(Zn(e)))}div(t){return e.from(t).isZero()&&ei("division-by-zero","div"),Qn(Zn(this).div(Zn(t)))}mul(e){return Qn(Zn(this).mul(Zn(e)))}mod(e){const t=Zn(e);return t.isNeg()&&ei("division-by-zero","mod"),Qn(Zn(this).umod(t))}pow(e){const t=Zn(e);return t.isNeg()&&ei("negative-power","pow"),Qn(Zn(this).pow(t))}and(e){const t=Zn(e);return(this.isNegative()||t.isNeg())&&ei("unbound-bitwise-result","and"),Qn(Zn(this).and(t))}or(e){const t=Zn(e);return(this.isNegative()||t.isNeg())&&ei("unbound-bitwise-result","or"),Qn(Zn(this).or(t))}xor(e){const t=Zn(e);return(this.isNegative()||t.isNeg())&&ei("unbound-bitwise-result","xor"),Qn(Zn(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&ei("negative-width","mask"),Qn(Zn(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ei("negative-width","shl"),Qn(Zn(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ei("negative-width","shr"),Qn(Zn(this).shrn(e))}eq(e){return Zn(this).eq(Zn(e))}lt(e){return Zn(this).lt(Zn(e))}lte(e){return Zn(this).lte(Zn(e))}gt(e){return Zn(this).gt(Zn(e))}gte(e){return Zn(this).gte(Zn(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Zn(this).isZero()}toNumber(){try{return Zn(this).toNumber()}catch(e){ei("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Wn.throwError("this platform does not support BigInt",wn.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?$n||($n=!0,Wn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Wn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",wn.errors.UNEXPECTED_ARGUMENT,{}):Wn.throwError("BigNumber.toString does not accept parameters",wn.errors.UNEXPECTED_ARGUMENT,{})),Zn(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(Kn,Yn(t)):t.match(/^-?[0-9]+$/)?new e(Kn,Yn(new Vn(t))):Wn.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&ei("underflow","BigNumber.from",t),(t>=Xn||t<=-Xn)&&ei("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(kn(r))return e.from(Nn(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Mn(t)||"-"===t[0]&&Mn(t.substring(1))))return e.from(t)}return Wn.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Yn(e){if("string"!=typeof e)return Yn(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Wn.throwArgumentError("invalid hex","value",e),"0x00"===(e=Yn(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 Qn(e){return Jn.from(Yn(e))}function Zn(e){const t=Jn.from(e).toHexString();return"-"===t[0]?new Vn("-"+t.substring(3),16):new Vn(t.substring(2),16)}function ei(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Wn.throwError(e,wn.errors.NUMERIC_FAULT,n)}const ti=new wn(Gn),ri={},ni=Jn.from(0),ii=Jn.from(-1);function ai(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),ti.throwError(e,wn.errors.NUMERIC_FAULT,i)}let oi="0";for(;oi.length<256;)oi+=oi;function si(e){if("number"!=typeof e)try{e=Jn.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+oi.substring(0,e):ti.throwArgumentError("invalid decimal size","decimals",e)}function ci(e,t){null==t&&(t=0);const r=si(t),n=(e=Jn.from(e)).lt(ni);n&&(e=e.mul(ii));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(r).toString();return e=1===r.length?a:a+"."+i,n&&(e="-"+e),e}function ui(e,t){null==t&&(t=0);const r=si(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||ti.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&ti.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&ti.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>r.length-1&&ai("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=Jn.from(a),c=Jn.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(ii)),u}class fi{constructor(e,t,r,n){e!==ri&&ti.throwError("cannot use FixedFormat constructor; use FixedFormat.from",wn.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=si(n),Object.freeze(this)}static from(e){if(e instanceof fi)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=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||ti.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&ti.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&ti.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&ti.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new fi(ri,t,r,n)}}class di{constructor(e,t,r,n){e!==ri&&ti.throwError("cannot use FixedNumber constructor; use FixedNumber.from",wn.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&ti.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ui(this._value,this.format.decimals),r=ui(e._value,e.format.decimals);return di.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ui(this._value,this.format.decimals),r=ui(e._value,e.format.decimals);return di.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ui(this._value,this.format.decimals),r=ui(e._value,e.format.decimals);return di.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ui(this._value,this.format.decimals),r=ui(e._value,e.format.decimals);return di.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=di.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(li.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=di.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(li.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)&&ti.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=di.from("1"+oi.substring(0,e),this.format),n=hi.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}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&&ti.throwArgumentError("invalid byte width","width",e);return jn(Jn.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return di.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Jn.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Mn(e)||"bigint"==typeof e||kn(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),di.fromString(ci(e,t),fi.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=fi.from(t),n=ui(e,r.decimals);!r.signed&&n.lt(ni)&&ai("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=jn(i,r.width/8));const a=ci(n,r.decimals);return new di(ri,i,a,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=fi.from(t);if(On(e).length>r.width/8)throw new Error("overflow");let n=Jn.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),a=ci(n,r.decimals);return new di(ri,i,a,r)}static from(e,t){if("string"==typeof e)return di.fromString(e,t);if(kn(e))return di.fromBytes(e,t);try{return di.fromValue(e,0,t)}catch(e){if(e.code!==wn.errors.INVALID_ARGUMENT)throw e}return ti.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const li=di.from(1),hi=di.from("0.5");var pi=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};const mi=new wn("properties/5.7.0");function bi(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function yi(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function gi(e){return pi(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function vi(e,t){e&&"object"==typeof e||mi.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||mi.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function wi(e){const t={};for(const r in e)t[r]=e[r];return t}const _i={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Ei(e){if(null==e||_i[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!Ei(n))return!1}return!0}return mi.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Ti(e){if(Ei(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>Ai(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&bi(t,r,Ai(n))}return t}return mi.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Ai(e){return Ti(e)}let Si=class{constructor(e){for(const t in e)this[t]=Ai(e[t])}};var Ri=Object.freeze({__proto__:null,Description:Si,checkProperties:vi,deepCopy:Ai,defineReadOnly:bi,getStatic:yi,resolveProperties:gi,shallowCopy:wi});const ki="abi/5.7.0",Oi=new wn(ki),Ii={};let xi={calldata:!0,memory:!0,storage:!0},Ci={calldata:!0,memory:!0};function Mi(e,t){if("bytes"===e||"string"===e){if(xi[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Ci[t])return!0;return(xi[t]||"payable"===t)&&Oi.throwArgumentError("invalid modifier","name",t),!1}function Pi(e,t){for(let r in t)bi(e,r,t[r])}const Ni=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Bi=new RegExp(/^(.*)\[([0-9]*)\]$/);let Di=class e{constructor(t,r){t!==Ii&&Oi.throwError("use fromString",wn.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Pi(this,r);let n=this.type.match(Bi);Pi(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[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=Ni.sighash),Ni[e]||Oi.throwArgumentError("invalid format type","format",e),e===Ni.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!==Ni.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Ni.full?", ":",")+")"):t+=this.type,e!==Ni.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Ni.full&&this.name&&(t+=" "+this.name)),t}static from(t,r){return"string"==typeof t?e.fromString(t,r):e.fromObject(t)}static fromObject(t){return e.isParamType(t)?t:new e(Ii,{name:t.name||null,type:Ki(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}static fromString(t,r){return n=function(e,t){let r=e;function n(t){Oi.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let a={type:"",name:"",state:{allowType:!0}},o=a;for(let r=0;r<e.length;r++){let a=e[r];switch(a){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||n(r),o.state.allowType=!1,o.type=Ki(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),Mi(o.type,o.name)&&(o.name=""),o.type=Ki(o.type);let e=o;o=o.parent,o||n(r),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),Mi(o.type,o.name)&&(o.name=""),o.type=Ki(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=Ki(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||n(r),o.indexed&&n(r),o.indexed=!0,o.name=""):Mi(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||n(r),o.type+=a,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(r),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:n(r)}}return o.parent&&Oi.throwArgumentError("unexpected eof","param",e),delete a.state,"indexed"===o.name?(t||n(r.length-7),o.indexed&&n(r.length-7),o.indexed=!0,o.name=""):Mi(o.type,o.name)&&(o.name=""),a.type=Ki(a.type),a}(t,!!r),e.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}};function Fi(e,t){return function(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];","===a&&0===n?(t.push(r),r=""):(r+=a,"("===a?n++:")"===a&&(n--,-1===n&&Oi.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>Di.fromString(e,t)))}let Li=class e{constructor(e,t){e!==Ii&&Oi.throwError("use a static from method",wn.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Pi(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 Gi.fromObject(t);case"event":return Ui.fromObject(t);case"constructor":return Hi.fromObject(t);case"error":return Wi.fromObject(t);case"fallback":case"receive":return null}return Oi.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]?Ui.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Gi.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Hi.fromString(e.trim()):"error"===e.split(" ")[0]?Wi.fromString(e.substring(5).trim()):Oi.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}},Ui=class e extends Li{format(e){if(e||(e=Ni.sighash),Ni[e]||Oi.throwArgumentError("invalid format type","format",e),e===Ni.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!==Ni.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ni.full?", ":",")+") ",e!==Ni.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&&Oi.throwArgumentError("invalid event object","value",t);const r={name:$i(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Di.fromObject):[],type:"event"};return new e(Ii,r)}static fromString(t){let r=t.match(Ji);r||Oi.throwArgumentError("invalid event string","value",t);let n=!1;return r[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:Oi.warn("unknown modifier: "+e)}})),e.fromObject({name:r[1].trim(),anonymous:n,inputs:Fi(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}};function ji(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&Oi.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||Oi.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Jn.from(r[1]),r[0]):e}function qi(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 zi(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&&Oi.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&Oi.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||Oi.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&&Oi.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&&Oi.throwArgumentError("unable to determine stateMutability","value",e),t}let Hi=class e extends Li{format(e){if(e||(e=Ni.sighash),Ni[e]||Oi.throwArgumentError("invalid format type","format",e),e===Ni.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===Ni.sighash&&Oi.throwError("cannot format a constructor for sighash",wn.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Ni.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&&Oi.throwArgumentError("invalid constructor object","value",t);let r=zi(t);r.constant&&Oi.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Di.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Jn.from(t.gas):null};return new e(Ii,n)}static fromString(t){let r={type:"constructor"},n=(t=ji(t,r)).match(Ji);return n&&"constructor"===n[1].trim()||Oi.throwArgumentError("invalid constructor string","value",t),r.inputs=Fi(n[2].trim(),!1),qi(n[3].trim(),r),e.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}},Gi=class e extends Hi{format(e){if(e||(e=Ni.sighash),Ni[e]||Oi.throwArgumentError("invalid format type","format",e),e===Ni.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!==Ni.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ni.full?", ":",")+") ",e!==Ni.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&&Oi.throwArgumentError("invalid function object","value",t);let r=zi(t);const n={type:t.type,name:$i(t.name),constant:r.constant,inputs:t.inputs?t.inputs.map(Di.fromObject):[],outputs:t.outputs?t.outputs.map(Di.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Jn.from(t.gas):null};return new e(Ii,n)}static fromString(t){let r={type:"function"},n=(t=ji(t,r)).split(" returns ");n.length>2&&Oi.throwArgumentError("invalid function string","value",t);let i=n[0].match(Ji);if(i||Oi.throwArgumentError("invalid function signature","value",t),r.name=i[1].trim(),r.name&&$i(r.name),r.inputs=Fi(i[2],!1),qi(i[3].trim(),r),n.length>1){let e=n[1].match(Ji);""==e[1].trim()&&""==e[3].trim()||Oi.throwArgumentError("unexpected tokens","value",t),r.outputs=Fi(e[2],!1)}else r.outputs=[];return e.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}};function Vi(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||Oi.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}let Wi=class e extends Li{format(e){if(e||(e=Ni.sighash),Ni[e]||Oi.throwArgumentError("invalid format type","format",e),e===Ni.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ni.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ni.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&&Oi.throwArgumentError("invalid error object","value",t);const r={type:t.type,name:$i(t.name),inputs:t.inputs?t.inputs.map(Di.fromObject):[]};return Vi(new e(Ii,r))}static fromString(t){let r={type:"error"},n=t.match(Ji);return n||Oi.throwArgumentError("invalid error signature","value",t),r.name=n[1].trim(),r.name&&$i(r.name),r.inputs=Fi(n[2],!1),Vi(e.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}};function Ki(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Xi=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function $i(e){return e&&e.match(Xi)||Oi.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Ji=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Yi=new wn(ki);function Qi(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){const a=e.slice();a.push(i);try{r(a,n[i])}catch(e){t.push({path:a,error:e})}}};return r([],e),t}let Zi=class{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Yi.throwArgumentError(e,this.localName,t)}},ea=class{constructor(e){bi(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return Fn(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(In(e._data))}writeBytes(e){let t=On(e);const r=t.length%this.wordSize;return r&&(t=In([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=On(Jn.from(e));return t.length>this.wordSize&&Yi.throwError("value out-of-bounds",wn.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=In([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 ta={exports:{}};
|
|
2
2
|
/**
|
|
3
3
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
4
4
|
*
|
|
@@ -28,7 +28,7 @@ e.exports=r=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exp
|
|
|
28
28
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
29
29
|
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
30
30
|
* @license MIT
|
|
31
|
-
*/bM=yM,function(){var e="input is invalid type",t="object"==typeof window,r=t?window:{};r.JS_SHA3_NO_WINDOW&&(t=!1);var n=!t&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?r=sx:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&bM.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,o="0123456789abcdef".split(""),s=[4,1024,262144,67108864],c=[0,8,16,24],u=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],f=[224,256,384,512],d=[128,256],l=["hex","buffer","arrayBuffer","array","digest"],h={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var p=function(e,t,r){return function(n){return new I(e,t,e).update(n)[r]()}},m=function(e,t,r){return function(n,i){return new I(e,t,i).update(n)[r]()}},b=function(e,t,r){return function(t,n,i,a){return _["cshake"+e].update(t,n,i,a)[r]()}},y=function(e,t,r){return function(t,n,i,a){return _["kmac"+e].update(t,n,i,a)[r]()}},g=function(e,t,r,n){for(var i=0;i<l.length;++i){var a=l[i];e[a]=t(r,n,a)}return e},v=function(e,t){var r=p(e,t,"hex");return r.create=function(){return new I(e,t,e)},r.update=function(e){return r.create().update(e)},g(r,p,e,t)},w=[{name:"keccak",padding:[1,256,65536,16777216],bits:f,createMethod:v},{name:"sha3",padding:[6,1536,393216,100663296],bits:f,createMethod:v},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(e,t){var r=m(e,t,"hex");return r.create=function(r){return new I(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},g(r,m,e,t)}},{name:"cshake",padding:s,bits:d,createMethod:function(e,t){var r=h[e],n=b(e,0,"hex");return n.create=function(n,i,a){return i||a?new I(e,t,n).bytepad([i,a],r):_["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},g(n,b,e,t)}},{name:"kmac",padding:s,bits:d,createMethod:function(e,t){var r=h[e],n=y(e,0,"hex");return n.create=function(n,i,a){return new x(e,t,i).bytepad(["KMAC",a],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},g(n,y,e,t)}}],_={},E=[],T=0;T<w.length;++T)for(var A=w[T],S=A.bits,R=0;R<S.length;++R){var k=A.name+"_"+S[R];if(E.push(k),_[k]=A.createMethod(S[R],A.padding),"sha3"!==A.name){var O=A.name+S[R];E.push(O),_[O]=_[k]}}function I(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function x(e,t,r){I.call(this,e,t,r)}I.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,o,s=this.blocks,u=this.byteCount,f=t.length,d=this.blockCount,l=0,h=this.s;l<f;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<d+1;++i)s[i]=0;if(r)for(i=this.start;l<f&&i<u;++l)s[i>>2]|=t[l]<<c[3&i++];else for(i=this.start;l<f&&i<u;++l)(o=t.charCodeAt(l))<128?s[i>>2]|=o<<c[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++l)),s[i>>2]|=(240|o>>18)<<c[3&i++],s[i>>2]|=(128|o>>12&63)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[d],i=0;i<d;++i)h[i]^=s[i];C(h),this.reset=!0}else this.start=i}return this},I.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},I.prototype.encodeString=function(t){var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,o=t.length;if(r)i=o;else for(var s=0;s<t.length;++s){var c=t.charCodeAt(s);c<128?i+=1:c<2048?i+=2:c<55296||c>=57344?i+=3:(c=65536+((1023&c)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},I.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,a=[];return a.length=i,this.update(a),this},I.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];C(n)}},I.prototype.toString=I.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,s=0,c="";s<n;){for(a=0;a<t&&s<n;++a,++s)e=r[a],c+=o[e>>4&15]+o[15&e]+o[e>>12&15]+o[e>>8&15]+o[e>>20&15]+o[e>>16&15]+o[e>>28&15]+o[e>>24&15];s%t==0&&(C(r),a=0)}return i&&(e=r[a],c+=o[e>>4&15]+o[15&e],i>1&&(c+=o[e>>12&15]+o[e>>8&15]),i>2&&(c+=o[e>>20&15]+o[e>>16&15])),c},I.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,o=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var c=new Uint32Array(e);o<n;){for(a=0;a<t&&o<n;++a,++o)c[o]=r[a];o%t==0&&C(r)}return i&&(c[a]=r[a],e=e.slice(0,s)),e},I.prototype.buffer=I.prototype.arrayBuffer,I.prototype.digest=I.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,a=this.extraBytes,o=0,s=0,c=[];s<i;){for(o=0;o<r&&s<i;++o,++s)e=s<<2,t=n[o],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;s%r==0&&C(n)}return a&&(e=s<<2,t=n[o],c[e]=255&t,a>1&&(c[e+1]=t>>8&255),a>2&&(c[e+2]=t>>16&255)),c},x.prototype=new I,x.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var C=function(e){var t,r,n,i,a,o,s,c,f,d,l,h,p,m,b,y,g,v,w,_,E,T,A,S,R,k,O,I,x,C,M,P,N,B,D,F,L,U,j,q,z,H,G,V,W,K,X,$,J,Y,Q,Z,ee,te,re,ne,ie,ae,oe,se,ce,ue,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],a=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|s>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|f>>>31),r=a^(f<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(d<<1|l>>>31),r=s^(l<<1|d>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(h<<1|p>>>31),r=f^(p<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=d^(i<<1|a>>>31),r=l^(a<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],b=e[1],K=e[11]<<4|e[10]>>>28,X=e[10]<<4|e[11]>>>28,I=e[20]<<3|e[21]>>>29,x=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,D=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,$=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,C=e[33]<<13|e[32]>>>19,M=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,F=e[14]<<6|e[15]>>>26,L=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Y=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,P=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,S=e[6]<<28|e[7]>>>4,R=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,k=e[18]<<20|e[19]>>>12,O=e[19]<<20|e[18]>>>12,ae=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,T=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=m^~y&v,e[1]=b^~g&w,e[10]=S^~k&I,e[11]=R^~O&x,e[20]=B^~F&U,e[21]=D^~L&j,e[30]=V^~K&$,e[31]=W^~X&J,e[40]=te^~ne&ae,e[41]=re^~ie&oe,e[2]=y^~v&_,e[3]=g^~w&E,e[12]=k^~I&C,e[13]=O^~x&M,e[22]=F^~U&q,e[23]=L^~j&z,e[32]=K^~$&Y,e[33]=X^~J&Q,e[42]=ne^~ae&se,e[43]=ie^~oe&ce,e[4]=v^~_&T,e[5]=w^~E&A,e[14]=I^~C&P,e[15]=x^~M&N,e[24]=U^~q&H,e[25]=j^~z&G,e[34]=$^~Y&Z,e[35]=J^~Q&ee,e[44]=ae^~se&ue,e[45]=oe^~ce&fe,e[6]=_^~T&m,e[7]=E^~A&b,e[16]=C^~P&S,e[17]=M^~N&R,e[26]=q^~H&B,e[27]=z^~G&D,e[36]=Y^~Z&V,e[37]=Q^~ee&W,e[46]=se^~ue&te,e[47]=ce^~fe&re,e[8]=T^~m&y,e[9]=A^~b&g,e[18]=P^~S&k,e[19]=N^~R&O,e[28]=H^~B&F,e[29]=G^~D&L,e[38]=Z^~V&K,e[39]=ee^~W&X,e[48]=ue^~te&ne,e[49]=fe^~re&ie,e[0]^=u[n],e[1]^=u[n+1]};if(i)bM.exports=_;else for(T=0;T<E.length;++T)r[E[T]]=_[E[T]]}();var gM=yM.exports;function vM(e){return"0x"+gM.keccak_256(On(e))}let wM=!1,_M=!1;const EM={debug:1,default:2,info:2,warning:3,error:4,off:5};let TM=EM.default,AM=null;const SM=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){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 RM,kM;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(RM||(RM={})),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"}(kM||(kM={}));const OM="0123456789abcdef";let IM=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==EM[r]&&this.throwArgumentError("invalid log level name","logLevel",e),TM>EM[r]||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,r,n){if(_M)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=OM[t[e]>>4],r+=OM[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const a=t;let o="";switch(r){case kM.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 kM.CALL_EXCEPTION:case kM.INSUFFICIENT_FUNDS:case kM.MISSING_NEW:case kM.NONCE_EXPIRED:case kM.REPLACEMENT_UNDERPRICED:case kM.TRANSACTION_REPLACED:case kM.UNPREDICTABLE_GAS_LIMIT:o=r}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=r,Object.keys(n).forEach((function(e){s[e]=n[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){SM&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:SM})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.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:r.name})}static globalLogger(){return AM||(AM=new e("logger/5.7.0")),AM}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),wM){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_M=!!t,wM=!!r}static setLogLevel(t){const r=EM[t.toLowerCase()];null!=r?TM=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};IM.errors=kM,IM.levels=RM;var xM=fn.BN;const CM=new IM("bignumber/5.7.0"),MM={};let PM=!1;class NM{constructor(e,t){e!==MM&&CM.throwError("cannot call constructor directly; use BigNumber.from",IM.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return DM(FM(this).fromTwos(e))}toTwos(e){return DM(FM(this).toTwos(e))}abs(){return"-"===this._hex[0]?NM.from(this._hex.substring(1)):this}add(e){return DM(FM(this).add(FM(e)))}sub(e){return DM(FM(this).sub(FM(e)))}div(e){return NM.from(e).isZero()&&LM("division-by-zero","div"),DM(FM(this).div(FM(e)))}mul(e){return DM(FM(this).mul(FM(e)))}mod(e){const t=FM(e);return t.isNeg()&&LM("division-by-zero","mod"),DM(FM(this).umod(t))}pow(e){const t=FM(e);return t.isNeg()&&LM("negative-power","pow"),DM(FM(this).pow(t))}and(e){const t=FM(e);return(this.isNegative()||t.isNeg())&&LM("unbound-bitwise-result","and"),DM(FM(this).and(t))}or(e){const t=FM(e);return(this.isNegative()||t.isNeg())&&LM("unbound-bitwise-result","or"),DM(FM(this).or(t))}xor(e){const t=FM(e);return(this.isNegative()||t.isNeg())&&LM("unbound-bitwise-result","xor"),DM(FM(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&LM("negative-width","mask"),DM(FM(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&LM("negative-width","shl"),DM(FM(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&LM("negative-width","shr"),DM(FM(this).shrn(e))}eq(e){return FM(this).eq(FM(e))}lt(e){return FM(this).lt(FM(e))}lte(e){return FM(this).lte(FM(e))}gt(e){return FM(this).gt(FM(e))}gte(e){return FM(this).gte(FM(e))}isNegative(){return"-"===this._hex[0]}isZero(){return FM(this).isZero()}toNumber(){try{return FM(this).toNumber()}catch(e){LM("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return CM.throwError("this platform does not support BigInt",IM.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?PM||(PM=!0,CM.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?CM.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",IM.errors.UNEXPECTED_ARGUMENT,{}):CM.throwError("BigNumber.toString does not accept parameters",IM.errors.UNEXPECTED_ARGUMENT,{})),FM(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof NM)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new NM(MM,BM(e)):e.match(/^-?[0-9]+$/)?new NM(MM,BM(new xM(e))):CM.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&LM("underflow","BigNumber.from",e),(e>=9007199254740991||e<=-9007199254740991)&&LM("overflow","BigNumber.from",e),NM.from(String(e));const t=e;if("bigint"==typeof t)return NM.from(t.toString());if(kn(t))return NM.from(Nn(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return NM.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(Mn(e)||"-"===e[0]&&Mn(e.substring(1))))return NM.from(e)}return CM.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function BM(e){if("string"!=typeof e)return BM(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&CM.throwArgumentError("invalid hex","value",e),"0x00"===(e=BM(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 DM(e){return NM.from(BM(e))}function FM(e){const t=NM.from(e).toHexString();return"-"===t[0]?new xM("-"+t.substring(3),16):new xM(t.substring(2),16)}function LM(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),CM.throwError(e,IM.errors.NUMERIC_FAULT,n)}const UM=new IM("bignumber/5.7.0"),jM={},qM=NM.from(0),zM=NM.from(-1);function HM(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),UM.throwError(e,IM.errors.NUMERIC_FAULT,i)}let GM="0";for(;GM.length<256;)GM+=GM;function VM(e){if("number"!=typeof e)try{e=NM.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+GM.substring(0,e):UM.throwArgumentError("invalid decimal size","decimals",e)}function WM(e,t){null==t&&(t=0);const r=VM(t),n=(e=NM.from(e)).lt(qM);n&&(e=e.mul(zM));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(r).toString();return e=1===r.length?a:a+"."+i,n&&(e="-"+e),e}function KM(e,t){null==t&&(t=0);const r=VM(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||UM.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&UM.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&UM.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>r.length-1&&HM("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=NM.from(a),c=NM.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(zM)),u}let XM=class e{constructor(e,t,r,n){e!==jM&&UM.throwError("cannot use FixedFormat constructor; use FixedFormat.from",IM.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=VM(n),Object.freeze(this)}static from(t){if(t instanceof e)return t;"number"==typeof t&&(t=`fixed128x${t}`);let r=!0,n=128,i=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)r=!1;else{const e=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);e||UM.throwArgumentError("invalid fixed format","format",t),r="u"!==e[1],n=parseInt(e[2]),i=parseInt(e[3])}else if(t){const e=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&UM.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);r=e("signed","boolean",r),n=e("width","number",n),i=e("decimals","number",i)}return n%8&&UM.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&UM.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(jM,r,n,i)}},$M=class e{constructor(e,t,r,n){e!==jM&&UM.throwError("cannot use FixedNumber constructor; use FixedNumber.from",IM.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&UM.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(t){this._checkFormat(t);const r=KM(this._value,this.format.decimals),n=KM(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=KM(this._value,this.format.decimals),n=KM(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=KM(this._value,this.format.decimals),n=KM(t._value,t.format.decimals);return e.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const r=KM(this._value,this.format.decimals),n=KM(t._value,t.format.decimals);return e.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(JM.toFormat(r.format))),r}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(JM.toFormat(r.format))),r}round(t){null==t&&(t=0);const r=this.toString().split(".");if(1===r.length&&r.push("0"),(t<0||t>80||t%1)&&UM.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=e.from("1"+GM.substring(0,t),this.format),i=YM.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).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&&UM.throwArgumentError("invalid byte width","width",e);return jn(NM.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return e.fromString(this._value,t)}static fromValue(t,r,n){return null!=n||null==r||function(e){return null!=e&&(NM.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Mn(e)||"bigint"==typeof e||kn(e))}(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(WM(t,r),XM.from(n))}static fromString(t,r){null==r&&(r="fixed");const n=XM.from(r),i=KM(t,n.decimals);!n.signed&&i.lt(qM)&&HM("unsigned value cannot be negative","overflow","value",t);let a=null;n.signed?a=i.toTwos(n.width).toHexString():(a=i.toHexString(),a=jn(a,n.width/8));const o=WM(i,n.decimals);return new e(jM,a,o,n)}static fromBytes(t,r){null==r&&(r="fixed");const n=XM.from(r);if(On(t).length>n.width/8)throw new Error("overflow");let i=NM.from(t);n.signed&&(i=i.fromTwos(n.width));const a=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=WM(i,n.decimals);return new e(jM,a,o,n)}static from(t,r){if("string"==typeof t)return e.fromString(t,r);if(kn(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(t){if(t.code!==IM.errors.INVALID_ARGUMENT)throw t}return UM.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}};const JM=$M.from(1),YM=$M.from("0.5"),QM=new IM("strings/5.7.0");var ZM,eP;function tP(e,t=ZM.current){t!=ZM.current&&(QM.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const a=65536+((1023&n)<<10)+(1023&i);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(63&a|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return On(r)}function rP(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function nP(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function iP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function aP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iP(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function oP(e,t,r){return sP.apply(this,arguments)}function sP(){return(sP=ox(dx.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.users.map((function(e){return{ether_key:e.user,tokens:e.tokens.map((function(e){return aP({id:e.id,blueprint:e.blueprint},e.royalties&&e.royalties.length>0&&{royalties:e.royalties.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))})}))}})),a=r.royalties,o=aP(aP({contract_address:r.contract_address},a&&a.length>0&&{royalties:a.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))}),{},{users:i,auth_signature:""}),s=vM(tP(JSON.stringify(o))),e.next=6,mx(s,t);case 6:return c=e.sent,u=aP(aP({users:o.users.map((function(e){return{user:e.ether_key,tokens:e.tokens}}))},a&&a.length>0&&{royalties:a}),{},{contract_address:r.contract_address,auth_signature:c}),f={mintTokensRequestV2:[u]},e.next=11,n.mintTokens(f);case 11:return d=e.sent,e.abrupt("return",d.data);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cP(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};case"ETH":return{type:"ETH",data:{decimals:18}}}}function uP(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return fP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fP(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function fP(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function dP(e){return lP.apply(this,arguments)}function lP(){return(lP=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,a=t.request,o=t.transfersApi,e.next=3,n.getAddress();case 3:return s=e.sent,c="ERC721"===a.type?"1":a.amount,e.next=7,o.getSignableTransferV1({getSignableTransferRequest:{sender:s,token:cP(a),amount:c,receiver:a.receiver}});case 7:return u=e.sent,f=u.data,d=f.signable_message,l=f.payload_hash,e.next=11,mx(d,n);case 11:return h=e.sent,e.next=14,i.signMessage(l);case 14:return p=e.sent,m={sender_stark_key:u.data.sender_stark_key,sender_vault_id:u.data.sender_vault_id,receiver_stark_key:u.data.receiver_stark_key,receiver_vault_id:u.data.receiver_vault_id,asset_id:u.data.asset_id,amount:u.data.amount,nonce:u.data.nonce,expiration_timestamp:u.data.expiration_timestamp,stark_signature:p},e.next=18,o.createTransferV1({createTransferRequest:m,xImxEthAddress:s,xImxEthSignature:h});case 18:return b=e.sent,e.abrupt("return",{sent_signature:null==b?void 0:b.data.sent_signature,status:null==b||null===(r=b.data.status)||void 0===r?void 0:r.toString(),time:null==b?void 0:b.data.time,transfer_id:null==b?void 0:b.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function hP(e){return pP.apply(this,arguments)}function pP(){return(pP=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.transfersApi,e.next=3,r.getAddress();case 3:return o=e.sent,s=i.map((function(e){return{amount:"1",token:cP({type:"ERC721",tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver}})),e.next=7,a.getSignableTransfer({getSignableTransferRequestV2:{sender_ether_key:o,signable_requests:s}});case 7:if(c=e.sent,void 0!==(u=c.data.signable_message)){e.next=11;break}throw new Error("Invalid response from Signable registration offchain");case 11:return e.next=13,mx(u,r);case 13:f=e.sent,d=[],l=uP(c.data.signable_responses),e.prev=16,l.s();case 18:if((h=l.n()).done){e.next=27;break}return p=h.value,e.next=22,n.signMessage(p.payload_hash);case 22:m=e.sent,b={sender_vault_id:p.sender_vault_id,receiver_stark_key:p.receiver_stark_key,receiver_vault_id:p.receiver_vault_id,asset_id:p.asset_id,amount:p.amount,nonce:p.nonce,expiration_timestamp:p.expiration_timestamp,stark_signature:m},d.push(b);case 25:e.next=18;break;case 27:e.next=32;break;case 29:e.prev=29,e.t0=e.catch(16),l.e(e.t0);case 32:return e.prev=32,l.f(),e.finish(32);case 35:return y={sender_stark_key:c.data.sender_stark_key,requests:d},e.next=38,a.createTransfer({createTransferRequestV2:y,xImxEthAddress:o,xImxEthSignature:f});case 38:return g=e.sent,e.abrupt("return",{transfer_ids:null==g?void 0:g.data.transfer_ids});case 40:case"end":return e.stop()}}),e,null,[[16,29,32,35]])})))).apply(this,arguments)}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(ZM||(ZM={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(eP||(eP={})),nP("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),rP("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),rP("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),rP("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t})),nP("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const mP=new IM("units/5.7.0"),bP=["wei","kwei","mwei","gwei","szabo","finney","ether"];function yP(e,t){if("string"!=typeof e&&mP.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=bP.indexOf(t);-1!==e&&(t=3*e)}return KM(e,null!=t?t:18)}function gP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function vP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gP(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function wP(e,t,r,n,i,a,o){return _P.apply(this,arguments)}function _P(){return(_P=ox(dx.mark((function e(t,r,n,i,a,o,s){var c,u,f;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return c=e.sent,e.next=5,pM(c,i,s);case 5:return u=e.sent,e.next=8,o.populateTransaction.registerAndDepositEth(c,i,u.operator_signature,n,a);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(vP(vP({},f),{},{value:r})));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function EP(e,t,r,n,i,a){return TP.apply(this,arguments)}function TP(){return(TP=ox(dx.mark((function e(t,r,n,i,a,o){var s;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction["deposit(uint256,uint256,uint256)"](i,n,a);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(vP(vP({},s),{},{value:r})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function AP(e,t,r,n,i,a){return SP.apply(this,arguments)}function SP(){return(SP=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u,f,d,l,h,p,m,b,y;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,c={decimals:18},u=yP(r.amount,"wei"),f={user:s,token:{type:r.type,data:c},amount:u.toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:f});case 8:return d=e.sent,e.next=11,a.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type}}});case 11:return l=e.sent,h=l.data.asset_type,p=d.data.stark_key,m=d.data.vault_id,b=KI.connect(o.ethConfiguration.coreContractAddress,t),y=nx.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,lM(p,y);case 19:if(e.sent){e.next=24;break}return e.abrupt("return",wP(t,u,h,p,m,b,i));case 24:return e.abrupt("return",EP(t,u,h,p,m,b));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RP(e,t,r,n,i,a){return kP.apply(this,arguments)}function kP(){return(kP=ox(dx.mark((function e(t,r,n,i,a,o){var s;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.depositERC20(i,n,a,r);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function OP(e,t,r,n,i,a,o){return IP.apply(this,arguments)}function IP(){return(IP=ox(dx.mark((function e(t,r,n,i,a,o,s){var c,u,f;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return c=e.sent,e.next=5,pM(c,i,s);case 5:return u=e.sent,e.next=8,o.populateTransaction.registerAndDepositERC20(c,i,u.operator_signature,n,a,r);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(f));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xP(e,t,r,n,i,a,o){return CP.apply(this,arguments)}function CP(){return(CP=ox(dx.mark((function e(t,r,n,i,a,o,s){var c,u,f,d,l,h,p,m,b,y,g,v,w,_,E,T;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return c=e.sent,e.next=5,a.getToken({address:r.tokenAddress});case 5:return u=e.sent,f=parseInt(u.data.decimals),d={decimals:f,token_address:r.tokenAddress},l=yP(r.amount,0),h=zI.connect(r.tokenAddress,t),e.next=12,h.populateTransaction.approve(s.ethConfiguration.coreContractAddress,l);case 12:return p=e.sent,e.next=15,t.sendTransaction(p);case 15:return m={user:c,token:{type:r.type,data:d},amount:l.toString()},e.next=18,n.getSignableDeposit({getSignableDepositRequest:m});case 18:return b=e.sent,e.next=21,o.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress}}}});case 21:return y=e.sent,g=y.data.asset_type,v=b.data.stark_key,w=b.data.vault_id,_=NM.from(b.data.amount),E=KI.connect(s.ethConfiguration.coreContractAddress,t),T=nx.connect(s.ethConfiguration.registrationContractAddress,t),e.next=30,lM(v,T);case 30:if(e.sent){e.next=35;break}return e.abrupt("return",OP(t,_,g,v,w,E,i));case 35:return e.abrupt("return",RP(t,_,g,v,w,E));case 36:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function MP(e,t,r,n,i,a){return PP.apply(this,arguments)}function PP(){return(PP=ox(dx.mark((function e(t,r,n,i,a,o){var s;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.depositNft(i,n,a,r);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function NP(e,t,r,n,i,a){return BP.apply(this,arguments)}function BP(){return(BP=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u,f,d,l,h,p,m,b,y,g,v,w;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,c={token_address:r.tokenAddress,token_id:r.tokenId},u={user:s,token:{type:r.type,data:c},amount:"1".toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:u});case 8:return f=e.sent,e.next=11,a.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress,token_id:r.tokenId}}}});case 11:return d=e.sent,l=d.data.asset_type,h=f.data.stark_key,p=f.data.vault_id,m=KI.connect(o.ethConfiguration.coreContractAddress,t),b=nx.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,lM(h,b);case 19:return y=e.sent,g=GI.connect(r.tokenAddress,t),v=o.ethConfiguration.coreContractAddress,e.next=24,g.isApprovedForAll(s,v);case 24:if(e.sent){e.next=28;break}return e.next=28,g.setApprovalForAll(v,!0);case 28:if(y){e.next=34;break}return e.next=31,pM(s,h,i);case 31:return w=e.sent,e.next=34,m.registerUser(s,h,w.operator_signature);case 34:return e.abrupt("return",MP(t,r.tokenId,l,h,p,m));case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var DP=function(e){if(void 0!==e)return e;throw new Error("undefined field exception")};function FP(e){return LP.apply(this,arguments)}function LP(){return(LP=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.withdrawalsApi,a="ERC721"===t.type?"1":t.amount,e.t0=i,e.next=5,r.getAddress();case 5:return e.t1=e.sent,e.t2=cP(t),e.t3=a,e.t4={user:e.t1,token:e.t2,amount:e.t3},e.t5={getSignableWithdrawalRequest:e.t4},e.next=12,e.t0.getSignableWithdrawal.call(e.t0,e.t5);case 12:return o=e.sent,s=o.data,c=s.signable_message,u=s.payload_hash,e.next=16,n.signMessage(u);case 16:return f=e.sent,e.next=19,vx(c,r);case 19:return d=e.sent,l=d.ethAddress,h=d.ethSignature,e.next=24,i.createWithdrawal({createWithdrawalRequest:{stark_key:DP(o.data.stark_key),amount:a,asset_id:DP(o.data.asset_id),vault_id:DP(o.data.vault_id),nonce:DP(o.data.nonce),stark_signature:f},xImxEthAddress:l,xImxEthSignature:h});case 24:return p=e.sent,e.abrupt("return",p.data);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function UP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function jP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?UP(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qP(e,t,r,n){return zP.apply(this,arguments)}function zP(){return(zP=ox(dx.mark((function e(t,r,n,i){var a;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.encodeAsset({assetType:t,encodeAssetRequest:{token:jP({type:r},i&&{data:i})}});case 2:return a=e.sent,e.abrupt("return",a.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function HP(e,t,r,n,i){return GP.apply(this,arguments)}function GP(){return(GP=ox(dx.mark((function e(t,r,n,i,a){var o,s,c;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return o=e.sent,e.next=5,pM(o,n,a);case 5:return s=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(o,n,s.operator_signature,r);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function VP(e,t,r,n){return WP.apply(this,arguments)}function WP(){return(WP=ox(dx.mark((function e(t,r,n,i){var a;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function KP(e,t,r,n,i,a){return XP.apply(this,arguments)}function XP(){return(XP=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qP("asset","ERC20",i,{token_address:n.tokenAddress});case 2:return s=e.sent,c=KI.connect(o.ethConfiguration.coreContractAddress,t),u=nx.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,lM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",HP(t,s.asset_type,r,u,a));case 12:return e.abrupt("return",VP(t,s.asset_type,r,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function JP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$P(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function YP(e,t,r,n,i){return QP.apply(this,arguments)}function QP(){return(QP=ox(dx.mark((function e(t,r,n,i,a){var o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.populateTransaction.withdrawAndMint(n,r,i);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ZP(e,t,r,n,i,a){return eN.apply(this,arguments)}function eN(){return(eN=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,e.next=5,pM(s,n,o);case 5:return c=e.sent,e.next=8,a.populateTransaction.regsiterAndWithdrawAndMint(s,n,c.operator_signature,r,i);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tN(e){var t=e.data.id,r=e.data.blueprint||"";return Mb(ub("{".concat(t,"}:{").concat(r,"}")))}function rN(e,t,r,n,i,a){return nN.apply(this,arguments)}function nN(){return(nN=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u,f;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qP("mintable-asset","ERC721",i,JP({id:n.data.id,token_address:n.data.tokenAddress},n.data.blueprint&&{blueprint:n.data.blueprint}));case 2:return s=e.sent,c=tN(n),u=KI.connect(o.ethConfiguration.coreContractAddress,t),f=nx.connect(o.ethConfiguration.registrationContractAddress,t),e.next=8,lM(r,f);case 8:if(e.sent){e.next=13;break}return e.abrupt("return",ZP(t,s.asset_type,r,c,f,a));case 13:return e.abrupt("return",YP(t,s.asset_type,r,c,u));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function iN(e,t,r,n,i,a){return aN.apply(this,arguments)}function aN(){return(aN=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,e.next=5,pM(s,n,o);case 5:return c=e.sent,e.next=8,a.populateTransaction.registerAndWithdrawNft(s,n,c.operator_signature,r,i);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oN(e,t,r,n,i){return sN.apply(this,arguments)}function sN(){return(sN=ox(dx.mark((function e(t,r,n,i,a){var o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.populateTransaction.withdrawNft(n,r,i);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cN(e,t,r,n,i,a){return uN.apply(this,arguments)}function uN(){return(uN=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qP("asset","ERC721",i,{token_id:n.tokenId,token_address:n.tokenAddress});case 2:return s=e.sent,c=KI.connect(o.ethConfiguration.coreContractAddress,t),u=nx.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,lM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",iN(t,s.asset_type,r,n.tokenId,u,a));case 12:return e.abrupt("return",oN(t,s.asset_type,r,n.tokenId,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fN(e,t,r,n,i,a,o){return dN.apply(this,arguments)}function dN(){return(dN=ox(dx.mark((function e(t,r,n,i,a,o,s){var c,u;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=n.tokenAddress,u=n.tokenId,e.next=4,a.getMintableTokenDetailsByClientTokenId({tokenAddress:c,tokenId:u}).then((function(e){return rN(t,r,{type:"ERC721",data:{id:u,tokenAddress:c,blueprint:e.data.blueprint}},i,o,s)})).catch((function(e){var a;if(404===(null===(a=e.response)||void 0===a?void 0:a.status))return cN(t,r,n,i,o,s);throw e}));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lN(e,t,r,n,i){return hN.apply(this,arguments)}function hN(){return(hN=ox(dx.mark((function e(t,r,n,i,a){var o,s,c;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return o=e.sent,e.next=5,pM(o,n,a);case 5:return s=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(o,n,s.operator_signature,r);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pN(e,t,r,n){return mN.apply(this,arguments)}function mN(){return(mN=ox(dx.mark((function e(t,r,n,i){var a;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bN(e,t,r,n,i){return yN.apply(this,arguments)}function yN(){return(yN=ox(dx.mark((function e(t,r,n,i,a){var o,s,c;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qP("asset","ETH",n);case 2:return o=e.sent,s=KI.connect(a.ethConfiguration.coreContractAddress,t),c=nx.connect(a.ethConfiguration.registrationContractAddress,t),e.next=7,lM(r,c);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",lN(t,o.asset_type,r,c,i));case 12:return e.abrupt("return",pN(t,o.asset_type,r,s));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function vN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gN(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function wN(e){return _N.apply(this,arguments)}function _N(){return(_N=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.ordersApi,e.next=3,r.getAddress();case 3:return o=e.sent,s="ERC721"===i.sell.type?"1":i.sell.amount,c="ERC721"===i.buy.type?"1":i.buy.amount,u={user:o,amount_buy:c,token_buy:cP(i.buy),amount_sell:s,token_sell:cP(i.sell),fees:i.fees,expiration_timestamp:i.expiration_timestamp,split_fees:!0},e.next=9,a.getSignableOrder({getSignableOrderRequestV3:u});case 9:return f=e.sent,d=f.data,l=d.signable_message,h=d.payload_hash,e.next=13,mx(l,r);case 13:return p=e.sent,e.next=16,n.signMessage(h);case 16:return m=e.sent,b=f.data,y={createOrderRequest:{amount_buy:b.amount_buy,amount_sell:b.amount_sell,asset_id_buy:b.asset_id_buy,asset_id_sell:b.asset_id_sell,expiration_timestamp:b.expiration_timestamp,include_fees:!0,fees:i.fees,nonce:b.nonce,stark_key:b.stark_key,stark_signature:m,vault_id_buy:b.vault_id_buy,vault_id_sell:b.vault_id_sell},xImxEthAddress:o,xImxEthSignature:p},e.next=21,a.createOrderV3(y);case 21:return g=e.sent,e.abrupt("return",vN({},g.data));case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function EN(e){return TN.apply(this,arguments)}function TN(){return(TN=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.ordersApi,e.next=3,a.getSignableCancelOrderV3({getSignableCancelOrderRequest:{order_id:i.order_id}});case 3:return o=e.sent,s=o.data,c=s.signable_message,u=s.payload_hash,e.next=7,mx(c,r);case 7:return f=e.sent,e.next=10,n.signMessage(u);case 10:return d=e.sent,e.next=13,r.getAddress();case 13:return l=e.sent,e.next=16,a.cancelOrderV3({id:i.order_id.toString(),cancelOrderRequest:{order_id:i.order_id,stark_signature:d},xImxEthAddress:l,xImxEthSignature:f});case 16:return h=e.sent,e.abrupt("return",{order_id:h.data.order_id,status:h.data.status});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function AN(e){return SN.apply(this,arguments)}function SN(){return(SN=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.tradesApi,e.next=3,r.getAddress();case 3:return o=e.sent,e.next=6,a.getSignableTrade({getSignableTradeRequest:{user:o,order_id:i.order_id,fees:i.fees}});case 6:return s=e.sent,c=s.data,u=c.signable_message,f=c.payload_hash,e.next=10,mx(u,r);case 10:return d=e.sent,e.next=13,n.signMessage(f);case 13:return l=e.sent,e.next=16,a.createTradeV3({createTradeRequest:{amount_buy:s.data.amount_buy,amount_sell:s.data.amount_sell,asset_id_buy:s.data.asset_id_buy,asset_id_sell:s.data.asset_id_sell,expiration_timestamp:s.data.expiration_timestamp,fee_info:s.data.fee_info,fees:i.fees,include_fees:!0,nonce:s.data.nonce,order_id:i.order_id,stark_key:s.data.stark_key,vault_id_buy:s.data.vault_id_buy,vault_id_sell:s.data.vault_id_sell,stark_signature:l},xImxEthAddress:o,xImxEthSignature:d});case 16:return h=e.sent,e.abrupt("return",h.data);case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RN(e){return kN.apply(this,arguments)}function kN(){return(kN=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,a=t.request,o=t.exchangesApi,e.next=3,n.getAddress();case 3:return s=e.sent,c=a.amount,e.next=7,o.getExchangeSignableTransfer({id:a.transactionID,getSignableTransferRequest:{sender:s,token:cP(a),amount:c,receiver:a.receiver}});case 7:return u=e.sent,f=u.data,d=f.signable_message,l=f.payload_hash,e.next=11,mx(d,n);case 11:return h=e.sent,e.next=14,i.signMessage(l);case 14:return p=e.sent,m={sender_stark_key:u.data.sender_stark_key,sender_vault_id:u.data.sender_vault_id,receiver_stark_key:u.data.receiver_stark_key,receiver_vault_id:u.data.receiver_vault_id,asset_id:u.data.asset_id,amount:u.data.amount,nonce:u.data.nonce,expiration_timestamp:u.data.expiration_timestamp,stark_signature:p},e.next=18,o.createExchangeTransfer({id:a.transactionID,createTransferRequest:m,xImxEthAddress:s,xImxEthSignature:h});case 18:return b=e.sent,e.abrupt("return",{sent_signature:null==b?void 0:b.data.sent_signature,status:null==b||null===(r=b.data.status)||void 0===r?void 0:r.toString(),time:null==b?void 0:b.data.time,transfer_id:null==b?void 0:b.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ON(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function IN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ON(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ON(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var xN=function(){function e(t){FI(this,e),this.config=t;var r=t.apiConfiguration;this.config=t,this.depositsApi=new fC(r),this.encodingApi=new pC(r),this.mintsApi=new xC(r),this.ordersApi=new LC(r),this.tokensApi=new WC(r),this.tradesApi=new JC(r),this.transfersApi=new eM(r),this.usersApi=new iM(r),this.withdrawalsApi=new cM(r),this.projectsApi=new zC(r),this.collectionsApi=new oC(r),this.metadataApi=new EC(r),this.metadataRefreshesApi=new RC(r),this.exchangesApi=new gC(r)}var t,r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g,v,w,_,E,T,A,S,R,k,O;return UI(e,[{key:"isChainValid",value:function(e){return e===this.config.ethConfiguration.chainID}},{key:"validateChain",value:(O=ox(dx.mark((function e(t){var r;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getChainId();case 2:if(r=e.sent,this.isChainValid(r)){e.next=5;break}throw new Error("The wallet used for this operation is not from the correct network.");case 5:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"registerOffchain",value:(k=ox(dx.mark((function e(t){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",fM(IN(IN({},t),{},{usersApi:this.usersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"isRegisteredOnchain",value:(R=ox(dx.mark((function e(t){var r,n;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return r=nx.connect(this.config.ethConfiguration.registrationContractAddress,t.ethSigner),e.next=5,t.starkSigner.getAddress();case 5:return n=e.sent,e.abrupt("return",lM(n,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"mint",value:(S=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",oP(t,r,this.mintsApi));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"transfer",value:(A=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",dP(IN(IN({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"exchangeTransfer",value:(T=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",RN(IN(IN({},t),{},{request:r,exchangesApi:this.exchangesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"batchNftTransfer",value:(E=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",hP(IN(IN({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"deposit",value:(_=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r.type,e.next="ETH"===e.t0?3:"ERC20"===e.t0?4:"ERC721"===e.t0?5:6;break;case 3:return e.abrupt("return",this.depositEth(t,r));case 4:return e.abrupt("return",this.depositERC20(t,r));case 5:return e.abrupt("return",this.depositERC721(t,r));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"depositEth",value:(w=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",AP(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"depositERC20",value:(v=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",xP(t,r,this.depositsApi,this.usersApi,this.tokensApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"depositERC721",value:(g=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",NP(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"prepareWithdrawal",value:(y=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",FP(IN(IN(IN({},t),r),{},{withdrawalsApi:this.withdrawalsApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"completeWithdrawal",value:function(e,t,r){switch(r.type){case"ETH":return this.completeEthWithdrawal(e,t);case"ERC20":return this.completeERC20Withdrawal(e,t,r);case"ERC721":return this.completeERC721Withdrawal(e,t,r)}}},{key:"completeEthWithdrawal",value:(b=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",bN(t,r,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"completeERC20Withdrawal",value:(m=ox(dx.mark((function e(t,r,n){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",KP(t,r,n,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return m.apply(this,arguments)})},{key:"completeERC721Withdrawal",value:function(){var e=ox(dx.mark((function e(t,r,n){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",fN(t,r,n,this.encodingApi,this.mintsApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"createOrder",value:(p=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",wN(IN(IN({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"cancelOrder",value:(h=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",EN(IN(IN({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"createTrade",value:(l=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",AN(IN(IN({},t),{},{request:r,tradesApi:this.tradesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"createProject",value:(d=ox(dx.mark((function e(t,r){var n;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.createProject({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createProjectRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"getProject",value:(f=ox(dx.mark((function e(t,r){var n;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.getProject({id:r,iMXSignature:n.signature,iMXTimestamp:n.timestamp}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"getProjects",value:(u=ox(dx.mark((function e(t,r,n,i,a){var o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return o=e.sent,e.abrupt("return",this.projectsApi.getProjects({iMXSignature:o.signature,iMXTimestamp:o.timestamp,pageSize:r,cursor:n,orderBy:i,direction:a}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return u.apply(this,arguments)})},{key:"createCollection",value:(c=ox(dx.mark((function e(t,r){var n;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return n=e.sent,e.abrupt("return",this.collectionsApi.createCollection({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createCollectionRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"updateCollection",value:(s=ox(dx.mark((function e(t,r,n){var i;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return i=e.sent,e.abrupt("return",this.collectionsApi.updateCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,address:r,updateCollectionRequest:n}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return s.apply(this,arguments)})},{key:"addMetadataSchemaToCollection",value:(o=ox(dx.mark((function e(t,r,n){var i;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return i=e.sent,e.abrupt("return",this.metadataApi.addMetadataSchemaToCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,addMetadataSchemaToCollectionRequest:n,address:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return o.apply(this,arguments)})},{key:"updateMetadataSchemaByName",value:(a=ox(dx.mark((function e(t,r,n,i){var a;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return a=e.sent,e.abrupt("return",this.metadataApi.updateMetadataSchemaByName({iMXSignature:a.signature,iMXTimestamp:a.timestamp,address:r,name:n,metadataSchemaRequest:i}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return a.apply(this,arguments)})},{key:"listMetadataRefreshes",value:(i=ox(dx.mark((function e(t,r,n,i){var a,o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return a=e.sent,e.next=5,t.getAddress();case 5:return o=e.sent,e.abrupt("return",this.metadataRefreshesApi.getAListOfMetadataRefreshes({xImxEthSignature:a.signature,xImxEthTimestamp:a.timestamp,xImxEthAddress:o,collectionAddress:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return i.apply(this,arguments)})},{key:"getMetadataRefreshErrors",value:(n=ox(dx.mark((function e(t,r,n,i){var a,o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return a=e.sent,e.next=5,t.getAddress();case 5:return o=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshErrors({xImxEthSignature:a.signature,xImxEthTimestamp:a.timestamp,xImxEthAddress:o,refreshId:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"getMetadataRefreshResults",value:(r=ox(dx.mark((function e(t,r){var n,i;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshResults({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,refreshId:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"createMetadataRefresh",value:(t=ox(dx.mark((function e(t,r){var n,i;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.requestAMetadataRefresh({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,createMetadataRefreshRequest:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();var CN=function(e){YI(r,Dx(Error));var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=XI(e);if(t){var i=XI(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ex(this,r)}}(r);function r(e){var n,i=e.code,a=e.details,o=e.message;return FI(this,r),(n=t.call(this,o)).code=i,n.details=a,n}return UI(r)}();function MN(e){if(DI.isAxiosError(e)&&e.response){var t,r,n,i=e.response.data;return i.code&&i.message?new CN({code:i.code,details:i.details,message:i.message}):new CN({code:null!==(t=null!==(r=e.code)&&void 0!==r?r:null===(n=e.response)||void 0===n?void 0:n.status.toString())&&void 0!==t?t:"unknown_error_code",message:String(e)})}return new CN({code:"unknown_error_code",message:String(e)})}var PN=function(){function e(t){FI(this,e),this.depositsApi=new fC(t.apiConfiguration),this.mintsApi=new xC(t.apiConfiguration),this.ordersApi=new LC(t.apiConfiguration),this.tokensApi=new WC(t.apiConfiguration),this.tradesApi=new JC(t.apiConfiguration),this.transfersApi=new eM(t.apiConfiguration),this.exchangeApi=new gC(t.apiConfiguration),this.usersApi=new iM(t.apiConfiguration),this.withdrawalsApi=new cM(t.apiConfiguration),this.balanceApi=new rC(t.apiConfiguration),this.assetApi=new Qx(t.apiConfiguration),this.collectionApi=new oC(t.apiConfiguration),this.metadataApi=new EC(t.apiConfiguration),this.metadataRefreshesApi=new RC(t.apiConfiguration),this.nftCheckoutPrimaryApi=new NC(t.apiConfiguration),this.projectsApi=new zC(t.apiConfiguration),this.workflows=new xN(t)}var t,r,n;return UI(e,[{key:"deposit",value:function(e,t){return this.workflows.deposit(e,t).catch((function(e){throw MN(e)}))}},{key:"getDeposit",value:function(e){return this.depositsApi.getDeposit(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listDeposits",value:function(e){return this.depositsApi.listDeposits(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"registerOffchain",value:function(e){return this.workflows.registerOffchain(e).catch((function(e){throw MN(e)}))}},{key:"isRegisteredOnchain",value:function(e){return this.workflows.isRegisteredOnchain(e).catch((function(e){throw MN(e)}))}},{key:"getUser",value:function(e){return this.usersApi.getUsers({user:e}).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getAsset",value:function(e){return this.assetApi.getAsset(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listAssets",value:function(e){return this.assetApi.listAssets(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"createCollection",value:function(e,t){return this.workflows.createCollection(e,t).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getCollection",value:function(e){return this.collectionApi.getCollection(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listCollectionFilters",value:function(e){return this.collectionApi.listCollectionFilters(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listCollections",value:function(e){return this.collectionApi.listCollections(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"updateCollection",value:function(e,t,r){return this.workflows.updateCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"addMetadataSchemaToCollection",value:function(e,t,r){return this.workflows.addMetadataSchemaToCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getMetadataSchema",value:function(e){return this.metadataApi.getMetadataSchema(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"updateMetadataSchemaByName",value:function(e,t,r,n){return this.workflows.updateMetadataSchemaByName(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listMetadataRefreshes",value:function(e,t,r,n){return this.workflows.listMetadataRefreshes(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getMetadataRefreshErrors",value:function(e,t,r,n){return this.workflows.getMetadataRefreshErrors(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getMetadataRefreshResults",value:function(e,t){return this.workflows.getMetadataRefreshResults(e,t).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"createMetadataRefresh",value:function(e,t){return this.workflows.createMetadataRefresh(e,t).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"createProject",value:(n=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.createProject(t,r).then((function(e){return e.data})).catch((function(e){throw MN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getProject",value:(r=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProject(t,r).then((function(e){return e.data})).catch((function(e){throw MN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getProjects",value:(t=ox(dx.mark((function e(t,r,n,i,a){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProjects(t,r,n,i,a).then((function(e){return e.data})).catch((function(e){throw MN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r,n,i,a){return t.apply(this,arguments)})},{key:"getBalance",value:function(e){return this.balanceApi.getBalance(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listBalances",value:function(e){return this.balanceApi.listBalances(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getMint",value:function(e){return this.mintsApi.getMint(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listMints",value:function(e){return this.mintsApi.listMints(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"mint",value:function(e,t){return this.workflows.mint(e,t).catch((function(e){throw MN(e)}))}},{key:"listWithdrawals",value:function(e){return this.withdrawalsApi.listWithdrawals(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getWithdrawal",value:function(e){return this.withdrawalsApi.getWithdrawal(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"prepareWithdrawal",value:function(e,t){return this.workflows.prepareWithdrawal(e,t).catch((function(e){throw MN(e)}))}},{key:"completeWithdrawal",value:function(e,t,r){return this.workflows.completeWithdrawal(e,t,r).catch((function(e){throw MN(e)}))}},{key:"getOrder",value:function(e){return this.ordersApi.getOrderV3(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listOrders",value:function(e){return this.ordersApi.listOrdersV3(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"createOrder",value:function(e,t){return this.workflows.createOrder(e,t).catch((function(e){throw MN(e)}))}},{key:"cancelOrder",value:function(e,t){return this.workflows.cancelOrder(e,t).catch((function(e){throw MN(e)}))}},{key:"getTrade",value:function(e){return this.tradesApi.getTradeV3(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listTrades",value:function(e){return this.tradesApi.listTradesV3(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"createTrade",value:function(e,t){return this.workflows.createTrade(e,t).catch((function(e){throw MN(e)}))}},{key:"getToken",value:function(e){return this.tokensApi.getToken(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listTokens",value:function(e){return this.tokensApi.listTokens(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getTransfer",value:function(e){return this.transfersApi.getTransfer(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listTransfers",value:function(e){return this.transfersApi.listTransfers(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"transfer",value:function(e,t){return this.workflows.transfer(e,t).catch((function(e){throw MN(e)}))}},{key:"batchNftTransfer",value:function(e,t){return this.workflows.batchNftTransfer(e,t).catch((function(e){throw MN(e)}))}},{key:"createExchange",value:function(e){return this.exchangeApi.createExchange(e).catch((function(e){throw MN(e)}))}},{key:"getExchange",value:function(e){return this.exchangeApi.getExchange(e).catch((function(e){throw MN(e)}))}},{key:"getExchanges",value:function(e){return this.exchangeApi.getExchanges(e).catch((function(e){throw MN(e)}))}},{key:"exchangeTransfer",value:function(e,t){return this.workflows.exchangeTransfer(e,t).catch((function(e){throw MN(e)}))}},{key:"createNftPrimary",value:function(e){return this.nftCheckoutPrimaryApi.createNftPrimary(e).catch((function(e){throw MN(e)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(e){return this.nftCheckoutPrimaryApi.getCurrenciesNFTCheckoutPrimary(e).catch((function(e){throw MN(e)}))}},{key:"getNftPrimaryTransaction",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransaction(e).catch((function(e){throw MN(e)}))}},{key:"getNftPrimaryTransactions",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransactions(e).catch((function(e){throw MN(e)}))}}]),e}();function NN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function BN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?NN(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var DN={"x-sdk-version":"imx-core-sdk-ts-".concat("2.4.0")},FN=function(e){var t=e.coreContractAddress,r=e.registrationContractAddress,n=e.chainID,i=e.basePath,a=e.headers,o=e.sdkVersion;if(!i.trim())throw Error("basePath can not be empty");return o&&(DN["x-sdk-version"]=o),a=BN(BN({},a||{}),DN),{apiConfiguration:new uM({basePath:i,baseOptions:{headers:a}}),ethConfiguration:{coreContractAddress:t,registrationContractAddress:r,chainID:n}}},LN={get PRODUCTION(){return FN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"})},get SANDBOX(){return FN({basePath:"https://api.sandbox.x.immutable.com",chainID:11155111,coreContractAddress:"0x2d5C349fD8464DA06a3f90b4B0E9195F3d1b7F98",registrationContractAddress:"0xDbA6129C02E69405622fAdc3d5A7f8d23eac3b97"})},createConfig:FN},UN=new fn("08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f",16);new Bb.ec(new Bb.curves.PresetCurve({type:"short",prime:null,p:"08000000 00000011 00000000 00000000 00000000 00000000 00000000 00000001",a:"00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001",b:"06f21413 efbe40de 150e596d 72f7a8c5 609ad26c 15c915c1 f4cdfcb9 9cee9e89",n:UN.toString("hex"),hash:Vu.sha256,gRed:!1,g:["1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca","5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"]}));var jN=function(){var e=new fn("1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000",16);return e.sub(e.mod(UN))};function qN(e,t){return new fn(Vu.sha256().update(nb(Ib(e)+Sb(fb(t),2))).digest("hex"),16)}function zN(e){for(var t=jN(),r=qN(e.toString("hex",64),0),n=0;r.gte(t);n++)r=qN(r.toString("hex"),n);return r.umod(UN).toString("hex")}function HN(e){for(var t=jN(),r=qN(e.toString("hex",64),0),n=1;r.gte(t);n++)r=qN(r.toString("hex"),n);return r.umod(UN).toString("hex")}function GN(e){var t=jN();return qN(e.toString("hex",64),0).gte(t)}function VN(e){return WN.apply(this,arguments)}function WN(){return(WN=ox(dx.mark((function e(t){var r,n;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=new PN(LN.PRODUCTION),e.next=4,r.getUser(t);case 4:if(!((n=e.sent).accounts.length>0)){e.next=7;break}return e.abrupt("return",{starkPublicKey:n.accounts[0],accountNotFound:!1});case 7:e.next=14;break;case 9:if(e.prev=9,e.t0=e.catch(0),!(e.t0 instanceof CN&&"account_not_found"==e.t0.code)){e.next=13;break}return e.abrupt("return",{starkPublicKey:"",accountNotFound:!0});case 13:throw e.t0;case 14:case"end":return e.stop()}}),e,null,[[0,9]])})))).apply(this,arguments)}function KN(e,t){var r=Yk.hdkey.fromMasterSeed(Buffer.from(e.slice(2),"hex")).derivePath(t).getWallet().getPrivateKey();return new fn(r)}function XN(e,t,r){return $N.apply(this,arguments)}function $N(){return($N=ox(dx.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=KN(t,r),a=HN(i),GN(i)){e.next=4;break}return e.abrupt("return",a);case 4:return e.next=6,VN(n);case 6:if(void 0!==(o=e.sent)){e.next=9;break}throw new Error("Error fetching stark public key from IMX");case 9:if(!o.accountNotFound){e.next=11;break}return e.abrupt("return",a);case 11:return s=new fn(Ib(o.starkPublicKey),16),e.next=14,Nx(a).getAddress();case 14:if(c=e.sent,!s.eq(new fn(Ib(c),16))){e.next=17;break}return e.abrupt("return",a);case 17:return u=zN(i),e.next=20,Nx(u).getAddress();case 20:if(c=e.sent,!s.eq(new fn(Ib(c),16))){e.next=23;break}return e.abrupt("return",u);case 23:return f=Mx(t,r),d=Cx(f),e.next=27,Nx(d).getAddress();case 27:if(c=e.sent,!s.eq(new fn(Ib(c),16))){e.next=30;break}return e.abrupt("return",d);case 30:throw new Error("Can not deterministically generate stark private key - please contact support");case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function JN(e){return YN.apply(this,arguments)}function YN(){return(YN=ox(dx.mark((function e(t){var r,n,i,a,o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return r=e.sent.toLowerCase(),e.next=5,t.signMessage("Only sign this request if you’ve initiated an action with Immutable X.");case 5:return n=e.sent,i=qn(n).s,a=Ix("starkex","immutablex",r,"1"),e.next=10,XN(i,a,r);case 10:return o=e.sent,e.abrupt("return",o.padStart(64,"0"));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}IM.errors.INSUFFICIENT_FUNDS,IM.errors.NONCE_EXPIRED,IM.errors.REPLACEMENT_UNDERPRICED;const QN=({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n})=>LN.createConfig({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n,sdkVersion:"ts-immutable-sdk-0.28.8"}),ZN=()=>QN({basePath:"https://api.sandbox.x.immutable.com",chainID:11155111,coreContractAddress:"0x2d5C349fD8464DA06a3f90b4B0E9195F3d1b7F98",registrationContractAddress:"0xDbA6129C02E69405622fAdc3d5A7f8d23eac3b97"});class eB{immutableXConfig;baseConfig;constructor({baseConfig:e,overrides:t}){if(this.baseConfig=e,t)this.immutableXConfig=t.immutableXConfig;else switch(e.environment){case Je.SANDBOX:this.immutableXConfig=ZN();break;case Je.PRODUCTION:this.immutableXConfig=QN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"});break;default:this.immutableXConfig=ZN()}}}class tB{immutableX;depositsApi;mintsApi;ordersApi;tokensApi;tradesApi;transfersApi;exchangeApi;nftCheckoutPrimaryApi;usersApi;withdrawalsApi;balanceApi;assetApi;collectionApi;metadataApi;metadataRefreshesApi;projectsApi;constructor(e){const t=new eB(e);this.immutableX=new PN(t.immutableXConfig),this.depositsApi=this.immutableX.depositsApi,this.mintsApi=this.immutableX.mintsApi,this.ordersApi=this.immutableX.ordersApi,this.tokensApi=this.immutableX.tokensApi,this.tradesApi=this.immutableX.tradesApi,this.transfersApi=this.immutableX.transfersApi,this.exchangeApi=this.immutableX.exchangeApi,this.usersApi=this.immutableX.usersApi,this.withdrawalsApi=this.immutableX.withdrawalsApi,this.balanceApi=this.immutableX.balanceApi,this.assetApi=this.immutableX.assetApi,this.collectionApi=this.immutableX.collectionApi,this.metadataApi=this.immutableX.metadataApi,this.metadataRefreshesApi=this.immutableX.metadataRefreshesApi,this.nftCheckoutPrimaryApi=this.immutableX.nftCheckoutPrimaryApi,this.projectsApi=this.immutableX.projectsApi}getDeposit(e){return this.immutableX.getDeposit(e)}listDeposits(e){return this.immutableX.listDeposits(e)}getUser(e){return this.immutableX.getUser(e)}getAsset(e){return this.immutableX.getAsset(e)}listAssets(e){return this.immutableX.listAssets(e)}createCollection(e,t){return this.immutableX.createCollection(e,t)}getCollection(e){return this.immutableX.getCollection(e)}listCollectionFilters(e){return this.immutableX.listCollectionFilters(e)}listCollections(e){return this.collectionApi.listCollections(e).then((e=>e.data))}updateCollection(e,t,r){return this.immutableX.updateCollection(e,t,r)}addMetadataSchemaToCollection(e,t,r){return this.immutableX.addMetadataSchemaToCollection(e,t,r)}getMetadataSchema(e){return this.immutableX.getMetadataSchema(e)}updateMetadataSchemaByName(e,t,r,n){return this.immutableX.updateMetadataSchemaByName(e,t,r,n)}listMetadataRefreshes(e,t,r,n){return this.immutableX.listMetadataRefreshes(e,t,r,n)}getMetadataRefreshErrors(e,t,r,n){return this.immutableX.getMetadataRefreshErrors(e,t,r,n)}getMetadataRefreshResults(e,t){return this.immutableX.getMetadataRefreshResults(e,t)}createMetadataRefresh(e,t){return this.immutableX.createMetadataRefresh(e,t)}async createProject(e,t){return this.immutableX.createProject(e,t)}async getProject(e,t){return this.immutableX.getProject(e,t)}async getProjects(e,t,r,n,i){return this.immutableX.getProjects(e,t,r,n,i)}getBalance(e){return this.immutableX.getBalance(e)}listBalances(e){return this.immutableX.listBalances(e)}getMint(e){return this.immutableX.getMint(e)}listMints(e){return this.immutableX.listMints(e)}mint(e,t){return this.immutableX.mint(e,t)}listWithdrawals(e){return this.immutableX.listWithdrawals(e)}getWithdrawal(e){return this.immutableX.getWithdrawal(e)}getOrder(e){return this.immutableX.getOrder(e)}listOrders(e){return this.immutableX.listOrders(e)}getTrade(e){return this.immutableX.getTrade(e)}listTrades(e){return this.immutableX.listTrades(e)}getToken(e){return this.immutableX.getToken(e)}listTokens(e){return this.immutableX.listTokens(e)}getTransfer(e){return this.immutableX.getTransfer(e)}listTransfers(e){return this.immutableX.listTransfers(e)}createExchange(e){return this.immutableX.createExchange(e).then((e=>e.data))}getExchange(e){return this.immutableX.getExchange(e).then((e=>e.data))}getExchanges(e){return this.immutableX.getExchanges(e).then((e=>e.data))}exchangeTransfer(e,t){return this.immutableX.exchangeTransfer(e,t)}createNftPrimary(e){return this.immutableX.createNftPrimary(e).then((e=>e.data))}getCurrenciesNFTCheckoutPrimary(e){return this.immutableX.getCurrenciesNFTCheckoutPrimary(e).then((e=>e.data))}getNftPrimaryTransaction(e){return this.immutableX.getNftPrimaryTransaction(e).then((e=>e.data))}getNftPrimaryTransactions(e){return this.immutableX.getNftPrimaryTransactions(e).then((e=>e.data))}}var rB=Object.freeze({__proto__:null,IMXError:CN,ImmutableXClient:tB,imxClientCreateStarkSigner:Nx,imxClientGenerateLegacyStarkPrivateKey:JN});var nB={exports:{}};!function(e,t){e.exports=function(){var e=e||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==nr&&nr.crypto&&(r=nr.crypto),!r)try{r=Hb}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.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 r;return e.prototype=t,r=new e,e.prototype=null,r}}(),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)}},c=o.WordArray=s.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||f).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=o<<24-(n+a)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),u=a.enc={},f=u.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},l=u.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)))}},h=o.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,a=n.sigBytes,o=this.blockSize,s=a/(4*o),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*o,f=e.min(4*u,a);if(u){for(var d=0;d<u;d+=o)this._doProcessBlock(i,d);r=i.splice(0,u),n.sigBytes-=f}return new c.init(r,f)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=h.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.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,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new p.HMAC.init(e,r).finalize(t)}}});var p=a.algo={};return a}(Math);return e}()}(nB);var iB=nB.exports,aB=ir(iB),oB={exports:{}};!function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(s[i]=r(t.pow(n,.5))),c[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],f=o.SHA256=a.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],f=r[5],d=r[6],l=r[7],h=0;h<64;h++){if(h<16)u[h]=0|e[t+h];else{var p=u[h-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,b=u[h-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;u[h]=m+u[h-7]+y+u[h-16]}var g=n&i^n&a^i&a,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&f^~s&d)+c[h]+u[h];l=d,d=f,f=s,s=o+w|0,o=a,a=i,i=n,n=w+(v+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+f|0,r[6]=r[6]+d|0,r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=a._createHelper(f),r.HmacSHA256=a._createHmacHelper(f)}(Math),e.SHA256}(iB)}(oB);var sB=ir(oB.exports),cB={exports:{}};!function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],a=0,o=0;o<t;o++)if(o%4){var s=n[e.charCodeAt(o-1)]<<o%4*2|n[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=s<<24-a%4*8,a++}return r.create(i,a)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],a=0;a<r;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<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<r.length;a++)i[r.charCodeAt(a)]=a}var o=r.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(iB)}(cB);var uB=ir(cB.exports),fB={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(iB)}(fB);var dB=ir(fB.exports);function lB(e){this.message=e}lB.prototype=new Error,lB.prototype.name="InvalidCharacterError";var hB="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new lB("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,a=0,o="";n=t.charAt(a++);~n&&(r=i%4?64*r+n:n,i++%4)?o+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return o};function pB(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(hB(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return hB(t)}}function mB(e){this.message=e}function bB(e,t){if("string"!=typeof e)throw new mB("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(pB(e.split(".")[r]))}catch(e){throw new mB("Invalid token specified: "+e.message)}}mB.prototype=new Error,mB.prototype.name="InvalidTokenError";var yB,gB,vB,wB={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},_B=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(_B||{});(vB=_B||(_B={})).reset=function(){yB=3,gB=wB},vB.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");yB=e},vB.setLogger=function(e){gB=e};var EB=class{constructor(e){this._name=e}debug(...e){yB>=4&&gB.debug(EB._format(this._name,this._method),...e)}info(...e){yB>=3&&gB.info(EB._format(this._name,this._method),...e)}warn(...e){yB>=2&&gB.warn(EB._format(this._name,this._method),...e)}error(...e){yB>=1&&gB.error(EB._format(this._name,this._method),...e)}throw(e){throw this.error(e),e}create(e){const t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(e,t){const r=new EB(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){const r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){yB>=4&&gB.debug(EB._format(e),...t)}static info(e,...t){yB>=3&&gB.info(EB._format(e),...t)}static warn(e,...t){yB>=2&&gB.warn(EB._format(e),...t)}static error(e,...t){yB>=1&&gB.error(EB._format(e),...t)}};_B.reset();var TB,AB=class{static _randomWord(){return aB.lib.WordArray.random(1).words[0]}static generateUUIDv4(){const e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^AB._randomWord()&15>>+e/4).toString(16)));return e.replace(/-/g,"")}static generateCodeVerifier(){return AB.generateUUIDv4()+AB.generateUUIDv4()+AB.generateUUIDv4()}static generateCodeChallenge(e){try{const t=sB(e);return uB.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw EB.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const r=dB.parse([e,t].join(":"));return uB.stringify(r)}},SB=class{constructor(e){this._name=e,this._logger=new EB(`Event('${this._name}')`),this._callbacks=[]}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)t(...e)}},RB=class{static decode(e){try{return bB(e)}catch(e){throw EB.error("JwtUtils.decode",e),e}}},kB=class{static center({...e}){var t;return null==e.width&&(e.width=null!=(t=[800,720,600,480].find((e=>e<=window.outerWidth/1.618)))?t:360),null!=e.left||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),null!=e.height&&(null!=e.top||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter((([,e])=>null!=e)).map((([e,t])=>`${e}=${"boolean"!=typeof t?t:t?"yes":"no"}`)).join(",")}},OB=class extends SB{constructor(){super(...arguments),this._logger=new EB(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-OB.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=OB.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(e){const t=this._logger.create("init");e=Math.max(Math.floor(e),1);const r=OB.getEpochTime()+e;if(this.expiration===r&&this._timerHandle)return void t.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),t.debug("using duration",e),this._expiration=r;const n=Math.min(e,5);this._timerHandle=setInterval(this._callback,1e3*n)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},IB=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const r=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(r.slice(1))}},xB=class extends Error{constructor(e,t){var r,n,i;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw EB.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=null!=(r=e.error_description)?r:null,this.error_uri=null!=(n=e.error_uri)?n:null,this.state=e.userState,this.session_state=null!=(i=e.session_state)?i:null}},CB=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},MB=class{constructor(e){this._logger=new EB("AccessTokenEvents"),this._expiringTimer=new OB("Access token expiring"),this._expiredTimer=new OB("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}load(e){const t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){const r=e.expires_in;if(t.debug("access token present, remaining duration:",r),r>0){let e=r-this._expiringNotificationTimeInSeconds;e<=0&&(e=1),t.debug("registering expiring timer, raising in",e,"seconds"),this._expiringTimer.init(e)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const n=r+1;t.debug("registering expired timer, raising in",n,"seconds"),this._expiredTimer.init(n)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},PB=class{constructor(){this._logger=new EB("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},NB=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new EB("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:r,...n}=t;if(!r)return await fetch(e,n);const i=new AbortController,a=setTimeout((()=>i.abort()),1e3*r);try{return await fetch(e,{...t,signal:i.signal})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw new CB("Network timed out");throw e}finally{clearTimeout(a)}}async getJson(e,{token:t,credentials:r}={}){const n=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};let a;t&&(n.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this.appendExtraHeaders(i);try{n.debug("url:",e),a=await this.fetchWithTimeout(e,{method:"GET",headers:i,credentials:r})}catch(e){throw n.error("Network Error"),e}n.debug("HTTP response received, status",a.status);const o=a.headers.get("Content-Type");if(o&&!this._contentTypes.find((e=>o.startsWith(e)))&&n.throw(new Error(`Invalid response Content-Type: ${null!=o?o:"undefined"}, from URL: ${e}`)),a.ok&&this._jwtHandler&&(null==o?void 0:o.startsWith("application/jwt")))return await this._jwtHandler(await a.text());let s;try{s=await a.json()}catch(e){if(n.error("Error parsing JSON response",e),a.ok)throw e;throw new Error(`${a.statusText} (${a.status})`)}if(!a.ok){if(n.error("Error from server:",s),s.error)throw new xB(s);throw new Error(`${a.statusText} (${a.status}): ${JSON.stringify(s)}`)}return s}async postForm(e,{body:t,basicAuth:r,timeoutInSeconds:n,initCredentials:i}){const a=this._logger.create("postForm"),o={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};let s;void 0!==r&&(o.Authorization="Basic "+r),this.appendExtraHeaders(o);try{a.debug("url:",e),s=await this.fetchWithTimeout(e,{method:"POST",headers:o,body:t,timeoutInSeconds:n,credentials:i})}catch(e){throw a.error("Network error"),e}a.debug("HTTP response received, status",s.status);const c=s.headers.get("Content-Type");if(c&&!this._contentTypes.find((e=>c.startsWith(e))))throw new Error(`Invalid response Content-Type: ${null!=c?c:"undefined"}, from URL: ${e}`);const u=await s.text();let f={};if(u)try{f=JSON.parse(u)}catch(e){if(a.error("Error parsing JSON response",e),s.ok)throw e;throw new Error(`${s.statusText} (${s.status})`)}if(!s.ok){if(a.error("Error from server:",f),f.error)throw new xB(f,t);throw new Error(`${s.statusText} (${s.status}): ${JSON.stringify(f)}`)}return f}appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),r=Object.keys(this._extraHeaders),n=["authorization","accept","content-type"];0!==r.length&&r.forEach((r=>{if(n.includes(r.toLocaleLowerCase()))return void t.warn("Protected header could not be overridden",r,n);const i="function"==typeof this._extraHeaders[r]?this._extraHeaders[r]():this._extraHeaders[r];i&&""!==i&&(e[r]=i)}))}},BB=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new EB("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){this._logger.create(`get('${e}')`),e=this._prefix+e;return await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let r=0;r<e;r++){const e=await this._store.key(r);e&&0===e.indexOf(this._prefix)&&t.push(e.substr(this._prefix.length))}return t}},DB=class{constructor({authority:e,metadataUrl:t,metadata:r,signingKeys:n,metadataSeed:i,client_id:a,client_secret:o,response_type:s="code",scope:c="openid",redirect_uri:u,post_logout_redirect_uri:f,client_authentication:d="client_secret_post",prompt:l,display:h,max_age:p,ui_locales:m,acr_values:b,resource:y,response_mode:g="query",filterProtocolClaims:v=!0,loadUserInfo:w=!1,staleStateAgeInSeconds:_=900,clockSkewInSeconds:E=300,userInfoJwtIssuer:T="OP",mergeClaims:A=!1,disablePKCE:S=!1,stateStore:R,refreshTokenCredentials:k,revokeTokenAdditionalContentTypes:O,fetchRequestCredentials:I,refreshTokenAllowedScope:x,extraQueryParams:C={},extraTokenParams:M={},extraHeaders:P={}}){if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=r,this.metadataSeed=i,this.signingKeys=n,this.client_id=a,this.client_secret=o,this.response_type=s,this.scope=c,this.redirect_uri=u,this.post_logout_redirect_uri=f,this.client_authentication=d,this.prompt=l,this.display=h,this.max_age=p,this.ui_locales=m,this.acr_values=b,this.resource=y,this.response_mode=g,this.filterProtocolClaims=null==v||v,this.loadUserInfo=!!w,this.staleStateAgeInSeconds=_,this.clockSkewInSeconds=E,this.userInfoJwtIssuer=T,this.mergeClaims=!!A,this.disablePKCE=!!S,this.revokeTokenAdditionalContentTypes=O,I&&k&&console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."),this.fetchRequestCredentials=I||(k||"same-origin"),R)this.stateStore=R;else{const e="undefined"!=typeof window?window.localStorage:new PB;this.stateStore=new BB({store:e})}this.refreshTokenAllowedScope=x,this.extraQueryParams=C,this.extraTokenParams=M,this.extraHeaders=P}},FB=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new EB("TokenClient"),this._jsonService=new NB(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:r=this._settings.client_id,client_secret:n=this._settings.client_secret,...i}){const a=this._logger.create("exchangeCode");r||a.throw(new Error("A client_id is required")),t||a.throw(new Error("A redirect_uri is required")),i.code||a.throw(new Error("A code is required"));const o=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!n)throw a.throw(new Error("A client_secret is required")),null;s=AB.generateBasicAuth(r,n);break;case"client_secret_post":o.append("client_id",r),n&&o.append("client_secret",n)}const c=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(c,{body:o,basicAuth:s,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,scope:n=this._settings.scope,...i}){const a=this._logger.create("exchangeCredentials");t||a.throw(new Error("A client_id is required"));const o=new URLSearchParams({grant_type:e,scope:n});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw a.throw(new Error("A client_secret is required")),null;s=AB.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r)}const c=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(c,{body:o,basicAuth:s,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,timeoutInSeconds:n,...i}){const a=this._logger.create("exchangeRefreshToken");t||a.throw(new Error("A client_id is required")),i.refresh_token||a.throw(new Error("A refresh_token is required"));const o=new URLSearchParams({grant_type:e});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw a.throw(new Error("A client_secret is required")),null;s=AB.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r)}const c=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(c,{body:o,basicAuth:s,timeoutInSeconds:n,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async revoke(e){var t;const r=this._logger.create("revoke");e.token||r.throw(new Error("A token is required"));const n=await this._metadataService.getRevocationEndpoint(!1);r.debug(`got revocation endpoint, revoking ${null!=(t=e.token_type_hint)?t:"default token type"}`);const i=new URLSearchParams;for(const[t,r]of Object.entries(e))null!=r&&i.set(t,r);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(n,{body:i}),r.debug("got response")}},LB=class{constructor(e){this.id=e.id||AB.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=OB.getEpochTime(),this.request_type=e.request_type}toStorageString(){return new EB("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})}static fromStorageString(e){return EB.createStatic("State","fromStorageString"),new LB(JSON.parse(e))}static async clearStaleState(e,t){const r=EB.createStatic("State","clearStaleState"),n=OB.getEpochTime()-t,i=await e.getAllKeys();r.debug("got keys",i);for(let t=0;t<i.length;t++){const a=i[t],o=await e.get(a);let s=!1;if(o)try{const e=LB.fromStorageString(o);r.debug("got item from key:",a,e.created),e.created<=n&&(s=!0)}catch(e){r.error("Error parsing state for key:",a,e),s=!0}else r.debug("no item in storage for key:",a),s=!0;s&&(r.debug("removed item for key:",a),e.remove(a))}}},UB=class extends LB{constructor(e){super(e),!0===e.code_verifier?this.code_verifier=AB.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=AB.generateCodeChallenge(this.code_verifier)),this.authority=e.authority,this.client_id=e.client_id,this.redirect_uri=e.redirect_uri,this.scope=e.scope,this.client_secret=e.client_secret,this.extraTokenParams=e.extraTokenParams,this.response_mode=e.response_mode,this.skipUserInfo=e.skipUserInfo}toStorageString(){return new EB("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(e){EB.createStatic("SigninState","fromStorageString");const t=JSON.parse(e);return new UB(t)}},jB=class{constructor(e){this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-OB.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+OB.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},qB=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],zB=["sub","iss","aud","exp","iat"],HB=class{constructor(e){var t;this.id_token=e.id_token,this.session_state=null!=(t=e.session_state)?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-OB.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+OB.getEpochTime())}get expired(){const e=this.expires_in;if(void 0!==e)return e<=0}get scopes(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}toStorageString(){return new EB("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(e){return EB.createStatic("User","fromStorageString"),new HB(JSON.parse(e))}},GB="oidc-client",VB=class{constructor(){this._abort=new SB("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:r,keepOpen:n}=await new Promise(((r,n)=>{const i=i=>{var a;const o=i.data,s=null!=(a=e.scriptOrigin)?a:window.location.origin;if(i.origin===s&&(null==o?void 0:o.source)===GB){try{const r=IB.readParams(o.url,e.response_mode).get("state");if(r||t.warn("no state found in response url"),i.source!==this._window&&r!==e.state)return}catch(e){this._dispose(),n(new Error("Invalid response from window"))}r(o)}};window.addEventListener("message",i,!1),this._disposeHandlers.add((()=>window.removeEventListener("message",i,!1))),this._disposeHandlers.add(this._abort.addHandler((e=>{this._dispose(),n(e)})))}));return t.debug("got response from window"),this._dispose(),n||this.close(),{url:r}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,r=!1,n=window.location.origin){e.postMessage({source:GB,url:t,keepOpen:r},n)}},WB={location:!1,toolbar:!1,height:640},KB="_blank",XB=60,$B=2,JB=10,YB=class extends DB{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:n=WB,popupWindowTarget:i=KB,redirectMethod:a="assign",redirectTarget:o="self",iframeNotifyParentOrigin:s=e.iframeNotifyParentOrigin,iframeScriptOrigin:c=e.iframeScriptOrigin,silent_redirect_uri:u=e.redirect_uri,silentRequestTimeoutInSeconds:f=JB,automaticSilentRenew:d=!0,validateSubOnSilentRenew:l=!0,includeIdTokenInSilentRenew:h=!1,monitorSession:p=!1,monitorAnonymousSession:m=!1,checkSessionIntervalInSeconds:b=$B,query_status_response_type:y="code",stopCheckSessionOnError:g=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:w=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=XB,userStore:T}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=r,this.popupWindowFeatures=n,this.popupWindowTarget=i,this.redirectMethod=a,this.redirectTarget=o,this.iframeNotifyParentOrigin=s,this.iframeScriptOrigin=c,this.silent_redirect_uri=u,this.silentRequestTimeoutInSeconds=f,this.automaticSilentRenew=d,this.validateSubOnSilentRenew=l,this.includeIdTokenInSilentRenew=h,this.monitorSession=p,this.monitorAnonymousSession=m,this.checkSessionIntervalInSeconds=b,this.stopCheckSessionOnError=g,this.query_status_response_type=y,this.revokeTokenTypes=v,this.revokeTokensOnSignout=w,this.includeIdTokenInSilentSignout=_,this.accessTokenExpiringNotificationTimeInSeconds=E,T)this.userStore=T;else{const e="undefined"!=typeof window?window.sessionStorage:new PB;this.userStore=new BB({store:e})}}},QB=class extends VB{constructor({silentRequestTimeoutInSeconds:e=JB}){super(),this._logger=new EB("IFrameWindow"),this._timeoutInSeconds=e,this._frame=QB.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const t=setTimeout((()=>this._abort.raise(new CB("IFrame timed out without a response"))),1e3*this._timeoutInSeconds);return this._disposeHandlers.add((()=>clearTimeout(t))),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(e=>{var t;const r=e.target;null==(t=r.parentNode)||t.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},ZB=class extends VB{constructor({popupWindowTarget:e=KB,popupWindowFeatures:t={}}){super(),this._logger=new EB("PopupWindow");const r=kB.center({...WB,...t});this._window=window.open(void 0,e,kB.serialize(r))}async navigate(e){var t;null==(t=this._window)||t.focus();const r=setInterval((()=>{this._window&&!this._window.closed||this._abort.raise(new Error("Popup closed by user"))}),500);return this._disposeHandlers.add((()=>clearInterval(r))),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},eD=class extends MB{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new EB("UserManagerEvents"),this._userLoaded=new SB("User loaded"),this._userUnloaded=new SB("User unloaded"),this._silentRenewError=new SB("Silent renew error"),this._userSignedIn=new SB("User signed in"),this._userSignedOut=new SB("User signed out"),this._userSessionChanged=new SB("User session changed")}load(e,t=!0){super.load(e),t&&this._userLoaded.raise(e)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}_raiseSilentRenewError(e){this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}},tD=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(tD||{}),rD=((TB=rD||{}).SyncWeb3Method="SYNC_WEB3_METHOD",TB.DuplicateIframe="DUPLICATE_IFRAME",TB.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",TB.DeprecationNotice="DEPRECATION_NOTICE",TB),nD=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e[e.RedirectLoginComplete=-10015]="RedirectLoginComplete",e))(nD||{}),iD=(e=>(e.MetaMask="metamask",e.CoinbaseWallet="coinbase_wallet",e))(iD||{}),aD=(e=>(e.WalletSelected="wallet_selected",e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e))(aD||{}),oD=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.SendGaslessTransaction="eth_sendGaslessTransaction",e))(oD||{}),sD=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e))(sD||{}),cD=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(cD||{}),uD=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(uD||{}),fD=(e=>(e.Retry="retry",e))(fD||{}),dD=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(dD||{}),lD=(e=>(e.VerifyEmailOtp="verify-email-otp",e.Cancel="cancel",e))(lD||{}),hD=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.ExpiredEmailOtp="expired-email-otp",e))(hD||{}),pD=(e=>(e.Retry="device-retry",e))(pD||{}),mD=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(mD||{}),bD=(e=>(e.Harmony="HARMONY",e))(bD||{}),yD=(e=>(e.PhoneNumber="phone_number",e))(yD||{}),gD=Object.create,vD=Object.defineProperty,wD=Object.defineProperties,_D=Object.getOwnPropertyDescriptor,ED=Object.getOwnPropertyDescriptors,TD=Object.getOwnPropertyNames,AD=Object.getOwnPropertySymbols,SD=Object.getPrototypeOf,RD=Object.prototype.hasOwnProperty,kD=Object.prototype.propertyIsEnumerable,OD=(e,t,r)=>t in e?vD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ID=(e,t)=>{for(var r in t||(t={}))RD.call(t,r)&&OD(e,r,t[r]);if(AD)for(var r of AD(t))kD.call(t,r)&&OD(e,r,t[r]);return e},xD=(e,t)=>wD(e,ED(t)),CD=(e,t,r)=>new Promise(((n,i)=>{var a=e=>{try{s(r.next(e))}catch(e){i(e)}},o=e=>{try{s(r.throw(e))}catch(e){i(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,o);s((r=r.apply(e,t)).next())})),MD=((e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports))(((e,t)=>{var r=Object.prototype.hasOwnProperty,n="~";function i(){}function a(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,r,i,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new a(r,i||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),c.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)r.call(e,t)&&i.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},c.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},c.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},c.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c,u,f=this._events[s],d=arguments.length;if(f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),d){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,r),!0;case 4:return f.fn.call(f.context,t,r,i),!0;case 5:return f.fn.call(f.context,t,r,i,a),!0;case 6:return f.fn.call(f.context,t,r,i,a,o),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];f.fn.apply(f.context,c)}else{var l,h=f.length;for(u=0;u<h;u++)switch(f[u].once&&this.removeListener(e,f[u].fn,void 0,!0),d){case 1:f[u].fn.call(f[u].context);break;case 2:f[u].fn.call(f[u].context,t);break;case 3:f[u].fn.call(f[u].context,t,r);break;case 4:f[u].fn.call(f[u].context,t,r,i);break;default:if(!c)for(l=1,c=new Array(d-1);l<d;l++)c[l-1]=arguments[l];f[u].fn.apply(f[u].context,c)}}return!0},c.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},c.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},c.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!r||o.context===r)&&s(this,a);else{for(var c=0,u=[],f=o.length;c<f;c++)(o[c].fn!==t||i&&!o[c].once||r&&o[c].context!==r)&&u.push(o[c]);u.length?this._events[a]=1===u.length?u[0]:u:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,typeof t<"u"&&(t.exports=c)}));var PD={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},ND="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},BD=ND,DD=function(e){let t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=PD,n=(t=e.exports={}).re=[],i=t.src=[],a=t.t={},o=0,s=(e,t,r)=>{let s=o++;BD(s,t),a[e]=s,i[s]=t,n[s]=new RegExp(t,r?"g":void 0)};s("NUMERICIDENTIFIER","0|[1-9]\\d*"),s("NUMERICIDENTIFIERLOOSE","[0-9]+"),s("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),s("MAINVERSION",`(${i[a.NUMERICIDENTIFIER]})\\.(${i[a.NUMERICIDENTIFIER]})\\.(${i[a.NUMERICIDENTIFIER]})`),s("MAINVERSIONLOOSE",`(${i[a.NUMERICIDENTIFIERLOOSE]})\\.(${i[a.NUMERICIDENTIFIERLOOSE]})\\.(${i[a.NUMERICIDENTIFIERLOOSE]})`),s("PRERELEASEIDENTIFIER",`(?:${i[a.NUMERICIDENTIFIER]}|${i[a.NONNUMERICIDENTIFIER]})`),s("PRERELEASEIDENTIFIERLOOSE",`(?:${i[a.NUMERICIDENTIFIERLOOSE]}|${i[a.NONNUMERICIDENTIFIER]})`),s("PRERELEASE",`(?:-(${i[a.PRERELEASEIDENTIFIER]}(?:\\.${i[a.PRERELEASEIDENTIFIER]})*))`),s("PRERELEASELOOSE",`(?:-?(${i[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${i[a.PRERELEASEIDENTIFIERLOOSE]})*))`),s("BUILDIDENTIFIER","[0-9A-Za-z-]+"),s("BUILD",`(?:\\+(${i[a.BUILDIDENTIFIER]}(?:\\.${i[a.BUILDIDENTIFIER]})*))`),s("FULLPLAIN",`v?${i[a.MAINVERSION]}${i[a.PRERELEASE]}?${i[a.BUILD]}?`),s("FULL",`^${i[a.FULLPLAIN]}$`),s("LOOSEPLAIN",`[v=\\s]*${i[a.MAINVERSIONLOOSE]}${i[a.PRERELEASELOOSE]}?${i[a.BUILD]}?`),s("LOOSE",`^${i[a.LOOSEPLAIN]}$`),s("GTLT","((?:<|>)?=?)"),s("XRANGEIDENTIFIERLOOSE",`${i[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),s("XRANGEIDENTIFIER",`${i[a.NUMERICIDENTIFIER]}|x|X|\\*`),s("XRANGEPLAIN",`[v=\\s]*(${i[a.XRANGEIDENTIFIER]})(?:\\.(${i[a.XRANGEIDENTIFIER]})(?:\\.(${i[a.XRANGEIDENTIFIER]})(?:${i[a.PRERELEASE]})?${i[a.BUILD]}?)?)?`),s("XRANGEPLAINLOOSE",`[v=\\s]*(${i[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[a.XRANGEIDENTIFIERLOOSE]})(?:${i[a.PRERELEASELOOSE]})?${i[a.BUILD]}?)?)?`),s("XRANGE",`^${i[a.GTLT]}\\s*${i[a.XRANGEPLAIN]}$`),s("XRANGELOOSE",`^${i[a.GTLT]}\\s*${i[a.XRANGEPLAINLOOSE]}$`),s("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),s("COERCERTL",i[a.COERCE],!0),s("LONETILDE","(?:~>?)"),s("TILDETRIM",`(\\s*)${i[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",s("TILDE",`^${i[a.LONETILDE]}${i[a.XRANGEPLAIN]}$`),s("TILDELOOSE",`^${i[a.LONETILDE]}${i[a.XRANGEPLAINLOOSE]}$`),s("LONECARET","(?:\\^)"),s("CARETTRIM",`(\\s*)${i[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",s("CARET",`^${i[a.LONECARET]}${i[a.XRANGEPLAIN]}$`),s("CARETLOOSE",`^${i[a.LONECARET]}${i[a.XRANGEPLAINLOOSE]}$`),s("COMPARATORLOOSE",`^${i[a.GTLT]}\\s*(${i[a.LOOSEPLAIN]})$|^$`),s("COMPARATOR",`^${i[a.GTLT]}\\s*(${i[a.FULLPLAIN]})$|^$`),s("COMPARATORTRIM",`(\\s*)${i[a.GTLT]}\\s*(${i[a.LOOSEPLAIN]}|${i[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",s("HYPHENRANGE",`^\\s*(${i[a.XRANGEPLAIN]})\\s+-\\s+(${i[a.XRANGEPLAIN]})\\s*$`),s("HYPHENRANGELOOSE",`^\\s*(${i[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${i[a.XRANGEPLAINLOOSE]})\\s*$`),s("STAR","(<|>)?=?\\s*\\*"),s("GTE0","^\\s*>=\\s*0.0.0\\s*$"),s("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")})),FD=/^[0-9]+$/,LD=(e,t)=>{let r=FD.test(e),n=FD.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},UD={compareIdentifiers:LD,rcompareIdentifiers:(e,t)=>LD(t,e)},{MAX_LENGTH:jD,MAX_SAFE_INTEGER:qD}=PD,{re:zD,t:HD}=DD,{compareIdentifiers:GD}=UD,VD=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof VD){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>jD)throw new TypeError(`version is longer than ${jD} characters`);BD("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?zD[HD.LOOSE]:zD[HD.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>qD||this.major<0)throw new TypeError("Invalid major version");if(this.minor>qD||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>qD||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<qD)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(BD("SemVer.compare",this.version,this.options,e),!(e instanceof VD)){if("string"==typeof e&&e===this.version)return 0;e=new VD(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof VD||(e=new VD(e,this.options)),GD(this.major,e.major)||GD(this.minor,e.minor)||GD(this.patch,e.patch)}comparePre(e){if(e instanceof VD||(e=new VD(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(BD("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return GD(r,n)}while(++t)}compareBuild(e){e instanceof VD||(e=new VD(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(BD("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return GD(r,n)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}},WD=(e,t,r)=>new VD(e,r).compare(new VD(t,r)),KD=(e,t,r)=>0===WD(e,t,r),XD=(e,t,r)=>0!==WD(e,t,r),$D=(e,t,r)=>WD(e,t,r)>0,JD=(e,t,r)=>WD(e,t,r)>=0,YD=(e,t,r)=>WD(e,t,r)<0,QD=(e,t,r)=>WD(e,t,r)<=0,ZD=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return KD(e,r,n);case"!=":return XD(e,r,n);case">":return $D(e,r,n);case">=":return JD(e,r,n);case"<":return YD(e,r,n);case"<=":return QD(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},eF=Symbol("SemVer ANY"),tF=class{static get ANY(){return eF}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof tF){if(e.loose===!!t.loose)return e;e=e.value}BD("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===eF?this.value="":this.value=this.operator+this.semver.version,BD("comp",this)}parse(e){let t=this.options.loose?rF[nF.COMPARATORLOOSE]:rF[nF.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new VD(r[2],this.options.loose):this.semver=eF}toString(){return this.value}test(e){if(BD("Comparator.test",e,this.options.loose),this.semver===eF||e===eF)return!0;if("string"==typeof e)try{e=new VD(e,this.options)}catch(e){return!1}return ZD(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof tF))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new iF(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new iF(this.value,t).test(e.semver);let r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),n=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),i=this.semver.version===e.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),o=ZD(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),s=ZD(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||i&&a||o||s}},{re:rF,t:nF}=DD,iF=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof iF)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new iF(e.raw,t);if(e instanceof tF)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let{loose:t}=this.options;e=e.trim();let r=t?aF[oF.HYPHENRANGELOOSE]:aF[oF.HYPHENRANGE];e=e.replace(r,_F(this.options.includePrerelease)),BD("hyphen replace",e),e=e.replace(aF[oF.COMPARATORTRIM],sF),BD("comparator trim",e,aF[oF.COMPARATORTRIM]),e=(e=(e=e.replace(aF[oF.TILDETRIM],cF)).replace(aF[oF.CARETTRIM],uF)).split(/\s+/).join(" ");let n=t?aF[oF.COMPARATORLOOSE]:aF[oF.COMPARATOR];return e.split(" ").map((e=>dF(e,this.options))).join(" ").split(/\s+/).map((e=>wF(e,this.options))).filter(this.options.loose?e=>!!e.match(n):()=>!0).map((e=>new tF(e,this.options)))}intersects(e,t){if(!(e instanceof iF))throw new TypeError("a Range is required");return this.set.some((r=>fF(r,t)&&e.set.some((e=>fF(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new VD(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(EF(this.set[t],e,this.options))return!0;return!1}},{re:aF,t:oF,comparatorTrimReplace:sF,tildeTrimReplace:cF,caretTrimReplace:uF}=DD,fF=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},dF=(e,t)=>(BD("comp",e,t),e=mF(e,t),BD("caret",e),e=hF(e,t),BD("tildes",e),e=yF(e,t),BD("xrange",e),e=vF(e,t),BD("stars",e),e),lF=e=>!e||"x"===e.toLowerCase()||"*"===e,hF=(e,t)=>e.trim().split(/\s+/).map((e=>pF(e,t))).join(" "),pF=(e,t)=>{let r=t.loose?aF[oF.TILDELOOSE]:aF[oF.TILDE];return e.replace(r,((t,r,n,i,a)=>{let o;return BD("tilde",e,t,r,n,i,a),lF(r)?o="":lF(n)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:lF(i)?o=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(BD("replaceTilde pr",a),o=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):o=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,BD("tilde return",o),o}))},mF=(e,t)=>e.trim().split(/\s+/).map((e=>bF(e,t))).join(" "),bF=(e,t)=>{BD("caret",e,t);let r=t.loose?aF[oF.CARETLOOSE]:aF[oF.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,o)=>{let s;return BD("caret",e,t,r,i,a,o),lF(r)?s="":lF(i)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:lF(a)?s="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:o?(BD("replaceCaret pr",o),s="0"===r?"0"===i?`>=${r}.${i}.${a}-${o} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}-${o} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a}-${o} <${+r+1}.0.0-0`):(BD("no pr"),s="0"===r?"0"===i?`>=${r}.${i}.${a}${n} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a} <${+r+1}.0.0-0`),BD("caret return",s),s}))},yF=(e,t)=>(BD("replaceXRanges",e,t),e.split(/\s+/).map((e=>gF(e,t))).join(" ")),gF=(e,t)=>{e=e.trim();let r=t.loose?aF[oF.XRANGELOOSE]:aF[oF.XRANGE];return e.replace(r,((r,n,i,a,o,s)=>{BD("xRange",e,r,n,i,a,o,s);let c=lF(i),u=c||lF(a),f=u||lF(o),d=f;return"="===n&&d&&(n=""),s=t.includePrerelease?"-0":"",c?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(u&&(a=0),o=0,">"===n?(n=">=",u?(i=+i+1,a=0,o=0):(a=+a+1,o=0)):"<="===n&&(n="<",u?i=+i+1:a=+a+1),"<"===n&&(s="-0"),r=`${n+i}.${a}.${o}${s}`):u?r=`>=${i}.0.0${s} <${+i+1}.0.0-0`:f&&(r=`>=${i}.${a}.0${s} <${i}.${+a+1}.0-0`),BD("xRange return",r),r}))},vF=(e,t)=>(BD("replaceStars",e,t),e.trim().replace(aF[oF.STAR],"")),wF=(e,t)=>(BD("replaceGTE0",e,t),e.trim().replace(aF[t.includePrerelease?oF.GTE0PRE:oF.GTE0],"")),_F=e=>(t,r,n,i,a,o,s,c,u,f,d,l,h)=>`${r=lF(n)?"":lF(i)?`>=${n}.0.0${e?"-0":""}`:lF(a)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=lF(u)?"":lF(f)?`<${+u+1}.0.0-0`:lF(d)?`<${u}.${+f+1}.0-0`:l?`<=${u}.${f}.${d}-${l}`:e?`<${u}.${f}.${+d+1}-0`:`<=${c}`}`.trim(),EF=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(BD(e[r].semver),e[r].semver!==tF.ANY&&e[r].semver.prerelease.length>0){let n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0},TF=(e,t,r)=>{try{t=new iF(t,r)}catch(e){return!1}return t.test(e)},{MAX_LENGTH:AF}=PD,{re:SF,t:RF}=DD,kF=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof VD)return e;if("string"!=typeof e||e.length>AF||!(t.loose?SF[RF.LOOSE]:SF[RF.FULL]).test(e))return null;try{return new VD(e,t)}catch(e){return null}},{re:OF,t:IF}=DD,xF=(e,t)=>{if(e instanceof VD)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=OF[IF.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),OF[IF.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;OF[IF.COERCERTL].lastIndex=-1}else r=e.match(OF[IF.COERCE]);return null===r?null:kF(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function CF(e){return String.fromCharCode(parseInt(e.slice(1),16))}function MF(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function PF(e){return function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,CF))}(JSON.stringify(e))}function NF(e){return JSON.parse(function(e){return decodeURIComponent(Array.from(atob(e),MF).join(""))}(e))}function BF(e){return void 0===e}function DF(e){return function(e){return null===e}(e)||BF(e)}function FF(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var LF={};var UF={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"},jF=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,jF.prototype)}},qF=class extends Error{constructor(e){super(),this.__proto__=Error;let t=Number(null==e?void 0:e.code);this.rawMessage=(null==e?void 0:e.message)||"Internal error",this.code=function(e){return!DF(e)&&"number"==typeof e&&Object.values(nD).includes(e)}(t)?t:nD.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(null==e?void 0:e.data)||void 0,Object.setPrototypeOf(this,qF.prototype)}},zF=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},HF=class extends Error{constructor(e,t,r,n){super(`Magic Extension Error (${e.name}): [${t}] ${r}`),this.code=t,this.rawMessage=r,this.data=n,this.__proto__=Error,Object.setPrototypeOf(this,HF.prototype)}},GF=class{constructor(e,t,r){this.code=t,this.rawMessage=r,this.message=`Magic Extension Warning (${e.name}): [${t}] ${r}`}log(){console.warn(this.message)}};function VF(){return new jF(tD.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function WF(){return new jF(tD.MalformedResponse,"Response from the Magic iframe is malformed.")}function KF(e){return new jF(tD.ExtensionNotInitialized,`Extensions must be initialized with a Magic SDK instance before \`Extension.${e}\` can be accessed. Do not invoke \`Extension.${e}\` inside an extension constructor.`)}function XF(e){let t=`Some extensions are incompatible with \`${LF.sdkName}@${LF.version}\`:`;return e.filter((e=>void 0!==e.compat&&null!==e.compat)).forEach((e=>{let r=e.compat[LF.sdkName];"string"==typeof r?t+=`\n - Extension \`${e.name}\` supports version(s) \`${r}\``:r||(t+=`\n - Extension \`${e.name}\` does not support ${LF.platform} environments.`)})),new jF(tD.IncompatibleExtensions,t)}function $F(e){let{method:t,removalVersions:r,useInstead:n}=e,i=r[LF.sdkName],a=n?` Use \`${n}\` instead.`:"",o=`\`${t}\` will be removed from \`${LF.sdkName}\` in version \`${i}\`.${a}`;return new zF(rD.DeprecationNotice,o)}var JF=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function YF(){return JF.next().value}var QF=Symbol("Payload pre-processed by Magic SDK");function ZF(e){return Object.defineProperty(e,QF,{value:!0,enumerable:!1}),e}function eL(e){var t,r,n;return function(e){return!!e[QF]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=YF(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],ZF(e)),e}function tL(e,t=[]){return ZF({params:t,method:e,jsonrpc:"2.0",id:YF()})}var rL=class{constructor(e){e instanceof rL?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):function(e){return!DF(e)&&!(BF(e.jsonrpc)||BF(e.id)||BF(e.result)&&BF(e.error))}(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return void 0!==this._error&&null!==this._error}get hasResult(){return void 0!==this._result}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},nL=((e,t,r)=>(r=null!=e?gD(SD(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of TD(t))!RD.call(e,i)&&i!==r&&vD(e,i,{get:()=>t[i],enumerable:!(n=_D(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:vD(r,"default",{value:e,enumerable:!0}),e)))(MD()),iL=class extends nL.default{};function aL(){let e=new iL;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var oL=Symbol("isPromiEvent");function sL(e){return!!e[oL]}function cL(e){let t=uL(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=aL(),i=Symbol("Promise.then"),a=Symbol("Promise.catch"),o=Symbol("Promise.finally"),s=(e,t)=>(...r)=>{let n=t[e].apply(t,r);return c(n)},c=e=>Object.assign(e,{[oL]:!0,[i]:e[i]||e.then,[a]:e[a]||e.catch,[o]:e[o]||e.finally,then:s(i,e),catch:s(a,e),finally:s(o,e),on:n("on",e),once:n("once",e),addListener:n("addListener",e),off:n("off",e),removeListener:n("removeListener",e),removeAllListeners:n("removeAllListeners",e),emit:r("emit"),eventNames:r("eventNames"),listeners:r("listeners"),listenerCount:r("listenerCount")}),u=c(t.then((e=>(u.emit("done",e),u.emit("settled"),e)),(e=>{throw u.emit("error",e),u.emit("settled"),e})));return u}function uL(e){return new Promise(((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)}))}var fL=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(cD.MAGIC_HANDLE_REQUEST,eL(e)),r=cL(((e,r)=>{t.then((t=>{if(n(),t.hasError)r(new qF(t.payload.error));else{if(!t.hasResult)throw WF();e(t.payload.result)}})).catch((e=>{n(),r(e)}))})),n=this.overlay.on(sD.MAGIC_HANDLE_EVENT,(t=>{var n;let{response:i}=t.data;if(i.id===e.id&&(null==(n=i.result)?void 0:n.event)){let{event:e,params:t=[]}=i.result;r.emit(e,...t)}}));return r}createIntermediaryEvent(e,t){return r=>{let n=tL(oD.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}};var dL,lL={"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},hL=class extends fL{loginWithMagicLink(e){let t="@magic-sdk/react-native"===LF.sdkName||"@magic-sdk/react-native-bare"===LF.sdkName||"@magic-sdk/react-native-expo"===LF.sdkName;if(t&&function(e,t){let[r]=e.split(".").map(Number);return r>=t}(LF.version,19))throw new Error("loginWithMagicLink() is deprecated for this package, please utlize a passcode method like loginWithSMS or loginWithEmailOTP instead.");t&&$F({method:"auth.loginWithMagicLink()",removalVersions:lL,useInstead:"auth.loginWithEmailOTP()"}).log();let{email:r,showUI:n=!0,redirectURI:i,overrides:a}=e,o=tL(this.sdk.testMode?oD.LoginWithMagicLinkTestMode:oD.LoginWithMagicLink,[{email:r,showUI:n,redirectURI:i,overrides:a}]);return this.request(o)}loginWithSMS(e){let{phoneNumber:t}=e,r=tL(this.sdk.testMode?oD.LoginWithSmsTestMode:oD.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r,deviceCheckUI:n,overrides:i}=e,a=tL(this.sdk.testMode?oD.LoginWithEmailOTPTestMode:oD.LoginWithEmailOTP,[{email:t,showUI:r,deviceCheckUI:n,overrides:i}]),o=this.request(a);return!n&&o&&o.on(pD.Retry,(()=>{this.createIntermediaryEvent(pD.Retry,a.id)()})),!r&&o&&(o.on(lD.VerifyEmailOtp,(e=>{this.createIntermediaryEvent(lD.VerifyEmailOtp,a.id)(e)})),o.on(lD.Cancel,(()=>{this.createIntermediaryEvent(lD.Cancel,a.id)()}))),o}loginWithCredential(e){let t=null!=e?e:"";if(!e&&"web"===LF.platform){t=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let r=tL(this.sdk.testMode?oD.LoginWithCredentialTestMode:oD.LoginWithCredential,[t]);return this.request(r)}setAuthorizationToken(e){let t=tL(oD.SetAuthorizationToken,[{jwt:e}]);return this.request(t)}updateEmailWithUI(e){let{email:t,showUI:r=!0}=e,n=tL(this.sdk.testMode?oD.UpdateEmailTestMode:oD.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}},pL={};function mL(e){return(...t)=>CD(this,null,(function*(){return dL||(dL=yield LF.configureStorage()),yield dL.ready(),dL[e](...t)}))}((e,t)=>{for(var r in t)vD(e,r,{get:t[r],enumerable:!0})})(pL,{clear:()=>vL,getItem:()=>bL,iterate:()=>TL,key:()=>_L,keys:()=>EL,length:()=>wL,removeItem:()=>gL,setItem:()=>yL});var bL=mL("getItem"),yL=mL("setItem"),gL=mL("removeItem"),vL=mL("clear"),wL=mL("length"),_L=mL("key"),EL=mL("keys"),TL=mL("iterate"),AL=class extends fL{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}getIdToken(e){let t=tL(this.sdk.testMode?oD.GetIdTokenTestMode:oD.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=tL(this.sdk.testMode?oD.GenerateIdTokenTestMode:oD.GenerateIdToken,[e]);return this.request(t)}getInfo(){return CD(this,null,(function*(){let e=yield bL(this.localForageKey),t=tL(oD.GetInfo,[{walletType:e}]);return this.request(t)}))}isLoggedIn(){let e=tL(this.sdk.testMode?oD.IsLoggedInTestMode:oD.IsLoggedIn);return this.request(e)}logout(){gL(this.localForageKey);let e=tL(this.sdk.testMode?oD.LogoutTestMode:oD.Logout);return this.request(e)}requestInfoWithUI(e){let t=tL(oD.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}showSettings(e){let t=tL(this.sdk.testMode?oD.UserSettingsTestMode:oD.UserSettings,[e]);return this.request(t)}recoverAccount(e){let t=tL(this.sdk.testMode?oD.RecoverAccountTestMode:oD.RecoverAccount,[e]);return this.request(t)}getMetadata(){$F({method:"user.getMetadata()",removalVersions:lL,useInstead:"user.getInfo()"}).log();let e=tL(this.sdk.testMode?oD.GetMetadataTestMode:oD.GetMetadata);return this.request(e)}updateEmail(e){$F({method:"user.updateEmail()",removalVersions:lL,useInstead:"auth.updateEmailWithUI()"}).log();let{email:t,showUI:r=!0}=e,n=tL(this.sdk.testMode?oD.UpdateEmailTestMode:oD.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}};function SL(e,t){return t?new URL(e,t):new URL(e)}function RL(){let e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=191&e[8]|128;let t="";return t+=e[0].toString(16),t+=e[1].toString(16),t+=e[2].toString(16),t+=e[3].toString(16),t+="-",t+=e[4].toString(16),t+=e[5].toString(16),t+="-",t+=e[6].toString(16),t+=e[7].toString(16),t+="-",t+=e[8].toString(16),t+=e[9].toString(16),t+="-",t+=e[10].toString(16),t+=e[11].toString(16),t+=e[12].toString(16),t+=e[13].toString(16),t+=e[14].toString(16),t+=e[15].toString(16),t}var kL="STORE_KEY_PRIVATE_KEY",OL="STORE_KEY_PUBLIC_JWK",IL="ECDSA",xL={name:IL,namedCurve:"P-256"};function CL(){return CD(this,null,(function*(){let e=yield function(){return CD(this,null,(function*(){if(function(){let e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return(yield bL(OL))||(yield function(){return CD(this,null,(function*(){let{subtle:e}=window.crypto,t=yield e.generateKey(xL,!1,["sign"]),r=yield e.exportKey("jwk",t.publicKey);yield yL(kL,t.privateKey),yield yL(OL,r)}))}()),bL(OL);console.info("webcrypto is not supported")}))}();if(!e)return void console.info("unable to create public key or webcrypto is unsupported");let{subtle:t}=window.crypto,r=yield bL(kL);if(!r||!t)return void console.info("unable to find private key or webcrypto unsupported");let n={iat:Math.floor((new Date).getTime()/1e3),jti:RL()},i={typ:"dpop+jwt",alg:"ES256",jwk:e},a=ML(JSON.stringify(i)),o=ML(JSON.stringify(n)),s=function(e){return(new TextEncoder).encode(e)}(`${a}.${o}`),c={name:IL,hash:{name:"SHA-256"}},u=function(e){let t="";return e.forEach((e=>{t+=String.fromCharCode(e)})),PL(t)}(new Uint8Array(yield t.sign(c,r,s)));return`${a}.${o}.${u}`}))}function ML(e){return PL(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}(e))}function PL(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var NL=class extends fL{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}connectWithUI(){let e=cL(((t,r)=>CD(this,null,(function*(){try{if(this.isMetaMaskBrowser()&&(yield this.isWalletEnabled(iD.MetaMask))){let e=yield this.autoConnectIfWalletBrowser(iD.MetaMask);return void t(e)}if(this.isCoinbaseWalletBrowser()&&(yield this.isWalletEnabled(iD.CoinbaseWallet))){let e=yield this.autoConnectIfWalletBrowser(iD.CoinbaseWallet);return void t(e)}let n=this.getUserEnv(),i=tL(oD.Login,[n]),a=this.request(i);a.on(aD.WalletSelected,(e=>this.handleWalletSelected(xD(ID({},e),{payloadId:i.id})))),a.on("id-token-created",(t=>{e.emit("id-token-created",t)}));let o=yield a;o.error&&r(o),t(o)}catch(e){r(e)}}))));return e}showUI(){return this.request(tL(oD.ShowUI))}showAddress(){return this.request(tL(oD.ShowAddress))}showSendTokensUI(){return this.request(tL(oD.ShowSendTokensUI))}showOnRamp(){return this.request(tL(oD.ShowOnRamp))}showNFTs(){return this.request(tL(oD.ShowNFTs))}showBalances(){return this.request(tL(oD.ShowBalances))}sendGaslessTransaction(e,t){return this.request(tL(oD.SendGaslessTransaction,[e,t]))}getInfo(){return CD(this,null,(function*(){$F({method:"wallet.getInfo()",removalVersions:lL,useInstead:"user.getInfo()"}).log();let e=yield bL(this.localForageKey),t=tL(oD.GetInfo,[{walletType:e}]);return this.request(t)}))}disconnect(){$F({method:"wallet.disconnect()",removalVersions:lL,useInstead:"user.logout()"}).log(),gL(this.localForageKey);let e=tL(oD.Disconnect);return this.request(e)}requestUserInfoWithUI(e){$F({method:"wallet.requestUserInfoWithUI()",removalVersions:lL,useInstead:"user.requestUserInfoWithUI()"}).log();let t=tL(oD.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}getProvider(){return CD(this,null,(function*(){switch(yield bL(this.localForageKey)){case iD.MetaMask:return this.getMetaMaskProvider();case iD.CoinbaseWallet:return this.getCoinbaseProvider();default:return this.sdk.rpcProvider}}))}isMetaMaskInstalled(){var e,t,r;return(null==(e=window.ethereum)?void 0:e.isMetaMask)||!(null==(r=null==(t=window.ethereum)?void 0:t.providers)||!r.find((e=>null==e?void 0:e.isMetaMask)))}isMetaMaskBrowser(){return this.isMobile()&&this.isMetaMaskInstalled()}getMetaMaskProvider(){var e,t;return(null==(t=null==(e=window.ethereum)?void 0:e.providers)?void 0:t.find((e=>null==e?void 0:e.isMetaMask)))||window.ethereum}connectToMetaMask(){if(this.isMobile()&&!this.isMetaMaskInstalled()){let e=`https://metamask.app.link/dapp/${window.location.href.replace(/(^\w+:|^)\/\//,"")}`;window.location.href=e}return this.getMetaMaskProvider().request({method:"eth_requestAccounts"})}isCoinbaseWalletInstalled(){var e,t,r;return(null==(e=window.ethereum)?void 0:e.isCoinbaseWallet)||!(null==(r=null==(t=window.ethereum)?void 0:t.providers)||!r.find((e=>null==e?void 0:e.isCoinbaseWallet)))}isCoinbaseWalletBrowser(){var e;return!(null==(e=window.ethereum)||!e.isCoinbaseBrowser)}getCoinbaseProvider(){var e,t;return(null==(t=null==(e=window.ethereum)?void 0:e.providers)?void 0:t.find((e=>null==e?void 0:e.isCoinbaseWallet)))||window.ethereum}connectToCoinbaseWallet(){if(this.isMobile()&&!this.isCoinbaseWalletBrowser()){let e=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(window.location.href)}`;window.location.href=e}return this.getCoinbaseProvider().request({method:"eth_requestAccounts"})}isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Silk|Opera Mini/i.test(navigator.userAgent)}getUserEnv(){return{env:{isMetaMaskInstalled:this.isMetaMaskInstalled(),isCoinbaseWalletInstalled:this.isCoinbaseWalletInstalled()}}}connectToThirdPartyWallet(e){switch(e){case iD.MetaMask:return this.connectToMetaMask();case iD.CoinbaseWallet:return this.connectToCoinbaseWallet();default:throw new Error(`Invalid provider: ${e}. Must be one of "metamask" or "coinbase_wallet".`)}}isWalletEnabled(e){let t=tL("mc_is_wallet_enabled",[{wallet:e}]);return this.request(t)}handleWalletSelected(e){return CD(this,null,(function*(){try{let t=yield this.connectToThirdPartyWallet(e.wallet);yield yL(this.localForageKey,e.wallet),this.createIntermediaryEvent(aD.WalletConnected,e.payloadId)(t)}catch(t){console.error(t),this.createIntermediaryEvent(aD.WalletRejected,e.payloadId)()}}))}autoConnectIfWalletBrowser(e){return CD(this,null,(function*(){let t;e===iD.MetaMask&&(t=yield this.getMetaMaskProvider().request({method:"eth_requestAccounts"})),e===iD.CoinbaseWallet&&(t=yield this.getCoinbaseProvider().request({method:"eth_requestAccounts"})),yield yL(this.localForageKey,e);let r=tL(oD.AutoConnect,[{wallet:e,address:t}]);return this.request(r)}))}},{createBoundEmitterMethod:BL,createChainingEmitterMethod:DL}=aL(),FL=class extends fL{constructor(){super(...arguments),this.isMagic=!0,this.on=DL("on",this),this.once=DL("once",this),this.addListener=DL("addListener",this),this.off=DL("off",this),this.removeListener=DL("removeListener",this),this.removeAllListeners=DL("removeAllListeners",this),this.emit=BL("emit"),this.eventNames=BL("eventNames"),this.listeners=BL("listeners"),this.listenerCount=BL("listenerCount")}sendAsync(e,t){if(!t)throw function(e){return new jF(tD.InvalidArgument,`Invalid ${(e=>{let t=e+1,r=t%10,n=t%100;return 1===r&&11!==n?`${t}st`:2===r&&12!==n?`${t}nd`:3===r&&13!==n?`${t}rd`:`${t}th`})(e.argument)} argument given to \`${e.procedure}\`.\n Expected: \`${e.expected}\`\n Received: \`${e.received}\``)}({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(cD.MAGIC_HANDLE_REQUEST,e.map((e=>{let t=eL(e);return this.prefixPayloadMethodForTestMode(t),t}))).then((e=>{t(null,e.map((e=>xD(ID({},e.payload),{error:e.hasError?new qF(e.payload.error):null}))))}));else{let r=eL(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(cD.MAGIC_HANDLE_REQUEST,r).then((e=>{t(e.hasError?new qF(e.payload.error):null,e.payload)}))}}send(e,t){if("string"==typeof e){let r=tL(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new zF(rD.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.");return r.log(),new rL(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=tL(oD.Login);return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){this.sdk.testMode&&(e.method=`testMode/eth/${e.method}`)}},LL=["request","overlay","sdk"];function UL(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==fL.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var jL=class extends fL{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:cL,isPromiEvent:sL,encodeJSON:PF,decodeJSON:NF,createJsonRpcRequestPayload:tL,standardizeJsonRpcRequestPayload:eL,storage:pL};let e=[this,...UL(this)];LL.forEach((t=>{let r=e.map((e=>Object.getOwnPropertyDescriptor(e,t))),n=r.findIndex((e=>!!e)),i=n>0,a=r[n];a&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:a,isPrototypeField:i}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw KF(t)}}))}))}init(e){this.__is_initialized__||(LL.forEach((e=>{if(this.__sdk_access_field_descriptors__.has(e)){let{descriptor:t,isPrototypeField:r}=this.__sdk_access_field_descriptors__.get(e);r?delete this[e]:Object.defineProperty(this,e,t)}})),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:r,useInstead:n}=e;return new GF(this,"DEPRECATION_NOTICE",`\`${t}\` will be removed from this Extension in version \`${r}\`.${n?` Use \`${n}\` instead.`:""}`)}createWarning(e,t){return new GF(this,e,t)}createError(e,t,r){return new HF(this,e,t,r)}},qL=class extends jL{};qL.Internal=class extends jL{},qL.Anonymous="anonymous extension";var zL=class extends fL{purchase(e){let t=tL(oD.NFTPurchase,[e]);return this.request(t)}checkout(e){let t=tL(oD.NFTCheckout,[e]);return this.request(t)}transfer(e){let t=tL(oD.NFTTransfer,[e]);return this.request(t)}};function HL(e){return!e.compat||null==e.compat[LF.sdkName]||("string"==typeof e.compat[LF.sdkName]?TF(xF(LF.version),e.compat[LF.sdkName]):!!e.compat[LF.sdkName])}function GL(e){var t;let r=null!=(t=null==e?void 0:e.extensions)?t:[],n={},i=[];if(Array.isArray(r)?r.forEach((e=>{HL(e)?(e.init(this),(e.name||e.name!==qL.Anonymous)&&(this[e.name]=e),e instanceof qL.Internal&&(FF(e.config)||(n[e.name]=e.config))):i.push(e)})):Object.keys(r).forEach((e=>{if(HL(r[e])){r[e].init(this);let t=r[e];this[e]=t,t instanceof qL.Internal&&(FF(t.config)||(n[r[e].name]=t.config))}else i.push(r[e])})),i.length)throw XF(i);return n}var VL=class{constructor(e,t){var r;if(this.apiKey=e,!e)throw VF();"react-native"===LF.platform&&(null==t?void 0:t.endpoint)&&new zF(rD.ReactNativeEndpointConfiguration,`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${LF.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`).log();let{defaultEndpoint:n,version:i}=LF;this.testMode=!(null==t||!t.testMode),this.endpoint=SL(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new hL(this),this.user=new AL(this),this.wallet=new NL(this),this.nft=new zL(this),this.rpcProvider=new FL(this);let a=GL.call(this,t);this.parameters=PF(ID({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:SL(this.endpoint).host,sdk:UF[LF.sdkName],version:i,ext:FF(a)?void 0:a,locale:(null==t?void 0:t.locale)||"en_US"},LF.bundleId?{bundleId:LF.bundleId}:{})),null!=t&&t.deferPreload||this.preload()}get overlay(){if(!VL.__overlays__.has(this.parameters)){let e=new LF.ViewController(this.endpoint,this.parameters);e.init(),VL.__overlays__.set(this.parameters,e)}return VL.__overlays__.get(this.parameters)}preload(){return CD(this,null,(function*(){yield this.overlay.ready}))}},WL=VL;function KL(e,t){var r;let n=null==(r=t.data.response)?void 0:r.id,i=function(e,t){return t&&Array.isArray(e)?e.find((e=>e.id===t)):e}(e,n);if(n&&i){return{id:n,response:new rL(i).applyResult(t.data.response.result).applyError(t.data.response.error)}}return{}}WL.__overlays__=new Map;var XL=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return CD(this,null,(function*(){return uL((r=>CD(this,null,(function*(){yield this.ready;let n=[],i=Array.isArray(t)?t.map((e=>e.id)):[],a=yield function(e,t){return CD(this,null,(function*(){let r,n=yield bL("rt");if("web"===LF.platform)try{r=yield CL()}catch(e){console.error("webcrypto error",e)}return r?n?{msgType:e,payload:t,jwt:r,rt:n}:{msgType:e,payload:t,jwt:r}:{msgType:e,payload:t}}))}(`${e}-${this.parameters}`,t);yield this._post(a);let o=this.on(sD.MAGIC_HANDLE_RESPONSE,(e=>a=>{let{id:o,response:s}=KL(t,a);(function(e){CD(this,null,(function*(){!e.data.rt||(yield yL("rt",e.data.rt))}))})(a),o&&s&&Array.isArray(t)&&i.includes(o)?(n.push(s),n.length===t.length&&(e(),r(n))):o&&s&&!Array.isArray(t)&&o===t.id&&(e(),r(s))})((()=>o())))}))))}))}on(e,t){let r=t.bind(window),n=t=>{t.data.msgType===`${e}-${this.parameters}`&&r(t)};return this.messageHandlers.add(n),()=>this.messageHandlers.delete(n)}waitForReady(){return new Promise((e=>{this.on(sD.MAGIC_OVERLAY_READY,(()=>e()))}))}listen(){this.on(sD.MAGIC_HIDE_OVERLAY,(()=>{this.hideOverlay()})),this.on(sD.MAGIC_SHOW_OVERLAY,(()=>{this.showOverlay()}))}},$L=Object.create,JL=Object.defineProperty,YL=Object.getOwnPropertyDescriptor,QL=Object.getOwnPropertyNames,ZL=Object.getPrototypeOf,eU=Object.prototype.hasOwnProperty,tU=(e=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(e,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):e)((function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')})),rU=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nU=(e,t,r)=>(r=null!=e?$L(ZL(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of QL(t))!eU.call(e,i)&&i!==r&&JL(e,i,{get:()=>t[i],enumerable:!(n=YL(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:JL(r,"default",{value:e,enumerable:!0}),e)),iU=(e,t,r)=>new Promise(((n,i)=>{var a=e=>{try{s(r.next(e))}catch(e){i(e)}},o=e=>{try{s(r.throw(e))}catch(e){i(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,o);s((r=r.apply(e,t)).next())})),aU=rU(((e,t)=>{!function(r){if("object"==typeof e&&typeof t<"u")t.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).localforage=r()}}((function(){return function e(t,r,n){function i(o,s){if(!r[o]){if(!t[o]){var c="function"==typeof tU&&tU;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var f=r[o]={exports:{}};t[o][0].call(f.exports,(function(e){return i(t[o][1][e]||e)}),f,f.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof tU&&tU,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){(function(e){var r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var i=0,a=new n(f),o=e.document.createTextNode("");a.observe(o,{characterData:!0}),r=function(){o.data=i=++i%2}}else if(!e.setImmediate&&typeof e.MessageChannel<"u"){var s=new e.MessageChannel;s.port1.onmessage=f,r=function(){s.port2.postMessage(0)}}else r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};var c,u=[];function f(){c=!0;for(var e,t,r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}c=!1}t.exports=function(e){1===u.push(e)&&!c&&r()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(e,t,r){var n=e(1);function i(){}var a={},o=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==i&&h(this,e)}function f(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function d(e,t,r){n((function(){var n;try{n=t(r)}catch(t){return a.reject(e,t)}n===e?a.reject(e,new TypeError("Cannot resolve promise with itself")):a.resolve(e,n)}))}function l(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var r=!1;function n(t){r||(r=!0,a.reject(e,t))}function i(t){r||(r=!0,a.resolve(e,t))}var o=p((function(){t(i,n)}));"error"===o.status&&n(o.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(i);this.state!==c?d(r,this.state===s?e:t,this.outcome):this.queue.push(new f(r,e,t));return r},f.prototype.callFulfilled=function(e){a.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){a.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},a.resolve=function(e,t){var r=p(l,t);if("error"===r.status)return a.reject(e,r.value);var n=r.value;if(n)h(e,n);else{e.state=s,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},a.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:a.resolve(new this(i),e)},u.reject=function(e){var t=new this(i);return a.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=new Array(r),s=0,c=-1,u=new this(i);++c<r;)f(e[c],c);return u;function f(e,i){t.resolve(e).then((function(e){o[i]=e,++s===r&&!n&&(n=!0,a.resolve(u,o))}),(function(e){n||(n=!0,a.reject(u,e))}))}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=-1,s=new this(i);++o<r;)c(e[o]);return s;function c(e){t.resolve(e).then((function(e){n||(n=!0,a.resolve(s,e))}),(function(e){n||(n=!0,a.reject(s,e))}))}}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var i=function(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}();function a(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}typeof Promise>"u"&&e(3);var o=Promise;function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function c(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function u(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var d="local-forage-detect-blob-support",l=void 0,h={},p=Object.prototype.toString,m="readonly",b="readwrite";function y(e){return"boolean"==typeof l?o.resolve(l):function(e){return new o((function(t){var r=e.transaction(d,b),n=a([""]);r.objectStore(d).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return l=e}))}function g(e){var t=h[e.name],r={};r.promise=new o((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function v(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var r=h[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function _(e,t){return new o((function(r,n){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);g(e),e.db.close()}var a=[e.name];t&&a.push(e.version);var o=i.open.apply(i,a);t&&(o.onupgradeneeded=function(t){var r=o.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(d)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),n(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},r(t),v(e)}}))}function E(e){return _(e,!1)}function T(e){return _(e,!0)}function A(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function S(e){var t=function(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}(atob(e.data));return a([t],{type:e.type})}function R(e){return e&&e.__local_forage_encoded_blob}function k(e){var t=this,r=t._initReady().then((function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(r,e,e),r}function O(e,t,r,n){void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return o.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),T(e)})).then((function(){return function(e){g(e);for(var t=h[e.name],r=t.forages,n=0;n<r.length;n++){var i=r[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,E(e).then((function(t){return e.db=t,A(e)?T(e):t})).then((function(n){e.db=t.db=n;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=n})).catch((function(t){throw w(e,t),t}))}(e).then((function(){O(e,t,r,n-1)}))})).catch(r);r(i)}}var I={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var i=h[r.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},h[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=k);var a=[];function s(){return o.resolve()}for(var c=0;c<i.forages.length;c++){var u=i.forages[c];u!==t&&a.push(u._initReady().catch(s))}var f=i.forages.slice(0);return o.all(a).then((function(){return r.db=i.db,E(r)})).then((function(e){return r.db=e,A(r,t._defaultConfig.version)?T(r):e})).then((function(e){r.db=i.db=e,t._dbInfo=r;for(var n=0;n<f.length;n++){var a=f[n];a!==t&&(a._dbInfo.db=r.db,a._dbInfo.version=r.version)}}))},_support:function(){try{if(!i||!i.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}(),iterate:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){O(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).openCursor(),s=1;o.onsuccess=function(){var r=o.result;if(r){var n=r.value;R(n)&&(n=S(n));var i=e(n,r.key,s++);void 0!==i?t(i):r.continue()}else t()},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){O(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),R(e)&&(e=S(e)),t(e)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},setItem:function(e,t,r){var n=this;e=u(e);var i=new o((function(r,i){var a;n.ready().then((function(){return a=n._dbInfo,"[object Blob]"===p.call(t)?y(a.db).then((function(e){return e?t:function(e){return new o((function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)}))}(t)})):t})).then((function(t){O(n._dbInfo,b,(function(a,o){if(a)return i(a);try{var s=o.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var c=s.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),r(t)},o.onabort=o.onerror=function(){var e=c.error?c.error:c.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return s(i,r),i},removeItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){O(r._dbInfo,b,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).delete(e);a.oncomplete=function(){t()},a.onerror=function(){n(o.error)},a.onabort=function(){var e=o.error?o.error:o.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},clear:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){O(t._dbInfo,b,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=a.error?a.error:a.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},length:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){O(t._dbInfo,m,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).count();a.onsuccess=function(){e(a.result)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},key:function(e,t){var r=this,n=new o((function(t,n){e<0?t(null):r.ready().then((function(){O(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName),s=!1,c=o.openKeyCursor();c.onsuccess=function(){var r=c.result;r?0===e||s?t(r.key):(s=!0,r.advance(e)):t(null)},c.onerror=function(){n(c.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},keys:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){O(t._dbInfo,m,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];a.onsuccess=function(){var t=a.result;t?(o.push(t.key),t.continue()):e(o)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r,n=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName),e.name){var a=e.name===n.name&&this._dbInfo.db?o.resolve(this._dbInfo.db):E(e).then((function(t){var r=h[e.name],n=r.forages;r.db=t;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=t;return t}));r=e.storeName?a.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;g(e);var n=h[e.name],a=n.forages;t.close();for(var s=0;s<a.length;s++){var c=a[s];c._dbInfo.db=null,c._dbInfo.version=r}var u=new o((function(t,n){var a=i.open(e.name,r);a.onerror=function(e){a.result.close(),n(e)},a.onupgradeneeded=function(){a.result.deleteObjectStore(e.storeName)},a.onsuccess=function(){var e=a.result;e.close(),t(e)}}));return u.then((function(e){n.db=e;for(var t=0;t<a.length;t++){var r=a[t];r._dbInfo.db=e,v(r._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}})):a.then((function(t){g(e);var r=h[e.name],n=r.forages;t.close();for(var a=0;a<n.length;a++){n[a]._dbInfo.db=null}var s=new o((function(t,r){var n=i.deleteDatabase(e.name);n.onerror=function(){var e=n.result;e&&e.close(),r(n.error)},n.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}));return s.then((function(e){r.db=e;for(var t=0;t<n.length;t++){v(n[t]._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}))}else r=o.reject("Invalid arguments");return s(r,t),r}};var x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C=/^~~local_forage_type~([^~]+)~/,M="__lfsc__:",P="arbf",N="blob",B="si08",D="ui08",F="uic8",L="si16",U="si32",j="ur16",q="ui32",z="fl32",H="fl64",G=Object.prototype.toString;function V(e){var t,r,n,i,a,o=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var u=new ArrayBuffer(o),f=new Uint8Array(u);for(t=0;t<s;t+=4)r=x.indexOf(e[t]),n=x.indexOf(e[t+1]),i=x.indexOf(e[t+2]),a=x.indexOf(e[t+3]),f[c++]=r<<2|n>>4,f[c++]=(15&n)<<4|i>>2,f[c++]=(3&i)<<6|63&a;return u}function W(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=x[r[t]>>2],n+=x[(3&r[t])<<4|r[t+1]>>4],n+=x[(15&r[t+1])<<2|r[t+2]>>6],n+=x[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var K={serialize:function(e,t){var r="";if(e&&(r=G.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===G.call(e.buffer))){var n,i=M;e instanceof ArrayBuffer?(n=e,i+=P):(n=e.buffer,"[object Int8Array]"===r?i+=B:"[object Uint8Array]"===r?i+=D:"[object Uint8ClampedArray]"===r?i+=F:"[object Int16Array]"===r?i+=L:"[object Uint16Array]"===r?i+=j:"[object Int32Array]"===r?i+=U:"[object Uint32Array]"===r?i+=q:"[object Float32Array]"===r?i+=z:"[object Float64Array]"===r?i+=H:t(new Error("Failed to get type for BinaryArray"))),t(i+W(n))}else if("[object Blob]"===r){var a=new FileReader;a.onload=function(){var r="~~local_forage_type~"+e.type+"~"+W(this.result);t(M+N+r)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,9)!==M)return JSON.parse(e);var t,r=e.substring(13),n=e.substring(9,13);if(n===N&&C.test(r)){var i=r.match(C);t=i[1],r=r.substring(i[0].length)}var o=V(r);switch(n){case P:return o;case N:return a([o],{type:t});case B:return new Int8Array(o);case D:return new Uint8Array(o);case F:return new Uint8ClampedArray(o);case L:return new Int16Array(o);case j:return new Uint16Array(o);case U:return new Int32Array(o);case q:return new Uint32Array(o);case z:return new Float32Array(o);case H:return new Float64Array(o);default:throw new Error("Unkown type: "+n)}},stringToBuffer:V,bufferToString:W};function X(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function $(e,t,r,n,i,a){e.executeSql(r,n,i,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,s){s.rows.length?a(e,o):X(e,t,(function(){e.executeSql(r,n,i,a)}),a)}),a):a(e,o)}),a)}function J(e,t,r,n){var i=this;e=u(e);var a=new o((function(a,o){i.ready().then((function(){void 0===t&&(t=null);var s=t,c=i._dbInfo;c.serializer.serialize(t,(function(t,u){u?o(u):c.db.transaction((function(r){$(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){a(s)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void a(J.apply(i,[e,s,r,n-1]));o(t)}}))}))})).catch(o)}));return s(a,r),a}var Y={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new o((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(i){X(i,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=K,i},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT * FROM "+i.storeName,[],(function(r,n){for(var a=n.rows,o=a.length,s=0;s<o;s++){var c=a.item(s),u=c.value;if(u&&(u=i.serializer.deserialize(u)),void 0!==(u=e(u,c.key,s+1)))return void t(u)}t()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},setItem:function(e,t,r){return J.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},clear:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"DELETE FROM "+n.storeName,[],(function(){e()}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},length:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,r){var n=r.rows.item(0).c;e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},key:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},keys:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"SELECT key FROM "+n.storeName,[],(function(t,r){for(var n=[],i=0;i<r.rows.length;i++)n.push(r.rows.item(i).key);e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;return n=e.name?new o((function(t){var n;n=e.name===r.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:n,storeNames:[e.storeName]}):t(function(e){return new o((function(t,r){e.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var i=[],a=0;a<n.rows.length;a++)i.push(n.rows.item(a).name);t({db:e,storeNames:i})}),(function(e,t){r(t)}))}),(function(e){r(e)}))}))}(n))})).then((function(e){return new o((function(t,r){e.db.transaction((function(n){function i(e){return new o((function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){r(t)}))}))}for(var a=[],s=0,c=e.storeNames.length;s<c;s++)a.push(i(e.storeNames[s]));o.all(a).then((function(){t()})).catch((function(e){r(e)}))}),(function(e){r(e)}))}))})):o.reject("Invalid arguments"),s(n,t),n}};function Q(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Z(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}()||localStorage.length>0}var ee={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=Q(e,this._defaultConfig),Z()?(this._dbInfo=t,t.serializer=K,o.resolve()):o.reject()},_support:function(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,i=n.length,a=localStorage.length,o=1,s=0;s<a;s++){var c=localStorage.key(s);if(0===c.indexOf(n)){var u=localStorage.getItem(c);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,c.substring(i),o++)))return u}}}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=r.ready().then((function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return s(n,t),n},setItem:function(e,t,r){var n=this;e=u(e);var i=n.ready().then((function(){void 0===t&&(t=null);var r=t;return new o((function(i,a){var o=n._dbInfo;o.serializer.serialize(t,(function(t,n){if(n)a(n);else try{localStorage.setItem(o.keyPrefix+e,t),i(r)}catch(e){("QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&a(e),a(e)}}))}))}));return s(i,r),i},removeItem:function(e,t){var r=this;e=u(e);var n=r.ready().then((function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return s(n,t),n},clear:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return s(r,e),r},length:function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},key:function(e,t){var r=this,n=r.ready().then((function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch{t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return s(n,t),n},keys:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo,r=localStorage.length,n=[],i=0;i<r;i++){var a=localStorage.key(i);0===a.indexOf(e.keyPrefix)&&n.push(a.substring(e.keyPrefix.length))}return n}));return s(r,e),r},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,i=this;return n=e.name?new o((function(t){e.storeName?t(Q(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):o.reject("Invalid arguments"),s(n,t),n}},te=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},re=function(e,t){for(var r=e.length,n=0;n<r;){if(te(e[n],t))return!0;n++}return!1},ne=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},oe={INDEXEDDB:I,WEBSQL:Y,LOCALSTORAGE:ee},se=[oe.INDEXEDDB._driver,oe.WEBSQL._driver,oe.LOCALSTORAGE._driver],ce=["dropInstance"],ue=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),fe={description:"",driver:se.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then((function(){return e[t].apply(e,r)}))}}function le(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(ne(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var he=function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),oe)if(oe.hasOwnProperty(r)){var n=oe[r],i=n._driver;this[r]=i,ie[i]||this.defineDriver(n)}this._defaultConfig=le({},fe),this._config=le({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(typeof e>"u"?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new o((function(t,r){try{var n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(i);for(var a=ue.concat("_initStorage"),c=0,u=a.length;c<u;c++){var f=a[c];if((!re(ce,f)||e[f])&&"function"!=typeof e[f])return void r(i)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=o.reject(t);return s(r,arguments[arguments.length-1]),r}},r=0,n=ce.length;r<n;r++){var i=ce[r];e[i]||(e[i]=t(i))}}();var d=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,r):d(!!e._support):d(!0)}catch(e){r(e)}}));return c(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?o.resolve(ie[e]):o.reject(new Error("Driver not found."));return c(n,t,r),n},e.prototype.getSerializer=function(e){var t=o.resolve(K);return c(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return c(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;ne(e)||(e=[e]);var i=this._getSupportedDrivers(e);function a(){n._config.driver=n.driver()}function s(e){return n._extend(e),a(),n._ready=n._initStorage(n._config),n._ready}var u=null!==this._driverSet?this._driverSet.catch((function(){return o.resolve()})):o.resolve();return this._driverSet=u.then((function(){var e=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then((function(e){n._driver=e._driver,a(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var i=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(i).then(s).catch(r)}a();var c=new Error("No available storage method found.");return n._driverSet=o.reject(c),n._driverSet}()}}(i)}))})).catch((function(){a();var e=new Error("No available storage method found.");return n._driverSet=o.reject(e),n._driverSet})),c(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){le(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=ue.length;e<t;e++)de(this,ue[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),pe=new he;t.exports=pe},{3:3}]},{},[4])(4)}))})),oU=rU(((e,t)=>{!function(r,n){"object"==typeof e&&typeof t<"u"?n(e):"function"==typeof define&&define.amd?define("localforage-driver-memory",["exports"],n):n(r.LocalforageDriverMemory={})}(typeof self<"u"?self:e,(function(e){var t=/^~~local_forage_type~([^~]+)~/,r=Object.prototype.toString;function n(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),i=new Uint8Array(n),a=0,o=0;a<r;a+=4){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+1]),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+2]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+3]);i[o++]=s<<2|c>>4,i[o++]=(15&c)<<4|u>>2,i[o++]=(3&u)<<6|63&f}return n}function i(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];return t.length%3==2?r=r.substring(0,r.length-1)+"=":t.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function a(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var i=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),o=i.next();!o.done;o=i.next()){var s=o.value;Object.prototype.hasOwnProperty.call(e,s)&&(e.isActiveClone=null,n[s]=a(e[s]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function o(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function u(e,t){var r,n=this;if(t=c.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var i=this.config();e.name=e.name||i.name,e.storeName=e.storeName||i.storeName}return r=e.name?new Promise((function(t){e.storeName?t(o(e,n._defaultConfig)):t(e.name+"/")})):Promise.reject("Invalid arguments"),{promise:r,callback:t}}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var d={bufferToString:i,deserialize:function(e){if("__lfsc__:"!==e.substring(0,9))return JSON.parse(e);var r,i=e.substring(13),a=e.substring(9,13);if("blob"===a&&t.test(i)){var o=i.match(t);r=o[1],i=i.substring(o[0].length)}var s=n(i);switch(a){case"arbf":return s;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([s],{type:r});case"si08":return new Int8Array(s);case"ui08":return new Uint8Array(s);case"uic8":return new Uint8ClampedArray(s);case"si16":return new Int16Array(s);case"ur16":return new Uint16Array(s);case"si32":return new Int32Array(s);case"ui32":return new Uint32Array(s);case"fl32":return new Float32Array(s);case"fl64":return new Float64Array(s);default:throw new Error("Unkown type: "+a)}},serialize:function(e,t){var n="";if(e&&(n=r.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===r.call(e.buffer))){var a=void 0,o="__lfsc__:";e instanceof ArrayBuffer?(a=e,o+="arbf"):(a=e.buffer,"[object Int8Array]"===n?o+="si08":"[object Uint8Array]"===n?o+="ui08":"[object Uint8ClampedArray]"===n?o+="uic8":"[object Int16Array]"===n?o+="si16":"[object Uint16Array]"===n?o+="ur16":"[object Int32Array]"===n?o+="si32":"[object Uint32Array]"===n?o+="ui32":"[object Float32Array]"===n?o+="fl32":"[object Float64Array]"===n?o+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(o+i(a))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var r="~~local_forage_type~"+e.type+"~"+i(this.result);t("__lfsc__:blob"+r)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:n},l={},h=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return l[t]||(l[t]=new e(t)),l[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete l[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?a(e):{},r=o(t,this._defaultConfig),n=h.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=d,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then((function(){t._dbInfo.mStore.clear()}));return s(r,e),r},e.dropInstance=function(e,t){var r=u.apply(this,arguments),n=r.promise,i=r.callback,a=n.then((function(e){h.resolve(e).drop()}));return s(a,i),n},e.getItem=function(e,t){var r=this;e=f(e);var n=this.ready().then((function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)}));return s(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then((function(){for(var t=r._dbInfo.mStore,n=t.keys(),i=0;i<n.length;i++){var a=t.get(n[i]);if(a&&(a=r._dbInfo.serializer.deserialize(a)),void 0!==(a=e(a,n[i],i+1)))return a}}));return s(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then((function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch{t=null}return t}));return s(n,t),n},e.keys=function(e){var t=this,r=this.ready().then((function(){return t._dbInfo.mStore.keys()}));return s(r,e),r},e.length=function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},e.removeItem=function(e,t){var r=this;e=f(e);var n=this.ready().then((function(){r._dbInfo.mStore.rm(e)}));return s(n,t),n},e.setItem=function(e,t,r){var n=this;e=f(e);var i=this.ready().then((function(){void 0===t&&(t=null);var r=t;return new Promise((function(i,a){n._dbInfo.serializer.serialize(t,(function(t,o){if(o)a(o);else try{n._dbInfo.mStore.set(e,t),i(r)}catch(e){a(e)}}))}))}));return s(i,r),i},Object.defineProperty(e,"__esModule",{value:!0})}))})),sU=nU(aU()),cU=nU(oU()),uU={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var fU=function(e,t){return Object.assign(LF,t),e}(WL,{platform:"web",sdkName:"magic-sdk",version:"21.2.0",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends XL{constructor(){super(...arguments),this.activeElement=null}init(){this.test="hello",this.iframe=new Promise((e=>{let t=()=>{if(function(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find((t=>t.src.includes(e))))}(encodeURIComponent(this.parameters)))new zF(rD.DuplicateIframe,"Duplicate iframes found.").log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=SL(this.endpoint).host,t.title="Secure Modal",t.src=SL(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(let[t,r]of Object.entries(uU))e.style[t]=r}(t),document.body.appendChild(t),e(t)}};["loaded","interactive","complete"].includes(document.readyState)?t():window.addEventListener("load",t,!1)})),window.addEventListener("message",(e=>{var t;if(e.origin===this.endpoint&&e.data&&e.data.msgType&&this.messageHandlers.size){e.data.response=null!=(t=e.data.response)?t:{};for(let t of this.messageHandlers.values())t(e)}}))}showOverlay(){return iU(this,null,(function*(){let e=yield this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}))}hideOverlay(){return iU(this,null,(function*(){var e;(yield this.iframe).style.display="none",null!=(e=this.activeElement)&&e.focus&&this.activeElement.focus(),this.activeElement=null}))}_post(e){return iU(this,null,(function*(){let t=yield this.iframe;if(!t||!t.contentWindow)throw new jF(tD.ModalNotReady,"Modal is not ready.");t.contentWindow.postMessage(e,this.endpoint)}))}},configureStorage:()=>iU(void 0,null,(function*(){let e=sU.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(cU),yield e.setDriver([sU.default.INDEXEDDB,sU.default.LOCALSTORAGE,cU._driver]),e}))}),dU=(e=>(e.LoginWithOIDC="magic_auth_login_with_oidc",e))(dU||{}),lU=class extends qL.Internal{constructor(){super(...arguments),this.name="openid",this.config={}}loginWithOIDC(e){let t=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_oidc",[e]);return this.request(t)}};function hU(e,t){return function(){return e.apply(t,arguments)}}const{toString:pU}=Object.prototype,{getPrototypeOf:mU}=Object,bU=(e=>t=>{const r=pU.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),yU=e=>(e=e.toLowerCase(),t=>bU(t)===e),gU=e=>t=>typeof t===e,{isArray:vU}=Array,wU=gU("undefined");const _U=yU("ArrayBuffer");const EU=gU("string"),TU=gU("function"),AU=gU("number"),SU=e=>null!==e&&"object"==typeof e,RU=e=>{if("object"!==bU(e))return!1;const t=mU(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},kU=yU("Date"),OU=yU("File"),IU=yU("Blob"),xU=yU("FileList"),CU=yU("URLSearchParams");function MU(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),vU(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function PU(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const NU="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,BU=e=>!wU(e)&&e!==NU;const DU=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&mU(Uint8Array)),FU=yU("HTMLFormElement"),LU=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),UU=yU("RegExp"),jU=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};MU(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},qU="abcdefghijklmnopqrstuvwxyz",zU="0123456789",HU={DIGIT:zU,ALPHA:qU,ALPHA_DIGIT:qU+qU.toUpperCase()+zU};const GU=yU("AsyncFunction");var VU={isArray:vU,isArrayBuffer:_U,isBuffer:function(e){return null!==e&&!wU(e)&&null!==e.constructor&&!wU(e.constructor)&&TU(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||TU(e.append)&&("formdata"===(t=bU(e))||"object"===t&&TU(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&_U(e.buffer),t},isString:EU,isNumber:AU,isBoolean:e=>!0===e||!1===e,isObject:SU,isPlainObject:RU,isUndefined:wU,isDate:kU,isFile:OU,isBlob:IU,isRegExp:UU,isFunction:TU,isStream:e=>SU(e)&&TU(e.pipe),isURLSearchParams:CU,isTypedArray:DU,isFileList:xU,forEach:MU,merge:function e(){const{caseless:t}=BU(this)&&this||{},r={},n=(n,i)=>{const a=t&&PU(r,i)||i;RU(r[a])&&RU(n)?r[a]=e(r[a],n):RU(n)?r[a]=e({},n):vU(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&MU(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(MU(t,((t,n)=>{r&&TU(t)?e[n]=hU(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,a,o;const s={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],n&&!n(o,e,t)||s[o]||(t[o]=e[o],s[o]=!0);e=!1!==r&&mU(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:bU,kindOfTest:yU,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(vU(e))return e;let t=e.length;if(!AU(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:FU,hasOwnProperty:LU,hasOwnProp:LU,reduceDescriptors:jU,freezeMethods:e=>{jU(e,((t,r)=>{if(TU(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];TU(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return vU(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:PU,global:NU,isContextDefined:BU,ALPHABET:HU,generateString:(e=16,t=HU.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&TU(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(SU(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=vU(e)?[]:{};return MU(e,((e,t)=>{const a=r(e,n+1);!wU(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:GU,isThenable:e=>e&&(SU(e)||TU(e))&&TU(e.then)&&TU(e.catch)};function WU(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}VU.inherits(WU,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:VU.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const KU=WU.prototype,XU={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{XU[e]={value:e}})),Object.defineProperties(WU,XU),Object.defineProperty(KU,"isAxiosError",{value:!0}),WU.from=(e,t,r,n,i,a)=>{const o=Object.create(KU);return VU.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),WU.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function $U(e){return VU.isPlainObject(e)||VU.isArray(e)}function JU(e){return VU.endsWith(e,"[]")?e.slice(0,-2):e}function YU(e,t,r){return e?e.concat(t).map((function(e,t){return e=JU(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const QU=VU.toFlatObject(VU,{},null,(function(e){return/^is[A-Z]/.test(e)}));function ZU(e,t,r){if(!VU.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=VU.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!VU.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&VU.isSpecCompliantForm(t);if(!VU.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(VU.isDate(e))return e.toISOString();if(!s&&VU.isBlob(e))throw new WU("Blob is not supported. Use a Buffer instead.");return VU.isArrayBuffer(e)||VU.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(VU.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(VU.isArray(e)&&function(e){return VU.isArray(e)&&!e.some($U)}(e)||(VU.isFileList(e)||VU.endsWith(r,"[]"))&&(s=VU.toArray(e)))return r=JU(r),s.forEach((function(e,n){!VU.isUndefined(e)&&null!==e&&t.append(!0===o?YU([r],n,a):null===o?r:r+"[]",c(e))})),!1;return!!$U(e)||(t.append(YU(i,r,a),c(e)),!1)}const f=[],d=Object.assign(QU,{defaultVisitor:u,convertValue:c,isVisitable:$U});if(!VU.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!VU.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),VU.forEach(r,(function(r,a){!0===(!(VU.isUndefined(r)||null===r)&&i.call(t,r,VU.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),f.pop()}}(e),t}function ej(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function tj(e,t){this._pairs=[],e&&ZU(e,this,t)}const rj=tj.prototype;function nj(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ij(e,t,r){if(!t)return e;const n=r&&r.encode||nj,i=r&&r.serialize;let a;if(a=i?i(t,r):VU.isURLSearchParams(t)?t.toString():new tj(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}rj.append=function(e,t){this._pairs.push([e,t])},rj.toString=function(e){const t=e?function(t){return e.call(this,t,ej)}:ej;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var aj=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){VU.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},oj={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var sj={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:tj,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function cj(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&VU.isArray(n)?n.length:a,s)return VU.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&VU.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&VU.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(VU.isFormData(e)&&VU.isFunction(e.entries)){const r={};return VU.forEachEntry(e,((e,n)=>{t(function(e){return VU.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const uj={"Content-Type":void 0};const fj={transitional:oj,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=VU.isObject(e);i&&VU.isHTMLForm(e)&&(e=new FormData(e));if(VU.isFormData(e))return n&&n?JSON.stringify(cj(e)):e;if(VU.isArrayBuffer(e)||VU.isBuffer(e)||VU.isStream(e)||VU.isFile(e)||VU.isBlob(e))return e;if(VU.isArrayBufferView(e))return e.buffer;if(VU.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ZU(e,new sj.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return sj.isNode&&VU.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=VU.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ZU(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(VU.isString(e))try{return(t||JSON.parse)(e),VU.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||fj.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&VU.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw WU.from(e,WU.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:sj.classes.FormData,Blob:sj.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};VU.forEach(["delete","get","head"],(function(e){fj.headers[e]={}})),VU.forEach(["post","put","patch"],(function(e){fj.headers[e]=VU.merge(uj)}));var dj=fj;const lj=VU.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const hj=Symbol("internals");function pj(e){return e&&String(e).trim().toLowerCase()}function mj(e){return!1===e||null==e?e:VU.isArray(e)?e.map(mj):String(e)}function bj(e,t,r,n,i){return VU.isFunction(n)?n.call(this,t,r):(i&&(t=r),VU.isString(t)?VU.isString(n)?-1!==t.indexOf(n):VU.isRegExp(n)?n.test(t):void 0:void 0)}class yj{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=pj(t);if(!i)throw new Error("header name must be a non-empty string");const a=VU.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=mj(e))}const a=(e,t)=>VU.forEach(e,((e,r)=>i(e,r,t)));return VU.isPlainObject(e)||e instanceof this.constructor?a(e,t):VU.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&lj[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=pj(e)){const r=VU.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(VU.isFunction(t))return t.call(this,e,r);if(VU.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=pj(e)){const r=VU.findKey(this,e);return!(!r||void 0===this[r]||t&&!bj(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=pj(e)){const i=VU.findKey(r,e);!i||t&&!bj(0,r[i],i,t)||(delete r[i],n=!0)}}return VU.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!bj(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return VU.forEach(this,((n,i)=>{const a=VU.findKey(r,i);if(a)return t[a]=mj(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=mj(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return VU.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&VU.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[hj]=this[hj]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=pj(e);t[n]||(!function(e,t){const r=VU.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return VU.isArray(e)?e.forEach(n):n(e),this}}yj.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),VU.freezeMethods(yj.prototype),VU.freezeMethods(yj);var gj=yj;function vj(e,t){const r=this||dj,n=t||r,i=gj.from(n.headers);let a=n.data;return VU.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function wj(e){return!(!e||!e.__CANCEL__)}function _j(e,t,r){WU.call(this,null==e?"canceled":e,WU.ERR_CANCELED,t,r),this.name="CanceledError"}VU.inherits(_j,WU,{__CANCEL__:!0});var Ej=sj.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),VU.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),VU.isString(n)&&o.push("path="+n),VU.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Tj(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Aj=sj.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=VU.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function Sj(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=n[o];i||(i=c),r[a]=s,n[a]=c;let f=o,d=0;for(;f!==a;)d+=r[f++],f%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),c-i<t)return;const l=u&&c-u;return l?Math.round(1e3*d/l):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,c=n(s);r=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:c||void 0,estimated:c&&o&&a<=o?(o-a)/c:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var Rj="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=gj.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}VU.isFormData(n)&&(sj.isStandardBrowserEnv||sj.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=Tj(e.baseURL,e.url);function f(){if(!c)return;const n=gj.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new WU("Request failed with status code "+r.status,[WU.ERR_BAD_REQUEST,WU.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),ij(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=f:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(f)},c.onabort=function(){c&&(r(new WU("Request aborted",WU.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new WU("Network Error",WU.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||oj;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new WU(t,n.clarifyTimeoutError?WU.ETIMEDOUT:WU.ECONNABORTED,e,c)),c=null},sj.isStandardBrowserEnv){const t=(e.withCredentials||Aj(u))&&e.xsrfCookieName&&Ej.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&VU.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),VU.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",Sj(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",Sj(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{c&&(r(!t||t.type?new _j(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===sj.protocols.indexOf(d)?r(new WU("Unsupported protocol "+d+":",WU.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const kj={http:null,xhr:Rj};VU.forEach(kj,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Oj=e=>{e=VU.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=VU.isString(r)?kj[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new WU(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(VU.hasOwnProp(kj,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!VU.isFunction(n))throw new TypeError("adapter is not a function");return n};function Ij(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _j(null,e)}function xj(e){Ij(e),e.headers=gj.from(e.headers),e.data=vj.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Oj(e.adapter||dj.adapter)(e).then((function(t){return Ij(e),t.data=vj.call(e,e.transformResponse,t),t.headers=gj.from(t.headers),t}),(function(t){return wj(t)||(Ij(e),t&&t.response&&(t.response.data=vj.call(e,e.transformResponse,t.response),t.response.headers=gj.from(t.response.headers))),Promise.reject(t)}))}const Cj=e=>e instanceof gj?e.toJSON():e;function Mj(e,t){t=t||{};const r={};function n(e,t,r){return VU.isPlainObject(e)&&VU.isPlainObject(t)?VU.merge.call({caseless:r},e,t):VU.isPlainObject(t)?VU.merge({},t):VU.isArray(t)?t.slice():t}function i(e,t,r){return VU.isUndefined(t)?VU.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!VU.isUndefined(t))return n(void 0,t)}function o(e,t){return VU.isUndefined(t)?VU.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t)=>i(Cj(e),Cj(t),!0)};return VU.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||i,o=a(e[n],t[n],n);VU.isUndefined(o)&&a!==s||(r[n]=o)})),r}const Pj="1.4.0",Nj={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Nj[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Bj={};Nj.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new WU(n(i," has been removed"+(t?" in "+t:"")),WU.ERR_DEPRECATED);return t&&!Bj[i]&&(Bj[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}};var Dj={assertOptions:function(e,t,r){if("object"!=typeof e)throw new WU("options must be an object",WU.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new WU("option "+a+" must be "+r,WU.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new WU("Unknown option "+a,WU.ERR_BAD_OPTION)}},validators:Nj};const Fj=Dj.validators;class Lj{constructor(e){this.defaults=e,this.interceptors={request:new aj,response:new aj}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Mj(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Dj.assertOptions(r,{silentJSONParsing:Fj.transitional(Fj.boolean),forcedJSONParsing:Fj.transitional(Fj.boolean),clarifyTimeoutError:Fj.transitional(Fj.boolean)},!1),null!=n&&(VU.isFunction(n)?t.paramsSerializer={serialize:n}:Dj.assertOptions(n,{encode:Fj.function,serialize:Fj.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&VU.merge(i.common,i[t.method]),a&&VU.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=gj.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let f,d=0;if(!s){const e=[xj.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,c),f=e.length,u=Promise.resolve(t);d<f;)u=u.then(e[d++],e[d++]);return u}f=o.length;let l=t;for(d=0;d<f;){const e=o[d++],t=o[d++];try{l=e(l)}catch(e){t.call(this,e);break}}try{u=xj.call(this,l)}catch(e){return Promise.reject(e)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(e){return ij(Tj((e=Mj(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}VU.forEach(["delete","get","head","options"],(function(e){Lj.prototype[e]=function(t,r){return this.request(Mj(r||{},{method:e,url:t,data:(r||{}).data}))}})),VU.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Mj(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Lj.prototype[e]=t(),Lj.prototype[e+"Form"]=t(!0)}));var Uj=Lj;class jj{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new _j(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;const t=new jj((function(t){e=t}));return{token:t,cancel:e}}}var qj=jj;const zj={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(zj).forEach((([e,t])=>{zj[t]=e}));var Hj=zj;const Gj=function e(t){const r=new Uj(t),n=hU(Uj.prototype.request,r);return VU.extend(n,Uj.prototype,r,{allOwnKeys:!0}),VU.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Mj(t,r))},n}(dj);Gj.Axios=Uj,Gj.CanceledError=_j,Gj.CancelToken=qj,Gj.isCancel=wj,Gj.VERSION=Pj,Gj.toFormData=ZU,Gj.AxiosError=WU,Gj.Cancel=Gj.CanceledError,Gj.all=function(e){return Promise.all(e)},Gj.spread=function(e){return function(t){return e.apply(null,t)}},Gj.isAxiosError=function(e){return VU.isObject(e)&&!0===e.isAxiosError},Gj.mergeConfig=Mj,Gj.AxiosHeaders=gj,Gj.formToJSON=e=>cj(VU.isHTMLForm(e)?new FormData(e):e),Gj.HttpStatusCode=Hj,Gj.default=Gj;var Vj=Gj;const Wj="https://guardian.sandbox.imtbl.com".replace(/\/+$/,"");class Kj{basePath;axios;configuration;constructor(e,t=Wj,r=Vj){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Xj extends Error{field;name="RequiredError";constructor(e,t){super(t),this.field=e}}const $j="https://example.com",Jj=function(e,t,r){if(null==r)throw new Xj(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Yj=async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}};function Qj(e,t,r=""){"object"==typeof t?Array.isArray(t)?t.forEach((t=>Qj(e,t,r))):Object.keys(t).forEach((n=>Qj(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t)}const Zj=function(e,...t){const r=new URLSearchParams(e.search);Qj(r,t),e.search=r.toString()},eq=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},tq=function(e){return e.pathname+e.search+e.hash},rq=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||a)+e.url};return i.request(o)}},nq=function(e){const t=function(e){return{approvePendingMessage:async(t,r={})=>{Jj("approvePendingMessage","messageID",t);const n="/guardian/v1/messages/{messageID}/approve".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,$j);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...r},s={};await Yj(s,e),Zj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:tq(i),options:o}},evaluateMessage:async(t,r={})=>{Jj("evaluateMessage","messageEvaluationRequest",t);const n=new URL("/guardian/v1/messages/evaluate",$j);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...r},o={};await Yj(o,e),o["Content-Type"]="application/json",Zj(n,{});let s=i&&i.headers?i.headers:{};return a.headers={...o,...s,...r.headers},a.data=eq(t,a,e),{url:tq(n),options:a}},getMessageByID:async(t,r={})=>{Jj("getMessageByID","messageID",t);const n="/guardian/v1/messages/{messageID}".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,$j);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...r},s={};await Yj(s,e),Zj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:tq(i),options:o}}}}(e);return{async approvePendingMessage(r,n){const i=await t.approvePendingMessage(r,n);return rq(i,Vj,Wj,e)},async evaluateMessage(r,n){const i=await t.evaluateMessage(r,n);return rq(i,Vj,Wj,e)},async getMessageByID(r,n){const i=await t.getMessageByID(r,n);return rq(i,Vj,Wj,e)}}};class iq extends Kj{approvePendingMessage(e,t){return nq(this.configuration).approvePendingMessage(e.messageID,t).then((e=>e(this.axios,this.basePath)))}evaluateMessage(e,t){return nq(this.configuration).evaluateMessage(e.messageEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getMessageByID(e,t){return nq(this.configuration).getMessageByID(e.messageID,t).then((e=>e(this.axios,this.basePath)))}}const aq=function(e){const t=function(e){return{approvePendingTransaction:async(t,r,n={})=>{Jj("approvePendingTransaction","payloadHash",t),Jj("approvePendingTransaction","transactionApprovalRequest",r);const i="/guardian/v1/transactions/{payloadHash}/approve".replace("{payloadHash}",encodeURIComponent(String(t))),a=new URL(i,$j);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Yj(c,e),c["Content-Type"]="application/json",Zj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=eq(r,s,e),{url:tq(a),options:s}},evaluateTransaction:async(t,r,n={})=>{Jj("evaluateTransaction","id",t),Jj("evaluateTransaction","transactionEvaluationRequest",r);const i="/guardian/v1/transactions/{id}/evaluate".replace("{id}",encodeURIComponent(String(t))),a=new URL(i,$j);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Yj(c,e),c["Content-Type"]="application/json",Zj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=eq(r,s,e),{url:tq(a),options:s}},getTransactionByID:async(t,r,n,i={})=>{Jj("getTransactionByID","transactionID",t),Jj("getTransactionByID","chainType",r);const a="/guardian/v1/transactions/{transactionID}".replace("{transactionID}",encodeURIComponent(String(t))),o=new URL(a,$j);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i},u={},f={};await Yj(u,e),void 0!==r&&(f.chainType=r),void 0!==n&&(f.chainID=n),Zj(o,f);let d=s&&s.headers?s.headers:{};return c.headers={...u,...d,...i.headers},{url:tq(o),options:c}}}}(e);return{async approvePendingTransaction(r,n,i){const a=await t.approvePendingTransaction(r,n,i);return rq(a,Vj,Wj,e)},async evaluateTransaction(r,n,i){const a=await t.evaluateTransaction(r,n,i);return rq(a,Vj,Wj,e)},async getTransactionByID(r,n,i,a){const o=await t.getTransactionByID(r,n,i,a);return rq(o,Vj,Wj,e)}}};class oq extends Kj{approvePendingTransaction(e,t){return aq(this.configuration).approvePendingTransaction(e.payloadHash,e.transactionApprovalRequest,t).then((e=>e(this.axios,this.basePath)))}evaluateTransaction(e,t){return aq(this.configuration).evaluateTransaction(e.id,e.transactionEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionByID(e,t){return aq(this.configuration).getTransactionByID(e.transactionID,e.chainType,e.chainID,t).then((e=>e(this.axios,this.basePath)))}}class sq{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const cq="starkex",uq="evm";function fq(e){const t=-1!==new fn(e,16).cmp(new fn(27))?new fn(e,16).sub(new fn(27)).toNumber():new fn(e,16).toNumber();return e.trim()?t:void 0}async function dq(e,t){const r=function(e,t=64){const r=Ib(e);return{r:new fn(r.substring(0,t),"hex"),s:new fn(r.substring(t,2*t),"hex"),recoveryParam:fq(r.substring(2*t,2*t+2))}}(await t.signMessage(e));return Cb(kb((n=r).r.toString(16),64)+kb(n.s.toString(16),64)+kb(n.recoveryParam?.toString(16)||"",2));var n}function lq(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};default:return{type:"ETH",data:{decimals:18}}}}const hq={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 pq(){return pq=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},pq.apply(this,arguments)}var mq;!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"}(mq||(mq={}));function bq(e,t){return function(...r){const n=Array.prototype.slice.call(r);return new Promise((async(r,i)=>{try{n.push(((e,t)=>e?i(e):r(t))),await e.apply(t,n)}catch(e){i(e)}}))}}new class{constructor(e){this.config=e,this.logLevel=void 0,this.configure(e)}configure(e){switch(this.config=pq({},this.config,e),this.config.logLevel){case"DEBUG":this.logLevel=mq.DEBUG;break;case"INFO":default:this.logLevel=mq.INFO;break;case"WARN":this.logLevel=mq.WARN;break;case"ERROR":this.logLevel=mq.ERROR;break;case"DISABLED":this.logLevel=mq.DISABLED}void 0===this.config.silence&&(this.config.silence=!1)}debug(e,...t){!0!==this.config.silence&&this.logLevel===mq.DEBUG&&console.log(e,...t)}info(e,...t){!0!==this.config.silence&&this.logLevel<=mq.INFO&&console.log(e,...t)}warn(e,...t){!0!==this.config.silence&&this.logLevel<=mq.WARN&&(console.warn(e,...t),this.config.onwarn&&this.config.onwarn(e,t))}error(e,...t){!0!==this.config.silence&&this.logLevel<=mq.ERROR&&(console.error(e,...t),this.config.onerror&&this.config.onerror(e,t))}}({logLevel:"INFO",silence:!0});const yq=(e=0,t=Number.MAX_SAFE_INTEGER)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function gq(){return gq=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},gq.apply(this,arguments)}const vq=(e,t=!1)=>(((e,t=!1,r=!1)=>{if(!e)throw new Error("invalid network config: empty config");const n=[];if(Array.isArray(e)?n.push(...e):n.push(e),0===n.length){if(t)throw new Error("invalid network config: empty config");return!1}const i=n.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}n.forEach((e=>e.name=e.name.toLowerCase()));const o=n.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 c=!1,u=!1;for(let e=0;e<n.length;e++){const i=n[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(!r&&!i.relayer){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: relayer must be provided`);return!1}if(i.isDefaultChain){if(c){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: DefaultChain is already set by another config`);return!1}c=!0}if(i.isAuthChain){if(u&&t)throw new Error(`invalid network config for chainId ${i.chainId}: AuthChain is already set by another config`);u=!0}}if(!c){if(t)throw new Error("invalid network config: DefaultChain must be set");return!1}if(!u){if(t)throw new Error("invalid network config: AuthChain must be set");return!1}})(e,!0,t),e),wq=e=>vq(_q(e)),_q=e=>{if(!e)return[];const t=e.sort(((e,t)=>e.chainId===t.chainId?0:e.chainId<t.chainId?-1:1)),r=t.findIndex((e=>e.isDefaultChain));r>0&&t.splice(0,0,t.splice(r,1)[0]);const n=t.findIndex((e=>e.isAuthChain&&!0!==e.isDefaultChain));return n>0&&t.splice(1,0,t.splice(n,1)[0]),t},Eq=(e,t)=>"string"==typeof e?(t=t||{},e.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim,(function(e,r){let n=t[r];return n="function"==typeof n?n():null==n?"":"object"==typeof n||"symbol"==typeof n?n.toString():n.valueOf(),n}))):"";let Tq;!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"}(Tq||(Tq={}));const Aq=e=>Eq("https://${network}-indexer.sequence.app",{network:e}),Sq=e=>Eq("https://${network}-relayer.sequence.app",{network:e}),Rq=e=>Eq("https://nodes.sequence.app/${network}",{network:e}),kq={[Tq.MAINNET]:{chainId:Tq.MAINNET,name:"mainnet",title:"Ethereum",blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[Tq.ROPSTEN]:{chainId:Tq.ROPSTEN,name:"ropsten",title:"Ropsten",testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[Tq.RINKEBY]:{chainId:Tq.RINKEBY,name:"rinkeby",title:"Rinkeby",testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",disabled:!0},[Tq.GOERLI]:{chainId:Tq.GOERLI,name:"goerli",title:"Goerli",testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[Tq.KOVAN]:{chainId:Tq.KOVAN,name:"kovan",title:"Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"}},[Tq.POLYGON]:{chainId:Tq.POLYGON,name:"polygon",title:"Polygon",blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"}},[Tq.POLYGON_MUMBAI]:{chainId:Tq.POLYGON_MUMBAI,name:"mumbai",title:"Polygon Mumbai",testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"}},[Tq.POLYGON_ZKEVM]:{chainId:Tq.POLYGON_ZKEVM,name:"polygon-zkevm",title:"Polygon zkEVM",blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"}},[Tq.BSC]:{chainId:Tq.BSC,name:"bsc",title:"BNB Smart Chain",blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"}},[Tq.BSC_TESTNET]:{chainId:Tq.BSC_TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"}},[Tq.OPTIMISM]:{chainId:Tq.OPTIMISM,name:"optimism",title:"Optimism",blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"}},[Tq.OPTIMISM_TESTNET]:{chainId:Tq.OPTIMISM_TESTNET,name:"optimism-testnet",title:"Optimistic Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Optimism Testnet)",rootUrl:"https://kovan-optimistic.etherscan.io/"}},[Tq.ARBITRUM]:{chainId:Tq.ARBITRUM,name:"arbitrum",title:"Arbitrum One",blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"}},[Tq.ARBITRUM_GOERLI]:{chainId:Tq.ARBITRUM_GOERLI,name:"arbitrum-goerli",title:"Arbitrum Goerli",testnet:!0,blockExplorer:{name:"Arbiscan (Testnet)",rootUrl:"https://testnet.arbiscan.io/"}},[Tq.ARBITRUM_NOVA]:{chainId:Tq.ARBITRUM_NOVA,name:"arbitrum-nova",title:"Arbitrum Nova",blockExplorer:{name:"Nova Explorer",rootUrl:"https://nova-explorer.arbitrum.io/"}},[Tq.AVALANCHE]:{chainId:Tq.AVALANCHE,name:"avalanche",title:"Avalanche",blockExplorer:{name:"Snowtrace",rootUrl:"https://snowtrace.io/"}},[Tq.AVALANCHE_TESTNET]:{chainId:Tq.AVALANCHE_TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://testnet.snowtrace.io/"}},[Tq.FANTOM]:{chainId:Tq.FANTOM,name:"fantom",title:"Fantom",blockExplorer:{name:"FTMScan",rootUrl:"https://ftmscan.com/"}},[Tq.FANTOM_TESTNET]:{chainId:Tq.FANTOM_TESTNET,name:"fantom-testnet",title:"Fantom Testnet",testnet:!0,blockExplorer:{name:"FTMScan (Testnet)",rootUrl:"https://testnet.ftmscan.com/"}},[Tq.GNOSIS]:{chainId:Tq.GNOSIS,name:"gnosis",title:"Gnosis Chain",blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"}},[Tq.AURORA]:{chainId:Tq.AURORA,name:"aurora",title:"Aurora",blockExplorer:{name:"Aurora Explorer",rootUrl:"https://aurorascan.dev/"}},[Tq.AURORA_TESTNET]:{chainId:Tq.AURORA_TESTNET,name:"aurora-testnet",title:"Aurora Testnet",blockExplorer:{name:"Aurora Explorer (Testnet)",rootUrl:"https://testnet.aurorascan.dev/"}},[Tq.BASE_GOERLI]:{chainId:Tq.BASE_GOERLI,name:"base-goerli",title:"Base Goerli",blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"}}};wq([gq({},kq[Tq.MAINNET],{rpcUrl:Rq("mainnet"),relayer:{url:Sq("mainnet")},indexerUrl:Aq("mainnet")}),gq({},kq[Tq.POLYGON],{rpcUrl:Rq("polygon"),relayer:{url:Sq("polygon")},indexerUrl:Aq("polygon"),isDefaultChain:!0,isAuthChain:!0}),gq({},kq[Tq.BSC],{rpcUrl:Rq("bsc"),indexerUrl:Aq("bsc"),relayer:{url:Sq("bsc")}}),gq({},kq[Tq.AVALANCHE],{rpcUrl:Rq("avalanche"),indexerUrl:Aq("avalanche"),relayer:{url:Sq("avalanche")}}),gq({},kq[Tq.ARBITRUM],{rpcUrl:Rq("arbitrum"),indexerUrl:Aq("arbitrum"),relayer:{url:Sq("arbitrum")}}),gq({},kq[Tq.ARBITRUM_NOVA],{rpcUrl:Rq("arbitrum-nova"),indexerUrl:Aq("arbitrum-nova"),relayer:{url:Sq("arbitrum-nova")}}),gq({},kq[Tq.OPTIMISM],{rpcUrl:Rq("optimism"),indexerUrl:Aq("optimism"),relayer:{url:Sq("optimism")}}),gq({},kq[Tq.POLYGON_ZKEVM],{rpcUrl:Rq("polygon-zkevm"),indexerUrl:Aq("polygon-zkevm"),relayer:{url:Sq("polygon-zkevm")}}),gq({},kq[Tq.GNOSIS],{rpcUrl:Rq("gnosis"),indexerUrl:Aq("gnosis"),relayer:{url:Sq("gnosis")}})]),wq([gq({},kq[Tq.RINKEBY],{rpcUrl:Rq("rinkeby"),relayer:{url:Sq("rinkeby")},indexerUrl:Aq("rinkeby")}),gq({},kq[Tq.GOERLI],{rpcUrl:Rq("goerli"),relayer:{url:Sq("goerli")},indexerUrl:Aq("goerli")}),gq({},kq[Tq.POLYGON_MUMBAI],{rpcUrl:Rq("mumbai"),relayer:{url:Sq("mumbai")},indexerUrl:Aq("mumbai"),isDefaultChain:!0,isAuthChain:!0}),gq({},kq[Tq.BSC_TESTNET],{rpcUrl:Rq("bsc-testnet"),relayer:{url:Sq("bsc-testnet")},indexerUrl:Aq("bsc-testnet")}),gq({},kq[Tq.ARBITRUM_GOERLI],{rpcUrl:Rq("arbitrum-goerli"),relayer:{url:Sq("arbitrum-goerli")},indexerUrl:Aq("arbitrum-goerli")}),gq({},kq[Tq.BASE_GOERLI],{rpcUrl:Rq("base-goerli"),relayer:{url:Sq("base-goerli")},indexerUrl:Aq("base-goerli")})]);const Oq="2.0";function Iq(){return Iq=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Iq.apply(this,arguments)}let xq;function Cq(e,t){return e.reduce((function(e,r,n){return t(r,n)?e[0].push(r):e[1].push(r),e}),[[],[]])}!function(e){e.ethCall="eth_call",e.ethGetBalance="eth_getBalance",e.ethGetCode="eth_getCode"}(xq||(xq={}));const Mq={batchSize:50,timeWindow:50,contract:"0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E",verbose:!1};let Pq=class e{constructor(t){var r=this;if(this.batchableJsonRpcMethods=[xq.ethCall,xq.ethGetCode,xq.ethGetBalance],this.multicallInterface=new Ps(hq.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,r)=>this.batchableJsonRpcMethods.find((e=>e===t.method))?(this.queue.push({request:t,callback:r,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,r)),this.run=async function(){r.options.verbose&&console.log("Processing multicall");const e=Math.min(r.options.batchSize,r.queue.length);if(0===e)return;if(1===e)return r.forward(r.queue[0]),r.queue=[],void(r.options.verbose&&console.log("Skip multicall, single item"));r.options.verbose&&console.log("Resolving",e);var t=r.queue.slice(0,e);r.queue=e===r.queue.length?[]:r.queue.slice(e),r.options.verbose&&console.log("Updated queue",r.queue.length),0!==r.queue.length&&r.scheduleExecution();const n=t[0].next;let i;var[t,a]=Cq(t,(e=>{try{if(e.next!==n)return!1;switch(e.request.method){case xq.ethCall:if(e.request.params[0].from||e.request.params[0].gasPrice||e.request.params[0].value)return!1;case xq.ethGetBalance:case xq.ethGetCode:const t=function(e){if(void 0===e)return"latest";switch(e){case"earliest":case"latest":case"pending":return e}return Jn.from(e)}(e.request.params[1]);if(void 0===i&&(i=t),!function(e,t){return e===t||(Jn.isBigNumber(e)?!!Jn.isBigNumber(t)&&e.eq(t):!Jn.isBigNumber(t)&&e===t)}(t,i))return!1}return!0}catch(e){return!1}}));if(0!==a.length&&(r.options.verbose&&console.log("Forwarding incompatible calls",a.length),r.forward(a),0===t.length))return;let o=t.map((e=>{try{switch(e.request.method){case xq.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 xq.ethGetCode:return{delegateCall:!1,revertOnError:!1,target:r.options.contract,gasLimit:0,value:0,data:r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("callCode"),[e.request.params[0]])};case xq.ethGetBalance:return{delegateCall:!1,revertOnError:!1,target:r.options.contract,gasLimit:0,value:0,data:r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("callBalanceOf"),[e.request.params[0]])};default:return null}}catch(e){return null}}));var[t,a]=Cq(t,((e,t)=>void 0!==o[t]));if(o=o.filter((e=>e)),0!==a.length&&(r.options.verbose&&console.log("Forwarding calls on error",a.length),r.forward(a),0===t.length))return;let s;try{s=r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("multiCall"),[o])}catch(e){return void r.forward(t)}const c=yq(),u=await async function(e,t){try{return await e}catch(e){return t instanceof Function?t(e):t}}(bq(n)({id:c,jsonrpc:Oq,method:xq.ethCall,params:[{to:r.options.contract,value:0,data:s},Jn.isBigNumber(i)?i.toNumber():i]}),(e=>({jsonrpc:Oq,id:c,result:void 0,error:e})));if(u.error)return r.forward(t);let f;try{f=r.multicallInterface.decodeFunctionResult(r.multicallInterface.getFunction("multiCall"),u.result)}catch(e){return void r.forward(t)}r.options.verbose&&console.log("Got response for",t.length),t.forEach(((e,t)=>{if(f[0][t])switch(e.request.method){case xq.ethCall:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:f[1][t]});break;case xq.ethGetCode:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:ko.decode(["bytes"],f[1][t])[0]});break;case xq.ethGetBalance:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:ko.decode(["uint256"],f[1][t])[0]})}else r.forward(e)}))},this.options=t?Iq({},e.DefaultOptions,t):e.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(t){return t&&void 0!==t.handle&&void 0!==t.conf&&e.isMulticallOptions(t.options)}static isMulticallOptions(e){return void 0!==e&&void 0!==e.batchSize&&void 0!==e.timeWindow&&void 0!==e.contract}};Pq.DefaultOptions=Iq({},Mq);const Nq=["getNetwork","getBlockNumber","getGasPrice","getTransactionCount","getStorageAt","sendTransaction","estimateGas","getBlock","getTransaction","getTransactionReceipt","getLogs","emit","litenerCount","addListener","removeListener","waitForTransaction","detectNetwork","getBlockWithTransactions"];var Bq=Object.freeze({__proto__:null,ProxyMethods:Nq,MulticallProvider:class extends Vh{constructor(e,t){var r;super(e.getNetwork()),r=this,this.provider=e,this.multicall=void 0,this.listenerCount=this.provider.listenerCount,this.getResolver=async function(e){const t=r.provider;if(t.getResolver){const n=await t.getResolver(await e);return n?new zh(r,n.address,n.name):null}return t.getResolver(await e)},this.next=async function(e,t){try{switch(e.method){case xq.ethCall:r.callback(e,t,await r.provider.call(e.params[0],e.params[1]));break;case xq.ethGetCode:r.callback(e,t,await r.provider.getCode(e.params[0],e.params[1]));break;case xq.ethGetBalance:r.callback(e,t,await r.provider.getBalance(e.params[0],e.params[1]))}}catch(n){r.callback(e,t,void 0,n)}},this.multicall=Pq.isMulticall(t)?t:new Pq(t),Nq.forEach((t=>{void 0!==e[t]&&(this[t]=(...r)=>e[t](...r))}))}callback(e,t,r,n){t(n,{jsonrpc:Oq,id:e.id,result:r,error:n})}async call(e,t){return this.rpcCall(xq.ethCall,e,t)}async getCode(e,t){return this.rpcCall(xq.ethGetCode,e,t)}async getBalance(e,t){return this.rpcCall(xq.ethGetBalance,e,t)}async rpcCall(e,...t){const r=yq();return(await bq(this.multicall.handle)(this.next,{jsonrpc:Oq,id:r,method:e,params:t})).result}},MulticallExternalProvider:class{constructor(e,t){if(this.provider=e,this.multicall=void 0,this.multicall=Pq.isMulticall(t)?t:new Pq(t),e.send){const t=async function(t,r){e.send(t,r)};this.send=(e,r)=>{this.multicall.handle(t,e,r)}}if(e.sendAsync){const t=async function(t,r){e.sendAsync(t,r)};this.sendAsync=(e,r)=>{this.multicall.handle(t,e,r)}}}get isMetaMask(){return this.provider.isMetaMask}get isStatus(){return this.provider.isStatus}},multicallMiddleware:e=>t=>{const r=Pq.isMulticall(e)?e:new Pq(e);return(e,n)=>r.handle(t,e,n)}}),Dq=Object.freeze({__proto__:null,Multicall:Pq,providers:Bq});let Fq,Lq;try{Fq=localStorage}catch(e){const t=new Map;Fq={getItem:e=>{var r;return null!=(r=t.get(e))?r:null},setItem:(e,r)=>t.set(e,r),removeItem:e=>t.delete(e)}}function Uq(e){return void 0!==e.address&&!function(e){return jq(e)||qq(e)||zq(e)}(e)}function jq(e){const t=e;return void 0!==t.signature&&void 0===t.address}function qq(e){const t=e;return void 0!==t.r&&void 0!==t.s&&void 0!==t.v&&void 0!==t.t}function zq(e){const t=e;return void 0!==t.address&&void 0!==t.signature}!function(e){e[e.EOA=0]="EOA",e[e.Address=1]="Address",e[e.Full=2]="Full"}(Lq||(Lq={}));const Hq=e=>{if("string"!=typeof e)return e;const t=e.replace("0x",""),r=Jn.from(`0x${t.slice(0,4)}`).toNumber(),n=[];for(let e=4;e<t.length;){const r=Jn.from(t.slice(e,e+2)).toNumber();e+=2;const i=Jn.from(`0x${t.slice(e,e+2)}`).toNumber();switch(e+=2,r){case Lq.Address:const r=va(t.slice(e,e+40));e+=40,n.push({weight:i,address:r});break;case Lq.EOA:const a=On(`0x${t.slice(e,e+132)}`);e+=132;const o=qn(a.slice(0,65)),s=o.r,c=o.s,u=o.v,f=Jn.from(a[a.length-1]).toNumber();n.push({weight:i,signature:a,r:s,s:c,v:u,t:f});break;case Lq.Full:const d=va(t.slice(e,e+40));e+=40;const l=Jn.from(`0x${t.slice(e,e+4)}`).mul(2).toNumber();e+=4;const h=On(`0x${t.slice(e,e+l)}`);e+=l,n.push({weight:i,address:d,signature:h});break;default:throw Error("Signature type not supported")}}return{threshold:r,signers:n}},Gq=e=>{if("string"==typeof e)return Gq(Hq(e));const t=e.signers.map((e=>{if(Uq(e))return bm(["uint8","uint8","address"],[Lq.Address,e.weight,e.address]);if(qq(e))return bm(["uint8","uint8","bytes32","bytes32","uint8","uint8"],[Lq.EOA,e.weight,e.r,e.s,e.v,e.t]);if(zq(e)){const t=On(e.signature).length;return bm(["uint8","uint8","address","uint16","bytes"],[Lq.Full,e.weight,e.address,t,e.signature])}if(jq(e))return bm(["uint8","uint8","bytes"],[Lq.EOA,e.weight,e.signature]);throw Error("Unkwnown signature part type")}));return bm(["uint16",...Array(t.length).fill("bytes")],[e.threshold,...t])};var Vq;!function(e){e.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",e.INVALID_CONFIGURATION="INVALID_CONFIGURATION",e.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",e.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",e.SILENT_LOGIN_ERROR="SILENT_LOGIN_ERROR",e.REFRESH_TOKEN_ERROR="REFRESH_TOKEN_ERROR",e.USER_REGISTRATION_ERROR="USER_REGISTRATION_ERROR",e.USER_NOT_REGISTERED_ERROR="USER_NOT_REGISTERED_ERROR",e.LOGOUT_ERROR="LOGOUT_ERROR",e.TRANSFER_ERROR="TRANSFER_ERROR",e.CREATE_ORDER_ERROR="CREATE_ORDER_ERROR",e.CANCEL_ORDER_ERROR="CANCEL_ORDER_ERROR",e.EXCHANGE_TRANSFER_ERROR="EXCHANGE_TRANSFER_ERROR",e.CREATE_TRADE_ERROR="CREATE_TRADE_ERROR",e.OPERATION_NOT_SUPPORTED_ERROR="OPERATION_NOT_SUPPORTED_ERROR"}(Vq||(Vq={}));class Wq extends Error{type;constructor(e,t){super(e),this.type=t}}const Kq=async(e,t)=>{try{return await e()}catch(e){let r;throw r=He(e)&&e.response?.data&&function(e){return"code"in e&&"message"in e}(e.response.data)?e.response.data.message:e.message,new Wq(r,t)}},Xq="passport_credentials",$q="pkce_state",Jq="pkce_verifier";class Yq{saveCredentials(e){if(!this.areValid(e))throw Error("Invalid credentials.");localStorage.setItem(Xq,JSON.stringify(e))}getCredentials(){const e=localStorage.getItem(Xq);return e?JSON.parse(e):null}areValid(e){if(e){const t=this.isTokenValid(e.access_token),r=this.isTokenValid(e.id_token);return t&&r}return!1}isTokenValid(e){try{const t=bB(e).exp??0;return t>Date.now()/1e3+3600}catch(e){return!1}}clearCredentials(){localStorage.removeItem(Xq)}savePKCEData(e){localStorage.setItem($q,e.state),localStorage.setItem(Jq,e.verifier)}getPKCEData(){const e=localStorage.getItem($q),t=localStorage.getItem(Jq);return e&&t?{state:e,verifier:t}:null}}function Qq(e){const{id_token:t,expired:r}=e;return!!r||function(e){if(!e)return!1;const t=bB(e),r=Math.floor(Date.now()/1e3);return t.exp<r}(t)}const Zq={headers:{"Content-Type":"application/x-www-form-urlencoded"}};function ez(e){return new Promise((t=>{setTimeout(t,e)}))}class tz{userManager;config;deviceCredentialsManager;logoutMode;refreshingPromise=null;constructor(e){this.config=e,this.userManager=new class{constructor(e){this._logger=new EB("UserManager"),this.settings=new YB(e),this._client=new class{constructor(e){this._logger=new EB("OidcClient"),this.settings=new DB(e),this.metadataService=new class{constructor(e){this._settings=e,this._logger=new EB("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new NB(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,t),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const r=this._logger.create(`_getMetadataProperty('${e}')`),n=await this.getMetadata();if(r.debug("resolved"),void 0===n[e]){if(!0===t)return void r.warn("Metadata does not contain optional property");r.throw(new Error("Metadata does not contain property "+e))}return n[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const r=await this._jsonService.getJson(t);if(e.debug("got key set",r),!Array.isArray(r.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=r.keys,this._signingKeys}}(this.settings),this._claimsService=new class{constructor(e){this._settings=e,this._logger=new EB("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:qB;for(const r of e)zB.includes(r)||delete t[r]}return t}mergeClaims(e,t){const r={...e};for(const[e,n]of Object.entries(t))for(const t of Array.isArray(n)?n:[n]){const n=r[e];n?Array.isArray(n)?n.includes(t)||n.push(t):r[e]!==t&&("object"==typeof t&&this._settings.mergeClaims?r[e]=this.mergeClaims(n,t):r[e]=[n,t]):r[e]=t}return r}}(this.settings),this._validator=new class{constructor(e,t,r){this._settings=e,this._metadataService=t,this._claimsService=r,this._logger=new EB("ResponseValidator"),this._userInfoService=new class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new EB("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const r=RB.decode(e);return t.debug("JWT decoding successful"),r}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new NB(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const r=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",r);const n=await this._jsonService.getJson(r,{token:e,credentials:this._settings.fetchRequestCredentials});return t.debug("got claims",n),n}}(this._settings,this._metadataService),this._tokenClient=new FB(this._settings,this._metadataService)}async validateSigninResponse(e,t){const r=this._logger.create("validateSigninResponse");this._processSigninState(e,t),r.debug("state processed"),await this._processCode(e,t),r.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,null==t?void 0:t.skipUserInfo,e.isOpenId),r.debug("claims processed")}async validateCredentialsResponse(e,t){const r=this._logger.create("validateCredentialsResponse");e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),r.debug("claims processed")}async validateRefreshResponse(e,t){const r=this._logger.create("validateRefreshResponse");e.userState=t.data,null!=e.session_state||(e.session_state=t.session_state),null!=e.scope||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),r.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);const n=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,n),r.debug("claims processed")}validateSignoutResponse(e,t){const r=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&r.throw(new Error("State does not match")),r.debug("state validated"),e.userState=t.data,e.error)throw r.warn("Response was error",e.error),new xB(e)}_processSigninState(e,t){const r=this._logger.create("_processSigninState");if(t.id!==e.state&&r.throw(new Error("State does not match")),t.client_id||r.throw(new Error("No client_id on state")),t.authority||r.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&r.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&r.throw(new Error("client_id mismatch on settings vs. signin state")),r.debug("state validated"),e.userState=t.data,null!=e.scope||(e.scope=t.scope),e.error)throw r.warn("Response was error",e.error),new xB(e);t.code_verifier&&!e.code&&r.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,r=!0){const n=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token)return void n.debug("not loading user info");n.debug("loading user info");const i=await this._userInfoService.getClaims(e.access_token);n.debug("user info claims received from user info endpoint"),r&&i.sub!==e.profile.sub&&n.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(i)),n.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t){const r=this._logger.create("_processCode");if(e.code){r.debug("Validating code");const n=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,...t.extraTokenParams});Object.assign(e,n)}else r.debug("No code to process")}_validateIdTokenAttributes(e,t){var r;const n=this._logger.create("_validateIdTokenAttributes");n.debug("decoding ID Token JWT");const i=RB.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){const e=RB.decode(t);i.sub!==e.sub&&n.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==e.auth_time&&n.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==e.azp&&n.throw(new Error("azp in id_token does not match original azp")),!i.azp&&e.azp&&n.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}}(this.settings,this.metadataService,this._claimsService),this._tokenClient=new FB(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:r,request_type:n,id_token_hint:i,login_hint:a,skipUserInfo:o,nonce:s,response_type:c=this.settings.response_type,scope:u=this.settings.scope,redirect_uri:f=this.settings.redirect_uri,prompt:d=this.settings.prompt,display:l=this.settings.display,max_age:h=this.settings.max_age,ui_locales:p=this.settings.ui_locales,acr_values:m=this.settings.acr_values,resource:b=this.settings.resource,response_mode:y=this.settings.response_mode,extraQueryParams:g=this.settings.extraQueryParams,extraTokenParams:v=this.settings.extraTokenParams}){const w=this._logger.create("createSigninRequest");if("code"!==c)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const _=await this.metadataService.getAuthorizationEndpoint();w.debug("Received authorization endpoint",_);const E=new class{constructor({url:e,authority:t,client_id:r,redirect_uri:n,response_type:i,scope:a,state_data:o,response_mode:s,request_type:c,client_secret:u,nonce:f,resource:d,skipUserInfo:l,extraQueryParams:h,extraTokenParams:p,disablePKCE:m,...b}){if(this._logger=new EB("SigninRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");if(!r)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!n)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!i)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!a)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!t)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new UB({data:o,request_type:c,code_verifier:!m,client_id:r,authority:t,redirect_uri:n,response_mode:s,client_secret:u,scope:a,extraTokenParams:p,skipUserInfo:l});const y=new URL(e);y.searchParams.append("client_id",r),y.searchParams.append("redirect_uri",n),y.searchParams.append("response_type",i),y.searchParams.append("scope",a),f&&y.searchParams.append("nonce",f),y.searchParams.append("state",this.state.id),this.state.code_challenge&&(y.searchParams.append("code_challenge",this.state.code_challenge),y.searchParams.append("code_challenge_method","S256")),d&&(Array.isArray(d)?d:[d]).forEach((e=>y.searchParams.append("resource",e)));for(const[e,t]of Object.entries({response_mode:s,...b,...h}))null!=t&&y.searchParams.append(e,t.toString());this.url=y.href}}({url:_,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:f,response_type:c,scope:u,state_data:e,prompt:d,display:l,max_age:h,ui_locales:p,id_token_hint:i,login_hint:a,acr_values:m,resource:b,request:t,request_uri:r,extraQueryParams:g,extraTokenParams:v,request_type:n,response_mode:y,client_secret:this.settings.client_secret,skipUserInfo:o,nonce:s,disablePKCE:this.settings.disablePKCE});await this.clearStaleState();const T=E.state;return await this.settings.stateStore.set(T.id,T.toStorageString()),E}async readSigninResponseState(e,t=!1){const r=this._logger.create("readSigninResponseState"),n=new jB(IB.readParams(e,this.settings.response_mode));if(!n.state)throw r.throw(new Error("No state in response")),null;const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:UB.fromStorageString(i),response:n}}async processSigninResponse(e){const t=this._logger.create("processSigninResponse"),{state:r,response:n}=await this.readSigninResponseState(e,!0);return t.debug("received state from storage; validating response"),await this._validator.validateSigninResponse(n,r),n}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r=!1,extraTokenParams:n={}}){const i=await this._tokenClient.exchangeCredentials({username:e,password:t,...n}),a=new jB(new URLSearchParams);return Object.assign(a,i),await this._validator.validateCredentialsResponse(a,r),a}async useRefreshToken({state:e,timeoutInSeconds:t}){var r;const n=this._logger.create("useRefreshToken");let i;if(void 0===this.settings.refreshTokenAllowedScope)i=e.scope;else{const t=this.settings.refreshTokenAllowedScope.split(" ");i=((null==(r=e.scope)?void 0:r.split(" "))||[]).filter((e=>t.includes(e))).join(" ")}const a=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:i,timeoutInSeconds:t}),o=new jB(new URLSearchParams);return Object.assign(o,a),n.debug("validating response",o),await this._validator.validateRefreshResponse(o,{...e,scope:i}),o}async createSignoutRequest({state:e,id_token_hint:t,request_type:r,post_logout_redirect_uri:n=this.settings.post_logout_redirect_uri,extraQueryParams:i=this.settings.extraQueryParams}={}){const a=this._logger.create("createSignoutRequest"),o=await this.metadataService.getEndSessionEndpoint();if(!o)throw a.throw(new Error("No end session endpoint")),null;a.debug("Received end session endpoint",o);const s=new class{constructor({url:e,state_data:t,id_token_hint:r,post_logout_redirect_uri:n,extraQueryParams:i,request_type:a}){if(this._logger=new EB("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const o=new URL(e);r&&o.searchParams.append("id_token_hint",r),n&&(o.searchParams.append("post_logout_redirect_uri",n),t&&(this.state=new LB({data:t,request_type:a}),o.searchParams.append("state",this.state.id)));for(const[e,t]of Object.entries({...i}))null!=t&&o.searchParams.append(e,t.toString());this.url=o.href}}({url:o,id_token_hint:t,post_logout_redirect_uri:n,state_data:e,extraQueryParams:i,request_type:r});await this.clearStaleState();const c=s.state;return c&&(a.debug("Signout request has state to persist"),await this.settings.stateStore.set(c.id,c.toStorageString())),s}async readSignoutResponseState(e,t=!1){const r=this._logger.create("readSignoutResponseState"),n=new class{constructor(e){this.state=e.get("state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}}(IB.readParams(e,this.settings.response_mode));if(!n.state){if(r.debug("No state in response"),n.error)throw r.warn("Response was error:",n.error),new xB(n);return{state:void 0,response:n}}const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:LB.fromStorageString(i),response:n}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:r,response:n}=await this.readSignoutResponseState(e,!0);return r?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(n,r)):t.debug("No state from storage; skipping response validation"),n}clearStaleState(){return this._logger.create("clearStaleState"),LB.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}}(e),this._redirectNavigator=new class{constructor(e){this._settings=e,this._logger=new EB("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var r;this._logger.create("prepare");let n=window.self;"top"===t&&(n=null!=(r=window.top)?r:window.self);const i=n.location[e].bind(n.location);let a;return{navigate:async e=>{this._logger.create("navigate");const t=new Promise(((e,t)=>{a=t}));return i(e.url),await t},close:()=>{this._logger.create("close"),null==a||a(new Error("Redirect aborted")),n.stop()}}}}(this.settings),this._popupNavigator=new class{constructor(e){this._settings=e,this._logger=new EB("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new ZB({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,t=!1){this._logger.create("callback"),ZB.notifyOpener(e,t)}}(this.settings),this._iframeNavigator=new class{constructor(e){this._settings=e,this._logger=new EB("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new QB({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),QB.notifyParent(e,this._settings.iframeNotifyParentOrigin)}}(this.settings),this._events=new eD(this.settings),this._silentRenewService=new class{constructor(e){this._userManager=e,this._logger=new EB("SilentRenewService"),this._isStarted=!1,this._retryTimer=new OB("Retry Silent Renew"),this._tokenExpiring=async()=>{const e=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),e.debug("silent token renewal successful")}catch(t){if(t instanceof CB)return e.warn("ErrorTimeout from signinSilent:",t,"retry in 5s"),void this._retryTimer.init(5);e.error("Error from signinSilent:",t),this._userManager.events._raiseSilentRenewError(t)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}}(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new class{constructor(e){this._userManager=e,this._logger=new EB("SessionMonitor"),this._start=async e=>{const t=e.session_state;if(!t)return;const r=this._logger.create("_start");if(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,r.debug("session_state",t,", sub",this._sub)):(this._sub=void 0,this._sid=void 0,r.debug("session_state",t,", anonymous user")),this._checkSessionIFrame)this._checkSessionIFrame.start(t);else try{const e=await this._userManager.metadataService.getCheckSessionIframe();if(e){r.debug("initializing check session iframe");const n=this._userManager.settings.client_id,i=this._userManager.settings.checkSessionIntervalInSeconds,a=this._userManager.settings.stopCheckSessionOnError,o=new class{constructor(e,t,r,n,i){this._callback=e,this._client_id=t,this._intervalInSeconds=n,this._stopOnError=i,this._logger=new EB("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=e=>{e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(e.data+" message from check session op iframe"))};const a=new URL(r);this._frame_origin=a.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=a.href}load(){return new Promise((e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)}))}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{this._frame.contentWindow&&this._session_state&&this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}}(this._callback,n,e,i,a);await o.load(),this._checkSessionIFrame=o,o.start(t)}else r.warn("no check session iframe found in the metadata")}catch(e){r.error("Error from getCheckSessionIframe:",e instanceof Error?e.message:e)}},this._stop=()=>{const e=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const t=setInterval((async()=>{clearInterval(t);try{const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}catch(t){e.error("error from querySessionStatus",t instanceof Error?t.message:t)}}),1e3)}},this._callback=async()=>{const e=this._logger.create("_callback");try{const t=await this._userManager.querySessionStatus();let r=!0;t&&this._checkSessionIFrame?t.sub===this._sub?(r=!1,this._checkSessionIFrame.start(t.session_state),t.sid===this._sid?e.debug("same sub still logged in at OP, restarting check session iframe; session_state",t.session_state):(e.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",t.session_state),this._userManager.events._raiseUserSessionChanged())):e.debug("different subject signed into OP",t.sub):e.debug("subject no longer signed into OP"),r?this._sub?this._userManager.events._raiseUserSignedOut():this._userManager.events._raiseUserSignedIn():e.debug("no change in session detected, no event to raise")}catch(t){this._sub&&(e.debug("Error calling queryCurrentSigninSession; raising signed out event",t),this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((e=>{this._logger.error(e)}))}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}}}(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(){const e=this._logger.create("getUser"),t=await this._loadUser();return t?(e.info("user loaded"),this._events.load(t,!1),t):(e.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),this._events.unload()}async signinRedirect(e={}){this._logger.create("signinRedirect");const{redirectMethod:t,...r}=e,n=await this._redirectNavigator.prepare({redirectMethod:t});await this._signinStart({request_type:"si:r",...r},n)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),r=await this._signinEnd(e);return r.profile&&r.profile.sub?t.info("success, signed in subject",r.profile.sub):t.info("no subject"),r}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:r=!1}){const n=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r,extraTokenParams:this.settings.extraTokenParams});n.debug("got signin response");const a=await this._buildUser(i);return a.profile&&a.profile.sub?n.info("success, signed in subject",a.profile.sub):n.info("no subject"),a}async signinPopup(e={}){const t=this._logger.create("signinPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,a=this.settings.popup_redirect_uri;a||t.throw(new Error("No popup_redirect_uri configured"));const o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n}),s=await this._signin({request_type:"si:p",redirect_uri:a,display:"popup",...i},o);return s&&(s.profile&&s.profile.sub?t.info("success, signed in subject",s.profile.sub):t.info("no subject")),s}async signinPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async signinSilent(e={}){var t;const r=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:n,...i}=e;let a=await this._loadUser();if(null==a?void 0:a.refresh_token){r.debug("using refresh token");const e=new class{constructor(e){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.data=e.state}}(a);return await this._useRefreshToken(e)}const o=this.settings.silent_redirect_uri;let s;o||r.throw(new Error("No silent_redirect_uri configured")),a&&this.settings.validateSubOnSilentRenew&&(r.debug("subject prior to silent renew:",a.profile.sub),s=a.profile.sub);const c=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});return a=await this._signin({request_type:"si:s",redirect_uri:o,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0,...i},c,s),a&&((null==(t=a.profile)?void 0:t.sub)?r.info("success, signed in subject",a.profile.sub):r.info("no subject")),a}async _useRefreshToken(e){const t=await this._client.useRefreshToken({state:e,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds}),r=new HB({...e,...t});return await this.storeUser(r),this._events.load(r),r}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":return await this.signinPopupCallback(e);case"si:s":return await this.signinSilentCallback(e);default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:r}=await this._client.readSignoutResponseState(e);if(r)switch(r.request_type){case"so:r":await this.signoutRedirectCallback(e);break;case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:r,...n}=e,i=this.settings.silent_redirect_uri;i||t.throw(new Error("No silent_redirect_uri configured"));const a=await this._loadUser(),o=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r}),s=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...n},o);try{const e=await this._client.processSigninResponse(s.url);return t.debug("got signin response"),e.session_state&&e.profile.sub?(t.info("success for subject",e.profile.sub),{session_state:e.session_state,sub:e.profile.sub,sid:e.profile.sid}):(t.info("success, user not authenticated"),null)}catch(e){if(this.settings.monitorAnonymousSession&&e instanceof xB)switch(e.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:e.session_state}}throw e}}async _signin(e,t,r){const n=await this._signinStart(e,t);return await this._signinEnd(n.url,r)}async _signinStart(e,t){const r=this._logger.create("_signinStart");try{const n=await this._client.createSigninRequest(e);return r.debug("got signin request"),await t.navigate({url:n.url,state:n.state.id,response_mode:n.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(e){throw r.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signinEnd(e,t){const r=this._logger.create("_signinEnd"),n=await this._client.processSigninResponse(e);return r.debug("got signin response"),await this._buildUser(n,t)}async _buildUser(e,t){const r=this._logger.create("_buildUser"),n=new HB(e);if(t){if(t!==n.profile.sub)throw r.debug("current user does not match user returned from signin. sub from signin:",n.profile.sub),new xB({...e,error:"login_required"});r.debug("current user matches user returned from signin")}return await this.storeUser(n),r.debug("user stored"),this._events.load(n),n}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:r,...n}=e,i=await this._redirectNavigator.prepare({redirectMethod:r});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...n},i),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),r=await this._signoutEnd(e);return t.info("success"),r}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,a=this.settings.popup_post_logout_redirect_uri,o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n});await this._signout({request_type:"so:p",post_logout_redirect_uri:a,state:null==a?void 0:{},...i},o),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async _signout(e,t){const r=await this._signoutStart(e,t);return await this._signoutEnd(r.url)}async _signoutStart(e={},t){var r;const n=this._logger.create("_signoutStart");try{const i=await this._loadUser();n.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);const a=e.id_token_hint||i&&i.id_token;a&&(n.debug("setting id_token_hint in signout request"),e.id_token_hint=a),await this.removeUser(),n.debug("user removed, creating signout request");const o=await this._client.createSignoutRequest(e);return n.debug("got signout request"),await t.navigate({url:o.url,state:null==(r=o.state)?void 0:r.id})}catch(e){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),r=await this._client.processSignoutResponse(e);return t.debug("got signout response"),r}async signoutSilent(e={}){var t;const r=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:n,...i}=e,a=this.settings.includeIdTokenInSilentSignout?null==(t=await this._loadUser())?void 0:t.id_token:void 0,o=this.settings.popup_post_logout_redirect_uri,s=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});await this._signout({request_type:"so:s",post_logout_redirect_uri:o,id_token_hint:a,...i},s),r.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const r=this._logger.create("_revokeInternal");if(!e)return;const n=t.filter((t=>"string"==typeof e[t]));if(n.length){for(const t of n)await this._client.revokeToken(e[t],t),r.info(`${t} revoked successfully`),"access_token"!==t&&(e[t]=null);await this.storeUser(e),r.debug("user stored"),this._events.load(e)}else r.debug("no need to revoke due to no token(s)")}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),HB.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const r=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,r)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey)}async clearStaleState(){await this._client.clearStaleState()}}((({oidcConfiguration:e,authenticationDomain:t})=>{const r="undefined"!=typeof window?window.localStorage:new PB,n=new BB({store:r}),i={authority:t,redirect_uri:e.redirectUri,popup_redirect_uri:e.redirectUri,client_id:e.clientId,metadata:{authorization_endpoint:`${t}/authorize`,token_endpoint:`${t}/oauth/token`,userinfo_endpoint:`${t}/userinfo`,end_session_endpoint:`${t}/v2/logout?returnTo=${encodeURIComponent(e.logoutRedirectUri)}&client_id=${e.clientId}`},mergeClaims:!0,loadUserInfo:!0,scope:e.scope,userStore:n};return e.audience&&(i.extraQueryParams={audience:e.audience}),i})(e)),this.deviceCredentialsManager=new Yq,this.logoutMode=e.oidcConfiguration.logoutMode||"redirect"}static mapOidcUserToDomainModel=e=>{const t=e.profile?.passport,r={expired:e.expired,idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:e.profile.sub,email:e.profile.email,nickname:e.profile.nickname}};return t?.imx_eth_address&&(r.imx={ethAddress:t?.imx_eth_address,starkAddress:t?.imx_stark_address,userAdminAddress:t?.imx_user_admin_address}),t?.zkevm_eth_address&&(r.zkEvm={ethAddress:t?.zkevm_eth_address,userAdminAddress:t?.zkevm_user_admin_address}),r};static mapDeviceTokenResponseToDomainUserModel=e=>{const t=bB(e.id_token),r={idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:t.sub,email:t.email,nickname:t.nickname}};return t?.passport?.imx_eth_address&&(r.imx={ethAddress:t?.passport?.imx_eth_address,starkAddress:t?.passport?.imx_stark_address,userAdminAddress:t?.passport?.imx_user_admin_address}),t?.passport?.zkevm_eth_address&&(r.zkEvm={ethAddress:t?.passport?.zkevm_eth_address,userAdminAddress:t?.passport?.zkevm_user_admin_address}),r};async login(){return Kq((async()=>{const e=await this.userManager.signinPopup({popupWindowFeatures:{width:410,height:450}});return tz.mapOidcUserToDomainModel(e)}),Vq.AUTHENTICATION_ERROR)}async loginCallback(){return Kq((async()=>this.userManager.signinPopupCallback()),Vq.AUTHENTICATION_ERROR)}async loginWithDeviceFlow(){return Kq((async()=>{const e=await Ne.post(`${this.config.authenticationDomain}/oauth/device/code`,{client_id:this.config.oidcConfiguration.clientId,scope:this.config.oidcConfiguration.scope,audience:this.config.oidcConfiguration.audience},Zq);return{code:e.data.user_code,deviceCode:e.data.device_code,url:e.data.verification_uri_complete,interval:e.data.interval}}),Vq.AUTHENTICATION_ERROR)}async connectImxDeviceFlow(e,t,r){return Kq((async()=>{const n=Date.now();for(;;){if(null!=r&&Date.now()-n>r)throw new Error("Timed out");await ez(1e3*t);try{const t=await this.getDeviceFlowToken(e),r=tz.mapDeviceTokenResponseToDomainUserModel(t);return r.imx?.ethAddress&&r.imx?.starkAddress&&r.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(t),r}catch(e){if(!Ne.isAxiosError(e))throw e;{const t=e.response?.data;switch(t.error){case"authorization_pending":case"slow_down":break;case"expired_token":throw new Error("Token expired, please log in again");case"access_denied":throw new Error("User denied access");default:throw new Error("Error getting token")}}}}throw new Error("Failed to get credentials")}),Vq.AUTHENTICATION_ERROR)}async getDeviceFlowToken(e){return(await Ne.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e},Zq)).data}static base64URLEncode(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static sha256(e){return(void 0)("sha256").update(e).digest()}getPKCEAuthorizationUrl(){const e=tz.base64URLEncode((void 0)(32)),t=tz.base64URLEncode(tz.sha256(e)),r=tz.base64URLEncode((void 0)(32));return this.deviceCredentialsManager.savePKCEData({state:r,verifier:e}),`${this.config.authenticationDomain}/authorize?response_type=code&code_challenge=${t}&code_challenge_method=S256&client_id=${this.config.oidcConfiguration.clientId}&redirect_uri=${this.config.oidcConfiguration.redirectUri}&scope=${this.config.oidcConfiguration.scope}&state=${r}&audience=${this.config.oidcConfiguration.audience}`}async connectImxPKCEFlow(e,t){return Kq((async()=>{const r=this.deviceCredentialsManager.getPKCEData();if(!r)throw new Error("No code verifier or state for PKCE");if(t!==r.state)throw new Error("Provided state does not match stored state");const n=await this.getPKCEToken(e,r.verifier),i=tz.mapDeviceTokenResponseToDomainUserModel(n);return i.imx?.ethAddress&&i.imx?.starkAddress&&i.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(n),i}),Vq.AUTHENTICATION_ERROR)}async getPKCEToken(e,t){return(await Ne.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"authorization_code",code_verifier:t,code:e,redirect_uri:this.config.oidcConfiguration.redirectUri},Zq)).data}async connectImxWithCredentials(e){return Kq((async()=>{if(this.deviceCredentialsManager.areValid(e))return tz.mapDeviceTokenResponseToDomainUserModel(e);const t=e?.refresh_token??null;if(t){return await this.refreshToken(t)}return null}),Vq.AUTHENTICATION_ERROR)}async refreshToken(e){const t=(await Ne.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"refresh_token",refresh_token:e},Zq)).data;return tz.mapDeviceTokenResponseToDomainUserModel(t)}async logout(){return Kq((async()=>"silent"===this.logoutMode?this.userManager.signoutSilent():this.userManager.signoutRedirect()),Vq.LOGOUT_ERROR)}async logoutSilentCallback(e){return this.userManager.signoutSilentCallback(e)}async logoutDeviceFlow(){return Kq((async()=>{this.deviceCredentialsManager.clearCredentials()}),Vq.LOGOUT_ERROR)}async loginSilent({forceRefresh:e}={forceRefresh:!1}){return Kq((async()=>this.getUser({forceRefresh:e})),Vq.SILENT_LOGIN_ERROR)}async getAuthenticatedUser({forceRefresh:e=!1}){if(e)return this.refreshTokenAndUpdatePromise();const t=await this.userManager.getUser();return t?Qq(t)?t.refresh_token?this.refreshTokenAndUpdatePromise():null:tz.mapOidcUserToDomainModel(t):null}async refreshTokenAndUpdatePromise(){return this.refreshingPromise||(this.refreshingPromise=new Promise((async(e,t)=>{try{const t=await this.userManager.signinSilent();if(t)return void e(tz.mapOidcUserToDomainModel(t));e(null)}catch(e){t(e)}finally{this.refreshingPromise=null}}))),this.refreshingPromise}async getUser({forceRefresh:e}={forceRefresh:!1}){return Kq((async()=>{const t=await this.getAuthenticatedUser({forceRefresh:e});if(t)return t;const r=this.deviceCredentialsManager.getCredentials();return r?tz.mapDeviceTokenResponseToDomainUserModel(r):null}),Vq.NOT_LOGGED_IN_ERROR)}async getUserDeviceFlow(){return Kq((async()=>{const e=this.deviceCredentialsManager.getCredentials();return e?tz.mapDeviceTokenResponseToDomainUserModel(e):null}),Vq.NOT_LOGGED_IN_ERROR)}checkStoredDeviceFlowCredentials(){return this.deviceCredentialsManager.getCredentials()}}class rz{config;lazyMagicClient;constructor(e){this.config=e,"undefined"!=typeof window&&(this.lazyMagicClient=((e,t)=>e().then(t))((()=>new Promise((e=>{if("complete"===window.document.readyState)e();else{const t=()=>{"complete"===window.document.readyState&&(e(),window.document.removeEventListener("readystatechange",t))};window.document.addEventListener("readystatechange",t)}}))),(()=>{const e=new fU(this.config.magicPublishableApiKey,{extensions:[new lU],network:this.config.network});return e.preload(),e})))}get magicClient(){if(!this.lazyMagicClient)throw new Error("Cannot perform this action outside of the browser");return this.lazyMagicClient}async login(e){return Kq((async()=>{const t=await this.magicClient;return await t.openid.loginWithOIDC({jwt:e,providerId:this.config.magicProviderId}),t.rpcProvider}),Vq.WALLET_CONNECTION_ERROR)}async logout(){const e=await this.magicClient;e.user&&await e.user.logout()}}const nz=1e3,iz=3,az=async(e,t)=>{const{retries:r=iz,interval:n=nz,finalErr:i=Error("Retry failed"),finallyFn:a=(()=>{})}=t||{};try{return await e()}catch(t){return r<=0?Promise.reject(i):(await(o=n,new Promise((e=>{setTimeout((()=>e()),o)}))),az(e,{retries:r-1,finalErr:i,finallyFn:a}))}finally{r<=0&&a()}var o};var oz,sz;!function(e){e[e.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",e[e.UNAUTHORIZED=4100]="UNAUTHORIZED",e[e.UNSUPPORTED_METHOD=4200]="UNSUPPORTED_METHOD",e[e.DISCONNECTED=4900]="DISCONNECTED"}(oz||(oz={})),function(e){e[e.RPC_SERVER_ERROR=-32e3]="RPC_SERVER_ERROR",e[e.INVALID_REQUEST=-32600]="INVALID_REQUEST",e[e.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",e[e.INVALID_PARAMS=-32602]="INVALID_PARAMS",e[e.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e[e.PARSE_ERROR=-32700]="PARSE_ERROR",e[e.TRANSACTION_REJECTED=-32003]="TRANSACTION_REJECTED"}(sz||(sz={}));class cz extends Error{message;code;constructor(e,t){super(t),this.message=t,this.code=e}}const uz="Transaction requires confirmation but this functionality is not supported in this environment. Please contact Immutable support if you need to enable this feature.",fz=e=>Jn.from(e).toString();class dz{transactionAPI;messageAPI;confirmationScreen;crossSdkBridgeEnabled;constructor({confirmationScreen:e,config:t}){const r=new sq({basePath:t.imxPublicApiDomain});this.confirmationScreen=e,this.crossSdkBridgeEnabled=t.crossSdkBridgeEnabled,this.messageAPI=new iq(r),this.transactionAPI=new oq(r)}withConfirmationScreen(e){return t=>this.withConfirmationScreenTask(e)(t)()}withConfirmationScreenTask(e){return t=>async()=>{this.confirmationScreen.loading(e);try{return await t()}catch(e){throw this.confirmationScreen.closeWindow(),e}}}withDefaultConfirmationScreenTask(e){return this.withConfirmationScreenTask()(e)}async evaluateImxTransaction({payloadHash:e,user:t}){const r={Authorization:`Bearer ${t.accessToken}`};if(!(await az((async()=>this.transactionAPI.getTransactionByID({transactionID:e,chainType:"starkex"},{headers:r})),{finallyFn:()=>{this.confirmationScreen.closeWindow()}})).data.id)throw new Error("Transaction doesn't exists");const n=await this.transactionAPI.evaluateTransaction({id:e,transactionEvaluationRequest:{chainType:"starkex"}},{headers:r}),{confirmationRequired:i}=n.data;if(i){if(this.crossSdkBridgeEnabled)throw new Error(uz);if(!(await this.confirmationScreen.requestConfirmation(e,t.imx.ethAddress,cq)).confirmed)throw new Error("Transaction rejected by user")}else this.confirmationScreen.closeWindow()}async evaluateEVMTransaction({chainId:e,nonce:t,user:r,metaTransactions:n}){const i={Authorization:`Bearer ${r.accessToken}`},a=(e=>{try{return e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit?fz(e.gasLimit):"0",target:e.to??Da,value:e.value?fz(e.value):"0",data:e.data?e.data.toString():"0x"})))}catch(e){const t=e instanceof Error?e.message:String(e);throw new cz(sz.INVALID_PARAMS,`Transaction failed to parsing: ${t}`)}})(n);try{return(await this.transactionAPI.evaluateTransaction({id:"evm",transactionEvaluationRequest:{chainType:"evm",chainId:e,transactionData:{nonce:t,userAddress:r.zkEvm.ethAddress,metaTransactions:a}}},{headers:i})).data}catch(e){const t=e instanceof Error?e.message:String(e);throw new cz(sz.INTERNAL_ERROR,`Transaction failed to validate with error: ${t}`)}}async validateEVMTransaction({chainId:e,nonce:t,user:r,metaTransactions:n}){const i=await this.evaluateEVMTransaction({chainId:e,nonce:t,user:r,metaTransactions:n}),{confirmationRequired:a,transactionId:o}=i;if(a&&this.crossSdkBridgeEnabled)throw new cz(sz.TRANSACTION_REJECTED,uz);if(a&&o){if(!(await this.confirmationScreen.requestConfirmation(o,r.zkEvm.ethAddress,uq,e)).confirmed)throw new cz(sz.TRANSACTION_REJECTED,"Transaction rejected by user")}else this.confirmationScreen.closeWindow()}async evaluateMessage({chainID:e,payload:t,user:r}){try{return(await this.messageAPI.evaluateMessage({messageEvaluationRequest:{chainID:e,payload:t}},{headers:{Authorization:`Bearer ${r.accessToken}`}})).data}catch(e){const t=e instanceof Error?e.message:String(e);throw new cz(sz.INTERNAL_ERROR,`Message failed to validate with error: ${t}`)}}async validateMessage({chainID:e,payload:t,user:r}){const{messageId:n,confirmationRequired:i}=await this.evaluateMessage({chainID:e,payload:t,user:r});if(i&&this.crossSdkBridgeEnabled)throw new cz(sz.TRANSACTION_REJECTED,uz);if(i&&n){if(!(await this.confirmationScreen.requestMessageConfirmation(n,r.zkEvm.ethAddress)).confirmed)throw new cz(sz.TRANSACTION_REJECTED,"Signature rejected by user")}else this.confirmationScreen.closeWindow()}}var lz,hz;!function(e){e.LOGGED_OUT="loggedOut"}(lz||(lz={})),function(e){e.PRODUCTION="mainnet",e.SANDBOX="sepolia"}(hz||(hz={}));const pz="ERC721";const mz="ERC721";class bz{authManager;starkSigner;immutableXClient;guardianClient;constructor({authManager:e,starkSigner:t,immutableXClient:r,confirmationScreen:n,config:i,passportEventEmitter:a}){this.authManager=e,this.starkSigner=t,this.immutableXClient=r,this.guardianClient=new dz({confirmationScreen:n,config:i}),a.on(lz.LOGGED_OUT,this.handleLogout)}handleLogout=()=>{this.starkSigner=void 0};async getAuthenticatedUserSigner(){const e=await this.authManager.getUser();if(!e||void 0===this.starkSigner)throw new Wq("User has been logged out",Vq.NOT_LOGGED_IN_ERROR);if(t=e,void 0===t?.imx)throw new Wq("User has not been registered with StarkEx",Vq.USER_NOT_REGISTERED_ERROR);var t;return{user:e,starkSigner:this.starkSigner}}async transfer(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({request:e,transfersApi:t,starkSigner:r,user:n,guardianClient:i}){return Kq(i.withDefaultConfirmationScreenTask((async()=>{const a=e.type===mz?"1":e.amount,o={sender:n.imx.ethAddress,token:lq(e),amount:a,receiver:e.receiver},s={Authorization:`Bearer ${n.accessToken}`},c=await t.getSignableTransferV1({getSignableTransferRequest:o},{headers:s});await i.evaluateImxTransaction({user:n,payloadHash:c.data.payload_hash});const u=c.data,{payload_hash:f}=u,d=await r.signMessage(f),l=await r.getAddress(),h={createTransferRequest:{sender_stark_key:u.sender_stark_key||l,sender_vault_id:u.sender_vault_id,receiver_stark_key:u.receiver_stark_key,receiver_vault_id:u.receiver_vault_id,asset_id:u.asset_id,amount:u.amount,nonce:u.nonce,expiration_timestamp:u.expiration_timestamp,stark_signature:d}},{data:p}=await t.createTransferV1(h,{headers:s});return{sent_signature:p.sent_signature,status:p.status?.toString(),time:p.time,transfer_id:p.transfer_id}})),Vq.TRANSFER_ERROR)}({request:e,user:t,starkSigner:r,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}registerOffchain(){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOffchain(){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOnchain(){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}async createOrder(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({starkSigner:e,user:t,request:r,ordersApi:n,guardianClient:i}){return Kq(i.withDefaultConfirmationScreenTask((async()=>{const{ethAddress:a}=t.imx,o=r.sell.type===pz?"1":r.sell.amount,s=r.buy.type===pz?"1":r.buy.amount,c={Authorization:`Bearer ${t.accessToken}`},u={user:a,amount_buy:s,token_buy:lq(r.buy),amount_sell:o,token_sell:lq(r.sell),fees:r.fees,split_fees:!0,expiration_timestamp:r.expiration_timestamp},f=await n.getSignableOrder({getSignableOrderRequestV3:u},{headers:c});await i.evaluateImxTransaction({user:t,payloadHash:f.data.payload_hash});const{payload_hash:d}=f.data,l=await e.signMessage(d),h=f.data,p={createOrderRequest:{include_fees:!0,fees:r.fees,stark_signature:l,amount_buy:h.amount_buy,amount_sell:h.amount_sell,asset_id_buy:h.asset_id_buy,asset_id_sell:h.asset_id_sell,expiration_timestamp:h.expiration_timestamp,nonce:h.nonce,stark_key:h.stark_key,vault_id_buy:h.vault_id_buy,vault_id_sell:h.vault_id_sell}};return{...(await n.createOrderV3(p,{headers:c})).data}})),Vq.CREATE_ORDER_ERROR)}({request:e,user:t,starkSigner:r,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}async cancelOrder(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({user:e,starkSigner:t,request:r,ordersApi:n,guardianClient:i}){return Kq(i.withDefaultConfirmationScreenTask((async()=>{const a={order_id:r.order_id},o={Authorization:`Bearer ${e.accessToken}`},s=await n.getSignableCancelOrderV3({getSignableCancelOrderRequest:a},{headers:o});await i.evaluateImxTransaction({user:e,payloadHash:s.data.payload_hash});const{payload_hash:c}=s.data,u=await t.signMessage(c),f=await n.cancelOrderV3({id:r.order_id.toString(),cancelOrderRequest:{order_id:r.order_id,stark_signature:u}},{headers:o});return{order_id:f.data.order_id,status:f.data.status}})),Vq.CANCEL_ORDER_ERROR)}({request:e,user:t,starkSigner:r,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}async createTrade(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({request:e,tradesApi:t,user:r,starkSigner:n,guardianClient:i}){return Kq(i.withDefaultConfirmationScreenTask((async()=>{const{ethAddress:a}=r.imx,o={expiration_timestamp:e.expiration_timestamp,fees:e.fees,order_id:e.order_id,user:a},s={Authorization:`Bearer ${r.accessToken}`},c=await t.getSignableTrade({getSignableTradeRequest:o},{headers:s});await i.evaluateImxTransaction({user:r,payloadHash:c.data.payload_hash});const{payload_hash:u}=c.data,f=await n.signMessage(u),{data:d}=c,l={createTradeRequest:{include_fees:!0,fees:e?.fees,stark_signature:f,order_id:e?.order_id,fee_info:d.fee_info,amount_buy:d.amount_buy,amount_sell:d.amount_sell,asset_id_buy:d.asset_id_buy,asset_id_sell:d.asset_id_sell,expiration_timestamp:d.expiration_timestamp,nonce:d.nonce,stark_key:d.stark_key,vault_id_buy:d.vault_id_buy,vault_id_sell:d.vault_id_sell}},{data:h}=await t.createTradeV3(l,{headers:s});return h})),Vq.CREATE_TRADE_ERROR)}({request:e,user:t,starkSigner:r,tradesApi:this.immutableXClient.tradesApi,guardianClient:this.guardianClient})}async batchNftTransfer(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({user:e,starkSigner:t,request:r,transfersApi:n,guardianClient:i}){return Kq(i.withConfirmationScreenTask({width:480,height:784})((async()=>{const{ethAddress:a}=e.imx,o=r.map((e=>({amount:"1",token:lq({type:mz,tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver}))),s={Authorization:`Bearer ${e.accessToken}`},c=await n.getSignableTransfer({getSignableTransferRequestV2:{sender_ether_key:a,signable_requests:o}},{headers:s});await i.evaluateImxTransaction({user:e,payloadHash:c.data.signable_responses[0]?.payload_hash});const u=await Promise.all(c.data.signable_responses.map((async e=>{const r=await t.signMessage(e.payload_hash);return{sender_vault_id:e.sender_vault_id,receiver_stark_key:e.receiver_stark_key,receiver_vault_id:e.receiver_vault_id,asset_id:e.asset_id,amount:e.amount,nonce:e.nonce,expiration_timestamp:e.expiration_timestamp,stark_signature:r}}))),f={sender_stark_key:c.data.sender_stark_key,requests:u},d=await n.createTransfer({createTransferRequestV2:f},{headers:s});return{transfer_ids:d?.data.transfer_ids}})),Vq.TRANSFER_ERROR)}({request:e,user:t,starkSigner:r,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}async exchangeTransfer(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({user:e,starkSigner:t,request:r,exchangesApi:n}){return Kq((async()=>{const{ethAddress:i}=e.imx,a=r.amount,o=await n.getExchangeSignableTransfer({id:r.transactionID,getSignableTransferRequest:{sender:i,token:lq(r),amount:a,receiver:r.receiver}}),s=await t.getAddress(),{payload_hash:c}=o.data,u=await t.signMessage(c),f={sender_stark_key:o.data.sender_stark_key||s,sender_vault_id:o.data.sender_vault_id,receiver_stark_key:o.data.receiver_stark_key,receiver_vault_id:o.data.receiver_vault_id,asset_id:o.data.asset_id,amount:o.data.amount,nonce:o.data.nonce,expiration_timestamp:o.data.expiration_timestamp,stark_signature:u},d={Authorization:`Bearer ${e.accessToken}`},l=await n.createExchangeTransfer({id:r.transactionID,createTransferRequest:f},{headers:d});return{sent_signature:l?.data.sent_signature,status:l?.data.status?.toString(),time:l?.data.time,transfer_id:l?.data.transfer_id}}),Vq.EXCHANGE_TRANSFER_ERROR)}({request:e,user:t,starkSigner:r,exchangesApi:this.immutableXClient.exchangeApi})}deposit(e){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}prepareWithdrawal(e){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}completeWithdrawal(e,t){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}async getAddress(){const{user:e}=await this.getAuthenticatedUserSigner();return Promise.resolve(e.imx.ethAddress)}}class yz{authManager;config;confirmationScreen;immutableXClient;magicAdapter;passportEventEmitter;constructor({authManager:e,config:t,confirmationScreen:r,immutableXClient:n,magicAdapter:i,passportEventEmitter:a}){this.authManager=e,this.config=t,this.confirmationScreen=r,this.immutableXClient=n,this.magicAdapter=i,this.passportEventEmitter=a}async getProvider(){let e=null;try{e=await this.authManager.loginSilent()}catch(e){console.warn(e)}return e||(e=await this.authManager.login()),this.createProviderInstance(e)}async getProviderSilent(){const e=await this.authManager.loginSilent();return e?this.createProviderInstance(e):null}async getProviderWithDeviceFlow(e,t,r){const n=await this.authManager.connectImxDeviceFlow(e,t,r);return this.createProviderInstance(n)}async getProviderWithPKCEFlow(e,t){const r=await this.authManager.connectImxPKCEFlow(e,t);return this.createProviderInstance(r)}async getProviderWithCredentials(e){const t=await this.authManager.connectImxWithCredentials(e);return t?this.createProviderInstance(t):null}async createProviderInstance(e){if(!e.idToken)throw new Wq("Failed to initialise",Vq.WALLET_CONNECTION_ERROR);const t=await this.magicAdapter.login(e.idToken),r=new om(t).getSigner(),n=await(async e=>Kq((async()=>Nx(await JN(e))),Vq.WALLET_CONNECTION_ERROR))(r);return e.imx?.ethAddress||await this.registerStarkEx(r,n,e.accessToken),new bz({authManager:this.authManager,starkSigner:n,immutableXClient:this.immutableXClient,confirmationScreen:this.confirmationScreen,config:this.config,passportEventEmitter:this.passportEventEmitter})}async registerStarkEx(e,t,r){return Kq((async()=>{await async function({ethSigner:e,starkSigner:t,usersApi:r},n){return Kq((async()=>{const[i,a]=await Promise.all([e.getAddress(),t.getAddress()]),o=await r.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:i,stark_key:a}}),{signable_message:s,payload_hash:c}=o.data,[u,f]=await Promise.all([dq(s,e),t.signMessage(c)]);return(await r.registerPassportUser({authorization:`Bearer ${n}`,registerPassportUserRequest:{eth_signature:u,ether_key:i,stark_signature:f,stark_key:a}})).statusText}),Vq.USER_REGISTRATION_ERROR)}({ethSigner:e,starkSigner:t,usersApi:this.immutableXClient.usersApi},r);return await az((async()=>{const e=await this.authManager.loginSilent({forceRefresh:!0});return!!e?.imx?e:Promise.reject(new Error("user wallet addresses not exist"))}))}),Vq.REFRESH_TOKEN_ERROR)}}const gz=(e,t,r)=>{const n=t.map((t=>!e[t]&&t)).filter((e=>e)).join(", ");if(""!==n){throw new Wq(r?`${r} - ${n} cannot be null`:`${n} cannot be null`,Vq.INVALID_CONFIGURATION)}};class vz{network;authenticationDomain;passportDomain;imxPublicApiDomain;magicPublishableApiKey;magicProviderId;oidcConfiguration;baseConfig;zkEvmRpcUrl;relayerUrl;multiRollupConfig;crossSdkBridgeEnabled;constructor({baseConfig:e,overrides:t,crossSdkBridgeEnabled:r,...n}){if(gz(n,["clientId","logoutRedirectUri","redirectUri"]),this.oidcConfiguration=n,this.baseConfig=e,this.crossSdkBridgeEnabled=r||!1,t)gz(t,["network","authenticationDomain","passportDomain","magicPublishableApiKey","magicProviderId","zkEvmRpcUrl","relayerUrl","imxPublicApiDomain","indexerMrBasePath","orderBookMrBasePath","passportMrBasePath"],"overrides"),this.network=t.network,this.authenticationDomain=t.authenticationDomain,this.passportDomain=t.passportDomain,this.imxPublicApiDomain=t.imxPublicApiDomain,this.magicPublishableApiKey=t.magicPublishableApiKey,this.magicProviderId=t.magicProviderId,this.zkEvmRpcUrl=t.zkEvmRpcUrl,this.relayerUrl=t.relayerUrl,this.multiRollupConfig={indexer:Kt({basePath:t.indexerMrBasePath}),orderBook:Kt({basePath:t.orderBookMrBasePath}),passport:Kt({basePath:t.passportMrBasePath})};else switch(e.environment){case Je.PRODUCTION:this.network=hz.PRODUCTION,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.immutable.com",this.imxPublicApiDomain="https://api.immutable.com",this.zkEvmRpcUrl="",this.relayerUrl="https://api.immutable.com/relayer-mr",this.multiRollupConfig=Xt();break;case Je.SANDBOX:default:this.network=hz.SANDBOX,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.sandbox.immutable.com",this.imxPublicApiDomain="https://api.sandbox.immutable.com",this.zkEvmRpcUrl="https://rpc.testnet.immutable.com",this.relayerUrl="https://api.sandbox.immutable.com/relayer-mr",this.multiRollupConfig=$t()}}}var wz;!function(e){e.CONFIRMATION_WINDOW_READY="confirmation_window_ready",e.TRANSACTION_CONFIRMED="transaction_confirmed",e.TRANSACTION_ERROR="transaction_error",e.MESSAGE_CONFIRMED="message_confirmed",e.MESSAGE_REJECTED="message_rejected",e.LOGOUT_SUCCESS="logout_success"}(wz||(wz={}));const _z="imx_passport_confirmation";class Ez{config;confirmationWindow;constructor(e){this.config=e}getHref(e,t){let r=`${this.config.passportDomain}/transaction-confirmation/${e}`;if(t){const e=t?Object.keys(t).map((e=>`${e}=${t[e]}`)).join("&"):"";r=`${r}?${e}`}return r}requestConfirmation(e,t,r,n){return new Promise(((i,a)=>{const o=({data:e,origin:t})=>{if(t===this.config.passportDomain&&e.eventType===_z)switch(e.messageType){case wz.CONFIRMATION_WINDOW_READY:break;case wz.TRANSACTION_CONFIRMED:i({confirmed:!0});break;case wz.TRANSACTION_ERROR:a(new Error("Transaction error"));break;default:a(new Error("Unsupported message type"))}};if(!this.confirmationWindow)return void i({confirmed:!1});window.addEventListener("message",o);let s="";s=r===cq?this.getHref("transaction",{transactionId:e,etherAddress:t,chainType:r}):this.getHref("zkevm",{transactionId:e,etherAddress:t,chainType:r,chainId:n}),this.showConfirmationScreen(s,o,i)}))}requestMessageConfirmation(e,t){return new Promise(((r,n)=>{const i=({data:e,origin:t})=>{if(t===this.config.passportDomain&&e.eventType===_z)switch(e.messageType){case wz.CONFIRMATION_WINDOW_READY:break;case wz.MESSAGE_CONFIRMED:r({confirmed:!0});break;case wz.MESSAGE_REJECTED:n(new Error("Message rejected"));break;default:n(new Error("Unsupported message type"))}};if(!this.confirmationWindow)return void r({confirmed:!1});window.addEventListener("message",i);const a=this.getHref("zkevm/message",{messageID:e,etherAddress:t});this.showConfirmationScreen(a,i,r)}))}loading(e){this.config.crossSdkBridgeEnabled||(this.confirmationWindow=(({url:e,title:t,width:r,height:n})=>{const i=Math.max(0,Math.round(window.screenX+(window.outerWidth-r)/2)),a=Math.max(0,Math.round(window.screenY+(window.outerHeight-n)/2)),o=window.open(e,t,`\n scrollbars=yes,\n width=${r}, \n height=${n}, \n top=${a}, \n left=${i}\n `);if(!o)throw new Error("Failed to open confirmation screen");return o.focus(),o})({url:this.getHref("loading"),title:"Confirm this transaction",width:e?.width||480,height:e?.height||380}))}closeWindow(){this.confirmationWindow?.close()}logout(){return new Promise(((e,t)=>{const r=document.createElement("iframe");r.setAttribute("id","passport-confirm"),r.setAttribute("src",this.getHref("logout")),r.setAttribute("style","display: none; position: absolute;width:0px;height:0px;border:0;");const n=({data:i,origin:a})=>{a===this.config.passportDomain&&i.eventType===_z&&(window.removeEventListener("message",n),r.remove(),i.messageType===wz.LOGOUT_SUCCESS&&e({logout:!0}),t(new Error("Unsupported logout type")))};window.addEventListener("message",n),document.body.appendChild(r)}))}showConfirmationScreen(e,t,r){this.confirmationWindow.location.href=e;const n=setInterval((()=>{this.confirmationWindow?.closed&&(clearInterval(n),window.removeEventListener("message",t),r({confirmed:!1}))}),1e3)}}var Tz,Az;!function(e){e.PENDING="PENDING",e.SUBMITTED="SUBMITTED",e.SUCCESSFUL="SUCCESSFUL",e.REVERTED="REVERTED",e.FAILED="FAILED"}(Tz||(Tz={})),function(e){e.ACCOUNTS_CHANGED="accountsChanged"}(Az||(Az={}));class Sz{emitter=new S_;emit(e,...t){this.emitter.emit(e,...t)}on(e,t){this.emitter.on(e,t)}removeListener(e,t){this.emitter.removeListener(e,t)}}const Rz=(e,t,r)=>bm(["string","uint256","address","bytes32"],["",e,t,r]),kz=async(e,t,r,n,i)=>{const a=e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit??La,target:e.to??Da,value:e.value??La,data:e.data??[]})));const o=function(e,t){return na(ko.encode(["uint256","tuple(\n bool delegateCall,\n bool revertOnError,\n uint256 gasLimit,\n address target,\n uint256 value,\n bytes data\n)[]"],[e,t]))}(t,a),s=On(na(Rz(r,n,o))),c=await i.signMessage(s),u=Gq({threshold:1,signers:[{weight:1,signature:`${c}02`}]}),f=new Ps(hq.mainModule.abi);return f.encodeFunctionData(f.getFunction("execute"),[a,t,u])},Oz=async(e,t,r,n,i)=>{const a={...e.types};delete a.EIP712Domain;const o=As.hash(e.domain,a,e.message),s=On(na(Rz(r,n,o))),c=`${await i.signMessage(s)}02`,{signers:u}=(e=>Hq(`0000${e}`))(t);return Gq({threshold:2,signers:[...u,{weight:1,signature:c}]})},Iz=e=>`eip155:${e}`;class xz{config;jsonRpcProvider;user;constructor({config:e,jsonRpcProvider:t,user:r}){this.config=e,this.jsonRpcProvider=t,this.user=r}async postToRelayer(e){const t={id:1,jsonrpc:"2.0",...e},r=await fetch(`${this.config.relayerUrl}/v1/transactions`,{method:"POST",headers:{Authorization:`Bearer ${this.user.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await r.json();if(n.error)throw n.error;return n}async ethSendTransaction(e,t){const{chainId:r}=await this.jsonRpcProvider.ready,n={method:"eth_sendTransaction",params:[{to:e,data:t,chainId:Iz(r)}]},{result:i}=await this.postToRelayer(n);return i}async imGetTransactionByHash(e){const t={method:"im_getTransactionByHash",params:[e]},{result:r}=await this.postToRelayer(t);return r}async imGetFeeOptions(e,t){const{chainId:r}=await this.jsonRpcProvider.ready,n={method:"im_getFeeOptions",params:[{userAddress:e,data:t,chainId:Iz(r)}]},{result:i}=await this.postToRelayer(n);return i}async imSignTypedData(e,t){const{chainId:r}=await this.jsonRpcProvider.ready,n={method:"im_signTypedData",params:[{address:e,eip712Payload:t,chainId:Iz(r)}]},{result:i}=await this.postToRelayer(n);return i}}const Cz=async({authManager:e,config:t,magicAdapter:r,multiRollupApiClients:n})=>{const i=await e.getUser()||await e.getUserDeviceFlow()||await e.login();if(!i.idToken)throw new Error("User is missing idToken");const a=await r.login(i.idToken);if(!i.zkEvm){const r=await async function({authManager:e,config:t,magicProvider:r,multiRollupApiClients:n,accessToken:i}){const a=new om(r).getSigner(),o=await a.getAddress(),s=await dq("Only sign this message from Immutable Passport",a),c={Authorization:`Bearer ${i}`};try{await n.passportApi.createCounterfactualAddress({createCounterfactualAddressRequest:{ethereumAddress:o,ethereumSignature:s}},{headers:c})}catch(e){throw new cz(sz.INTERNAL_ERROR,`Failed to create counterfactual address: ${e}`)}let u;if(t.crossSdkBridgeEnabled){const t=e.checkStoredDeviceFlowCredentials();if(!t||!t.refresh_token)throw new cz(sz.INTERNAL_ERROR,"Cross SDK bridge: Failed to refresh user details");u=await e.refreshToken(t.refresh_token)}else u=await e.loginSilent({forceRefresh:!0});if(!u?.zkEvm)throw new cz(sz.INTERNAL_ERROR,"Failed to refresh user details");return u}({authManager:e,config:t,magicProvider:a,multiRollupApiClients:n,accessToken:i.accessToken});return{user:r,magicProvider:a}}return{user:i,magicProvider:a}},Mz=({params:e,magicProvider:t,jsonRpcProvider:r,relayerClient:n,guardianClient:i,user:a})=>i.withConfirmationScreen({width:480,height:520})((async()=>{const o=e[0];if(!o.to)throw new cz(sz.INVALID_PARAMS,'eth_sendTransaction requires a "to" field');const{chainId:s}=await r.ready,c=Jn.from(s),u=new om(t).getSigner(),f=await(async(e,t)=>{const r=await e.send("eth_getCode",[t,"latest"]);if(r&&"0x"!==r)return new bd(t,hq.mainModule.abi,e).nonce();return 0})(r,a.zkEvm.ethAddress),d={to:o.to,data:o.data,nonce:f,value:o.value,revertOnError:!0},l=await(async(e,t,r,n,i,a)=>{const o=await kz([e],t,r,n,i),s=(await a.imGetFeeOptions(n,o)).find((e=>"IMX"===e.tokenSymbol));if(!s)throw new Error("Failed to retrieve fees for IMX token");const c={nonce:t,to:s.recipientAddress,value:s.tokenPrice,revertOnError:!0};return Jn.from(c.value).isZero()?[e]:[e,c]})(d,f,c,a.zkEvm.ethAddress,u,n);await i.validateEVMTransaction({chainId:Iz(s),nonce:fz(f),user:a,metaTransactions:l});const h=await kz(l,f,c,a.zkEvm.ethAddress,u),p=await n.ethSendTransaction(a.zkEvm.ethAddress,h),m=await az((async()=>{const e=await n.imGetTransactionByHash(p);if(e.status===Tz.PENDING)throw new Error;return e}),{retries:30,interval:1e3,finalErr:new cz(sz.RPC_SERVER_ERROR,"transaction hash not generated in time")});if(![Tz.SUBMITTED,Tz.SUCCESSFUL].includes(m.status)){let e=`Transaction failed to submit with status ${m.status}.`;throw m.statusMessage&&(e+=` Error message: ${m.statusMessage}`),new cz(sz.RPC_SERVER_ERROR,e)}return m.hash})),Pz=["types","domain","primaryType","message"],Nz=(e,t)=>{let r;if("string"==typeof e)try{r=JSON.parse(e)}catch(e){throw new cz(sz.INVALID_PARAMS,`Failed to parse typed data JSON: ${e}`)}else{if("object"!=typeof e)throw new cz(sz.INVALID_PARAMS,`Invalid typed data argument: ${e}`);r=e}if(!(e=>Pz.every((t=>t in e)))(r))throw new cz(sz.INVALID_PARAMS,`Invalid typed data argument. The following properties are required: ${Pz.join(", ")}`);const n=r.domain?.chainId;if(n&&("string"==typeof n&&(n.startsWith("0x")?r.domain.chainId=parseInt(n,16):r.domain.chainId=parseInt(n,10)),r.domain.chainId!==t))throw new cz(sz.INVALID_PARAMS,`Invalid chainId, expected ${t}`);return r};class Bz{authManager;config;confirmationScreen;magicAdapter;multiRollupApiClients;jsonRpcProvider;eventEmitter;guardianClient;relayerClient;magicProvider;user;isPassport=!0;constructor({authManager:e,magicAdapter:t,config:r,confirmationScreen:n,multiRollupApiClients:i,passportEventEmitter:a}){this.authManager=e,this.magicAdapter=t,this.config=r,this.confirmationScreen=n,r.crossSdkBridgeEnabled?this.jsonRpcProvider=new ip({url:this.config.zkEvmRpcUrl,fetchOptions:{referrer:"http://imtblgamesdk.local"}}):this.jsonRpcProvider=new ip(this.config.zkEvmRpcUrl),this.multiRollupApiClients=i,this.eventEmitter=new Sz,a.on(lz.LOGGED_OUT,this.handleLogout)}handleLogout=()=>{const e=this.isLoggedIn();this.magicProvider=void 0,this.user=void 0,this.relayerClient=void 0,this.guardianClient=void 0,e&&this.eventEmitter.emit(Az.ACCOUNTS_CHANGED,[])};isLoggedIn(){return void 0!==this.magicProvider&&void 0!==this.user&&void 0!==this.relayerClient&&void 0!==this.guardianClient}async performRequest(e){switch(e.method){case"eth_requestAccounts":{if(this.isLoggedIn())return[this.user.zkEvm.ethAddress];const{magicProvider:e,user:t}=await Cz({authManager:this.authManager,config:this.config,magicAdapter:this.magicAdapter,multiRollupApiClients:this.multiRollupApiClients});return this.user=t,this.magicProvider=e,this.relayerClient=new xz({config:this.config,jsonRpcProvider:this.jsonRpcProvider,user:this.user}),this.guardianClient=new dz({confirmationScreen:this.confirmationScreen,config:this.config}),this.eventEmitter.emit(Az.ACCOUNTS_CHANGED,[this.user.zkEvm.ethAddress]),[this.user.zkEvm.ethAddress]}case"eth_sendTransaction":if(!this.isLoggedIn())throw new cz(oz.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");return Mz({params:e.params||[],magicProvider:this.magicProvider,guardianClient:this.guardianClient,jsonRpcProvider:this.jsonRpcProvider,relayerClient:this.relayerClient,user:this.user});case"eth_accounts":return this.isLoggedIn()?[this.user.zkEvm.ethAddress]:[];case"eth_signTypedData":case"eth_signTypedData_v4":if(!this.isLoggedIn())throw new cz(oz.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");return(async({params:e,method:t,magicProvider:r,jsonRpcProvider:n,relayerClient:i,guardianClient:a,user:o})=>a.withConfirmationScreen({width:480,height:730})((async()=>{const s=e[0],c=e[1];if(!s||!c)throw new cz(sz.INVALID_PARAMS,`${t} requires an address and a typed data JSON`);const{chainId:u}=await n.ready,f=Nz(c,u);await a.validateMessage({chainID:String(u),payload:f,user:o});const d=await i.imSignTypedData(s,f),l=new om(r).getSigner();return Oz(f,d,Jn.from(u),s,l)})))({method:e.method,params:e.params||[],magicProvider:this.magicProvider,jsonRpcProvider:this.jsonRpcProvider,relayerClient:this.relayerClient,user:this.user,guardianClient:this.guardianClient});case"eth_gasPrice":case"eth_getBalance":case"eth_getCode":case"eth_getStorageAt":case"eth_estimateGas":case"eth_call":case"eth_blockNumber":case"eth_chainId":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":case"eth_getTransactionCount":return this.jsonRpcProvider.send(e.method,e.params||[]);default:throw new cz(oz.UNSUPPORTED_METHOD,"Method not supported")}}async performJsonRpcRequest(e){const{id:t,jsonrpc:r}=e;try{return{id:t,jsonrpc:r,result:await this.performRequest(e)}}catch(e){let n;return n=e instanceof cz?e:e instanceof Error?new cz(sz.INTERNAL_ERROR,e.message):new cz(sz.INTERNAL_ERROR,"Internal error"),{id:t,jsonrpc:r,error:n}}}async request(e){try{return this.performRequest(e)}catch(e){if(e instanceof cz)throw e;if(e instanceof Error)throw new cz(sz.INTERNAL_ERROR,e.message);throw new cz(sz.INTERNAL_ERROR,"Internal error")}}sendAsync(e,t){if(!t)throw new Error("No callback provided");Array.isArray(e)?Promise.all(e.map(this.performJsonRpcRequest)).then((e=>{t(null,e)})).catch((e=>{t(e,[])})):this.performJsonRpcRequest(e).then((e=>{t(null,e)})).catch((e=>{t(e,null)}))}async send(e,t,r){if("string"==typeof e)return"function"==typeof t?this.sendAsync({method:e,params:[]},t):r?this.sendAsync({method:e,params:Array.isArray(t)?t:[]},r):this.request({method:e,params:Array.isArray(t)?t:[]});if("function"==typeof t)return this.sendAsync(e,t);if(!Array.isArray(e)&&"object"==typeof e)return this.performJsonRpcRequest(e);throw new cz(sz.INVALID_REQUEST,"Invalid request")}on(e,t){this.eventEmitter.on(e,t)}removeListener(e,t){this.eventEmitter.removeListener(e,t)}}var Dz=Object.freeze({__proto__:null,JsonRpcError:cz,get Networks(){return hz},Passport:class{authManager;config;confirmationScreen;immutableXClient;magicAdapter;multiRollupApiClients;passportImxProviderFactory;passportEventEmitter;constructor(e){this.config=new vz(e),this.authManager=new tz(this.config),this.magicAdapter=new rz(this.config),this.confirmationScreen=new Ez(this.config),this.immutableXClient=e.overrides?.immutableXClient||new tB({baseConfig:e.baseConfig}),this.multiRollupApiClients=new Vt(this.config.multiRollupConfig),this.passportEventEmitter=new Sz,this.passportImxProviderFactory=new yz({authManager:this.authManager,config:this.config,confirmationScreen:this.confirmationScreen,immutableXClient:this.immutableXClient,magicAdapter:this.magicAdapter,passportEventEmitter:this.passportEventEmitter})}async connectImxSilent(){return this.passportImxProviderFactory.getProviderSilent()}async connectImx(){return this.passportImxProviderFactory.getProvider()}async connectImxDeviceFlow(e,t,r){return this.passportImxProviderFactory.getProviderWithDeviceFlow(e,t,r)}getPKCEAuthorizationUrl(){return this.authManager.getPKCEAuthorizationUrl()}async connectImxPKCEFlow(e,t){return this.passportImxProviderFactory.getProviderWithPKCEFlow(e,t)}checkStoredDeviceFlowCredentials(){return this.authManager.checkStoredDeviceFlowCredentials()}async connectImxWithCredentials(e){return this.passportImxProviderFactory.getProviderWithCredentials(e)}connectEvm(){if(this.config.network===hz.PRODUCTION)throw new Error("EVM is not supported on production network");return new Bz({passportEventEmitter:this.passportEventEmitter,authManager:this.authManager,magicAdapter:this.magicAdapter,config:this.config,confirmationScreen:this.confirmationScreen,multiRollupApiClients:this.multiRollupApiClients})}async login(e){const{useCachedSession:t=!1}=e||{};let r=null;try{r=await this.authManager.loginSilent()}catch(e){console.warn("loginSilent failed with error:",e)}return r||t||(r=await this.authManager.login()),r?r.profile:null}async loginWithDeviceFlow(){return this.authManager.loginWithDeviceFlow()}async loginCallback(){return this.authManager.loginCallback()}async logout(){await this.authManager.logout(),await this.confirmationScreen.logout(),await this.magicAdapter.logout(),this.passportEventEmitter.emit(lz.LOGGED_OUT)}async logoutSilentCallback(e){return this.authManager.logoutSilentCallback(e)}async logoutDeviceFlow(){return this.authManager.logoutDeviceFlow()}async getUserInfo(){const e=await this.authManager.getUser();return e?.profile}async getUserInfoDeviceFlow(){const e=await this.authManager.getUserDeviceFlow();return e?.profile}async getIdToken(){const e=await this.authManager.getUser();return e?.idToken}async getAccessToken(){const e=await this.authManager.getUser();return e?.accessToken}async getLinkedAddresses(){const e=await this.authManager.getUser();if(!e?.profile.sub)return[];const t={Authorization:`Bearer ${e.accessToken}`};return(await this.multiRollupApiClients.passportApi.getLinkedAddresses({userId:e?.profile.sub},{headers:t})).data.linkedAddresses}},PassportError:Wq,get ProviderErrorCode(){return oz},get ProviderEvent(){return Az},get RpcErrorCode(){return sz}}),Fz=ir("object"==typeof self?self.FormData:window.FormData),Lz={},Uz={},jz=ar(Dq),qz=ar(Mm),zz={},Hz=ar(Ns),Gz=ar(Aa),Vz=ar(Mo),Wz=ar(Ed),Kz=ar(Hn),Xz=ar(Ss),$z=ar(Qd),Jz=ar(Bl),Yz=ar(ia),Qz=ar(_n),Zz=ar(Od),eH=ar(vm),tH=ar(il),rH=ar(Ri),nH=ar(ha),iH=ar(Df),aH=ar(wo),oH=ar(ed),sH=ar(km),cH=ar(ql),uH=ar(ah);!function(e){var t=nr&&nr.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=nr&&nr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=nr&&nr.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&t(n,e,i);return r(n,e),n};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=Hz;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=Gz;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=n(Vz);e.base64=o;var s=Wz;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var c=Kz;Object.defineProperty(e,"arrayify",{enumerable:!0,get:function(){return c.arrayify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return c.concat}}),Object.defineProperty(e,"hexConcat",{enumerable:!0,get:function(){return c.hexConcat}}),Object.defineProperty(e,"hexDataSlice",{enumerable:!0,get:function(){return c.hexDataSlice}}),Object.defineProperty(e,"hexDataLength",{enumerable:!0,get:function(){return c.hexDataLength}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return c.hexlify}}),Object.defineProperty(e,"hexStripZeros",{enumerable:!0,get:function(){return c.hexStripZeros}}),Object.defineProperty(e,"hexValue",{enumerable:!0,get:function(){return c.hexValue}}),Object.defineProperty(e,"hexZeroPad",{enumerable:!0,get:function(){return c.hexZeroPad}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return c.isBytes}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return c.isBytesLike}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return c.isHexString}}),Object.defineProperty(e,"joinSignature",{enumerable:!0,get:function(){return c.joinSignature}}),Object.defineProperty(e,"zeroPad",{enumerable:!0,get:function(){return c.zeroPad}}),Object.defineProperty(e,"splitSignature",{enumerable:!0,get:function(){return c.splitSignature}}),Object.defineProperty(e,"stripZeros",{enumerable:!0,get:function(){return c.stripZeros}});var u=Xz;Object.defineProperty(e,"_TypedDataEncoder",{enumerable:!0,get:function(){return u._TypedDataEncoder}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return u.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return u.hashMessage}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return u.id}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return u.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return u.namehash}});var f=$z;Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return f.defaultPath}}),Object.defineProperty(e,"entropyToMnemonic",{enumerable:!0,get:function(){return f.entropyToMnemonic}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return f.getAccountPath}}),Object.defineProperty(e,"HDNode",{enumerable:!0,get:function(){return f.HDNode}}),Object.defineProperty(e,"isValidMnemonic",{enumerable:!0,get:function(){return f.isValidMnemonic}}),Object.defineProperty(e,"mnemonicToEntropy",{enumerable:!0,get:function(){return f.mnemonicToEntropy}}),Object.defineProperty(e,"mnemonicToSeed",{enumerable:!0,get:function(){return f.mnemonicToSeed}});var d=Jz;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return d.getJsonWalletAddress}});var l=Yz;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return l.keccak256}});var h=Qz;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return h.Logger}});var p=Zz;Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return p.computeHmac}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return p.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return p.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return p.sha512}});var m=eH;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 b=tH;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return b.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return b.shuffled}});var y=rH;Object.defineProperty(e,"checkProperties",{enumerable:!0,get:function(){return y.checkProperties}}),Object.defineProperty(e,"deepCopy",{enumerable:!0,get:function(){return y.deepCopy}}),Object.defineProperty(e,"defineReadOnly",{enumerable:!0,get:function(){return y.defineReadOnly}}),Object.defineProperty(e,"getStatic",{enumerable:!0,get:function(){return y.getStatic}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return y.resolveProperties}}),Object.defineProperty(e,"shallowCopy",{enumerable:!0,get:function(){return y.shallowCopy}});var g=n(nH);e.RLP=g;var v=iH;Object.defineProperty(e,"computePublicKey",{enumerable:!0,get:function(){return v.computePublicKey}}),Object.defineProperty(e,"recoverPublicKey",{enumerable:!0,get:function(){return v.recoverPublicKey}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return v.SigningKey}});var w=aH;Object.defineProperty(e,"formatBytes32String",{enumerable:!0,get:function(){return w.formatBytes32String}}),Object.defineProperty(e,"nameprep",{enumerable:!0,get:function(){return w.nameprep}}),Object.defineProperty(e,"parseBytes32String",{enumerable:!0,get:function(){return w.parseBytes32String}}),Object.defineProperty(e,"_toEscapedUtf8String",{enumerable:!0,get:function(){return w._toEscapedUtf8String}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return w.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return w.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return w.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return w.Utf8ErrorFuncs}});var _=oH;Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return _.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return _.computeAddress}}),Object.defineProperty(e,"parseTransaction",{enumerable:!0,get:function(){return _.parse}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return _.recoverAddress}}),Object.defineProperty(e,"serializeTransaction",{enumerable:!0,get:function(){return _.serialize}}),Object.defineProperty(e,"TransactionTypes",{enumerable:!0,get:function(){return _.TransactionTypes}});var E=sH;Object.defineProperty(e,"commify",{enumerable:!0,get:function(){return E.commify}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return E.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return E.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return E.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return E.parseUnits}});var T=cH;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return T.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return T.verifyTypedData}});var A=uH;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return A._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return A.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return A.poll}});var S=Zz;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return S.SupportedAlgorithm}});var R=aH;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return R.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return R.Utf8ErrorReason}})}(zz);var fH={};Object.defineProperty(fH,"__esModule",{value:!0}),fH.DomainRegistryABI=void 0;fH.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 dH={};Object.defineProperty(dH,"__esModule",{value:!0}),dH.SeaportABIv14=void 0;dH.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 lH={};!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=qz;var r,n,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"}(r||(e.OrderType=r={})),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"}(n||(e.ItemType=n={})),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"}(lH);var hH={},pH={};Object.defineProperty(pH,"__esModule",{value:!0}),pH.ERC20ABI=void 0;pH.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 mH={};Object.defineProperty(mH,"__esModule",{value:!0}),mH.ERC721ABI=void 0;mH.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 bH,yH={},gH={};function vH(){if(bH)return gH;bH=1,Object.defineProperty(gH,"__esModule",{value:!0}),gH.getItemToCriteriaMap=gH.generateCriteriaResolvers=void 0;const e=lH,t=EH();gH.generateCriteriaResolvers=({orders:r,offerCriterias:n=[[]],considerationCriterias:i=[[]]})=>{const a=r.flatMap(((r,n)=>r.parameters.offer.map(((t,r)=>({orderIndex:n,item:t,index:r,side:e.Side.OFFER}))).filter((({item:e})=>(0,t.isCriteriaItem)(e.itemType))))),o=r.flatMap(((r,n)=>r.parameters.consideration.map(((t,r)=>({orderIndex:n,item:t,index:r,side:e.Side.CONSIDERATION}))).filter((({item:e})=>(0,t.isCriteriaItem)(e.itemType))))),s=(e,t)=>e.map((({orderIndex:e,item:r,index:n,side:i})=>{const a=r.identifierOrCriteria||"0",o=t[e][n];return{orderIndex:e,index:n,side:i,identifier:o.identifier,criteriaProof:"0"===a?[]:o.proof}}));return[...s(a,n),...s(o,i)]};return gH.getItemToCriteriaMap=(e,r)=>{const n=[...r];return e.reduce(((e,r)=>((0,t.isCriteriaItem)(r.itemType)&&e.set(r,n.shift()),e)),new Map)},gH}var wH,_H={};function EH(){return wH||(wH=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=qz,r=lH,n=vH(),i=_H;e.isCurrencyItem=({itemType:e})=>[r.ItemType.NATIVE,r.ItemType.ERC20].includes(e);e.isNativeCurrencyItem=({itemType:e})=>e===r.ItemType.NATIVE;e.isErc20Item=e=>e===r.ItemType.ERC20;e.isErc721Item=e=>[r.ItemType.ERC721,r.ItemType.ERC721_WITH_CRITERIA].includes(e);e.isErc1155Item=e=>[r.ItemType.ERC1155,r.ItemType.ERC1155_WITH_CRITERIA].includes(e);e.isCriteriaItem=e=>[r.ItemType.ERC721_WITH_CRITERIA,r.ItemType.ERC1155_WITH_CRITERIA].includes(e);e.getPresentItemAmount=({startAmount:e,endAmount:r,timeBasedItemParams:n})=>{const i=t.BigNumber.from(e),a=t.BigNumber.from(r);if(!n)return i.gt(a)?i:a;const{isConsiderationItem:o,currentBlockTimestamp:s,ascendingAmountTimestampBuffer:c,startTime:u,endTime:f}=n,d=t.BigNumber.from(f).sub(u),l=a.gt(e),h=t.BigNumber.from(l?s+c:s);if(h.lt(u))return i;const p=(h.gt(f)?t.BigNumber.from(f):h).sub(u),m=d.sub(p);return i.mul(m).add(a.mul(p)).add(o?d.sub(1):0).div(d)};e.getSummedTokenAndIdentifierAmounts=({items:r,criterias:i,timeBasedItemParams:a})=>{const o=(0,n.getItemToCriteriaMap)(r,i),s=r.reduce(((r,n)=>{var i,s,c,u;const f=null!==(s=null===(i=o.get(n))||void 0===i?void 0:i.identifier)&&void 0!==s?s:n.identifierOrCriteria;return Object.assign(Object.assign({},r),{[n.token]:Object.assign(Object.assign({},r[n.token]),{[f]:(null!==(u=null===(c=r[n.token])||void 0===c?void 0:c[f])&&void 0!==u?u:t.BigNumber.from(0)).add((0,e.getPresentItemAmount)({startAmount:n.startAmount,endAmount:n.endAmount,timeBasedItemParams:a}))})})}),{});return s};e.getMaximumSizeForOrder=({parameters:{offer:e,consideration:t}})=>{const r=[...e,...t].flatMap((({startAmount:e,endAmount:t})=>[e,t]));return(0,i.findGcd)(r)}}(yH)),yH}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findGcd=e.gcd=void 0;const t=qz;e.gcd=(r,n)=>{const i=t.BigNumber.from(r),a=t.BigNumber.from(n);return i.eq(0)?a:(0,e.gcd)(a.mod(r),i)};e.findGcd=r=>{let n=t.BigNumber.from(r[0]);for(let t=1;t<r.length;t++)if(n=(0,e.gcd)(r[t],n),n.eq(1))return n;return n}}(_H);var TH={};!function(e){var t=nr&&nr.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getTagFromDomain=e.getTransactionMethods=e.executeAllActions=void 0;const r=zz;e.executeAllActions=e=>t(void 0,void 0,void 0,(function*(){for(let t=0;t<e.length-1;t++){const r=e[t];if("approval"===r.type){const e=yield r.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=(r,n,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 c=o=>t(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},s),o),c=yield r.populateTransaction[n](...i,t);if(a){const t=(0,e.getTagFromDomain)(a);c.data=c.data+t}return c}));return{callStatic:e=>{const t=Object.assign(Object.assign({},s),e);return r.callStatic[n](...i,t)},estimateGas:e=>{const t=Object.assign(Object.assign({},s),e);return r.estimateGas[n](...i,t)},transact:e=>t(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},s),e),n=yield c(t);return r.signer.sendTransaction(n)})),buildTransaction:c}};e.getTagFromDomain=e=>(0,r.keccak256)((0,r.toUtf8Bytes)(e)).slice(2,10)}(TH);var AH=nr&&nr.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(hH,"__esModule",{value:!0}),hH.getApprovalActions=hH.approvedItemAmount=void 0;const SH=qz,RH=pH,kH=mH,OH=lH,IH=EH(),xH=TH;hH.approvedItemAmount=(e,t,r,n)=>AH(void 0,void 0,void 0,(function*(){if((0,IH.isErc721Item)(t.itemType)||(0,IH.isErc1155Item)(t.itemType)){return new SH.Contract(t.token,kH.ERC721ABI,n).isApprovedForAll(e,r).then((e=>e?OH.MAX_INT:SH.BigNumber.from(0)))}if(t.itemType===OH.ItemType.ERC20){return new SH.Contract(t.token,RH.ERC20ABI,n).allowance(e,r)}return OH.MAX_INT})),hH.getApprovalActions=function(e,t,r){return e.filter(((t,r)=>r===e.length-1||e[r+1].token!==t.token)).map((({token:e,operator:n,itemType:i,identifierOrCriteria:a,requiredApprovedAmount:o})=>{const s=(0,IH.isErc1155Item)(i);if((0,IH.isErc721Item)(i)||s){const o=new SH.Contract(e,kH.ERC721ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,operator:n,transactionMethods:(0,xH.getTransactionMethods)(o.connect(r),t&&!s?"approve":"setApprovalForAll",[n,!(t&&!s)||a])}}{const s=new SH.Contract(e,RH.ERC20ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,transactionMethods:(0,xH.getTransactionMethods)(s.connect(r),"approve",[n,t?o:OH.MAX_INT]),operator:n}}}))};var CH={},MH={},PH={};Object.defineProperty(PH,"__esModule",{value:!0}),PH.ERC1155ABI=void 0;PH.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 NH=nr&&nr.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(MH,"__esModule",{value:!0}),MH.balanceOf=void 0;const BH=qz,DH=PH,FH=pH,LH=mH,UH=lH,jH=EH();MH.balanceOf=(e,t,r,n)=>NH(void 0,void 0,void 0,(function*(){if((0,jH.isErc721Item)(t.itemType)){const i=new BH.Contract(t.token,LH.ERC721ABI,r);return t.itemType===UH.ItemType.ERC721_WITH_CRITERIA?n?i.ownerOf(n.identifier).then((t=>BH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase())))):i.balanceOf(e):i.ownerOf(t.identifierOrCriteria).then((t=>BH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase()))))}if((0,jH.isErc1155Item)(t.itemType)){const i=new BH.Contract(t.token,DH.ERC1155ABI,r);if(t.itemType===UH.ItemType.ERC1155_WITH_CRITERIA){if(!n){const e=BH.BigNumber.from(t.startAmount),r=BH.BigNumber.from(t.endAmount);return e.gt(r)?e:r}return i.balanceOf(e,n.identifier)}return i.balanceOf(e,t.identifierOrCriteria)}if((0,jH.isErc20Item)(t.itemType)){return new BH.Contract(t.token,FH.ERC20ABI,r).balanceOf(e)}return r.getBalance(e)})),function(e){var t=nr&&nr.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.validateStandardFulfillBalancesAndApprovals=e.validateBasicFulfillBalancesAndApprovals=e.validateOfferBalancesAndApprovals=e.getInsufficientBalanceAndApprovalAmounts=e.getBalancesAndApprovals=void 0;const r=qz,n=lH,i=hH,a=MH,o=vH(),s=EH(),c=(e,t,r)=>{const n=e.find((({token:e,identifierOrCriteria:n})=>t.toLowerCase()===e.toLowerCase()&&n.toLowerCase()===r.toLowerCase()));if(!n)throw new Error("Balances and approvals didn't contain all tokens and identifiers");return n};e.getBalancesAndApprovals=({owner:e,items:c,criterias:u,operator:f,multicallProvider:d})=>t(void 0,void 0,void 0,(function*(){const l=(0,o.getItemToCriteriaMap)(c,u);return Promise.all(c.map((o=>t(void 0,void 0,void 0,(function*(){var t,c;let u=Promise.resolve(r.BigNumber.from(0));return u=(0,s.isErc721Item)(o.itemType)||(0,s.isErc1155Item)(o.itemType)||(0,s.isErc20Item)(o.itemType)?(0,i.approvedItemAmount)(e,o,f,d):Promise.resolve(n.MAX_INT),{token:o.token,identifierOrCriteria:null!==(c=null===(t=l.get(o))||void 0===t?void 0:t.identifier)&&void 0!==c?c:o.identifierOrCriteria,balance:yield(0,a.balanceOf)(e,o,d,l.get(o)),approvedAmount:yield u,itemType:o.itemType}})))))}));e.getInsufficientBalanceAndApprovalAmounts=({balancesAndApprovals:e,tokenAndIdentifierAmounts:t,operator:r})=>{const n=[...Object.entries(t).map((([e,t])=>Object.entries(t).map((([t,r])=>[e,t,r]))))].flat(),i=t=>n.filter((([r,n,i])=>c(e,r,n)[t].lt(i))).map((([r,n,i])=>{const a=c(e,r,n);return{token:r,identifierOrCriteria:n,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:r})))];return{insufficientBalances:a,insufficientApprovals:o}};e.validateOfferBalancesAndApprovals=({offer:t,criterias:r,balancesAndApprovals:n,timeBasedItemParams:i,throwOnInsufficientBalances:a=!0,throwOnInsufficientApprovals:o,operator:c})=>{const{insufficientBalances:u,insufficientApprovals:f}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:n,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:t,criterias:r,timeBasedItemParams:i?Object.assign(Object.assign({},i),{isConsiderationItem:!1}):void 0}),operator:c});if(a&&u.length>0)throw new Error("The offerer does not have the amount needed to create or fulfill.");if(o&&f.length>0)throw new Error("The offerer does not have the sufficient approvals.");return f};e.validateBasicFulfillBalancesAndApprovals=({offer:t,consideration:r,offererBalancesAndApprovals:n,fulfillerBalancesAndApprovals:i,timeBasedItemParams:a,offererOperator:o,fulfillerOperator:c})=>{(0,e.validateOfferBalancesAndApprovals)({offer:t,criterias:[],balancesAndApprovals:n,timeBasedItemParams:a,throwOnInsufficientApprovals:!0,operator:o});const u=r.filter((e=>e.itemType!==t[0].itemType)),{insufficientBalances:f,insufficientApprovals:d}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:i,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:u,criterias:[],timeBasedItemParams:Object.assign(Object.assign({},a),{isConsiderationItem:!0})}),operator:c});if(f.length>0)throw new Error("The fulfiller does not have the balances needed to fulfill.");return d};e.validateStandardFulfillBalancesAndApprovals=({offer:t,consideration:r,offerCriteria:n,considerationCriteria:i,offererBalancesAndApprovals:a,fulfillerBalancesAndApprovals:o,timeBasedItemParams:c,offererOperator:f,fulfillerOperator:d})=>{(0,e.validateOfferBalancesAndApprovals)({offer:t,criterias:n,balancesAndApprovals:a,timeBasedItemParams:c,throwOnInsufficientApprovals:!0,operator:f});const l=u({items:t,criterias:n,balancesAndApprovals:o,timeBasedItemParams:c}),{insufficientBalances:h,insufficientApprovals:p}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:l,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:r,criterias:i,timeBasedItemParams:Object.assign(Object.assign({},c),{isConsiderationItem:!0})}),operator:d});if(h.length>0)throw new Error("The fulfiller does not have the balances needed to fulfill.");return p};const u=({items:e,criterias:t,timeBasedItemParams:r,balancesAndApprovals:n})=>{const i=(0,s.getSummedTokenAndIdentifierAmounts)({items:e,criterias:t,timeBasedItemParams:Object.assign(Object.assign({},r),{isConsiderationItem:!1})}),a=n.map((e=>Object.assign({},e)));return Object.entries(i).forEach((([e,t])=>Object.entries(t).forEach((([t,r])=>{const n=c(a,e,t),i=a.indexOf(n);a[i].balance=a[i].balance.add(r)})))),a}}(CH);var qH,zH={},HH={},GH={},VH={},WH={exports:{}},KH={exports:{}};function XH(){return qH||(qH=1,function(e,t){e.exports=function(){var e=e||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},i=n.lib={},a=i.Base={extend:function(e){var t=r(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)}},o=i.WordArray=a.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=o<<24-(n+a)%4*8}else for(a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},a=0;a<t;a+=4){var s=i(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new o.init(n,t)}}),s=n.enc={},c=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},f=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},d=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.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 r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,u=e.min(4*c,i);if(c){for(var f=0;f<c;f+=a)this._doProcessBlock(n,f);var d=n.splice(0,c);r.sigBytes-=u}return new o.init(d,u)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=d.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.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,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new l.HMAC.init(e,r).finalize(t)}}});var l=n.algo={};return n}(Math);return e}()}(KH)),KH.exports}!function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(s[i]=r(t.pow(n,.5))),c[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],f=o.SHA256=a.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],f=r[5],d=r[6],l=r[7],h=0;h<64;h++){if(h<16)u[h]=0|e[t+h];else{var p=u[h-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,b=u[h-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;u[h]=m+u[h-7]+y+u[h-16]}var g=n&i^n&a^i&a,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&f^~s&d)+c[h]+u[h];l=d,d=f,f=s,s=o+w|0,o=a,a=i,i=n,n=w+(v+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+f|0,r[6]=r[6]+d|0,r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=a._createHelper(f),r.HmacSHA256=a._createHmacHelper(f)}(Math),e.SHA256}(XH())}(WH);var $H=WH.exports,JH={exports:{}};!function(e,t){e.exports=function(){function e(e,t){var r=t?"└":"├";return r+=e?"─ ":"──┐"}function t(e,t){var r=[];for(var n in e)e.hasOwnProperty(n)&&(t&&"function"==typeof e[n]||r.push(n));return r}function r(n,i,a,o,s,c,u){var f,d,l="",h=0,p=o.slice(0);if(p.push([i,a])&&o.length>0&&(o.forEach((function(e,t){t>0&&(l+=(e[1]?" ":"│")+" "),d||e[0]!==i||(d=!0)})),l+=e(n,a)+n,s&&("object"!=typeof i||i instanceof Date)&&(l+=": "+i),d&&(l+=" (circular ref.)"),u(l)),!d&&"object"==typeof i){var m=t(i,c);m.forEach((function(e){f=++h===m.length,r(e,i[e],f,p,s,c,u)}))}}var n={asLines:function(e,t,n,i){r(".",e,!1,[],t,"function"!=typeof n&&n,i||n)},asTree:function(e,t,n){var i="";return r(".",e,!1,[],t,n,(function(e){i+=e+"\n"})),i}};return n}()}(JH);var YH,QH=JH.exports,ZH={},eG={exports:{}},tG={exports:{}};function rG(){return YH||(YH=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.Base,a=n.WordArray,o=r.x64={};o.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),o.WordArray=i.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push(i.high),r.push(i.low)}return a.create(r,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}})}(),e}(XH())}(tG)),tG.exports}var nG,iG={exports:{}};function aG(){return nG||(nG=1,function(e,t){e.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,n=t.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 t=e.byteLength,n=[],i=0;i<t;i++)n[i>>>2]|=e[i]<<24-i%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=t}}(),e.lib.WordArray}(XH())}(iG)),iG.exports}var oG,sG={exports:{}};function cG(){return oG||(oG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var a=t[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],a=0;a<r;a+=2){var o=i(t[a>>>2]>>>16-a%4*8&65535);n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,n=[],a=0;a<t;a++)n[a>>>1]|=i(e.charCodeAt(a)<<16-a%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(XH())}(sG)),sG.exports}var uG,fG={exports:{}};function dG(){return uG||(uG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],a=0,o=0;o<t;o++)if(o%4){var s=n[e.charCodeAt(o-1)]<<o%4*2,c=n[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=(s|c)<<24-a%4*8,a++}return r.create(i,a)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],a=0;a<r;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<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<r.length;a++)i[r.charCodeAt(a)]=a}var o=r.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(XH())}(fG)),fG.exports}var lG,hG={exports:{}};function pG(){return lG||(lG=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=o.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,o=e[t+0],c=e[t+1],h=e[t+2],p=e[t+3],m=e[t+4],b=e[t+5],y=e[t+6],g=e[t+7],v=e[t+8],w=e[t+9],_=e[t+10],E=e[t+11],T=e[t+12],A=e[t+13],S=e[t+14],R=e[t+15],k=a[0],O=a[1],I=a[2],x=a[3];k=u(k,O,I,x,o,7,s[0]),x=u(x,k,O,I,c,12,s[1]),I=u(I,x,k,O,h,17,s[2]),O=u(O,I,x,k,p,22,s[3]),k=u(k,O,I,x,m,7,s[4]),x=u(x,k,O,I,b,12,s[5]),I=u(I,x,k,O,y,17,s[6]),O=u(O,I,x,k,g,22,s[7]),k=u(k,O,I,x,v,7,s[8]),x=u(x,k,O,I,w,12,s[9]),I=u(I,x,k,O,_,17,s[10]),O=u(O,I,x,k,E,22,s[11]),k=u(k,O,I,x,T,7,s[12]),x=u(x,k,O,I,A,12,s[13]),I=u(I,x,k,O,S,17,s[14]),k=f(k,O=u(O,I,x,k,R,22,s[15]),I,x,c,5,s[16]),x=f(x,k,O,I,y,9,s[17]),I=f(I,x,k,O,E,14,s[18]),O=f(O,I,x,k,o,20,s[19]),k=f(k,O,I,x,b,5,s[20]),x=f(x,k,O,I,_,9,s[21]),I=f(I,x,k,O,R,14,s[22]),O=f(O,I,x,k,m,20,s[23]),k=f(k,O,I,x,w,5,s[24]),x=f(x,k,O,I,S,9,s[25]),I=f(I,x,k,O,p,14,s[26]),O=f(O,I,x,k,v,20,s[27]),k=f(k,O,I,x,A,5,s[28]),x=f(x,k,O,I,h,9,s[29]),I=f(I,x,k,O,g,14,s[30]),k=d(k,O=f(O,I,x,k,T,20,s[31]),I,x,b,4,s[32]),x=d(x,k,O,I,v,11,s[33]),I=d(I,x,k,O,E,16,s[34]),O=d(O,I,x,k,S,23,s[35]),k=d(k,O,I,x,c,4,s[36]),x=d(x,k,O,I,m,11,s[37]),I=d(I,x,k,O,g,16,s[38]),O=d(O,I,x,k,_,23,s[39]),k=d(k,O,I,x,A,4,s[40]),x=d(x,k,O,I,o,11,s[41]),I=d(I,x,k,O,p,16,s[42]),O=d(O,I,x,k,y,23,s[43]),k=d(k,O,I,x,w,4,s[44]),x=d(x,k,O,I,T,11,s[45]),I=d(I,x,k,O,R,16,s[46]),k=l(k,O=d(O,I,x,k,h,23,s[47]),I,x,o,6,s[48]),x=l(x,k,O,I,g,10,s[49]),I=l(I,x,k,O,S,15,s[50]),O=l(O,I,x,k,b,21,s[51]),k=l(k,O,I,x,T,6,s[52]),x=l(x,k,O,I,p,10,s[53]),I=l(I,x,k,O,_,15,s[54]),O=l(O,I,x,k,c,21,s[55]),k=l(k,O,I,x,v,6,s[56]),x=l(x,k,O,I,R,10,s[57]),I=l(I,x,k,O,y,15,s[58]),O=l(O,I,x,k,A,21,s[59]),k=l(k,O,I,x,m,6,s[60]),x=l(x,k,O,I,E,10,s[61]),I=l(I,x,k,O,h,15,s[62]),O=l(O,I,x,k,w,21,s[63]),a[0]=a[0]+k|0,a[1]=a[1]+O|0,a[2]=a[2]+I|0,a[3]=a[3]+x|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var a=t.floor(n/4294967296),o=n;r[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var f=c[u];c[u]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,a,o){var s=e+(t&r|~t&n)+i+o;return(s<<a|s>>>32-a)+t}function f(e,t,r,n,i,a,o){var s=e+(t&n|r&~n)+i+o;return(s<<a|s>>>32-a)+t}function d(e,t,r,n,i,a,o){var s=e+(t^r^n)+i+o;return(s<<a|s>>>32-a)+t}function l(e,t,r,n,i,a,o){var s=e+(r^(t|~n))+i+o;return(s<<a|s>>>32-a)+t}r.MD5=a._createHelper(c),r.HmacMD5=a._createHmacHelper(c)}(Math),e.MD5}(XH())}(hG)),hG.exports}var mG,bG={exports:{}};function yG(){return mG||(mG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,i=r.Hasher,a=t.algo,o=[],s=a.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],s=r[3],c=r[4],u=0;u<80;u++){if(u<16)o[u]=0|e[t+u];else{var f=o[u-3]^o[u-8]^o[u-14]^o[u-16];o[u]=f<<1|f>>>31}var d=(n<<5|n>>>27)+c+o[u];d+=u<20?1518500249+(i&a|~i&s):u<40?1859775393+(i^a^s):u<60?(i&a|i&s|a&s)-1894007588:(i^a^s)-899497514,c=s,s=a,a=i<<30|i>>>2,i=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+s|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=i._createHelper(s),t.HmacSHA1=i._createHmacHelper(s)}(),e.SHA1}(XH())}(bG)),bG.exports}var gG,vG={exports:{}};var wG,_G={exports:{}};function EG(){return wG||(wG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,i=n.Word,a=n.WordArray,o=t.algo;function s(){return i.create.apply(i,arguments)}var c=[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)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var f=o.SHA512=r.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 r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],f=r[5],d=r[6],l=r[7],h=n.high,p=n.low,m=i.high,b=i.low,y=a.high,g=a.low,v=o.high,w=o.low,_=s.high,E=s.low,T=f.high,A=f.low,S=d.high,R=d.low,k=l.high,O=l.low,I=h,x=p,C=m,M=b,P=y,N=g,B=v,D=w,F=_,L=E,U=T,j=A,q=S,z=R,H=k,G=O,V=0;V<80;V++){var W=u[V];if(V<16)var K=W.high=0|e[t+2*V],X=W.low=0|e[t+2*V+1];else{var $=u[V-15],J=$.high,Y=$.low,Q=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Z=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=u[V-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ae=u[V-7],oe=ae.high,se=ae.low,ce=u[V-16],ue=ce.high,fe=ce.low;K=(K=(K=Q+oe+((X=Z+se)>>>0<Z>>>0?1:0))+ne+((X+=ie)>>>0<ie>>>0?1:0))+ue+((X+=fe)>>>0<fe>>>0?1:0),W.high=K,W.low=X}var de,le=F&U^~F&q,he=L&j^~L&z,pe=I&C^I&P^C&P,me=x&M^x&N^M&N,be=(I>>>28|x<<4)^(I<<30|x>>>2)^(I<<25|x>>>7),ye=(x>>>28|I<<4)^(x<<30|I>>>2)^(x<<25|I>>>7),ge=(F>>>14|L<<18)^(F>>>18|L<<14)^(F<<23|L>>>9),ve=(L>>>14|F<<18)^(L>>>18|F<<14)^(L<<23|F>>>9),we=c[V],_e=we.high,Ee=we.low,Te=H+ge+((de=G+ve)>>>0<G>>>0?1:0),Ae=ye+me;H=q,G=z,q=U,z=j,U=F,j=L,F=B+(Te=(Te=(Te=Te+le+((de+=he)>>>0<he>>>0?1:0))+_e+((de+=Ee)>>>0<Ee>>>0?1:0))+K+((de+=X)>>>0<X>>>0?1:0))+((L=D+de|0)>>>0<D>>>0?1:0)|0,B=P,D=N,P=C,N=M,C=I,M=x,I=Te+(be+pe+(Ae>>>0<ye>>>0?1:0))+((x=de+Ae|0)>>>0<de>>>0?1:0)|0}p=n.low=p+x,n.high=h+I+(p>>>0<x>>>0?1:0),b=i.low=b+M,i.high=m+C+(b>>>0<M>>>0?1:0),g=a.low=g+N,a.high=y+P+(g>>>0<N>>>0?1:0),w=o.low=w+D,o.high=v+B+(w>>>0<D>>>0?1:0),E=s.low=E+L,s.high=_+F+(E>>>0<L>>>0?1:0),A=f.low=A+j,f.high=T+U+(A>>>0<j>>>0?1:0),R=d.low=R+z,d.high=S+q+(R>>>0<z>>>0?1:0),O=l.low=O+G,l.high=k+H+(O>>>0<G>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(f),t.HmacSHA512=r._createHmacHelper(f)}(),e.SHA512}(XH(),rG())}(_G)),_G.exports}var TG,AG={exports:{}};var SG,RG={exports:{}};function kG(){return SG||(SG=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.x64.Word,s=r.algo,c=[],u=[],f=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[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,l=0;l<7;l++){if(1&i){var h=(1<<l)-1;h<32?d^=1<<h:s^=1<<h-32}128&i?i=i<<1^113:i<<=1}f[a]=o.create(s,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=o.create()}();var l=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 r=this._state,n=this.blockSize/2,i=0;i<n;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),(O=r[i]).high^=o,O.low^=a}for(var s=0;s<24;s++){for(var l=0;l<5;l++){for(var h=0,p=0,m=0;m<5;m++)h^=(O=r[l+5*m]).high,p^=O.low;var b=d[l];b.high=h,b.low=p}for(l=0;l<5;l++){var y=d[(l+4)%5],g=d[(l+1)%5],v=g.high,w=g.low;for(h=y.high^(v<<1|w>>>31),p=y.low^(w<<1|v>>>31),m=0;m<5;m++)(O=r[l+5*m]).high^=h,O.low^=p}for(var _=1;_<25;_++){var E=(O=r[_]).high,T=O.low,A=c[_];A<32?(h=E<<A|T>>>32-A,p=T<<A|E>>>32-A):(h=T<<A-32|E>>>64-A,p=E<<A-32|T>>>64-A);var S=d[u[_]];S.high=h,S.low=p}var R=d[0],k=r[0];for(R.high=k.high,R.low=k.low,l=0;l<5;l++)for(m=0;m<5;m++){var O=r[_=l+5*m],I=d[_],x=d[(l+1)%5+5*m],C=d[(l+2)%5+5*m];O.high=I.high^~x.high&C.high,O.low=I.low^~x.low&C.low}O=r[0];var M=f[s];O.high^=M.high,O.low^=M.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,a=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/a)*a>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,c=s/8,u=[],f=0;f<c;f++){var d=o[f],l=d.high,h=d.low;l=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),u.push(h),u.push(l)}return new i.init(u,s)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=a._createHelper(l),r.HmacSHA3=a._createHmacHelper(l)}(Math),e.SHA3}(XH(),rG())}(RG)),RG.exports}var OG,IG={exports:{}};var xG,CG={exports:{}};function MG(){return xG||(xG=1,function(e,t){e.exports=function(e){!function(){var t=e,r=t.lib.Base,n=t.enc.Utf8;t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),s=a.words,c=o.words,u=0;u<r;u++)s[u]^=1549556828,c[u]^=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,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}()}(XH())}(CG)),CG.exports}var PG,NG={exports:{}};var BG,DG={exports:{}};function FG(){return BG||(BG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,a=t.algo,o=a.MD5,s=a.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:o,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),a=i.create(),o=a.words,s=r.keySize,c=r.iterations;o.length<s;){u&&n.update(u);var u=n.update(e).finalize(t);n.reset();for(var f=1;f<c;f++)u=n.finalize(u),n.reset();a.concat(u)}return a.sigBytes=4*s,a}});t.EvpKDF=function(e,t,r){return s.create(r).compute(e,t)}}(),e.EvpKDF}(XH(),yG(),MG())}(DG)),DG.exports}var LG,UG={exports:{}};function jG(){return LG||(LG=1,function(e,t){e.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,i=n.Base,a=n.WordArray,o=n.BufferedBlockAlgorithm,s=r.enc;s.Utf8;var c=s.Base64,u=r.algo.EvpKDF,f=n.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,r){this.cfg=this.cfg.extend(r),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?v:y}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()});n.StreamCipher=f.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=r.mode={},l=n.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}}),h=d.CBC=function(){var e=l.extend();function r(e,r,n){var i=this._iv;if(i){var a=i;this._iv=t}else a=this._prevBlock;for(var o=0;o<n;o++)e[r+o]^=a[o]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,a=e.slice(t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=a}}),e}(),p=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(i);var c=a.create(o,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:h,padding:p}),reset:function(){f.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else n=r.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,t&&t.words):(this._mode=n.call(r,this,t&&t.words),this._mode.__creator=n)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var m=n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),b=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=a.create([1398893684,1701076831]).concat(r).concat(t);else n=t;return n.toString(c)},parse:function(e){var t=c.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=a.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return m.create({ciphertext:t,salt:n})}},y=n.SerializableCipher=i.extend({cfg:i.extend({format:b}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),a=i.finalize(t),o=i.cfg;return m.create({ciphertext:a,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),g=(r.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=a.random(8));var i=u.create({keySize:t+r}).compute(e,n),o=a.create(i.words.slice(t),4*r);return i.sigBytes=4*t,m.create({key:i,iv:o,salt:n})}},v=n.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:g}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var a=y.encrypt.call(this,e,t,i.key,n);return a.mixIn(i),a},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=i.iv,y.decrypt.call(this,e,t,i.key,n)}})}()}(XH(),FG())}(UG)),UG.exports}var qG,zG={exports:{}};function HG(){return qG||(qG=1,function(e,t){e.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,n){var i=this._iv;if(i){var a=i.slice(0);this._iv=void 0}else a=this._prevBlock;n.encryptBlock(a,0);for(var o=0;o<r;o++)e[t+o]^=a[o]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i,n),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,a=e.slice(t,t+i);r.call(this,e,t,i,n),this._prevBlock=a}}),t}(),e.mode.CFB}(XH(),jG())}(zG)),zG.exports}var GG,VG={exports:{}};function WG(){return GG||(GG=1,function(e,t){e.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=o[s]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(XH(),jG())}(VG)),VG.exports}var KG,XG={exports:{}};function $G(){return KG||(KG=1,function(e,t){e.exports=function(e){
|
|
31
|
+
*/bM=yM,function(){var e="input is invalid type",t="object"==typeof window,r=t?window:{};r.JS_SHA3_NO_WINDOW&&(t=!1);var n=!t&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?r=sx:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&bM.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,o="0123456789abcdef".split(""),s=[4,1024,262144,67108864],c=[0,8,16,24],u=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],f=[224,256,384,512],d=[128,256],l=["hex","buffer","arrayBuffer","array","digest"],h={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var p=function(e,t,r){return function(n){return new I(e,t,e).update(n)[r]()}},m=function(e,t,r){return function(n,i){return new I(e,t,i).update(n)[r]()}},b=function(e,t,r){return function(t,n,i,a){return _["cshake"+e].update(t,n,i,a)[r]()}},y=function(e,t,r){return function(t,n,i,a){return _["kmac"+e].update(t,n,i,a)[r]()}},g=function(e,t,r,n){for(var i=0;i<l.length;++i){var a=l[i];e[a]=t(r,n,a)}return e},v=function(e,t){var r=p(e,t,"hex");return r.create=function(){return new I(e,t,e)},r.update=function(e){return r.create().update(e)},g(r,p,e,t)},w=[{name:"keccak",padding:[1,256,65536,16777216],bits:f,createMethod:v},{name:"sha3",padding:[6,1536,393216,100663296],bits:f,createMethod:v},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(e,t){var r=m(e,t,"hex");return r.create=function(r){return new I(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},g(r,m,e,t)}},{name:"cshake",padding:s,bits:d,createMethod:function(e,t){var r=h[e],n=b(e,0,"hex");return n.create=function(n,i,a){return i||a?new I(e,t,n).bytepad([i,a],r):_["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},g(n,b,e,t)}},{name:"kmac",padding:s,bits:d,createMethod:function(e,t){var r=h[e],n=y(e,0,"hex");return n.create=function(n,i,a){return new x(e,t,i).bytepad(["KMAC",a],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},g(n,y,e,t)}}],_={},E=[],T=0;T<w.length;++T)for(var A=w[T],S=A.bits,R=0;R<S.length;++R){var k=A.name+"_"+S[R];if(E.push(k),_[k]=A.createMethod(S[R],A.padding),"sha3"!==A.name){var O=A.name+S[R];E.push(O),_[O]=_[k]}}function I(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function x(e,t,r){I.call(this,e,t,r)}I.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,o,s=this.blocks,u=this.byteCount,f=t.length,d=this.blockCount,l=0,h=this.s;l<f;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<d+1;++i)s[i]=0;if(r)for(i=this.start;l<f&&i<u;++l)s[i>>2]|=t[l]<<c[3&i++];else for(i=this.start;l<f&&i<u;++l)(o=t.charCodeAt(l))<128?s[i>>2]|=o<<c[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++l)),s[i>>2]|=(240|o>>18)<<c[3&i++],s[i>>2]|=(128|o>>12&63)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[d],i=0;i<d;++i)h[i]^=s[i];C(h),this.reset=!0}else this.start=i}return this},I.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},I.prototype.encodeString=function(t){var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,o=t.length;if(r)i=o;else for(var s=0;s<t.length;++s){var c=t.charCodeAt(s);c<128?i+=1:c<2048?i+=2:c<55296||c>=57344?i+=3:(c=65536+((1023&c)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},I.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,a=[];return a.length=i,this.update(a),this},I.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];C(n)}},I.prototype.toString=I.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,s=0,c="";s<n;){for(a=0;a<t&&s<n;++a,++s)e=r[a],c+=o[e>>4&15]+o[15&e]+o[e>>12&15]+o[e>>8&15]+o[e>>20&15]+o[e>>16&15]+o[e>>28&15]+o[e>>24&15];s%t==0&&(C(r),a=0)}return i&&(e=r[a],c+=o[e>>4&15]+o[15&e],i>1&&(c+=o[e>>12&15]+o[e>>8&15]),i>2&&(c+=o[e>>20&15]+o[e>>16&15])),c},I.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,o=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var c=new Uint32Array(e);o<n;){for(a=0;a<t&&o<n;++a,++o)c[o]=r[a];o%t==0&&C(r)}return i&&(c[a]=r[a],e=e.slice(0,s)),e},I.prototype.buffer=I.prototype.arrayBuffer,I.prototype.digest=I.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,a=this.extraBytes,o=0,s=0,c=[];s<i;){for(o=0;o<r&&s<i;++o,++s)e=s<<2,t=n[o],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;s%r==0&&C(n)}return a&&(e=s<<2,t=n[o],c[e]=255&t,a>1&&(c[e+1]=t>>8&255),a>2&&(c[e+2]=t>>16&255)),c},x.prototype=new I,x.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var C=function(e){var t,r,n,i,a,o,s,c,f,d,l,h,p,m,b,y,g,v,w,_,E,T,A,S,R,k,O,I,x,C,M,P,N,B,D,F,L,U,j,q,z,H,G,V,W,K,X,$,J,Y,Q,Z,ee,te,re,ne,ie,ae,oe,se,ce,ue,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],a=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|s>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|f>>>31),r=a^(f<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(d<<1|l>>>31),r=s^(l<<1|d>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(h<<1|p>>>31),r=f^(p<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=d^(i<<1|a>>>31),r=l^(a<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],b=e[1],K=e[11]<<4|e[10]>>>28,X=e[10]<<4|e[11]>>>28,I=e[20]<<3|e[21]>>>29,x=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,D=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,$=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,C=e[33]<<13|e[32]>>>19,M=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,F=e[14]<<6|e[15]>>>26,L=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Y=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,P=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,S=e[6]<<28|e[7]>>>4,R=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,k=e[18]<<20|e[19]>>>12,O=e[19]<<20|e[18]>>>12,ae=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,T=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=m^~y&v,e[1]=b^~g&w,e[10]=S^~k&I,e[11]=R^~O&x,e[20]=B^~F&U,e[21]=D^~L&j,e[30]=V^~K&$,e[31]=W^~X&J,e[40]=te^~ne&ae,e[41]=re^~ie&oe,e[2]=y^~v&_,e[3]=g^~w&E,e[12]=k^~I&C,e[13]=O^~x&M,e[22]=F^~U&q,e[23]=L^~j&z,e[32]=K^~$&Y,e[33]=X^~J&Q,e[42]=ne^~ae&se,e[43]=ie^~oe&ce,e[4]=v^~_&T,e[5]=w^~E&A,e[14]=I^~C&P,e[15]=x^~M&N,e[24]=U^~q&H,e[25]=j^~z&G,e[34]=$^~Y&Z,e[35]=J^~Q&ee,e[44]=ae^~se&ue,e[45]=oe^~ce&fe,e[6]=_^~T&m,e[7]=E^~A&b,e[16]=C^~P&S,e[17]=M^~N&R,e[26]=q^~H&B,e[27]=z^~G&D,e[36]=Y^~Z&V,e[37]=Q^~ee&W,e[46]=se^~ue&te,e[47]=ce^~fe&re,e[8]=T^~m&y,e[9]=A^~b&g,e[18]=P^~S&k,e[19]=N^~R&O,e[28]=H^~B&F,e[29]=G^~D&L,e[38]=Z^~V&K,e[39]=ee^~W&X,e[48]=ue^~te&ne,e[49]=fe^~re&ie,e[0]^=u[n],e[1]^=u[n+1]};if(i)bM.exports=_;else for(T=0;T<E.length;++T)r[E[T]]=_[E[T]]}();var gM=yM.exports;function vM(e){return"0x"+gM.keccak_256(On(e))}let wM=!1,_M=!1;const EM={debug:1,default:2,info:2,warning:3,error:4,off:5};let TM=EM.default,AM=null;const SM=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){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 RM,kM;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(RM||(RM={})),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"}(kM||(kM={}));const OM="0123456789abcdef";let IM=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==EM[r]&&this.throwArgumentError("invalid log level name","logLevel",e),TM>EM[r]||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,r,n){if(_M)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=OM[t[e]>>4],r+=OM[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const a=t;let o="";switch(r){case kM.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 kM.CALL_EXCEPTION:case kM.INSUFFICIENT_FUNDS:case kM.MISSING_NEW:case kM.NONCE_EXPIRED:case kM.REPLACEMENT_UNDERPRICED:case kM.TRANSACTION_REPLACED:case kM.UNPREDICTABLE_GAS_LIMIT:o=r}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=r,Object.keys(n).forEach((function(e){s[e]=n[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){SM&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:SM})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.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:r.name})}static globalLogger(){return AM||(AM=new e("logger/5.7.0")),AM}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),wM){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_M=!!t,wM=!!r}static setLogLevel(t){const r=EM[t.toLowerCase()];null!=r?TM=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};IM.errors=kM,IM.levels=RM;var xM=fn.BN;const CM=new IM("bignumber/5.7.0"),MM={};let PM=!1;class NM{constructor(e,t){e!==MM&&CM.throwError("cannot call constructor directly; use BigNumber.from",IM.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return DM(FM(this).fromTwos(e))}toTwos(e){return DM(FM(this).toTwos(e))}abs(){return"-"===this._hex[0]?NM.from(this._hex.substring(1)):this}add(e){return DM(FM(this).add(FM(e)))}sub(e){return DM(FM(this).sub(FM(e)))}div(e){return NM.from(e).isZero()&&LM("division-by-zero","div"),DM(FM(this).div(FM(e)))}mul(e){return DM(FM(this).mul(FM(e)))}mod(e){const t=FM(e);return t.isNeg()&&LM("division-by-zero","mod"),DM(FM(this).umod(t))}pow(e){const t=FM(e);return t.isNeg()&&LM("negative-power","pow"),DM(FM(this).pow(t))}and(e){const t=FM(e);return(this.isNegative()||t.isNeg())&&LM("unbound-bitwise-result","and"),DM(FM(this).and(t))}or(e){const t=FM(e);return(this.isNegative()||t.isNeg())&&LM("unbound-bitwise-result","or"),DM(FM(this).or(t))}xor(e){const t=FM(e);return(this.isNegative()||t.isNeg())&&LM("unbound-bitwise-result","xor"),DM(FM(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&LM("negative-width","mask"),DM(FM(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&LM("negative-width","shl"),DM(FM(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&LM("negative-width","shr"),DM(FM(this).shrn(e))}eq(e){return FM(this).eq(FM(e))}lt(e){return FM(this).lt(FM(e))}lte(e){return FM(this).lte(FM(e))}gt(e){return FM(this).gt(FM(e))}gte(e){return FM(this).gte(FM(e))}isNegative(){return"-"===this._hex[0]}isZero(){return FM(this).isZero()}toNumber(){try{return FM(this).toNumber()}catch(e){LM("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return CM.throwError("this platform does not support BigInt",IM.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?PM||(PM=!0,CM.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?CM.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",IM.errors.UNEXPECTED_ARGUMENT,{}):CM.throwError("BigNumber.toString does not accept parameters",IM.errors.UNEXPECTED_ARGUMENT,{})),FM(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof NM)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new NM(MM,BM(e)):e.match(/^-?[0-9]+$/)?new NM(MM,BM(new xM(e))):CM.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&LM("underflow","BigNumber.from",e),(e>=9007199254740991||e<=-9007199254740991)&&LM("overflow","BigNumber.from",e),NM.from(String(e));const t=e;if("bigint"==typeof t)return NM.from(t.toString());if(kn(t))return NM.from(Nn(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return NM.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(Mn(e)||"-"===e[0]&&Mn(e.substring(1))))return NM.from(e)}return CM.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function BM(e){if("string"!=typeof e)return BM(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&CM.throwArgumentError("invalid hex","value",e),"0x00"===(e=BM(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 DM(e){return NM.from(BM(e))}function FM(e){const t=NM.from(e).toHexString();return"-"===t[0]?new xM("-"+t.substring(3),16):new xM(t.substring(2),16)}function LM(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),CM.throwError(e,IM.errors.NUMERIC_FAULT,n)}const UM=new IM("bignumber/5.7.0"),jM={},qM=NM.from(0),zM=NM.from(-1);function HM(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),UM.throwError(e,IM.errors.NUMERIC_FAULT,i)}let GM="0";for(;GM.length<256;)GM+=GM;function VM(e){if("number"!=typeof e)try{e=NM.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+GM.substring(0,e):UM.throwArgumentError("invalid decimal size","decimals",e)}function WM(e,t){null==t&&(t=0);const r=VM(t),n=(e=NM.from(e)).lt(qM);n&&(e=e.mul(zM));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(r).toString();return e=1===r.length?a:a+"."+i,n&&(e="-"+e),e}function KM(e,t){null==t&&(t=0);const r=VM(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||UM.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&UM.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&UM.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>r.length-1&&HM("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=NM.from(a),c=NM.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(zM)),u}let XM=class e{constructor(e,t,r,n){e!==jM&&UM.throwError("cannot use FixedFormat constructor; use FixedFormat.from",IM.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=VM(n),Object.freeze(this)}static from(t){if(t instanceof e)return t;"number"==typeof t&&(t=`fixed128x${t}`);let r=!0,n=128,i=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)r=!1;else{const e=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);e||UM.throwArgumentError("invalid fixed format","format",t),r="u"!==e[1],n=parseInt(e[2]),i=parseInt(e[3])}else if(t){const e=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&UM.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);r=e("signed","boolean",r),n=e("width","number",n),i=e("decimals","number",i)}return n%8&&UM.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&UM.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(jM,r,n,i)}},$M=class e{constructor(e,t,r,n){e!==jM&&UM.throwError("cannot use FixedNumber constructor; use FixedNumber.from",IM.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&UM.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(t){this._checkFormat(t);const r=KM(this._value,this.format.decimals),n=KM(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=KM(this._value,this.format.decimals),n=KM(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=KM(this._value,this.format.decimals),n=KM(t._value,t.format.decimals);return e.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const r=KM(this._value,this.format.decimals),n=KM(t._value,t.format.decimals);return e.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(JM.toFormat(r.format))),r}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(JM.toFormat(r.format))),r}round(t){null==t&&(t=0);const r=this.toString().split(".");if(1===r.length&&r.push("0"),(t<0||t>80||t%1)&&UM.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=e.from("1"+GM.substring(0,t),this.format),i=YM.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).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&&UM.throwArgumentError("invalid byte width","width",e);return jn(NM.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return e.fromString(this._value,t)}static fromValue(t,r,n){return null!=n||null==r||function(e){return null!=e&&(NM.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Mn(e)||"bigint"==typeof e||kn(e))}(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(WM(t,r),XM.from(n))}static fromString(t,r){null==r&&(r="fixed");const n=XM.from(r),i=KM(t,n.decimals);!n.signed&&i.lt(qM)&&HM("unsigned value cannot be negative","overflow","value",t);let a=null;n.signed?a=i.toTwos(n.width).toHexString():(a=i.toHexString(),a=jn(a,n.width/8));const o=WM(i,n.decimals);return new e(jM,a,o,n)}static fromBytes(t,r){null==r&&(r="fixed");const n=XM.from(r);if(On(t).length>n.width/8)throw new Error("overflow");let i=NM.from(t);n.signed&&(i=i.fromTwos(n.width));const a=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=WM(i,n.decimals);return new e(jM,a,o,n)}static from(t,r){if("string"==typeof t)return e.fromString(t,r);if(kn(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(t){if(t.code!==IM.errors.INVALID_ARGUMENT)throw t}return UM.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}};const JM=$M.from(1),YM=$M.from("0.5"),QM=new IM("strings/5.7.0");var ZM,eP;function tP(e,t=ZM.current){t!=ZM.current&&(QM.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const a=65536+((1023&n)<<10)+(1023&i);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(63&a|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return On(r)}function rP(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function nP(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function iP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function aP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iP(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function oP(e,t,r){return sP.apply(this,arguments)}function sP(){return(sP=ox(dx.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.users.map((function(e){return{ether_key:e.user,tokens:e.tokens.map((function(e){return aP({id:e.id,blueprint:e.blueprint},e.royalties&&e.royalties.length>0&&{royalties:e.royalties.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))})}))}})),a=r.royalties,o=aP(aP({contract_address:r.contract_address},a&&a.length>0&&{royalties:a.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))}),{},{users:i,auth_signature:""}),s=vM(tP(JSON.stringify(o))),e.next=6,mx(s,t);case 6:return c=e.sent,u=aP(aP({users:o.users.map((function(e){return{user:e.ether_key,tokens:e.tokens}}))},a&&a.length>0&&{royalties:a}),{},{contract_address:r.contract_address,auth_signature:c}),f={mintTokensRequestV2:[u]},e.next=11,n.mintTokens(f);case 11:return d=e.sent,e.abrupt("return",d.data);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cP(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};case"ETH":return{type:"ETH",data:{decimals:18}}}}function uP(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return fP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fP(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function fP(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function dP(e){return lP.apply(this,arguments)}function lP(){return(lP=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,a=t.request,o=t.transfersApi,e.next=3,n.getAddress();case 3:return s=e.sent,c="ERC721"===a.type?"1":a.amount,e.next=7,o.getSignableTransferV1({getSignableTransferRequest:{sender:s,token:cP(a),amount:c,receiver:a.receiver}});case 7:return u=e.sent,f=u.data,d=f.signable_message,l=f.payload_hash,e.next=11,mx(d,n);case 11:return h=e.sent,e.next=14,i.signMessage(l);case 14:return p=e.sent,m={sender_stark_key:u.data.sender_stark_key,sender_vault_id:u.data.sender_vault_id,receiver_stark_key:u.data.receiver_stark_key,receiver_vault_id:u.data.receiver_vault_id,asset_id:u.data.asset_id,amount:u.data.amount,nonce:u.data.nonce,expiration_timestamp:u.data.expiration_timestamp,stark_signature:p},e.next=18,o.createTransferV1({createTransferRequest:m,xImxEthAddress:s,xImxEthSignature:h});case 18:return b=e.sent,e.abrupt("return",{sent_signature:null==b?void 0:b.data.sent_signature,status:null==b||null===(r=b.data.status)||void 0===r?void 0:r.toString(),time:null==b?void 0:b.data.time,transfer_id:null==b?void 0:b.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function hP(e){return pP.apply(this,arguments)}function pP(){return(pP=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.transfersApi,e.next=3,r.getAddress();case 3:return o=e.sent,s=i.map((function(e){return{amount:"1",token:cP({type:"ERC721",tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver}})),e.next=7,a.getSignableTransfer({getSignableTransferRequestV2:{sender_ether_key:o,signable_requests:s}});case 7:if(c=e.sent,void 0!==(u=c.data.signable_message)){e.next=11;break}throw new Error("Invalid response from Signable registration offchain");case 11:return e.next=13,mx(u,r);case 13:f=e.sent,d=[],l=uP(c.data.signable_responses),e.prev=16,l.s();case 18:if((h=l.n()).done){e.next=27;break}return p=h.value,e.next=22,n.signMessage(p.payload_hash);case 22:m=e.sent,b={sender_vault_id:p.sender_vault_id,receiver_stark_key:p.receiver_stark_key,receiver_vault_id:p.receiver_vault_id,asset_id:p.asset_id,amount:p.amount,nonce:p.nonce,expiration_timestamp:p.expiration_timestamp,stark_signature:m},d.push(b);case 25:e.next=18;break;case 27:e.next=32;break;case 29:e.prev=29,e.t0=e.catch(16),l.e(e.t0);case 32:return e.prev=32,l.f(),e.finish(32);case 35:return y={sender_stark_key:c.data.sender_stark_key,requests:d},e.next=38,a.createTransfer({createTransferRequestV2:y,xImxEthAddress:o,xImxEthSignature:f});case 38:return g=e.sent,e.abrupt("return",{transfer_ids:null==g?void 0:g.data.transfer_ids});case 40:case"end":return e.stop()}}),e,null,[[16,29,32,35]])})))).apply(this,arguments)}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(ZM||(ZM={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(eP||(eP={})),nP("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),rP("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),rP("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),rP("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t})),nP("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const mP=new IM("units/5.7.0"),bP=["wei","kwei","mwei","gwei","szabo","finney","ether"];function yP(e,t){if("string"!=typeof e&&mP.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=bP.indexOf(t);-1!==e&&(t=3*e)}return KM(e,null!=t?t:18)}function gP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function vP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gP(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function wP(e,t,r,n,i,a,o){return _P.apply(this,arguments)}function _P(){return(_P=ox(dx.mark((function e(t,r,n,i,a,o,s){var c,u,f;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return c=e.sent,e.next=5,pM(c,i,s);case 5:return u=e.sent,e.next=8,o.populateTransaction.registerAndDepositEth(c,i,u.operator_signature,n,a);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(vP(vP({},f),{},{value:r})));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function EP(e,t,r,n,i,a){return TP.apply(this,arguments)}function TP(){return(TP=ox(dx.mark((function e(t,r,n,i,a,o){var s;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction["deposit(uint256,uint256,uint256)"](i,n,a);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(vP(vP({},s),{},{value:r})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function AP(e,t,r,n,i,a){return SP.apply(this,arguments)}function SP(){return(SP=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u,f,d,l,h,p,m,b,y;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,c={decimals:18},u=yP(r.amount,"wei"),f={user:s,token:{type:r.type,data:c},amount:u.toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:f});case 8:return d=e.sent,e.next=11,a.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type}}});case 11:return l=e.sent,h=l.data.asset_type,p=d.data.stark_key,m=d.data.vault_id,b=KI.connect(o.ethConfiguration.coreContractAddress,t),y=nx.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,lM(p,y);case 19:if(e.sent){e.next=24;break}return e.abrupt("return",wP(t,u,h,p,m,b,i));case 24:return e.abrupt("return",EP(t,u,h,p,m,b));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RP(e,t,r,n,i,a){return kP.apply(this,arguments)}function kP(){return(kP=ox(dx.mark((function e(t,r,n,i,a,o){var s;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.depositERC20(i,n,a,r);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function OP(e,t,r,n,i,a,o){return IP.apply(this,arguments)}function IP(){return(IP=ox(dx.mark((function e(t,r,n,i,a,o,s){var c,u,f;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return c=e.sent,e.next=5,pM(c,i,s);case 5:return u=e.sent,e.next=8,o.populateTransaction.registerAndDepositERC20(c,i,u.operator_signature,n,a,r);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(f));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xP(e,t,r,n,i,a,o){return CP.apply(this,arguments)}function CP(){return(CP=ox(dx.mark((function e(t,r,n,i,a,o,s){var c,u,f,d,l,h,p,m,b,y,g,v,w,_,E,T;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return c=e.sent,e.next=5,a.getToken({address:r.tokenAddress});case 5:return u=e.sent,f=parseInt(u.data.decimals),d={decimals:f,token_address:r.tokenAddress},l=yP(r.amount,0),h=zI.connect(r.tokenAddress,t),e.next=12,h.populateTransaction.approve(s.ethConfiguration.coreContractAddress,l);case 12:return p=e.sent,e.next=15,t.sendTransaction(p);case 15:return m={user:c,token:{type:r.type,data:d},amount:l.toString()},e.next=18,n.getSignableDeposit({getSignableDepositRequest:m});case 18:return b=e.sent,e.next=21,o.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress}}}});case 21:return y=e.sent,g=y.data.asset_type,v=b.data.stark_key,w=b.data.vault_id,_=NM.from(b.data.amount),E=KI.connect(s.ethConfiguration.coreContractAddress,t),T=nx.connect(s.ethConfiguration.registrationContractAddress,t),e.next=30,lM(v,T);case 30:if(e.sent){e.next=35;break}return e.abrupt("return",OP(t,_,g,v,w,E,i));case 35:return e.abrupt("return",RP(t,_,g,v,w,E));case 36:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function MP(e,t,r,n,i,a){return PP.apply(this,arguments)}function PP(){return(PP=ox(dx.mark((function e(t,r,n,i,a,o){var s;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.depositNft(i,n,a,r);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function NP(e,t,r,n,i,a){return BP.apply(this,arguments)}function BP(){return(BP=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u,f,d,l,h,p,m,b,y,g,v,w;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,c={token_address:r.tokenAddress,token_id:r.tokenId},u={user:s,token:{type:r.type,data:c},amount:"1".toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:u});case 8:return f=e.sent,e.next=11,a.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress,token_id:r.tokenId}}}});case 11:return d=e.sent,l=d.data.asset_type,h=f.data.stark_key,p=f.data.vault_id,m=KI.connect(o.ethConfiguration.coreContractAddress,t),b=nx.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,lM(h,b);case 19:return y=e.sent,g=GI.connect(r.tokenAddress,t),v=o.ethConfiguration.coreContractAddress,e.next=24,g.isApprovedForAll(s,v);case 24:if(e.sent){e.next=28;break}return e.next=28,g.setApprovalForAll(v,!0);case 28:if(y){e.next=34;break}return e.next=31,pM(s,h,i);case 31:return w=e.sent,e.next=34,m.registerUser(s,h,w.operator_signature);case 34:return e.abrupt("return",MP(t,r.tokenId,l,h,p,m));case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var DP=function(e){if(void 0!==e)return e;throw new Error("undefined field exception")};function FP(e){return LP.apply(this,arguments)}function LP(){return(LP=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.withdrawalsApi,a="ERC721"===t.type?"1":t.amount,e.t0=i,e.next=5,r.getAddress();case 5:return e.t1=e.sent,e.t2=cP(t),e.t3=a,e.t4={user:e.t1,token:e.t2,amount:e.t3},e.t5={getSignableWithdrawalRequest:e.t4},e.next=12,e.t0.getSignableWithdrawal.call(e.t0,e.t5);case 12:return o=e.sent,s=o.data,c=s.signable_message,u=s.payload_hash,e.next=16,n.signMessage(u);case 16:return f=e.sent,e.next=19,vx(c,r);case 19:return d=e.sent,l=d.ethAddress,h=d.ethSignature,e.next=24,i.createWithdrawal({createWithdrawalRequest:{stark_key:DP(o.data.stark_key),amount:a,asset_id:DP(o.data.asset_id),vault_id:DP(o.data.vault_id),nonce:DP(o.data.nonce),stark_signature:f},xImxEthAddress:l,xImxEthSignature:h});case 24:return p=e.sent,e.abrupt("return",p.data);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function UP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function jP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?UP(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qP(e,t,r,n){return zP.apply(this,arguments)}function zP(){return(zP=ox(dx.mark((function e(t,r,n,i){var a;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.encodeAsset({assetType:t,encodeAssetRequest:{token:jP({type:r},i&&{data:i})}});case 2:return a=e.sent,e.abrupt("return",a.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function HP(e,t,r,n,i){return GP.apply(this,arguments)}function GP(){return(GP=ox(dx.mark((function e(t,r,n,i,a){var o,s,c;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return o=e.sent,e.next=5,pM(o,n,a);case 5:return s=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(o,n,s.operator_signature,r);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function VP(e,t,r,n){return WP.apply(this,arguments)}function WP(){return(WP=ox(dx.mark((function e(t,r,n,i){var a;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function KP(e,t,r,n,i,a){return XP.apply(this,arguments)}function XP(){return(XP=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qP("asset","ERC20",i,{token_address:n.tokenAddress});case 2:return s=e.sent,c=KI.connect(o.ethConfiguration.coreContractAddress,t),u=nx.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,lM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",HP(t,s.asset_type,r,u,a));case 12:return e.abrupt("return",VP(t,s.asset_type,r,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function JP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$P(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function YP(e,t,r,n,i){return QP.apply(this,arguments)}function QP(){return(QP=ox(dx.mark((function e(t,r,n,i,a){var o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.populateTransaction.withdrawAndMint(n,r,i);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ZP(e,t,r,n,i,a){return eN.apply(this,arguments)}function eN(){return(eN=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,e.next=5,pM(s,n,o);case 5:return c=e.sent,e.next=8,a.populateTransaction.regsiterAndWithdrawAndMint(s,n,c.operator_signature,r,i);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tN(e){var t=e.data.id,r=e.data.blueprint||"";return Mb(ub("{".concat(t,"}:{").concat(r,"}")))}function rN(e,t,r,n,i,a){return nN.apply(this,arguments)}function nN(){return(nN=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u,f;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qP("mintable-asset","ERC721",i,JP({id:n.data.id,token_address:n.data.tokenAddress},n.data.blueprint&&{blueprint:n.data.blueprint}));case 2:return s=e.sent,c=tN(n),u=KI.connect(o.ethConfiguration.coreContractAddress,t),f=nx.connect(o.ethConfiguration.registrationContractAddress,t),e.next=8,lM(r,f);case 8:if(e.sent){e.next=13;break}return e.abrupt("return",ZP(t,s.asset_type,r,c,f,a));case 13:return e.abrupt("return",YP(t,s.asset_type,r,c,u));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function iN(e,t,r,n,i,a){return aN.apply(this,arguments)}function aN(){return(aN=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,e.next=5,pM(s,n,o);case 5:return c=e.sent,e.next=8,a.populateTransaction.registerAndWithdrawNft(s,n,c.operator_signature,r,i);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oN(e,t,r,n,i){return sN.apply(this,arguments)}function sN(){return(sN=ox(dx.mark((function e(t,r,n,i,a){var o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.populateTransaction.withdrawNft(n,r,i);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cN(e,t,r,n,i,a){return uN.apply(this,arguments)}function uN(){return(uN=ox(dx.mark((function e(t,r,n,i,a,o){var s,c,u;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qP("asset","ERC721",i,{token_id:n.tokenId,token_address:n.tokenAddress});case 2:return s=e.sent,c=KI.connect(o.ethConfiguration.coreContractAddress,t),u=nx.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,lM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",iN(t,s.asset_type,r,n.tokenId,u,a));case 12:return e.abrupt("return",oN(t,s.asset_type,r,n.tokenId,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fN(e,t,r,n,i,a,o){return dN.apply(this,arguments)}function dN(){return(dN=ox(dx.mark((function e(t,r,n,i,a,o,s){var c,u;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=n.tokenAddress,u=n.tokenId,e.next=4,a.getMintableTokenDetailsByClientTokenId({tokenAddress:c,tokenId:u}).then((function(e){return rN(t,r,{type:"ERC721",data:{id:u,tokenAddress:c,blueprint:e.data.blueprint}},i,o,s)})).catch((function(e){var a;if(404===(null===(a=e.response)||void 0===a?void 0:a.status))return cN(t,r,n,i,o,s);throw e}));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lN(e,t,r,n,i){return hN.apply(this,arguments)}function hN(){return(hN=ox(dx.mark((function e(t,r,n,i,a){var o,s,c;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return o=e.sent,e.next=5,pM(o,n,a);case 5:return s=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(o,n,s.operator_signature,r);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pN(e,t,r,n){return mN.apply(this,arguments)}function mN(){return(mN=ox(dx.mark((function e(t,r,n,i){var a;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bN(e,t,r,n,i){return yN.apply(this,arguments)}function yN(){return(yN=ox(dx.mark((function e(t,r,n,i,a){var o,s,c;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qP("asset","ETH",n);case 2:return o=e.sent,s=KI.connect(a.ethConfiguration.coreContractAddress,t),c=nx.connect(a.ethConfiguration.registrationContractAddress,t),e.next=7,lM(r,c);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",lN(t,o.asset_type,r,c,i));case 12:return e.abrupt("return",pN(t,o.asset_type,r,s));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function vN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gN(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function wN(e){return _N.apply(this,arguments)}function _N(){return(_N=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.ordersApi,e.next=3,r.getAddress();case 3:return o=e.sent,s="ERC721"===i.sell.type?"1":i.sell.amount,c="ERC721"===i.buy.type?"1":i.buy.amount,u={user:o,amount_buy:c,token_buy:cP(i.buy),amount_sell:s,token_sell:cP(i.sell),fees:i.fees,expiration_timestamp:i.expiration_timestamp,split_fees:!0},e.next=9,a.getSignableOrder({getSignableOrderRequestV3:u});case 9:return f=e.sent,d=f.data,l=d.signable_message,h=d.payload_hash,e.next=13,mx(l,r);case 13:return p=e.sent,e.next=16,n.signMessage(h);case 16:return m=e.sent,b=f.data,y={createOrderRequest:{amount_buy:b.amount_buy,amount_sell:b.amount_sell,asset_id_buy:b.asset_id_buy,asset_id_sell:b.asset_id_sell,expiration_timestamp:b.expiration_timestamp,include_fees:!0,fees:i.fees,nonce:b.nonce,stark_key:b.stark_key,stark_signature:m,vault_id_buy:b.vault_id_buy,vault_id_sell:b.vault_id_sell},xImxEthAddress:o,xImxEthSignature:p},e.next=21,a.createOrderV3(y);case 21:return g=e.sent,e.abrupt("return",vN({},g.data));case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function EN(e){return TN.apply(this,arguments)}function TN(){return(TN=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.ordersApi,e.next=3,a.getSignableCancelOrderV3({getSignableCancelOrderRequest:{order_id:i.order_id}});case 3:return o=e.sent,s=o.data,c=s.signable_message,u=s.payload_hash,e.next=7,mx(c,r);case 7:return f=e.sent,e.next=10,n.signMessage(u);case 10:return d=e.sent,e.next=13,r.getAddress();case 13:return l=e.sent,e.next=16,a.cancelOrderV3({id:i.order_id.toString(),cancelOrderRequest:{order_id:i.order_id,stark_signature:d},xImxEthAddress:l,xImxEthSignature:f});case 16:return h=e.sent,e.abrupt("return",{order_id:h.data.order_id,status:h.data.status});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function AN(e){return SN.apply(this,arguments)}function SN(){return(SN=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.tradesApi,e.next=3,r.getAddress();case 3:return o=e.sent,e.next=6,a.getSignableTrade({getSignableTradeRequest:{user:o,order_id:i.order_id,fees:i.fees}});case 6:return s=e.sent,c=s.data,u=c.signable_message,f=c.payload_hash,e.next=10,mx(u,r);case 10:return d=e.sent,e.next=13,n.signMessage(f);case 13:return l=e.sent,e.next=16,a.createTradeV3({createTradeRequest:{amount_buy:s.data.amount_buy,amount_sell:s.data.amount_sell,asset_id_buy:s.data.asset_id_buy,asset_id_sell:s.data.asset_id_sell,expiration_timestamp:s.data.expiration_timestamp,fee_info:s.data.fee_info,fees:i.fees,include_fees:!0,nonce:s.data.nonce,order_id:i.order_id,stark_key:s.data.stark_key,vault_id_buy:s.data.vault_id_buy,vault_id_sell:s.data.vault_id_sell,stark_signature:l},xImxEthAddress:o,xImxEthSignature:d});case 16:return h=e.sent,e.abrupt("return",h.data);case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RN(e){return kN.apply(this,arguments)}function kN(){return(kN=ox(dx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,a=t.request,o=t.exchangesApi,e.next=3,n.getAddress();case 3:return s=e.sent,c=a.amount,e.next=7,o.getExchangeSignableTransfer({id:a.transactionID,getSignableTransferRequest:{sender:s,token:cP(a),amount:c,receiver:a.receiver}});case 7:return u=e.sent,f=u.data,d=f.signable_message,l=f.payload_hash,e.next=11,mx(d,n);case 11:return h=e.sent,e.next=14,i.signMessage(l);case 14:return p=e.sent,m={sender_stark_key:u.data.sender_stark_key,sender_vault_id:u.data.sender_vault_id,receiver_stark_key:u.data.receiver_stark_key,receiver_vault_id:u.data.receiver_vault_id,asset_id:u.data.asset_id,amount:u.data.amount,nonce:u.data.nonce,expiration_timestamp:u.data.expiration_timestamp,stark_signature:p},e.next=18,o.createExchangeTransfer({id:a.transactionID,createTransferRequest:m,xImxEthAddress:s,xImxEthSignature:h});case 18:return b=e.sent,e.abrupt("return",{sent_signature:null==b?void 0:b.data.sent_signature,status:null==b||null===(r=b.data.status)||void 0===r?void 0:r.toString(),time:null==b?void 0:b.data.time,transfer_id:null==b?void 0:b.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ON(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function IN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ON(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ON(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var xN=function(){function e(t){FI(this,e),this.config=t;var r=t.apiConfiguration;this.config=t,this.depositsApi=new fC(r),this.encodingApi=new pC(r),this.mintsApi=new xC(r),this.ordersApi=new LC(r),this.tokensApi=new WC(r),this.tradesApi=new JC(r),this.transfersApi=new eM(r),this.usersApi=new iM(r),this.withdrawalsApi=new cM(r),this.projectsApi=new zC(r),this.collectionsApi=new oC(r),this.metadataApi=new EC(r),this.metadataRefreshesApi=new RC(r),this.exchangesApi=new gC(r)}var t,r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g,v,w,_,E,T,A,S,R,k,O;return UI(e,[{key:"isChainValid",value:function(e){return e===this.config.ethConfiguration.chainID}},{key:"validateChain",value:(O=ox(dx.mark((function e(t){var r;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getChainId();case 2:if(r=e.sent,this.isChainValid(r)){e.next=5;break}throw new Error("The wallet used for this operation is not from the correct network.");case 5:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"registerOffchain",value:(k=ox(dx.mark((function e(t){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",fM(IN(IN({},t),{},{usersApi:this.usersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"isRegisteredOnchain",value:(R=ox(dx.mark((function e(t){var r,n;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return r=nx.connect(this.config.ethConfiguration.registrationContractAddress,t.ethSigner),e.next=5,t.starkSigner.getAddress();case 5:return n=e.sent,e.abrupt("return",lM(n,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"mint",value:(S=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",oP(t,r,this.mintsApi));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"transfer",value:(A=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",dP(IN(IN({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"exchangeTransfer",value:(T=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",RN(IN(IN({},t),{},{request:r,exchangesApi:this.exchangesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"batchNftTransfer",value:(E=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",hP(IN(IN({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"deposit",value:(_=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r.type,e.next="ETH"===e.t0?3:"ERC20"===e.t0?4:"ERC721"===e.t0?5:6;break;case 3:return e.abrupt("return",this.depositEth(t,r));case 4:return e.abrupt("return",this.depositERC20(t,r));case 5:return e.abrupt("return",this.depositERC721(t,r));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"depositEth",value:(w=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",AP(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"depositERC20",value:(v=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",xP(t,r,this.depositsApi,this.usersApi,this.tokensApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"depositERC721",value:(g=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",NP(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"prepareWithdrawal",value:(y=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",FP(IN(IN(IN({},t),r),{},{withdrawalsApi:this.withdrawalsApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"completeWithdrawal",value:function(e,t,r){switch(r.type){case"ETH":return this.completeEthWithdrawal(e,t);case"ERC20":return this.completeERC20Withdrawal(e,t,r);case"ERC721":return this.completeERC721Withdrawal(e,t,r)}}},{key:"completeEthWithdrawal",value:(b=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",bN(t,r,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"completeERC20Withdrawal",value:(m=ox(dx.mark((function e(t,r,n){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",KP(t,r,n,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return m.apply(this,arguments)})},{key:"completeERC721Withdrawal",value:function(){var e=ox(dx.mark((function e(t,r,n){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",fN(t,r,n,this.encodingApi,this.mintsApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"createOrder",value:(p=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",wN(IN(IN({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"cancelOrder",value:(h=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",EN(IN(IN({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"createTrade",value:(l=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",AN(IN(IN({},t),{},{request:r,tradesApi:this.tradesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"createProject",value:(d=ox(dx.mark((function e(t,r){var n;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.createProject({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createProjectRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"getProject",value:(f=ox(dx.mark((function e(t,r){var n;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.getProject({id:r,iMXSignature:n.signature,iMXTimestamp:n.timestamp}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"getProjects",value:(u=ox(dx.mark((function e(t,r,n,i,a){var o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return o=e.sent,e.abrupt("return",this.projectsApi.getProjects({iMXSignature:o.signature,iMXTimestamp:o.timestamp,pageSize:r,cursor:n,orderBy:i,direction:a}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return u.apply(this,arguments)})},{key:"createCollection",value:(c=ox(dx.mark((function e(t,r){var n;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return n=e.sent,e.abrupt("return",this.collectionsApi.createCollection({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createCollectionRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"updateCollection",value:(s=ox(dx.mark((function e(t,r,n){var i;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return i=e.sent,e.abrupt("return",this.collectionsApi.updateCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,address:r,updateCollectionRequest:n}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return s.apply(this,arguments)})},{key:"addMetadataSchemaToCollection",value:(o=ox(dx.mark((function e(t,r,n){var i;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return i=e.sent,e.abrupt("return",this.metadataApi.addMetadataSchemaToCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,addMetadataSchemaToCollectionRequest:n,address:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return o.apply(this,arguments)})},{key:"updateMetadataSchemaByName",value:(a=ox(dx.mark((function e(t,r,n,i){var a;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return a=e.sent,e.abrupt("return",this.metadataApi.updateMetadataSchemaByName({iMXSignature:a.signature,iMXTimestamp:a.timestamp,address:r,name:n,metadataSchemaRequest:i}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return a.apply(this,arguments)})},{key:"listMetadataRefreshes",value:(i=ox(dx.mark((function e(t,r,n,i){var a,o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return a=e.sent,e.next=5,t.getAddress();case 5:return o=e.sent,e.abrupt("return",this.metadataRefreshesApi.getAListOfMetadataRefreshes({xImxEthSignature:a.signature,xImxEthTimestamp:a.timestamp,xImxEthAddress:o,collectionAddress:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return i.apply(this,arguments)})},{key:"getMetadataRefreshErrors",value:(n=ox(dx.mark((function e(t,r,n,i){var a,o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return a=e.sent,e.next=5,t.getAddress();case 5:return o=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshErrors({xImxEthSignature:a.signature,xImxEthTimestamp:a.timestamp,xImxEthAddress:o,refreshId:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"getMetadataRefreshResults",value:(r=ox(dx.mark((function e(t,r){var n,i;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshResults({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,refreshId:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"createMetadataRefresh",value:(t=ox(dx.mark((function e(t,r){var n,i;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yx(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.requestAMetadataRefresh({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,createMetadataRefreshRequest:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();var CN=function(e){YI(r,Dx(Error));var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=XI(e);if(t){var i=XI(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ex(this,r)}}(r);function r(e){var n,i=e.code,a=e.details,o=e.message;return FI(this,r),(n=t.call(this,o)).code=i,n.details=a,n}return UI(r)}();function MN(e){if(DI.isAxiosError(e)&&e.response){var t,r,n,i=e.response.data;return i.code&&i.message?new CN({code:i.code,details:i.details,message:i.message}):new CN({code:null!==(t=null!==(r=e.code)&&void 0!==r?r:null===(n=e.response)||void 0===n?void 0:n.status.toString())&&void 0!==t?t:"unknown_error_code",message:String(e)})}return new CN({code:"unknown_error_code",message:String(e)})}var PN=function(){function e(t){FI(this,e),this.depositsApi=new fC(t.apiConfiguration),this.mintsApi=new xC(t.apiConfiguration),this.ordersApi=new LC(t.apiConfiguration),this.tokensApi=new WC(t.apiConfiguration),this.tradesApi=new JC(t.apiConfiguration),this.transfersApi=new eM(t.apiConfiguration),this.exchangeApi=new gC(t.apiConfiguration),this.usersApi=new iM(t.apiConfiguration),this.withdrawalsApi=new cM(t.apiConfiguration),this.balanceApi=new rC(t.apiConfiguration),this.assetApi=new Qx(t.apiConfiguration),this.collectionApi=new oC(t.apiConfiguration),this.metadataApi=new EC(t.apiConfiguration),this.metadataRefreshesApi=new RC(t.apiConfiguration),this.nftCheckoutPrimaryApi=new NC(t.apiConfiguration),this.projectsApi=new zC(t.apiConfiguration),this.workflows=new xN(t)}var t,r,n;return UI(e,[{key:"deposit",value:function(e,t){return this.workflows.deposit(e,t).catch((function(e){throw MN(e)}))}},{key:"getDeposit",value:function(e){return this.depositsApi.getDeposit(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listDeposits",value:function(e){return this.depositsApi.listDeposits(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"registerOffchain",value:function(e){return this.workflows.registerOffchain(e).catch((function(e){throw MN(e)}))}},{key:"isRegisteredOnchain",value:function(e){return this.workflows.isRegisteredOnchain(e).catch((function(e){throw MN(e)}))}},{key:"getUser",value:function(e){return this.usersApi.getUsers({user:e}).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getAsset",value:function(e){return this.assetApi.getAsset(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listAssets",value:function(e){return this.assetApi.listAssets(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"createCollection",value:function(e,t){return this.workflows.createCollection(e,t).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getCollection",value:function(e){return this.collectionApi.getCollection(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listCollectionFilters",value:function(e){return this.collectionApi.listCollectionFilters(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listCollections",value:function(e){return this.collectionApi.listCollections(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"updateCollection",value:function(e,t,r){return this.workflows.updateCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"addMetadataSchemaToCollection",value:function(e,t,r){return this.workflows.addMetadataSchemaToCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getMetadataSchema",value:function(e){return this.metadataApi.getMetadataSchema(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"updateMetadataSchemaByName",value:function(e,t,r,n){return this.workflows.updateMetadataSchemaByName(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listMetadataRefreshes",value:function(e,t,r,n){return this.workflows.listMetadataRefreshes(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getMetadataRefreshErrors",value:function(e,t,r,n){return this.workflows.getMetadataRefreshErrors(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getMetadataRefreshResults",value:function(e,t){return this.workflows.getMetadataRefreshResults(e,t).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"createMetadataRefresh",value:function(e,t){return this.workflows.createMetadataRefresh(e,t).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"createProject",value:(n=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.createProject(t,r).then((function(e){return e.data})).catch((function(e){throw MN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getProject",value:(r=ox(dx.mark((function e(t,r){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProject(t,r).then((function(e){return e.data})).catch((function(e){throw MN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getProjects",value:(t=ox(dx.mark((function e(t,r,n,i,a){return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProjects(t,r,n,i,a).then((function(e){return e.data})).catch((function(e){throw MN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r,n,i,a){return t.apply(this,arguments)})},{key:"getBalance",value:function(e){return this.balanceApi.getBalance(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listBalances",value:function(e){return this.balanceApi.listBalances(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getMint",value:function(e){return this.mintsApi.getMint(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listMints",value:function(e){return this.mintsApi.listMints(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"mint",value:function(e,t){return this.workflows.mint(e,t).catch((function(e){throw MN(e)}))}},{key:"listWithdrawals",value:function(e){return this.withdrawalsApi.listWithdrawals(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getWithdrawal",value:function(e){return this.withdrawalsApi.getWithdrawal(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"prepareWithdrawal",value:function(e,t){return this.workflows.prepareWithdrawal(e,t).catch((function(e){throw MN(e)}))}},{key:"completeWithdrawal",value:function(e,t,r){return this.workflows.completeWithdrawal(e,t,r).catch((function(e){throw MN(e)}))}},{key:"getOrder",value:function(e){return this.ordersApi.getOrderV3(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listOrders",value:function(e){return this.ordersApi.listOrdersV3(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"createOrder",value:function(e,t){return this.workflows.createOrder(e,t).catch((function(e){throw MN(e)}))}},{key:"cancelOrder",value:function(e,t){return this.workflows.cancelOrder(e,t).catch((function(e){throw MN(e)}))}},{key:"getTrade",value:function(e){return this.tradesApi.getTradeV3(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listTrades",value:function(e){return this.tradesApi.listTradesV3(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"createTrade",value:function(e,t){return this.workflows.createTrade(e,t).catch((function(e){throw MN(e)}))}},{key:"getToken",value:function(e){return this.tokensApi.getToken(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listTokens",value:function(e){return this.tokensApi.listTokens(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"getTransfer",value:function(e){return this.transfersApi.getTransfer(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"listTransfers",value:function(e){return this.transfersApi.listTransfers(e).then((function(e){return e.data})).catch((function(e){throw MN(e)}))}},{key:"transfer",value:function(e,t){return this.workflows.transfer(e,t).catch((function(e){throw MN(e)}))}},{key:"batchNftTransfer",value:function(e,t){return this.workflows.batchNftTransfer(e,t).catch((function(e){throw MN(e)}))}},{key:"createExchange",value:function(e){return this.exchangeApi.createExchange(e).catch((function(e){throw MN(e)}))}},{key:"getExchange",value:function(e){return this.exchangeApi.getExchange(e).catch((function(e){throw MN(e)}))}},{key:"getExchanges",value:function(e){return this.exchangeApi.getExchanges(e).catch((function(e){throw MN(e)}))}},{key:"exchangeTransfer",value:function(e,t){return this.workflows.exchangeTransfer(e,t).catch((function(e){throw MN(e)}))}},{key:"createNftPrimary",value:function(e){return this.nftCheckoutPrimaryApi.createNftPrimary(e).catch((function(e){throw MN(e)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(e){return this.nftCheckoutPrimaryApi.getCurrenciesNFTCheckoutPrimary(e).catch((function(e){throw MN(e)}))}},{key:"getNftPrimaryTransaction",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransaction(e).catch((function(e){throw MN(e)}))}},{key:"getNftPrimaryTransactions",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransactions(e).catch((function(e){throw MN(e)}))}}]),e}();function NN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function BN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?NN(Object(r),!0).forEach((function(t){jI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var DN={"x-sdk-version":"imx-core-sdk-ts-".concat("2.4.0")},FN=function(e){var t=e.coreContractAddress,r=e.registrationContractAddress,n=e.chainID,i=e.basePath,a=e.headers,o=e.sdkVersion;if(!i.trim())throw Error("basePath can not be empty");return o&&(DN["x-sdk-version"]=o),a=BN(BN({},a||{}),DN),{apiConfiguration:new uM({basePath:i,baseOptions:{headers:a}}),ethConfiguration:{coreContractAddress:t,registrationContractAddress:r,chainID:n}}},LN={get PRODUCTION(){return FN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"})},get SANDBOX(){return FN({basePath:"https://api.sandbox.x.immutable.com",chainID:11155111,coreContractAddress:"0x2d5C349fD8464DA06a3f90b4B0E9195F3d1b7F98",registrationContractAddress:"0xDbA6129C02E69405622fAdc3d5A7f8d23eac3b97"})},createConfig:FN},UN=new fn("08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f",16);new Bb.ec(new Bb.curves.PresetCurve({type:"short",prime:null,p:"08000000 00000011 00000000 00000000 00000000 00000000 00000000 00000001",a:"00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001",b:"06f21413 efbe40de 150e596d 72f7a8c5 609ad26c 15c915c1 f4cdfcb9 9cee9e89",n:UN.toString("hex"),hash:Vu.sha256,gRed:!1,g:["1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca","5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"]}));var jN=function(){var e=new fn("1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000",16);return e.sub(e.mod(UN))};function qN(e,t){return new fn(Vu.sha256().update(nb(Ib(e)+Sb(fb(t),2))).digest("hex"),16)}function zN(e){for(var t=jN(),r=qN(e.toString("hex",64),0),n=0;r.gte(t);n++)r=qN(r.toString("hex"),n);return r.umod(UN).toString("hex")}function HN(e){for(var t=jN(),r=qN(e.toString("hex",64),0),n=1;r.gte(t);n++)r=qN(r.toString("hex"),n);return r.umod(UN).toString("hex")}function GN(e){var t=jN();return qN(e.toString("hex",64),0).gte(t)}function VN(e){return WN.apply(this,arguments)}function WN(){return(WN=ox(dx.mark((function e(t){var r,n;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=new PN(LN.PRODUCTION),e.next=4,r.getUser(t);case 4:if(!((n=e.sent).accounts.length>0)){e.next=7;break}return e.abrupt("return",{starkPublicKey:n.accounts[0],accountNotFound:!1});case 7:e.next=14;break;case 9:if(e.prev=9,e.t0=e.catch(0),!(e.t0 instanceof CN&&"account_not_found"==e.t0.code)){e.next=13;break}return e.abrupt("return",{starkPublicKey:"",accountNotFound:!0});case 13:throw e.t0;case 14:case"end":return e.stop()}}),e,null,[[0,9]])})))).apply(this,arguments)}function KN(e,t){var r=Yk.hdkey.fromMasterSeed(Buffer.from(e.slice(2),"hex")).derivePath(t).getWallet().getPrivateKey();return new fn(r)}function XN(e,t,r){return $N.apply(this,arguments)}function $N(){return($N=ox(dx.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=KN(t,r),a=HN(i),GN(i)){e.next=4;break}return e.abrupt("return",a);case 4:return e.next=6,VN(n);case 6:if(void 0!==(o=e.sent)){e.next=9;break}throw new Error("Error fetching stark public key from IMX");case 9:if(!o.accountNotFound){e.next=11;break}return e.abrupt("return",a);case 11:return s=new fn(Ib(o.starkPublicKey),16),e.next=14,Nx(a).getAddress();case 14:if(c=e.sent,!s.eq(new fn(Ib(c),16))){e.next=17;break}return e.abrupt("return",a);case 17:return u=zN(i),e.next=20,Nx(u).getAddress();case 20:if(c=e.sent,!s.eq(new fn(Ib(c),16))){e.next=23;break}return e.abrupt("return",u);case 23:return f=Mx(t,r),d=Cx(f),e.next=27,Nx(d).getAddress();case 27:if(c=e.sent,!s.eq(new fn(Ib(c),16))){e.next=30;break}return e.abrupt("return",d);case 30:throw new Error("Can not deterministically generate stark private key - please contact support");case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function JN(e){return YN.apply(this,arguments)}function YN(){return(YN=ox(dx.mark((function e(t){var r,n,i,a,o;return dx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return r=e.sent.toLowerCase(),e.next=5,t.signMessage("Only sign this request if you’ve initiated an action with Immutable X.");case 5:return n=e.sent,i=qn(n).s,a=Ix("starkex","immutablex",r,"1"),e.next=10,XN(i,a,r);case 10:return o=e.sent,e.abrupt("return",o.padStart(64,"0"));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}IM.errors.INSUFFICIENT_FUNDS,IM.errors.NONCE_EXPIRED,IM.errors.REPLACEMENT_UNDERPRICED;const QN=({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n})=>LN.createConfig({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n,sdkVersion:"ts-immutable-sdk-0.28.10"}),ZN=()=>QN({basePath:"https://api.sandbox.x.immutable.com",chainID:11155111,coreContractAddress:"0x2d5C349fD8464DA06a3f90b4B0E9195F3d1b7F98",registrationContractAddress:"0xDbA6129C02E69405622fAdc3d5A7f8d23eac3b97"});class eB{immutableXConfig;baseConfig;constructor({baseConfig:e,overrides:t}){if(this.baseConfig=e,t)this.immutableXConfig=t.immutableXConfig;else switch(e.environment){case Je.SANDBOX:this.immutableXConfig=ZN();break;case Je.PRODUCTION:this.immutableXConfig=QN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"});break;default:this.immutableXConfig=ZN()}}}class tB{immutableX;depositsApi;mintsApi;ordersApi;tokensApi;tradesApi;transfersApi;exchangeApi;nftCheckoutPrimaryApi;usersApi;withdrawalsApi;balanceApi;assetApi;collectionApi;metadataApi;metadataRefreshesApi;projectsApi;constructor(e){const t=new eB(e);this.immutableX=new PN(t.immutableXConfig),this.depositsApi=this.immutableX.depositsApi,this.mintsApi=this.immutableX.mintsApi,this.ordersApi=this.immutableX.ordersApi,this.tokensApi=this.immutableX.tokensApi,this.tradesApi=this.immutableX.tradesApi,this.transfersApi=this.immutableX.transfersApi,this.exchangeApi=this.immutableX.exchangeApi,this.usersApi=this.immutableX.usersApi,this.withdrawalsApi=this.immutableX.withdrawalsApi,this.balanceApi=this.immutableX.balanceApi,this.assetApi=this.immutableX.assetApi,this.collectionApi=this.immutableX.collectionApi,this.metadataApi=this.immutableX.metadataApi,this.metadataRefreshesApi=this.immutableX.metadataRefreshesApi,this.nftCheckoutPrimaryApi=this.immutableX.nftCheckoutPrimaryApi,this.projectsApi=this.immutableX.projectsApi}getDeposit(e){return this.immutableX.getDeposit(e)}listDeposits(e){return this.immutableX.listDeposits(e)}getUser(e){return this.immutableX.getUser(e)}getAsset(e){return this.immutableX.getAsset(e)}listAssets(e){return this.immutableX.listAssets(e)}createCollection(e,t){return this.immutableX.createCollection(e,t)}getCollection(e){return this.immutableX.getCollection(e)}listCollectionFilters(e){return this.immutableX.listCollectionFilters(e)}listCollections(e){return this.collectionApi.listCollections(e).then((e=>e.data))}updateCollection(e,t,r){return this.immutableX.updateCollection(e,t,r)}addMetadataSchemaToCollection(e,t,r){return this.immutableX.addMetadataSchemaToCollection(e,t,r)}getMetadataSchema(e){return this.immutableX.getMetadataSchema(e)}updateMetadataSchemaByName(e,t,r,n){return this.immutableX.updateMetadataSchemaByName(e,t,r,n)}listMetadataRefreshes(e,t,r,n){return this.immutableX.listMetadataRefreshes(e,t,r,n)}getMetadataRefreshErrors(e,t,r,n){return this.immutableX.getMetadataRefreshErrors(e,t,r,n)}getMetadataRefreshResults(e,t){return this.immutableX.getMetadataRefreshResults(e,t)}createMetadataRefresh(e,t){return this.immutableX.createMetadataRefresh(e,t)}async createProject(e,t){return this.immutableX.createProject(e,t)}async getProject(e,t){return this.immutableX.getProject(e,t)}async getProjects(e,t,r,n,i){return this.immutableX.getProjects(e,t,r,n,i)}getBalance(e){return this.immutableX.getBalance(e)}listBalances(e){return this.immutableX.listBalances(e)}getMint(e){return this.immutableX.getMint(e)}listMints(e){return this.immutableX.listMints(e)}mint(e,t){return this.immutableX.mint(e,t)}listWithdrawals(e){return this.immutableX.listWithdrawals(e)}getWithdrawal(e){return this.immutableX.getWithdrawal(e)}getOrder(e){return this.immutableX.getOrder(e)}listOrders(e){return this.immutableX.listOrders(e)}getTrade(e){return this.immutableX.getTrade(e)}listTrades(e){return this.immutableX.listTrades(e)}getToken(e){return this.immutableX.getToken(e)}listTokens(e){return this.immutableX.listTokens(e)}getTransfer(e){return this.immutableX.getTransfer(e)}listTransfers(e){return this.immutableX.listTransfers(e)}createExchange(e){return this.immutableX.createExchange(e).then((e=>e.data))}getExchange(e){return this.immutableX.getExchange(e).then((e=>e.data))}getExchanges(e){return this.immutableX.getExchanges(e).then((e=>e.data))}exchangeTransfer(e,t){return this.immutableX.exchangeTransfer(e,t)}createNftPrimary(e){return this.immutableX.createNftPrimary(e).then((e=>e.data))}getCurrenciesNFTCheckoutPrimary(e){return this.immutableX.getCurrenciesNFTCheckoutPrimary(e).then((e=>e.data))}getNftPrimaryTransaction(e){return this.immutableX.getNftPrimaryTransaction(e).then((e=>e.data))}getNftPrimaryTransactions(e){return this.immutableX.getNftPrimaryTransactions(e).then((e=>e.data))}}var rB=Object.freeze({__proto__:null,IMXError:CN,ImmutableXClient:tB,imxClientCreateStarkSigner:Nx,imxClientGenerateLegacyStarkPrivateKey:JN});var nB={exports:{}};!function(e,t){e.exports=function(){var e=e||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==nr&&nr.crypto&&(r=nr.crypto),!r)try{r=Hb}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.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 r;return e.prototype=t,r=new e,e.prototype=null,r}}(),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)}},c=o.WordArray=s.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||f).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=o<<24-(n+a)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),u=a.enc={},f=u.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},l=u.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)))}},h=o.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,a=n.sigBytes,o=this.blockSize,s=a/(4*o),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*o,f=e.min(4*u,a);if(u){for(var d=0;d<u;d+=o)this._doProcessBlock(i,d);r=i.splice(0,u),n.sigBytes-=f}return new c.init(r,f)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=h.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.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,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new p.HMAC.init(e,r).finalize(t)}}});var p=a.algo={};return a}(Math);return e}()}(nB);var iB=nB.exports,aB=ir(iB),oB={exports:{}};!function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(s[i]=r(t.pow(n,.5))),c[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],f=o.SHA256=a.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],f=r[5],d=r[6],l=r[7],h=0;h<64;h++){if(h<16)u[h]=0|e[t+h];else{var p=u[h-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,b=u[h-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;u[h]=m+u[h-7]+y+u[h-16]}var g=n&i^n&a^i&a,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&f^~s&d)+c[h]+u[h];l=d,d=f,f=s,s=o+w|0,o=a,a=i,i=n,n=w+(v+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+f|0,r[6]=r[6]+d|0,r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=a._createHelper(f),r.HmacSHA256=a._createHmacHelper(f)}(Math),e.SHA256}(iB)}(oB);var sB=ir(oB.exports),cB={exports:{}};!function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],a=0,o=0;o<t;o++)if(o%4){var s=n[e.charCodeAt(o-1)]<<o%4*2|n[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=s<<24-a%4*8,a++}return r.create(i,a)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],a=0;a<r;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<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<r.length;a++)i[r.charCodeAt(a)]=a}var o=r.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(iB)}(cB);var uB=ir(cB.exports),fB={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(iB)}(fB);var dB=ir(fB.exports);function lB(e){this.message=e}lB.prototype=new Error,lB.prototype.name="InvalidCharacterError";var hB="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new lB("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,a=0,o="";n=t.charAt(a++);~n&&(r=i%4?64*r+n:n,i++%4)?o+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return o};function pB(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(hB(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return hB(t)}}function mB(e){this.message=e}function bB(e,t){if("string"!=typeof e)throw new mB("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(pB(e.split(".")[r]))}catch(e){throw new mB("Invalid token specified: "+e.message)}}mB.prototype=new Error,mB.prototype.name="InvalidTokenError";var yB,gB,vB,wB={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},_B=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(_B||{});(vB=_B||(_B={})).reset=function(){yB=3,gB=wB},vB.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");yB=e},vB.setLogger=function(e){gB=e};var EB=class{constructor(e){this._name=e}debug(...e){yB>=4&&gB.debug(EB._format(this._name,this._method),...e)}info(...e){yB>=3&&gB.info(EB._format(this._name,this._method),...e)}warn(...e){yB>=2&&gB.warn(EB._format(this._name,this._method),...e)}error(...e){yB>=1&&gB.error(EB._format(this._name,this._method),...e)}throw(e){throw this.error(e),e}create(e){const t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(e,t){const r=new EB(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){const r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){yB>=4&&gB.debug(EB._format(e),...t)}static info(e,...t){yB>=3&&gB.info(EB._format(e),...t)}static warn(e,...t){yB>=2&&gB.warn(EB._format(e),...t)}static error(e,...t){yB>=1&&gB.error(EB._format(e),...t)}};_B.reset();var TB,AB=class{static _randomWord(){return aB.lib.WordArray.random(1).words[0]}static generateUUIDv4(){const e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^AB._randomWord()&15>>+e/4).toString(16)));return e.replace(/-/g,"")}static generateCodeVerifier(){return AB.generateUUIDv4()+AB.generateUUIDv4()+AB.generateUUIDv4()}static generateCodeChallenge(e){try{const t=sB(e);return uB.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw EB.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const r=dB.parse([e,t].join(":"));return uB.stringify(r)}},SB=class{constructor(e){this._name=e,this._logger=new EB(`Event('${this._name}')`),this._callbacks=[]}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)t(...e)}},RB=class{static decode(e){try{return bB(e)}catch(e){throw EB.error("JwtUtils.decode",e),e}}},kB=class{static center({...e}){var t;return null==e.width&&(e.width=null!=(t=[800,720,600,480].find((e=>e<=window.outerWidth/1.618)))?t:360),null!=e.left||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),null!=e.height&&(null!=e.top||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter((([,e])=>null!=e)).map((([e,t])=>`${e}=${"boolean"!=typeof t?t:t?"yes":"no"}`)).join(",")}},OB=class extends SB{constructor(){super(...arguments),this._logger=new EB(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-OB.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=OB.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(e){const t=this._logger.create("init");e=Math.max(Math.floor(e),1);const r=OB.getEpochTime()+e;if(this.expiration===r&&this._timerHandle)return void t.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),t.debug("using duration",e),this._expiration=r;const n=Math.min(e,5);this._timerHandle=setInterval(this._callback,1e3*n)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},IB=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const r=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(r.slice(1))}},xB=class extends Error{constructor(e,t){var r,n,i;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw EB.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=null!=(r=e.error_description)?r:null,this.error_uri=null!=(n=e.error_uri)?n:null,this.state=e.userState,this.session_state=null!=(i=e.session_state)?i:null}},CB=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},MB=class{constructor(e){this._logger=new EB("AccessTokenEvents"),this._expiringTimer=new OB("Access token expiring"),this._expiredTimer=new OB("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}load(e){const t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){const r=e.expires_in;if(t.debug("access token present, remaining duration:",r),r>0){let e=r-this._expiringNotificationTimeInSeconds;e<=0&&(e=1),t.debug("registering expiring timer, raising in",e,"seconds"),this._expiringTimer.init(e)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const n=r+1;t.debug("registering expired timer, raising in",n,"seconds"),this._expiredTimer.init(n)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},PB=class{constructor(){this._logger=new EB("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},NB=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new EB("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:r,...n}=t;if(!r)return await fetch(e,n);const i=new AbortController,a=setTimeout((()=>i.abort()),1e3*r);try{return await fetch(e,{...t,signal:i.signal})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw new CB("Network timed out");throw e}finally{clearTimeout(a)}}async getJson(e,{token:t,credentials:r}={}){const n=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};let a;t&&(n.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this.appendExtraHeaders(i);try{n.debug("url:",e),a=await this.fetchWithTimeout(e,{method:"GET",headers:i,credentials:r})}catch(e){throw n.error("Network Error"),e}n.debug("HTTP response received, status",a.status);const o=a.headers.get("Content-Type");if(o&&!this._contentTypes.find((e=>o.startsWith(e)))&&n.throw(new Error(`Invalid response Content-Type: ${null!=o?o:"undefined"}, from URL: ${e}`)),a.ok&&this._jwtHandler&&(null==o?void 0:o.startsWith("application/jwt")))return await this._jwtHandler(await a.text());let s;try{s=await a.json()}catch(e){if(n.error("Error parsing JSON response",e),a.ok)throw e;throw new Error(`${a.statusText} (${a.status})`)}if(!a.ok){if(n.error("Error from server:",s),s.error)throw new xB(s);throw new Error(`${a.statusText} (${a.status}): ${JSON.stringify(s)}`)}return s}async postForm(e,{body:t,basicAuth:r,timeoutInSeconds:n,initCredentials:i}){const a=this._logger.create("postForm"),o={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};let s;void 0!==r&&(o.Authorization="Basic "+r),this.appendExtraHeaders(o);try{a.debug("url:",e),s=await this.fetchWithTimeout(e,{method:"POST",headers:o,body:t,timeoutInSeconds:n,credentials:i})}catch(e){throw a.error("Network error"),e}a.debug("HTTP response received, status",s.status);const c=s.headers.get("Content-Type");if(c&&!this._contentTypes.find((e=>c.startsWith(e))))throw new Error(`Invalid response Content-Type: ${null!=c?c:"undefined"}, from URL: ${e}`);const u=await s.text();let f={};if(u)try{f=JSON.parse(u)}catch(e){if(a.error("Error parsing JSON response",e),s.ok)throw e;throw new Error(`${s.statusText} (${s.status})`)}if(!s.ok){if(a.error("Error from server:",f),f.error)throw new xB(f,t);throw new Error(`${s.statusText} (${s.status}): ${JSON.stringify(f)}`)}return f}appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),r=Object.keys(this._extraHeaders),n=["authorization","accept","content-type"];0!==r.length&&r.forEach((r=>{if(n.includes(r.toLocaleLowerCase()))return void t.warn("Protected header could not be overridden",r,n);const i="function"==typeof this._extraHeaders[r]?this._extraHeaders[r]():this._extraHeaders[r];i&&""!==i&&(e[r]=i)}))}},BB=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new EB("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){this._logger.create(`get('${e}')`),e=this._prefix+e;return await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let r=0;r<e;r++){const e=await this._store.key(r);e&&0===e.indexOf(this._prefix)&&t.push(e.substr(this._prefix.length))}return t}},DB=class{constructor({authority:e,metadataUrl:t,metadata:r,signingKeys:n,metadataSeed:i,client_id:a,client_secret:o,response_type:s="code",scope:c="openid",redirect_uri:u,post_logout_redirect_uri:f,client_authentication:d="client_secret_post",prompt:l,display:h,max_age:p,ui_locales:m,acr_values:b,resource:y,response_mode:g="query",filterProtocolClaims:v=!0,loadUserInfo:w=!1,staleStateAgeInSeconds:_=900,clockSkewInSeconds:E=300,userInfoJwtIssuer:T="OP",mergeClaims:A=!1,disablePKCE:S=!1,stateStore:R,refreshTokenCredentials:k,revokeTokenAdditionalContentTypes:O,fetchRequestCredentials:I,refreshTokenAllowedScope:x,extraQueryParams:C={},extraTokenParams:M={},extraHeaders:P={}}){if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=r,this.metadataSeed=i,this.signingKeys=n,this.client_id=a,this.client_secret=o,this.response_type=s,this.scope=c,this.redirect_uri=u,this.post_logout_redirect_uri=f,this.client_authentication=d,this.prompt=l,this.display=h,this.max_age=p,this.ui_locales=m,this.acr_values=b,this.resource=y,this.response_mode=g,this.filterProtocolClaims=null==v||v,this.loadUserInfo=!!w,this.staleStateAgeInSeconds=_,this.clockSkewInSeconds=E,this.userInfoJwtIssuer=T,this.mergeClaims=!!A,this.disablePKCE=!!S,this.revokeTokenAdditionalContentTypes=O,I&&k&&console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."),this.fetchRequestCredentials=I||(k||"same-origin"),R)this.stateStore=R;else{const e="undefined"!=typeof window?window.localStorage:new PB;this.stateStore=new BB({store:e})}this.refreshTokenAllowedScope=x,this.extraQueryParams=C,this.extraTokenParams=M,this.extraHeaders=P}},FB=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new EB("TokenClient"),this._jsonService=new NB(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:r=this._settings.client_id,client_secret:n=this._settings.client_secret,...i}){const a=this._logger.create("exchangeCode");r||a.throw(new Error("A client_id is required")),t||a.throw(new Error("A redirect_uri is required")),i.code||a.throw(new Error("A code is required"));const o=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!n)throw a.throw(new Error("A client_secret is required")),null;s=AB.generateBasicAuth(r,n);break;case"client_secret_post":o.append("client_id",r),n&&o.append("client_secret",n)}const c=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(c,{body:o,basicAuth:s,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,scope:n=this._settings.scope,...i}){const a=this._logger.create("exchangeCredentials");t||a.throw(new Error("A client_id is required"));const o=new URLSearchParams({grant_type:e,scope:n});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw a.throw(new Error("A client_secret is required")),null;s=AB.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r)}const c=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(c,{body:o,basicAuth:s,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,timeoutInSeconds:n,...i}){const a=this._logger.create("exchangeRefreshToken");t||a.throw(new Error("A client_id is required")),i.refresh_token||a.throw(new Error("A refresh_token is required"));const o=new URLSearchParams({grant_type:e});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw a.throw(new Error("A client_secret is required")),null;s=AB.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r)}const c=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(c,{body:o,basicAuth:s,timeoutInSeconds:n,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async revoke(e){var t;const r=this._logger.create("revoke");e.token||r.throw(new Error("A token is required"));const n=await this._metadataService.getRevocationEndpoint(!1);r.debug(`got revocation endpoint, revoking ${null!=(t=e.token_type_hint)?t:"default token type"}`);const i=new URLSearchParams;for(const[t,r]of Object.entries(e))null!=r&&i.set(t,r);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(n,{body:i}),r.debug("got response")}},LB=class{constructor(e){this.id=e.id||AB.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=OB.getEpochTime(),this.request_type=e.request_type}toStorageString(){return new EB("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})}static fromStorageString(e){return EB.createStatic("State","fromStorageString"),new LB(JSON.parse(e))}static async clearStaleState(e,t){const r=EB.createStatic("State","clearStaleState"),n=OB.getEpochTime()-t,i=await e.getAllKeys();r.debug("got keys",i);for(let t=0;t<i.length;t++){const a=i[t],o=await e.get(a);let s=!1;if(o)try{const e=LB.fromStorageString(o);r.debug("got item from key:",a,e.created),e.created<=n&&(s=!0)}catch(e){r.error("Error parsing state for key:",a,e),s=!0}else r.debug("no item in storage for key:",a),s=!0;s&&(r.debug("removed item for key:",a),e.remove(a))}}},UB=class extends LB{constructor(e){super(e),!0===e.code_verifier?this.code_verifier=AB.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=AB.generateCodeChallenge(this.code_verifier)),this.authority=e.authority,this.client_id=e.client_id,this.redirect_uri=e.redirect_uri,this.scope=e.scope,this.client_secret=e.client_secret,this.extraTokenParams=e.extraTokenParams,this.response_mode=e.response_mode,this.skipUserInfo=e.skipUserInfo}toStorageString(){return new EB("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(e){EB.createStatic("SigninState","fromStorageString");const t=JSON.parse(e);return new UB(t)}},jB=class{constructor(e){this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-OB.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+OB.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},qB=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],zB=["sub","iss","aud","exp","iat"],HB=class{constructor(e){var t;this.id_token=e.id_token,this.session_state=null!=(t=e.session_state)?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-OB.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+OB.getEpochTime())}get expired(){const e=this.expires_in;if(void 0!==e)return e<=0}get scopes(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}toStorageString(){return new EB("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(e){return EB.createStatic("User","fromStorageString"),new HB(JSON.parse(e))}},GB="oidc-client",VB=class{constructor(){this._abort=new SB("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:r,keepOpen:n}=await new Promise(((r,n)=>{const i=i=>{var a;const o=i.data,s=null!=(a=e.scriptOrigin)?a:window.location.origin;if(i.origin===s&&(null==o?void 0:o.source)===GB){try{const r=IB.readParams(o.url,e.response_mode).get("state");if(r||t.warn("no state found in response url"),i.source!==this._window&&r!==e.state)return}catch(e){this._dispose(),n(new Error("Invalid response from window"))}r(o)}};window.addEventListener("message",i,!1),this._disposeHandlers.add((()=>window.removeEventListener("message",i,!1))),this._disposeHandlers.add(this._abort.addHandler((e=>{this._dispose(),n(e)})))}));return t.debug("got response from window"),this._dispose(),n||this.close(),{url:r}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,r=!1,n=window.location.origin){e.postMessage({source:GB,url:t,keepOpen:r},n)}},WB={location:!1,toolbar:!1,height:640},KB="_blank",XB=60,$B=2,JB=10,YB=class extends DB{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:n=WB,popupWindowTarget:i=KB,redirectMethod:a="assign",redirectTarget:o="self",iframeNotifyParentOrigin:s=e.iframeNotifyParentOrigin,iframeScriptOrigin:c=e.iframeScriptOrigin,silent_redirect_uri:u=e.redirect_uri,silentRequestTimeoutInSeconds:f=JB,automaticSilentRenew:d=!0,validateSubOnSilentRenew:l=!0,includeIdTokenInSilentRenew:h=!1,monitorSession:p=!1,monitorAnonymousSession:m=!1,checkSessionIntervalInSeconds:b=$B,query_status_response_type:y="code",stopCheckSessionOnError:g=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:w=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=XB,userStore:T}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=r,this.popupWindowFeatures=n,this.popupWindowTarget=i,this.redirectMethod=a,this.redirectTarget=o,this.iframeNotifyParentOrigin=s,this.iframeScriptOrigin=c,this.silent_redirect_uri=u,this.silentRequestTimeoutInSeconds=f,this.automaticSilentRenew=d,this.validateSubOnSilentRenew=l,this.includeIdTokenInSilentRenew=h,this.monitorSession=p,this.monitorAnonymousSession=m,this.checkSessionIntervalInSeconds=b,this.stopCheckSessionOnError=g,this.query_status_response_type=y,this.revokeTokenTypes=v,this.revokeTokensOnSignout=w,this.includeIdTokenInSilentSignout=_,this.accessTokenExpiringNotificationTimeInSeconds=E,T)this.userStore=T;else{const e="undefined"!=typeof window?window.sessionStorage:new PB;this.userStore=new BB({store:e})}}},QB=class extends VB{constructor({silentRequestTimeoutInSeconds:e=JB}){super(),this._logger=new EB("IFrameWindow"),this._timeoutInSeconds=e,this._frame=QB.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const t=setTimeout((()=>this._abort.raise(new CB("IFrame timed out without a response"))),1e3*this._timeoutInSeconds);return this._disposeHandlers.add((()=>clearTimeout(t))),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(e=>{var t;const r=e.target;null==(t=r.parentNode)||t.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},ZB=class extends VB{constructor({popupWindowTarget:e=KB,popupWindowFeatures:t={}}){super(),this._logger=new EB("PopupWindow");const r=kB.center({...WB,...t});this._window=window.open(void 0,e,kB.serialize(r))}async navigate(e){var t;null==(t=this._window)||t.focus();const r=setInterval((()=>{this._window&&!this._window.closed||this._abort.raise(new Error("Popup closed by user"))}),500);return this._disposeHandlers.add((()=>clearInterval(r))),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},eD=class extends MB{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new EB("UserManagerEvents"),this._userLoaded=new SB("User loaded"),this._userUnloaded=new SB("User unloaded"),this._silentRenewError=new SB("Silent renew error"),this._userSignedIn=new SB("User signed in"),this._userSignedOut=new SB("User signed out"),this._userSessionChanged=new SB("User session changed")}load(e,t=!0){super.load(e),t&&this._userLoaded.raise(e)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}_raiseSilentRenewError(e){this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}},tD=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(tD||{}),rD=((TB=rD||{}).SyncWeb3Method="SYNC_WEB3_METHOD",TB.DuplicateIframe="DUPLICATE_IFRAME",TB.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",TB.DeprecationNotice="DEPRECATION_NOTICE",TB),nD=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e[e.RedirectLoginComplete=-10015]="RedirectLoginComplete",e))(nD||{}),iD=(e=>(e.MetaMask="metamask",e.CoinbaseWallet="coinbase_wallet",e))(iD||{}),aD=(e=>(e.WalletSelected="wallet_selected",e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e))(aD||{}),oD=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.SendGaslessTransaction="eth_sendGaslessTransaction",e))(oD||{}),sD=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e))(sD||{}),cD=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(cD||{}),uD=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(uD||{}),fD=(e=>(e.Retry="retry",e))(fD||{}),dD=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(dD||{}),lD=(e=>(e.VerifyEmailOtp="verify-email-otp",e.Cancel="cancel",e))(lD||{}),hD=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.ExpiredEmailOtp="expired-email-otp",e))(hD||{}),pD=(e=>(e.Retry="device-retry",e))(pD||{}),mD=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(mD||{}),bD=(e=>(e.Harmony="HARMONY",e))(bD||{}),yD=(e=>(e.PhoneNumber="phone_number",e))(yD||{}),gD=Object.create,vD=Object.defineProperty,wD=Object.defineProperties,_D=Object.getOwnPropertyDescriptor,ED=Object.getOwnPropertyDescriptors,TD=Object.getOwnPropertyNames,AD=Object.getOwnPropertySymbols,SD=Object.getPrototypeOf,RD=Object.prototype.hasOwnProperty,kD=Object.prototype.propertyIsEnumerable,OD=(e,t,r)=>t in e?vD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ID=(e,t)=>{for(var r in t||(t={}))RD.call(t,r)&&OD(e,r,t[r]);if(AD)for(var r of AD(t))kD.call(t,r)&&OD(e,r,t[r]);return e},xD=(e,t)=>wD(e,ED(t)),CD=(e,t,r)=>new Promise(((n,i)=>{var a=e=>{try{s(r.next(e))}catch(e){i(e)}},o=e=>{try{s(r.throw(e))}catch(e){i(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,o);s((r=r.apply(e,t)).next())})),MD=((e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports))(((e,t)=>{var r=Object.prototype.hasOwnProperty,n="~";function i(){}function a(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,r,i,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new a(r,i||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),c.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)r.call(e,t)&&i.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},c.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},c.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},c.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c,u,f=this._events[s],d=arguments.length;if(f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),d){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,r),!0;case 4:return f.fn.call(f.context,t,r,i),!0;case 5:return f.fn.call(f.context,t,r,i,a),!0;case 6:return f.fn.call(f.context,t,r,i,a,o),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];f.fn.apply(f.context,c)}else{var l,h=f.length;for(u=0;u<h;u++)switch(f[u].once&&this.removeListener(e,f[u].fn,void 0,!0),d){case 1:f[u].fn.call(f[u].context);break;case 2:f[u].fn.call(f[u].context,t);break;case 3:f[u].fn.call(f[u].context,t,r);break;case 4:f[u].fn.call(f[u].context,t,r,i);break;default:if(!c)for(l=1,c=new Array(d-1);l<d;l++)c[l-1]=arguments[l];f[u].fn.apply(f[u].context,c)}}return!0},c.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},c.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},c.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!r||o.context===r)&&s(this,a);else{for(var c=0,u=[],f=o.length;c<f;c++)(o[c].fn!==t||i&&!o[c].once||r&&o[c].context!==r)&&u.push(o[c]);u.length?this._events[a]=1===u.length?u[0]:u:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,typeof t<"u"&&(t.exports=c)}));var PD={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},ND="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},BD=ND,DD=function(e){let t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=PD,n=(t=e.exports={}).re=[],i=t.src=[],a=t.t={},o=0,s=(e,t,r)=>{let s=o++;BD(s,t),a[e]=s,i[s]=t,n[s]=new RegExp(t,r?"g":void 0)};s("NUMERICIDENTIFIER","0|[1-9]\\d*"),s("NUMERICIDENTIFIERLOOSE","[0-9]+"),s("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),s("MAINVERSION",`(${i[a.NUMERICIDENTIFIER]})\\.(${i[a.NUMERICIDENTIFIER]})\\.(${i[a.NUMERICIDENTIFIER]})`),s("MAINVERSIONLOOSE",`(${i[a.NUMERICIDENTIFIERLOOSE]})\\.(${i[a.NUMERICIDENTIFIERLOOSE]})\\.(${i[a.NUMERICIDENTIFIERLOOSE]})`),s("PRERELEASEIDENTIFIER",`(?:${i[a.NUMERICIDENTIFIER]}|${i[a.NONNUMERICIDENTIFIER]})`),s("PRERELEASEIDENTIFIERLOOSE",`(?:${i[a.NUMERICIDENTIFIERLOOSE]}|${i[a.NONNUMERICIDENTIFIER]})`),s("PRERELEASE",`(?:-(${i[a.PRERELEASEIDENTIFIER]}(?:\\.${i[a.PRERELEASEIDENTIFIER]})*))`),s("PRERELEASELOOSE",`(?:-?(${i[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${i[a.PRERELEASEIDENTIFIERLOOSE]})*))`),s("BUILDIDENTIFIER","[0-9A-Za-z-]+"),s("BUILD",`(?:\\+(${i[a.BUILDIDENTIFIER]}(?:\\.${i[a.BUILDIDENTIFIER]})*))`),s("FULLPLAIN",`v?${i[a.MAINVERSION]}${i[a.PRERELEASE]}?${i[a.BUILD]}?`),s("FULL",`^${i[a.FULLPLAIN]}$`),s("LOOSEPLAIN",`[v=\\s]*${i[a.MAINVERSIONLOOSE]}${i[a.PRERELEASELOOSE]}?${i[a.BUILD]}?`),s("LOOSE",`^${i[a.LOOSEPLAIN]}$`),s("GTLT","((?:<|>)?=?)"),s("XRANGEIDENTIFIERLOOSE",`${i[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),s("XRANGEIDENTIFIER",`${i[a.NUMERICIDENTIFIER]}|x|X|\\*`),s("XRANGEPLAIN",`[v=\\s]*(${i[a.XRANGEIDENTIFIER]})(?:\\.(${i[a.XRANGEIDENTIFIER]})(?:\\.(${i[a.XRANGEIDENTIFIER]})(?:${i[a.PRERELEASE]})?${i[a.BUILD]}?)?)?`),s("XRANGEPLAINLOOSE",`[v=\\s]*(${i[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[a.XRANGEIDENTIFIERLOOSE]})(?:${i[a.PRERELEASELOOSE]})?${i[a.BUILD]}?)?)?`),s("XRANGE",`^${i[a.GTLT]}\\s*${i[a.XRANGEPLAIN]}$`),s("XRANGELOOSE",`^${i[a.GTLT]}\\s*${i[a.XRANGEPLAINLOOSE]}$`),s("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),s("COERCERTL",i[a.COERCE],!0),s("LONETILDE","(?:~>?)"),s("TILDETRIM",`(\\s*)${i[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",s("TILDE",`^${i[a.LONETILDE]}${i[a.XRANGEPLAIN]}$`),s("TILDELOOSE",`^${i[a.LONETILDE]}${i[a.XRANGEPLAINLOOSE]}$`),s("LONECARET","(?:\\^)"),s("CARETTRIM",`(\\s*)${i[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",s("CARET",`^${i[a.LONECARET]}${i[a.XRANGEPLAIN]}$`),s("CARETLOOSE",`^${i[a.LONECARET]}${i[a.XRANGEPLAINLOOSE]}$`),s("COMPARATORLOOSE",`^${i[a.GTLT]}\\s*(${i[a.LOOSEPLAIN]})$|^$`),s("COMPARATOR",`^${i[a.GTLT]}\\s*(${i[a.FULLPLAIN]})$|^$`),s("COMPARATORTRIM",`(\\s*)${i[a.GTLT]}\\s*(${i[a.LOOSEPLAIN]}|${i[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",s("HYPHENRANGE",`^\\s*(${i[a.XRANGEPLAIN]})\\s+-\\s+(${i[a.XRANGEPLAIN]})\\s*$`),s("HYPHENRANGELOOSE",`^\\s*(${i[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${i[a.XRANGEPLAINLOOSE]})\\s*$`),s("STAR","(<|>)?=?\\s*\\*"),s("GTE0","^\\s*>=\\s*0.0.0\\s*$"),s("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")})),FD=/^[0-9]+$/,LD=(e,t)=>{let r=FD.test(e),n=FD.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},UD={compareIdentifiers:LD,rcompareIdentifiers:(e,t)=>LD(t,e)},{MAX_LENGTH:jD,MAX_SAFE_INTEGER:qD}=PD,{re:zD,t:HD}=DD,{compareIdentifiers:GD}=UD,VD=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof VD){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>jD)throw new TypeError(`version is longer than ${jD} characters`);BD("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?zD[HD.LOOSE]:zD[HD.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>qD||this.major<0)throw new TypeError("Invalid major version");if(this.minor>qD||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>qD||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<qD)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(BD("SemVer.compare",this.version,this.options,e),!(e instanceof VD)){if("string"==typeof e&&e===this.version)return 0;e=new VD(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof VD||(e=new VD(e,this.options)),GD(this.major,e.major)||GD(this.minor,e.minor)||GD(this.patch,e.patch)}comparePre(e){if(e instanceof VD||(e=new VD(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(BD("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return GD(r,n)}while(++t)}compareBuild(e){e instanceof VD||(e=new VD(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(BD("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return GD(r,n)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}},WD=(e,t,r)=>new VD(e,r).compare(new VD(t,r)),KD=(e,t,r)=>0===WD(e,t,r),XD=(e,t,r)=>0!==WD(e,t,r),$D=(e,t,r)=>WD(e,t,r)>0,JD=(e,t,r)=>WD(e,t,r)>=0,YD=(e,t,r)=>WD(e,t,r)<0,QD=(e,t,r)=>WD(e,t,r)<=0,ZD=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return KD(e,r,n);case"!=":return XD(e,r,n);case">":return $D(e,r,n);case">=":return JD(e,r,n);case"<":return YD(e,r,n);case"<=":return QD(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},eF=Symbol("SemVer ANY"),tF=class{static get ANY(){return eF}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof tF){if(e.loose===!!t.loose)return e;e=e.value}BD("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===eF?this.value="":this.value=this.operator+this.semver.version,BD("comp",this)}parse(e){let t=this.options.loose?rF[nF.COMPARATORLOOSE]:rF[nF.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new VD(r[2],this.options.loose):this.semver=eF}toString(){return this.value}test(e){if(BD("Comparator.test",e,this.options.loose),this.semver===eF||e===eF)return!0;if("string"==typeof e)try{e=new VD(e,this.options)}catch(e){return!1}return ZD(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof tF))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new iF(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new iF(this.value,t).test(e.semver);let r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),n=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),i=this.semver.version===e.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),o=ZD(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),s=ZD(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||i&&a||o||s}},{re:rF,t:nF}=DD,iF=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof iF)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new iF(e.raw,t);if(e instanceof tF)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let{loose:t}=this.options;e=e.trim();let r=t?aF[oF.HYPHENRANGELOOSE]:aF[oF.HYPHENRANGE];e=e.replace(r,_F(this.options.includePrerelease)),BD("hyphen replace",e),e=e.replace(aF[oF.COMPARATORTRIM],sF),BD("comparator trim",e,aF[oF.COMPARATORTRIM]),e=(e=(e=e.replace(aF[oF.TILDETRIM],cF)).replace(aF[oF.CARETTRIM],uF)).split(/\s+/).join(" ");let n=t?aF[oF.COMPARATORLOOSE]:aF[oF.COMPARATOR];return e.split(" ").map((e=>dF(e,this.options))).join(" ").split(/\s+/).map((e=>wF(e,this.options))).filter(this.options.loose?e=>!!e.match(n):()=>!0).map((e=>new tF(e,this.options)))}intersects(e,t){if(!(e instanceof iF))throw new TypeError("a Range is required");return this.set.some((r=>fF(r,t)&&e.set.some((e=>fF(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new VD(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(EF(this.set[t],e,this.options))return!0;return!1}},{re:aF,t:oF,comparatorTrimReplace:sF,tildeTrimReplace:cF,caretTrimReplace:uF}=DD,fF=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},dF=(e,t)=>(BD("comp",e,t),e=mF(e,t),BD("caret",e),e=hF(e,t),BD("tildes",e),e=yF(e,t),BD("xrange",e),e=vF(e,t),BD("stars",e),e),lF=e=>!e||"x"===e.toLowerCase()||"*"===e,hF=(e,t)=>e.trim().split(/\s+/).map((e=>pF(e,t))).join(" "),pF=(e,t)=>{let r=t.loose?aF[oF.TILDELOOSE]:aF[oF.TILDE];return e.replace(r,((t,r,n,i,a)=>{let o;return BD("tilde",e,t,r,n,i,a),lF(r)?o="":lF(n)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:lF(i)?o=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(BD("replaceTilde pr",a),o=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):o=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,BD("tilde return",o),o}))},mF=(e,t)=>e.trim().split(/\s+/).map((e=>bF(e,t))).join(" "),bF=(e,t)=>{BD("caret",e,t);let r=t.loose?aF[oF.CARETLOOSE]:aF[oF.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,o)=>{let s;return BD("caret",e,t,r,i,a,o),lF(r)?s="":lF(i)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:lF(a)?s="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:o?(BD("replaceCaret pr",o),s="0"===r?"0"===i?`>=${r}.${i}.${a}-${o} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}-${o} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a}-${o} <${+r+1}.0.0-0`):(BD("no pr"),s="0"===r?"0"===i?`>=${r}.${i}.${a}${n} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a} <${+r+1}.0.0-0`),BD("caret return",s),s}))},yF=(e,t)=>(BD("replaceXRanges",e,t),e.split(/\s+/).map((e=>gF(e,t))).join(" ")),gF=(e,t)=>{e=e.trim();let r=t.loose?aF[oF.XRANGELOOSE]:aF[oF.XRANGE];return e.replace(r,((r,n,i,a,o,s)=>{BD("xRange",e,r,n,i,a,o,s);let c=lF(i),u=c||lF(a),f=u||lF(o),d=f;return"="===n&&d&&(n=""),s=t.includePrerelease?"-0":"",c?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(u&&(a=0),o=0,">"===n?(n=">=",u?(i=+i+1,a=0,o=0):(a=+a+1,o=0)):"<="===n&&(n="<",u?i=+i+1:a=+a+1),"<"===n&&(s="-0"),r=`${n+i}.${a}.${o}${s}`):u?r=`>=${i}.0.0${s} <${+i+1}.0.0-0`:f&&(r=`>=${i}.${a}.0${s} <${i}.${+a+1}.0-0`),BD("xRange return",r),r}))},vF=(e,t)=>(BD("replaceStars",e,t),e.trim().replace(aF[oF.STAR],"")),wF=(e,t)=>(BD("replaceGTE0",e,t),e.trim().replace(aF[t.includePrerelease?oF.GTE0PRE:oF.GTE0],"")),_F=e=>(t,r,n,i,a,o,s,c,u,f,d,l,h)=>`${r=lF(n)?"":lF(i)?`>=${n}.0.0${e?"-0":""}`:lF(a)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=lF(u)?"":lF(f)?`<${+u+1}.0.0-0`:lF(d)?`<${u}.${+f+1}.0-0`:l?`<=${u}.${f}.${d}-${l}`:e?`<${u}.${f}.${+d+1}-0`:`<=${c}`}`.trim(),EF=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(BD(e[r].semver),e[r].semver!==tF.ANY&&e[r].semver.prerelease.length>0){let n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0},TF=(e,t,r)=>{try{t=new iF(t,r)}catch(e){return!1}return t.test(e)},{MAX_LENGTH:AF}=PD,{re:SF,t:RF}=DD,kF=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof VD)return e;if("string"!=typeof e||e.length>AF||!(t.loose?SF[RF.LOOSE]:SF[RF.FULL]).test(e))return null;try{return new VD(e,t)}catch(e){return null}},{re:OF,t:IF}=DD,xF=(e,t)=>{if(e instanceof VD)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=OF[IF.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),OF[IF.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;OF[IF.COERCERTL].lastIndex=-1}else r=e.match(OF[IF.COERCE]);return null===r?null:kF(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function CF(e){return String.fromCharCode(parseInt(e.slice(1),16))}function MF(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function PF(e){return function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,CF))}(JSON.stringify(e))}function NF(e){return JSON.parse(function(e){return decodeURIComponent(Array.from(atob(e),MF).join(""))}(e))}function BF(e){return void 0===e}function DF(e){return function(e){return null===e}(e)||BF(e)}function FF(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var LF={};var UF={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"},jF=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,jF.prototype)}},qF=class extends Error{constructor(e){super(),this.__proto__=Error;let t=Number(null==e?void 0:e.code);this.rawMessage=(null==e?void 0:e.message)||"Internal error",this.code=function(e){return!DF(e)&&"number"==typeof e&&Object.values(nD).includes(e)}(t)?t:nD.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(null==e?void 0:e.data)||void 0,Object.setPrototypeOf(this,qF.prototype)}},zF=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},HF=class extends Error{constructor(e,t,r,n){super(`Magic Extension Error (${e.name}): [${t}] ${r}`),this.code=t,this.rawMessage=r,this.data=n,this.__proto__=Error,Object.setPrototypeOf(this,HF.prototype)}},GF=class{constructor(e,t,r){this.code=t,this.rawMessage=r,this.message=`Magic Extension Warning (${e.name}): [${t}] ${r}`}log(){console.warn(this.message)}};function VF(){return new jF(tD.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function WF(){return new jF(tD.MalformedResponse,"Response from the Magic iframe is malformed.")}function KF(e){return new jF(tD.ExtensionNotInitialized,`Extensions must be initialized with a Magic SDK instance before \`Extension.${e}\` can be accessed. Do not invoke \`Extension.${e}\` inside an extension constructor.`)}function XF(e){let t=`Some extensions are incompatible with \`${LF.sdkName}@${LF.version}\`:`;return e.filter((e=>void 0!==e.compat&&null!==e.compat)).forEach((e=>{let r=e.compat[LF.sdkName];"string"==typeof r?t+=`\n - Extension \`${e.name}\` supports version(s) \`${r}\``:r||(t+=`\n - Extension \`${e.name}\` does not support ${LF.platform} environments.`)})),new jF(tD.IncompatibleExtensions,t)}function $F(e){let{method:t,removalVersions:r,useInstead:n}=e,i=r[LF.sdkName],a=n?` Use \`${n}\` instead.`:"",o=`\`${t}\` will be removed from \`${LF.sdkName}\` in version \`${i}\`.${a}`;return new zF(rD.DeprecationNotice,o)}var JF=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function YF(){return JF.next().value}var QF=Symbol("Payload pre-processed by Magic SDK");function ZF(e){return Object.defineProperty(e,QF,{value:!0,enumerable:!1}),e}function eL(e){var t,r,n;return function(e){return!!e[QF]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=YF(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],ZF(e)),e}function tL(e,t=[]){return ZF({params:t,method:e,jsonrpc:"2.0",id:YF()})}var rL=class{constructor(e){e instanceof rL?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):function(e){return!DF(e)&&!(BF(e.jsonrpc)||BF(e.id)||BF(e.result)&&BF(e.error))}(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return void 0!==this._error&&null!==this._error}get hasResult(){return void 0!==this._result}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},nL=((e,t,r)=>(r=null!=e?gD(SD(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of TD(t))!RD.call(e,i)&&i!==r&&vD(e,i,{get:()=>t[i],enumerable:!(n=_D(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:vD(r,"default",{value:e,enumerable:!0}),e)))(MD()),iL=class extends nL.default{};function aL(){let e=new iL;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var oL=Symbol("isPromiEvent");function sL(e){return!!e[oL]}function cL(e){let t=uL(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=aL(),i=Symbol("Promise.then"),a=Symbol("Promise.catch"),o=Symbol("Promise.finally"),s=(e,t)=>(...r)=>{let n=t[e].apply(t,r);return c(n)},c=e=>Object.assign(e,{[oL]:!0,[i]:e[i]||e.then,[a]:e[a]||e.catch,[o]:e[o]||e.finally,then:s(i,e),catch:s(a,e),finally:s(o,e),on:n("on",e),once:n("once",e),addListener:n("addListener",e),off:n("off",e),removeListener:n("removeListener",e),removeAllListeners:n("removeAllListeners",e),emit:r("emit"),eventNames:r("eventNames"),listeners:r("listeners"),listenerCount:r("listenerCount")}),u=c(t.then((e=>(u.emit("done",e),u.emit("settled"),e)),(e=>{throw u.emit("error",e),u.emit("settled"),e})));return u}function uL(e){return new Promise(((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)}))}var fL=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(cD.MAGIC_HANDLE_REQUEST,eL(e)),r=cL(((e,r)=>{t.then((t=>{if(n(),t.hasError)r(new qF(t.payload.error));else{if(!t.hasResult)throw WF();e(t.payload.result)}})).catch((e=>{n(),r(e)}))})),n=this.overlay.on(sD.MAGIC_HANDLE_EVENT,(t=>{var n;let{response:i}=t.data;if(i.id===e.id&&(null==(n=i.result)?void 0:n.event)){let{event:e,params:t=[]}=i.result;r.emit(e,...t)}}));return r}createIntermediaryEvent(e,t){return r=>{let n=tL(oD.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}};var dL,lL={"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},hL=class extends fL{loginWithMagicLink(e){let t="@magic-sdk/react-native"===LF.sdkName||"@magic-sdk/react-native-bare"===LF.sdkName||"@magic-sdk/react-native-expo"===LF.sdkName;if(t&&function(e,t){let[r]=e.split(".").map(Number);return r>=t}(LF.version,19))throw new Error("loginWithMagicLink() is deprecated for this package, please utlize a passcode method like loginWithSMS or loginWithEmailOTP instead.");t&&$F({method:"auth.loginWithMagicLink()",removalVersions:lL,useInstead:"auth.loginWithEmailOTP()"}).log();let{email:r,showUI:n=!0,redirectURI:i,overrides:a}=e,o=tL(this.sdk.testMode?oD.LoginWithMagicLinkTestMode:oD.LoginWithMagicLink,[{email:r,showUI:n,redirectURI:i,overrides:a}]);return this.request(o)}loginWithSMS(e){let{phoneNumber:t}=e,r=tL(this.sdk.testMode?oD.LoginWithSmsTestMode:oD.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r,deviceCheckUI:n,overrides:i}=e,a=tL(this.sdk.testMode?oD.LoginWithEmailOTPTestMode:oD.LoginWithEmailOTP,[{email:t,showUI:r,deviceCheckUI:n,overrides:i}]),o=this.request(a);return!n&&o&&o.on(pD.Retry,(()=>{this.createIntermediaryEvent(pD.Retry,a.id)()})),!r&&o&&(o.on(lD.VerifyEmailOtp,(e=>{this.createIntermediaryEvent(lD.VerifyEmailOtp,a.id)(e)})),o.on(lD.Cancel,(()=>{this.createIntermediaryEvent(lD.Cancel,a.id)()}))),o}loginWithCredential(e){let t=null!=e?e:"";if(!e&&"web"===LF.platform){t=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let r=tL(this.sdk.testMode?oD.LoginWithCredentialTestMode:oD.LoginWithCredential,[t]);return this.request(r)}setAuthorizationToken(e){let t=tL(oD.SetAuthorizationToken,[{jwt:e}]);return this.request(t)}updateEmailWithUI(e){let{email:t,showUI:r=!0}=e,n=tL(this.sdk.testMode?oD.UpdateEmailTestMode:oD.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}},pL={};function mL(e){return(...t)=>CD(this,null,(function*(){return dL||(dL=yield LF.configureStorage()),yield dL.ready(),dL[e](...t)}))}((e,t)=>{for(var r in t)vD(e,r,{get:t[r],enumerable:!0})})(pL,{clear:()=>vL,getItem:()=>bL,iterate:()=>TL,key:()=>_L,keys:()=>EL,length:()=>wL,removeItem:()=>gL,setItem:()=>yL});var bL=mL("getItem"),yL=mL("setItem"),gL=mL("removeItem"),vL=mL("clear"),wL=mL("length"),_L=mL("key"),EL=mL("keys"),TL=mL("iterate"),AL=class extends fL{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}getIdToken(e){let t=tL(this.sdk.testMode?oD.GetIdTokenTestMode:oD.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=tL(this.sdk.testMode?oD.GenerateIdTokenTestMode:oD.GenerateIdToken,[e]);return this.request(t)}getInfo(){return CD(this,null,(function*(){let e=yield bL(this.localForageKey),t=tL(oD.GetInfo,[{walletType:e}]);return this.request(t)}))}isLoggedIn(){let e=tL(this.sdk.testMode?oD.IsLoggedInTestMode:oD.IsLoggedIn);return this.request(e)}logout(){gL(this.localForageKey);let e=tL(this.sdk.testMode?oD.LogoutTestMode:oD.Logout);return this.request(e)}requestInfoWithUI(e){let t=tL(oD.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}showSettings(e){let t=tL(this.sdk.testMode?oD.UserSettingsTestMode:oD.UserSettings,[e]);return this.request(t)}recoverAccount(e){let t=tL(this.sdk.testMode?oD.RecoverAccountTestMode:oD.RecoverAccount,[e]);return this.request(t)}getMetadata(){$F({method:"user.getMetadata()",removalVersions:lL,useInstead:"user.getInfo()"}).log();let e=tL(this.sdk.testMode?oD.GetMetadataTestMode:oD.GetMetadata);return this.request(e)}updateEmail(e){$F({method:"user.updateEmail()",removalVersions:lL,useInstead:"auth.updateEmailWithUI()"}).log();let{email:t,showUI:r=!0}=e,n=tL(this.sdk.testMode?oD.UpdateEmailTestMode:oD.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}};function SL(e,t){return t?new URL(e,t):new URL(e)}function RL(){let e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=191&e[8]|128;let t="";return t+=e[0].toString(16),t+=e[1].toString(16),t+=e[2].toString(16),t+=e[3].toString(16),t+="-",t+=e[4].toString(16),t+=e[5].toString(16),t+="-",t+=e[6].toString(16),t+=e[7].toString(16),t+="-",t+=e[8].toString(16),t+=e[9].toString(16),t+="-",t+=e[10].toString(16),t+=e[11].toString(16),t+=e[12].toString(16),t+=e[13].toString(16),t+=e[14].toString(16),t+=e[15].toString(16),t}var kL="STORE_KEY_PRIVATE_KEY",OL="STORE_KEY_PUBLIC_JWK",IL="ECDSA",xL={name:IL,namedCurve:"P-256"};function CL(){return CD(this,null,(function*(){let e=yield function(){return CD(this,null,(function*(){if(function(){let e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return(yield bL(OL))||(yield function(){return CD(this,null,(function*(){let{subtle:e}=window.crypto,t=yield e.generateKey(xL,!1,["sign"]),r=yield e.exportKey("jwk",t.publicKey);yield yL(kL,t.privateKey),yield yL(OL,r)}))}()),bL(OL);console.info("webcrypto is not supported")}))}();if(!e)return void console.info("unable to create public key or webcrypto is unsupported");let{subtle:t}=window.crypto,r=yield bL(kL);if(!r||!t)return void console.info("unable to find private key or webcrypto unsupported");let n={iat:Math.floor((new Date).getTime()/1e3),jti:RL()},i={typ:"dpop+jwt",alg:"ES256",jwk:e},a=ML(JSON.stringify(i)),o=ML(JSON.stringify(n)),s=function(e){return(new TextEncoder).encode(e)}(`${a}.${o}`),c={name:IL,hash:{name:"SHA-256"}},u=function(e){let t="";return e.forEach((e=>{t+=String.fromCharCode(e)})),PL(t)}(new Uint8Array(yield t.sign(c,r,s)));return`${a}.${o}.${u}`}))}function ML(e){return PL(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}(e))}function PL(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var NL=class extends fL{constructor(){super(...arguments),this.localForageKey="mc_active_wallet"}connectWithUI(){let e=cL(((t,r)=>CD(this,null,(function*(){try{if(this.isMetaMaskBrowser()&&(yield this.isWalletEnabled(iD.MetaMask))){let e=yield this.autoConnectIfWalletBrowser(iD.MetaMask);return void t(e)}if(this.isCoinbaseWalletBrowser()&&(yield this.isWalletEnabled(iD.CoinbaseWallet))){let e=yield this.autoConnectIfWalletBrowser(iD.CoinbaseWallet);return void t(e)}let n=this.getUserEnv(),i=tL(oD.Login,[n]),a=this.request(i);a.on(aD.WalletSelected,(e=>this.handleWalletSelected(xD(ID({},e),{payloadId:i.id})))),a.on("id-token-created",(t=>{e.emit("id-token-created",t)}));let o=yield a;o.error&&r(o),t(o)}catch(e){r(e)}}))));return e}showUI(){return this.request(tL(oD.ShowUI))}showAddress(){return this.request(tL(oD.ShowAddress))}showSendTokensUI(){return this.request(tL(oD.ShowSendTokensUI))}showOnRamp(){return this.request(tL(oD.ShowOnRamp))}showNFTs(){return this.request(tL(oD.ShowNFTs))}showBalances(){return this.request(tL(oD.ShowBalances))}sendGaslessTransaction(e,t){return this.request(tL(oD.SendGaslessTransaction,[e,t]))}getInfo(){return CD(this,null,(function*(){$F({method:"wallet.getInfo()",removalVersions:lL,useInstead:"user.getInfo()"}).log();let e=yield bL(this.localForageKey),t=tL(oD.GetInfo,[{walletType:e}]);return this.request(t)}))}disconnect(){$F({method:"wallet.disconnect()",removalVersions:lL,useInstead:"user.logout()"}).log(),gL(this.localForageKey);let e=tL(oD.Disconnect);return this.request(e)}requestUserInfoWithUI(e){$F({method:"wallet.requestUserInfoWithUI()",removalVersions:lL,useInstead:"user.requestUserInfoWithUI()"}).log();let t=tL(oD.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}getProvider(){return CD(this,null,(function*(){switch(yield bL(this.localForageKey)){case iD.MetaMask:return this.getMetaMaskProvider();case iD.CoinbaseWallet:return this.getCoinbaseProvider();default:return this.sdk.rpcProvider}}))}isMetaMaskInstalled(){var e,t,r;return(null==(e=window.ethereum)?void 0:e.isMetaMask)||!(null==(r=null==(t=window.ethereum)?void 0:t.providers)||!r.find((e=>null==e?void 0:e.isMetaMask)))}isMetaMaskBrowser(){return this.isMobile()&&this.isMetaMaskInstalled()}getMetaMaskProvider(){var e,t;return(null==(t=null==(e=window.ethereum)?void 0:e.providers)?void 0:t.find((e=>null==e?void 0:e.isMetaMask)))||window.ethereum}connectToMetaMask(){if(this.isMobile()&&!this.isMetaMaskInstalled()){let e=`https://metamask.app.link/dapp/${window.location.href.replace(/(^\w+:|^)\/\//,"")}`;window.location.href=e}return this.getMetaMaskProvider().request({method:"eth_requestAccounts"})}isCoinbaseWalletInstalled(){var e,t,r;return(null==(e=window.ethereum)?void 0:e.isCoinbaseWallet)||!(null==(r=null==(t=window.ethereum)?void 0:t.providers)||!r.find((e=>null==e?void 0:e.isCoinbaseWallet)))}isCoinbaseWalletBrowser(){var e;return!(null==(e=window.ethereum)||!e.isCoinbaseBrowser)}getCoinbaseProvider(){var e,t;return(null==(t=null==(e=window.ethereum)?void 0:e.providers)?void 0:t.find((e=>null==e?void 0:e.isCoinbaseWallet)))||window.ethereum}connectToCoinbaseWallet(){if(this.isMobile()&&!this.isCoinbaseWalletBrowser()){let e=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(window.location.href)}`;window.location.href=e}return this.getCoinbaseProvider().request({method:"eth_requestAccounts"})}isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Silk|Opera Mini/i.test(navigator.userAgent)}getUserEnv(){return{env:{isMetaMaskInstalled:this.isMetaMaskInstalled(),isCoinbaseWalletInstalled:this.isCoinbaseWalletInstalled()}}}connectToThirdPartyWallet(e){switch(e){case iD.MetaMask:return this.connectToMetaMask();case iD.CoinbaseWallet:return this.connectToCoinbaseWallet();default:throw new Error(`Invalid provider: ${e}. Must be one of "metamask" or "coinbase_wallet".`)}}isWalletEnabled(e){let t=tL("mc_is_wallet_enabled",[{wallet:e}]);return this.request(t)}handleWalletSelected(e){return CD(this,null,(function*(){try{let t=yield this.connectToThirdPartyWallet(e.wallet);yield yL(this.localForageKey,e.wallet),this.createIntermediaryEvent(aD.WalletConnected,e.payloadId)(t)}catch(t){console.error(t),this.createIntermediaryEvent(aD.WalletRejected,e.payloadId)()}}))}autoConnectIfWalletBrowser(e){return CD(this,null,(function*(){let t;e===iD.MetaMask&&(t=yield this.getMetaMaskProvider().request({method:"eth_requestAccounts"})),e===iD.CoinbaseWallet&&(t=yield this.getCoinbaseProvider().request({method:"eth_requestAccounts"})),yield yL(this.localForageKey,e);let r=tL(oD.AutoConnect,[{wallet:e,address:t}]);return this.request(r)}))}},{createBoundEmitterMethod:BL,createChainingEmitterMethod:DL}=aL(),FL=class extends fL{constructor(){super(...arguments),this.isMagic=!0,this.on=DL("on",this),this.once=DL("once",this),this.addListener=DL("addListener",this),this.off=DL("off",this),this.removeListener=DL("removeListener",this),this.removeAllListeners=DL("removeAllListeners",this),this.emit=BL("emit"),this.eventNames=BL("eventNames"),this.listeners=BL("listeners"),this.listenerCount=BL("listenerCount")}sendAsync(e,t){if(!t)throw function(e){return new jF(tD.InvalidArgument,`Invalid ${(e=>{let t=e+1,r=t%10,n=t%100;return 1===r&&11!==n?`${t}st`:2===r&&12!==n?`${t}nd`:3===r&&13!==n?`${t}rd`:`${t}th`})(e.argument)} argument given to \`${e.procedure}\`.\n Expected: \`${e.expected}\`\n Received: \`${e.received}\``)}({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(cD.MAGIC_HANDLE_REQUEST,e.map((e=>{let t=eL(e);return this.prefixPayloadMethodForTestMode(t),t}))).then((e=>{t(null,e.map((e=>xD(ID({},e.payload),{error:e.hasError?new qF(e.payload.error):null}))))}));else{let r=eL(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(cD.MAGIC_HANDLE_REQUEST,r).then((e=>{t(e.hasError?new qF(e.payload.error):null,e.payload)}))}}send(e,t){if("string"==typeof e){let r=tL(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new zF(rD.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.");return r.log(),new rL(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=tL(oD.Login);return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){this.sdk.testMode&&(e.method=`testMode/eth/${e.method}`)}},LL=["request","overlay","sdk"];function UL(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==fL.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var jL=class extends fL{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:cL,isPromiEvent:sL,encodeJSON:PF,decodeJSON:NF,createJsonRpcRequestPayload:tL,standardizeJsonRpcRequestPayload:eL,storage:pL};let e=[this,...UL(this)];LL.forEach((t=>{let r=e.map((e=>Object.getOwnPropertyDescriptor(e,t))),n=r.findIndex((e=>!!e)),i=n>0,a=r[n];a&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:a,isPrototypeField:i}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw KF(t)}}))}))}init(e){this.__is_initialized__||(LL.forEach((e=>{if(this.__sdk_access_field_descriptors__.has(e)){let{descriptor:t,isPrototypeField:r}=this.__sdk_access_field_descriptors__.get(e);r?delete this[e]:Object.defineProperty(this,e,t)}})),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:r,useInstead:n}=e;return new GF(this,"DEPRECATION_NOTICE",`\`${t}\` will be removed from this Extension in version \`${r}\`.${n?` Use \`${n}\` instead.`:""}`)}createWarning(e,t){return new GF(this,e,t)}createError(e,t,r){return new HF(this,e,t,r)}},qL=class extends jL{};qL.Internal=class extends jL{},qL.Anonymous="anonymous extension";var zL=class extends fL{purchase(e){let t=tL(oD.NFTPurchase,[e]);return this.request(t)}checkout(e){let t=tL(oD.NFTCheckout,[e]);return this.request(t)}transfer(e){let t=tL(oD.NFTTransfer,[e]);return this.request(t)}};function HL(e){return!e.compat||null==e.compat[LF.sdkName]||("string"==typeof e.compat[LF.sdkName]?TF(xF(LF.version),e.compat[LF.sdkName]):!!e.compat[LF.sdkName])}function GL(e){var t;let r=null!=(t=null==e?void 0:e.extensions)?t:[],n={},i=[];if(Array.isArray(r)?r.forEach((e=>{HL(e)?(e.init(this),(e.name||e.name!==qL.Anonymous)&&(this[e.name]=e),e instanceof qL.Internal&&(FF(e.config)||(n[e.name]=e.config))):i.push(e)})):Object.keys(r).forEach((e=>{if(HL(r[e])){r[e].init(this);let t=r[e];this[e]=t,t instanceof qL.Internal&&(FF(t.config)||(n[r[e].name]=t.config))}else i.push(r[e])})),i.length)throw XF(i);return n}var VL=class{constructor(e,t){var r;if(this.apiKey=e,!e)throw VF();"react-native"===LF.platform&&(null==t?void 0:t.endpoint)&&new zF(rD.ReactNativeEndpointConfiguration,`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${LF.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`).log();let{defaultEndpoint:n,version:i}=LF;this.testMode=!(null==t||!t.testMode),this.endpoint=SL(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new hL(this),this.user=new AL(this),this.wallet=new NL(this),this.nft=new zL(this),this.rpcProvider=new FL(this);let a=GL.call(this,t);this.parameters=PF(ID({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:SL(this.endpoint).host,sdk:UF[LF.sdkName],version:i,ext:FF(a)?void 0:a,locale:(null==t?void 0:t.locale)||"en_US"},LF.bundleId?{bundleId:LF.bundleId}:{})),null!=t&&t.deferPreload||this.preload()}get overlay(){if(!VL.__overlays__.has(this.parameters)){let e=new LF.ViewController(this.endpoint,this.parameters);e.init(),VL.__overlays__.set(this.parameters,e)}return VL.__overlays__.get(this.parameters)}preload(){return CD(this,null,(function*(){yield this.overlay.ready}))}},WL=VL;function KL(e,t){var r;let n=null==(r=t.data.response)?void 0:r.id,i=function(e,t){return t&&Array.isArray(e)?e.find((e=>e.id===t)):e}(e,n);if(n&&i){return{id:n,response:new rL(i).applyResult(t.data.response.result).applyError(t.data.response.error)}}return{}}WL.__overlays__=new Map;var XL=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return CD(this,null,(function*(){return uL((r=>CD(this,null,(function*(){yield this.ready;let n=[],i=Array.isArray(t)?t.map((e=>e.id)):[],a=yield function(e,t){return CD(this,null,(function*(){let r,n=yield bL("rt");if("web"===LF.platform)try{r=yield CL()}catch(e){console.error("webcrypto error",e)}return r?n?{msgType:e,payload:t,jwt:r,rt:n}:{msgType:e,payload:t,jwt:r}:{msgType:e,payload:t}}))}(`${e}-${this.parameters}`,t);yield this._post(a);let o=this.on(sD.MAGIC_HANDLE_RESPONSE,(e=>a=>{let{id:o,response:s}=KL(t,a);(function(e){CD(this,null,(function*(){!e.data.rt||(yield yL("rt",e.data.rt))}))})(a),o&&s&&Array.isArray(t)&&i.includes(o)?(n.push(s),n.length===t.length&&(e(),r(n))):o&&s&&!Array.isArray(t)&&o===t.id&&(e(),r(s))})((()=>o())))}))))}))}on(e,t){let r=t.bind(window),n=t=>{t.data.msgType===`${e}-${this.parameters}`&&r(t)};return this.messageHandlers.add(n),()=>this.messageHandlers.delete(n)}waitForReady(){return new Promise((e=>{this.on(sD.MAGIC_OVERLAY_READY,(()=>e()))}))}listen(){this.on(sD.MAGIC_HIDE_OVERLAY,(()=>{this.hideOverlay()})),this.on(sD.MAGIC_SHOW_OVERLAY,(()=>{this.showOverlay()}))}},$L=Object.create,JL=Object.defineProperty,YL=Object.getOwnPropertyDescriptor,QL=Object.getOwnPropertyNames,ZL=Object.getPrototypeOf,eU=Object.prototype.hasOwnProperty,tU=(e=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(e,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):e)((function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')})),rU=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nU=(e,t,r)=>(r=null!=e?$L(ZL(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of QL(t))!eU.call(e,i)&&i!==r&&JL(e,i,{get:()=>t[i],enumerable:!(n=YL(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:JL(r,"default",{value:e,enumerable:!0}),e)),iU=(e,t,r)=>new Promise(((n,i)=>{var a=e=>{try{s(r.next(e))}catch(e){i(e)}},o=e=>{try{s(r.throw(e))}catch(e){i(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,o);s((r=r.apply(e,t)).next())})),aU=rU(((e,t)=>{!function(r){if("object"==typeof e&&typeof t<"u")t.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).localforage=r()}}((function(){return function e(t,r,n){function i(o,s){if(!r[o]){if(!t[o]){var c="function"==typeof tU&&tU;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var f=r[o]={exports:{}};t[o][0].call(f.exports,(function(e){return i(t[o][1][e]||e)}),f,f.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof tU&&tU,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){(function(e){var r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var i=0,a=new n(f),o=e.document.createTextNode("");a.observe(o,{characterData:!0}),r=function(){o.data=i=++i%2}}else if(!e.setImmediate&&typeof e.MessageChannel<"u"){var s=new e.MessageChannel;s.port1.onmessage=f,r=function(){s.port2.postMessage(0)}}else r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};var c,u=[];function f(){c=!0;for(var e,t,r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}c=!1}t.exports=function(e){1===u.push(e)&&!c&&r()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(e,t,r){var n=e(1);function i(){}var a={},o=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==i&&h(this,e)}function f(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function d(e,t,r){n((function(){var n;try{n=t(r)}catch(t){return a.reject(e,t)}n===e?a.reject(e,new TypeError("Cannot resolve promise with itself")):a.resolve(e,n)}))}function l(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var r=!1;function n(t){r||(r=!0,a.reject(e,t))}function i(t){r||(r=!0,a.resolve(e,t))}var o=p((function(){t(i,n)}));"error"===o.status&&n(o.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(i);this.state!==c?d(r,this.state===s?e:t,this.outcome):this.queue.push(new f(r,e,t));return r},f.prototype.callFulfilled=function(e){a.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){a.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},a.resolve=function(e,t){var r=p(l,t);if("error"===r.status)return a.reject(e,r.value);var n=r.value;if(n)h(e,n);else{e.state=s,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},a.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:a.resolve(new this(i),e)},u.reject=function(e){var t=new this(i);return a.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=new Array(r),s=0,c=-1,u=new this(i);++c<r;)f(e[c],c);return u;function f(e,i){t.resolve(e).then((function(e){o[i]=e,++s===r&&!n&&(n=!0,a.resolve(u,o))}),(function(e){n||(n=!0,a.reject(u,e))}))}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=-1,s=new this(i);++o<r;)c(e[o]);return s;function c(e){t.resolve(e).then((function(e){n||(n=!0,a.resolve(s,e))}),(function(e){n||(n=!0,a.reject(s,e))}))}}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var i=function(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}();function a(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}typeof Promise>"u"&&e(3);var o=Promise;function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function c(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function u(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var d="local-forage-detect-blob-support",l=void 0,h={},p=Object.prototype.toString,m="readonly",b="readwrite";function y(e){return"boolean"==typeof l?o.resolve(l):function(e){return new o((function(t){var r=e.transaction(d,b),n=a([""]);r.objectStore(d).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return l=e}))}function g(e){var t=h[e.name],r={};r.promise=new o((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function v(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var r=h[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function _(e,t){return new o((function(r,n){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);g(e),e.db.close()}var a=[e.name];t&&a.push(e.version);var o=i.open.apply(i,a);t&&(o.onupgradeneeded=function(t){var r=o.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(d)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),n(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},r(t),v(e)}}))}function E(e){return _(e,!1)}function T(e){return _(e,!0)}function A(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function S(e){var t=function(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}(atob(e.data));return a([t],{type:e.type})}function R(e){return e&&e.__local_forage_encoded_blob}function k(e){var t=this,r=t._initReady().then((function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(r,e,e),r}function O(e,t,r,n){void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return o.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),T(e)})).then((function(){return function(e){g(e);for(var t=h[e.name],r=t.forages,n=0;n<r.length;n++){var i=r[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,E(e).then((function(t){return e.db=t,A(e)?T(e):t})).then((function(n){e.db=t.db=n;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=n})).catch((function(t){throw w(e,t),t}))}(e).then((function(){O(e,t,r,n-1)}))})).catch(r);r(i)}}var I={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var i=h[r.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},h[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=k);var a=[];function s(){return o.resolve()}for(var c=0;c<i.forages.length;c++){var u=i.forages[c];u!==t&&a.push(u._initReady().catch(s))}var f=i.forages.slice(0);return o.all(a).then((function(){return r.db=i.db,E(r)})).then((function(e){return r.db=e,A(r,t._defaultConfig.version)?T(r):e})).then((function(e){r.db=i.db=e,t._dbInfo=r;for(var n=0;n<f.length;n++){var a=f[n];a!==t&&(a._dbInfo.db=r.db,a._dbInfo.version=r.version)}}))},_support:function(){try{if(!i||!i.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}(),iterate:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){O(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).openCursor(),s=1;o.onsuccess=function(){var r=o.result;if(r){var n=r.value;R(n)&&(n=S(n));var i=e(n,r.key,s++);void 0!==i?t(i):r.continue()}else t()},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){O(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),R(e)&&(e=S(e)),t(e)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},setItem:function(e,t,r){var n=this;e=u(e);var i=new o((function(r,i){var a;n.ready().then((function(){return a=n._dbInfo,"[object Blob]"===p.call(t)?y(a.db).then((function(e){return e?t:function(e){return new o((function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)}))}(t)})):t})).then((function(t){O(n._dbInfo,b,(function(a,o){if(a)return i(a);try{var s=o.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var c=s.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),r(t)},o.onabort=o.onerror=function(){var e=c.error?c.error:c.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return s(i,r),i},removeItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){O(r._dbInfo,b,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).delete(e);a.oncomplete=function(){t()},a.onerror=function(){n(o.error)},a.onabort=function(){var e=o.error?o.error:o.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},clear:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){O(t._dbInfo,b,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=a.error?a.error:a.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},length:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){O(t._dbInfo,m,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).count();a.onsuccess=function(){e(a.result)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},key:function(e,t){var r=this,n=new o((function(t,n){e<0?t(null):r.ready().then((function(){O(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName),s=!1,c=o.openKeyCursor();c.onsuccess=function(){var r=c.result;r?0===e||s?t(r.key):(s=!0,r.advance(e)):t(null)},c.onerror=function(){n(c.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},keys:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){O(t._dbInfo,m,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];a.onsuccess=function(){var t=a.result;t?(o.push(t.key),t.continue()):e(o)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r,n=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName),e.name){var a=e.name===n.name&&this._dbInfo.db?o.resolve(this._dbInfo.db):E(e).then((function(t){var r=h[e.name],n=r.forages;r.db=t;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=t;return t}));r=e.storeName?a.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;g(e);var n=h[e.name],a=n.forages;t.close();for(var s=0;s<a.length;s++){var c=a[s];c._dbInfo.db=null,c._dbInfo.version=r}var u=new o((function(t,n){var a=i.open(e.name,r);a.onerror=function(e){a.result.close(),n(e)},a.onupgradeneeded=function(){a.result.deleteObjectStore(e.storeName)},a.onsuccess=function(){var e=a.result;e.close(),t(e)}}));return u.then((function(e){n.db=e;for(var t=0;t<a.length;t++){var r=a[t];r._dbInfo.db=e,v(r._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}})):a.then((function(t){g(e);var r=h[e.name],n=r.forages;t.close();for(var a=0;a<n.length;a++){n[a]._dbInfo.db=null}var s=new o((function(t,r){var n=i.deleteDatabase(e.name);n.onerror=function(){var e=n.result;e&&e.close(),r(n.error)},n.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}));return s.then((function(e){r.db=e;for(var t=0;t<n.length;t++){v(n[t]._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}))}else r=o.reject("Invalid arguments");return s(r,t),r}};var x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C=/^~~local_forage_type~([^~]+)~/,M="__lfsc__:",P="arbf",N="blob",B="si08",D="ui08",F="uic8",L="si16",U="si32",j="ur16",q="ui32",z="fl32",H="fl64",G=Object.prototype.toString;function V(e){var t,r,n,i,a,o=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var u=new ArrayBuffer(o),f=new Uint8Array(u);for(t=0;t<s;t+=4)r=x.indexOf(e[t]),n=x.indexOf(e[t+1]),i=x.indexOf(e[t+2]),a=x.indexOf(e[t+3]),f[c++]=r<<2|n>>4,f[c++]=(15&n)<<4|i>>2,f[c++]=(3&i)<<6|63&a;return u}function W(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=x[r[t]>>2],n+=x[(3&r[t])<<4|r[t+1]>>4],n+=x[(15&r[t+1])<<2|r[t+2]>>6],n+=x[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var K={serialize:function(e,t){var r="";if(e&&(r=G.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===G.call(e.buffer))){var n,i=M;e instanceof ArrayBuffer?(n=e,i+=P):(n=e.buffer,"[object Int8Array]"===r?i+=B:"[object Uint8Array]"===r?i+=D:"[object Uint8ClampedArray]"===r?i+=F:"[object Int16Array]"===r?i+=L:"[object Uint16Array]"===r?i+=j:"[object Int32Array]"===r?i+=U:"[object Uint32Array]"===r?i+=q:"[object Float32Array]"===r?i+=z:"[object Float64Array]"===r?i+=H:t(new Error("Failed to get type for BinaryArray"))),t(i+W(n))}else if("[object Blob]"===r){var a=new FileReader;a.onload=function(){var r="~~local_forage_type~"+e.type+"~"+W(this.result);t(M+N+r)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,9)!==M)return JSON.parse(e);var t,r=e.substring(13),n=e.substring(9,13);if(n===N&&C.test(r)){var i=r.match(C);t=i[1],r=r.substring(i[0].length)}var o=V(r);switch(n){case P:return o;case N:return a([o],{type:t});case B:return new Int8Array(o);case D:return new Uint8Array(o);case F:return new Uint8ClampedArray(o);case L:return new Int16Array(o);case j:return new Uint16Array(o);case U:return new Int32Array(o);case q:return new Uint32Array(o);case z:return new Float32Array(o);case H:return new Float64Array(o);default:throw new Error("Unkown type: "+n)}},stringToBuffer:V,bufferToString:W};function X(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function $(e,t,r,n,i,a){e.executeSql(r,n,i,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,s){s.rows.length?a(e,o):X(e,t,(function(){e.executeSql(r,n,i,a)}),a)}),a):a(e,o)}),a)}function J(e,t,r,n){var i=this;e=u(e);var a=new o((function(a,o){i.ready().then((function(){void 0===t&&(t=null);var s=t,c=i._dbInfo;c.serializer.serialize(t,(function(t,u){u?o(u):c.db.transaction((function(r){$(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){a(s)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void a(J.apply(i,[e,s,r,n-1]));o(t)}}))}))})).catch(o)}));return s(a,r),a}var Y={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new o((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(i){X(i,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=K,i},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT * FROM "+i.storeName,[],(function(r,n){for(var a=n.rows,o=a.length,s=0;s<o;s++){var c=a.item(s),u=c.value;if(u&&(u=i.serializer.deserialize(u)),void 0!==(u=e(u,c.key,s+1)))return void t(u)}t()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},setItem:function(e,t,r){return J.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},clear:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"DELETE FROM "+n.storeName,[],(function(){e()}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},length:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,r){var n=r.rows.item(0).c;e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},key:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},keys:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"SELECT key FROM "+n.storeName,[],(function(t,r){for(var n=[],i=0;i<r.rows.length;i++)n.push(r.rows.item(i).key);e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;return n=e.name?new o((function(t){var n;n=e.name===r.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:n,storeNames:[e.storeName]}):t(function(e){return new o((function(t,r){e.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var i=[],a=0;a<n.rows.length;a++)i.push(n.rows.item(a).name);t({db:e,storeNames:i})}),(function(e,t){r(t)}))}),(function(e){r(e)}))}))}(n))})).then((function(e){return new o((function(t,r){e.db.transaction((function(n){function i(e){return new o((function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){r(t)}))}))}for(var a=[],s=0,c=e.storeNames.length;s<c;s++)a.push(i(e.storeNames[s]));o.all(a).then((function(){t()})).catch((function(e){r(e)}))}),(function(e){r(e)}))}))})):o.reject("Invalid arguments"),s(n,t),n}};function Q(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Z(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}()||localStorage.length>0}var ee={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=Q(e,this._defaultConfig),Z()?(this._dbInfo=t,t.serializer=K,o.resolve()):o.reject()},_support:function(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,i=n.length,a=localStorage.length,o=1,s=0;s<a;s++){var c=localStorage.key(s);if(0===c.indexOf(n)){var u=localStorage.getItem(c);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,c.substring(i),o++)))return u}}}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=r.ready().then((function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return s(n,t),n},setItem:function(e,t,r){var n=this;e=u(e);var i=n.ready().then((function(){void 0===t&&(t=null);var r=t;return new o((function(i,a){var o=n._dbInfo;o.serializer.serialize(t,(function(t,n){if(n)a(n);else try{localStorage.setItem(o.keyPrefix+e,t),i(r)}catch(e){("QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&a(e),a(e)}}))}))}));return s(i,r),i},removeItem:function(e,t){var r=this;e=u(e);var n=r.ready().then((function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return s(n,t),n},clear:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return s(r,e),r},length:function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},key:function(e,t){var r=this,n=r.ready().then((function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch{t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return s(n,t),n},keys:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo,r=localStorage.length,n=[],i=0;i<r;i++){var a=localStorage.key(i);0===a.indexOf(e.keyPrefix)&&n.push(a.substring(e.keyPrefix.length))}return n}));return s(r,e),r},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,i=this;return n=e.name?new o((function(t){e.storeName?t(Q(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):o.reject("Invalid arguments"),s(n,t),n}},te=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},re=function(e,t){for(var r=e.length,n=0;n<r;){if(te(e[n],t))return!0;n++}return!1},ne=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},oe={INDEXEDDB:I,WEBSQL:Y,LOCALSTORAGE:ee},se=[oe.INDEXEDDB._driver,oe.WEBSQL._driver,oe.LOCALSTORAGE._driver],ce=["dropInstance"],ue=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),fe={description:"",driver:se.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then((function(){return e[t].apply(e,r)}))}}function le(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(ne(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var he=function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),oe)if(oe.hasOwnProperty(r)){var n=oe[r],i=n._driver;this[r]=i,ie[i]||this.defineDriver(n)}this._defaultConfig=le({},fe),this._config=le({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(typeof e>"u"?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new o((function(t,r){try{var n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(i);for(var a=ue.concat("_initStorage"),c=0,u=a.length;c<u;c++){var f=a[c];if((!re(ce,f)||e[f])&&"function"!=typeof e[f])return void r(i)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=o.reject(t);return s(r,arguments[arguments.length-1]),r}},r=0,n=ce.length;r<n;r++){var i=ce[r];e[i]||(e[i]=t(i))}}();var d=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,r):d(!!e._support):d(!0)}catch(e){r(e)}}));return c(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?o.resolve(ie[e]):o.reject(new Error("Driver not found."));return c(n,t,r),n},e.prototype.getSerializer=function(e){var t=o.resolve(K);return c(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return c(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;ne(e)||(e=[e]);var i=this._getSupportedDrivers(e);function a(){n._config.driver=n.driver()}function s(e){return n._extend(e),a(),n._ready=n._initStorage(n._config),n._ready}var u=null!==this._driverSet?this._driverSet.catch((function(){return o.resolve()})):o.resolve();return this._driverSet=u.then((function(){var e=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then((function(e){n._driver=e._driver,a(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var i=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(i).then(s).catch(r)}a();var c=new Error("No available storage method found.");return n._driverSet=o.reject(c),n._driverSet}()}}(i)}))})).catch((function(){a();var e=new Error("No available storage method found.");return n._driverSet=o.reject(e),n._driverSet})),c(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){le(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=ue.length;e<t;e++)de(this,ue[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),pe=new he;t.exports=pe},{3:3}]},{},[4])(4)}))})),oU=rU(((e,t)=>{!function(r,n){"object"==typeof e&&typeof t<"u"?n(e):"function"==typeof define&&define.amd?define("localforage-driver-memory",["exports"],n):n(r.LocalforageDriverMemory={})}(typeof self<"u"?self:e,(function(e){var t=/^~~local_forage_type~([^~]+)~/,r=Object.prototype.toString;function n(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),i=new Uint8Array(n),a=0,o=0;a<r;a+=4){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+1]),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+2]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+3]);i[o++]=s<<2|c>>4,i[o++]=(15&c)<<4|u>>2,i[o++]=(3&u)<<6|63&f}return n}function i(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];return t.length%3==2?r=r.substring(0,r.length-1)+"=":t.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function a(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var i=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),o=i.next();!o.done;o=i.next()){var s=o.value;Object.prototype.hasOwnProperty.call(e,s)&&(e.isActiveClone=null,n[s]=a(e[s]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function o(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function u(e,t){var r,n=this;if(t=c.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var i=this.config();e.name=e.name||i.name,e.storeName=e.storeName||i.storeName}return r=e.name?new Promise((function(t){e.storeName?t(o(e,n._defaultConfig)):t(e.name+"/")})):Promise.reject("Invalid arguments"),{promise:r,callback:t}}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var d={bufferToString:i,deserialize:function(e){if("__lfsc__:"!==e.substring(0,9))return JSON.parse(e);var r,i=e.substring(13),a=e.substring(9,13);if("blob"===a&&t.test(i)){var o=i.match(t);r=o[1],i=i.substring(o[0].length)}var s=n(i);switch(a){case"arbf":return s;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([s],{type:r});case"si08":return new Int8Array(s);case"ui08":return new Uint8Array(s);case"uic8":return new Uint8ClampedArray(s);case"si16":return new Int16Array(s);case"ur16":return new Uint16Array(s);case"si32":return new Int32Array(s);case"ui32":return new Uint32Array(s);case"fl32":return new Float32Array(s);case"fl64":return new Float64Array(s);default:throw new Error("Unkown type: "+a)}},serialize:function(e,t){var n="";if(e&&(n=r.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===r.call(e.buffer))){var a=void 0,o="__lfsc__:";e instanceof ArrayBuffer?(a=e,o+="arbf"):(a=e.buffer,"[object Int8Array]"===n?o+="si08":"[object Uint8Array]"===n?o+="ui08":"[object Uint8ClampedArray]"===n?o+="uic8":"[object Int16Array]"===n?o+="si16":"[object Uint16Array]"===n?o+="ur16":"[object Int32Array]"===n?o+="si32":"[object Uint32Array]"===n?o+="ui32":"[object Float32Array]"===n?o+="fl32":"[object Float64Array]"===n?o+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(o+i(a))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var r="~~local_forage_type~"+e.type+"~"+i(this.result);t("__lfsc__:blob"+r)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:n},l={},h=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return l[t]||(l[t]=new e(t)),l[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete l[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?a(e):{},r=o(t,this._defaultConfig),n=h.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=d,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then((function(){t._dbInfo.mStore.clear()}));return s(r,e),r},e.dropInstance=function(e,t){var r=u.apply(this,arguments),n=r.promise,i=r.callback,a=n.then((function(e){h.resolve(e).drop()}));return s(a,i),n},e.getItem=function(e,t){var r=this;e=f(e);var n=this.ready().then((function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)}));return s(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then((function(){for(var t=r._dbInfo.mStore,n=t.keys(),i=0;i<n.length;i++){var a=t.get(n[i]);if(a&&(a=r._dbInfo.serializer.deserialize(a)),void 0!==(a=e(a,n[i],i+1)))return a}}));return s(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then((function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch{t=null}return t}));return s(n,t),n},e.keys=function(e){var t=this,r=this.ready().then((function(){return t._dbInfo.mStore.keys()}));return s(r,e),r},e.length=function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},e.removeItem=function(e,t){var r=this;e=f(e);var n=this.ready().then((function(){r._dbInfo.mStore.rm(e)}));return s(n,t),n},e.setItem=function(e,t,r){var n=this;e=f(e);var i=this.ready().then((function(){void 0===t&&(t=null);var r=t;return new Promise((function(i,a){n._dbInfo.serializer.serialize(t,(function(t,o){if(o)a(o);else try{n._dbInfo.mStore.set(e,t),i(r)}catch(e){a(e)}}))}))}));return s(i,r),i},Object.defineProperty(e,"__esModule",{value:!0})}))})),sU=nU(aU()),cU=nU(oU()),uU={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var fU=function(e,t){return Object.assign(LF,t),e}(WL,{platform:"web",sdkName:"magic-sdk",version:"21.2.0",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends XL{constructor(){super(...arguments),this.activeElement=null}init(){this.test="hello",this.iframe=new Promise((e=>{let t=()=>{if(function(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find((t=>t.src.includes(e))))}(encodeURIComponent(this.parameters)))new zF(rD.DuplicateIframe,"Duplicate iframes found.").log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=SL(this.endpoint).host,t.title="Secure Modal",t.src=SL(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(let[t,r]of Object.entries(uU))e.style[t]=r}(t),document.body.appendChild(t),e(t)}};["loaded","interactive","complete"].includes(document.readyState)?t():window.addEventListener("load",t,!1)})),window.addEventListener("message",(e=>{var t;if(e.origin===this.endpoint&&e.data&&e.data.msgType&&this.messageHandlers.size){e.data.response=null!=(t=e.data.response)?t:{};for(let t of this.messageHandlers.values())t(e)}}))}showOverlay(){return iU(this,null,(function*(){let e=yield this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}))}hideOverlay(){return iU(this,null,(function*(){var e;(yield this.iframe).style.display="none",null!=(e=this.activeElement)&&e.focus&&this.activeElement.focus(),this.activeElement=null}))}_post(e){return iU(this,null,(function*(){let t=yield this.iframe;if(!t||!t.contentWindow)throw new jF(tD.ModalNotReady,"Modal is not ready.");t.contentWindow.postMessage(e,this.endpoint)}))}},configureStorage:()=>iU(void 0,null,(function*(){let e=sU.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(cU),yield e.setDriver([sU.default.INDEXEDDB,sU.default.LOCALSTORAGE,cU._driver]),e}))}),dU=(e=>(e.LoginWithOIDC="magic_auth_login_with_oidc",e))(dU||{}),lU=class extends qL.Internal{constructor(){super(...arguments),this.name="openid",this.config={}}loginWithOIDC(e){let t=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_oidc",[e]);return this.request(t)}};function hU(e,t){return function(){return e.apply(t,arguments)}}const{toString:pU}=Object.prototype,{getPrototypeOf:mU}=Object,bU=(e=>t=>{const r=pU.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),yU=e=>(e=e.toLowerCase(),t=>bU(t)===e),gU=e=>t=>typeof t===e,{isArray:vU}=Array,wU=gU("undefined");const _U=yU("ArrayBuffer");const EU=gU("string"),TU=gU("function"),AU=gU("number"),SU=e=>null!==e&&"object"==typeof e,RU=e=>{if("object"!==bU(e))return!1;const t=mU(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},kU=yU("Date"),OU=yU("File"),IU=yU("Blob"),xU=yU("FileList"),CU=yU("URLSearchParams");function MU(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),vU(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function PU(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const NU="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,BU=e=>!wU(e)&&e!==NU;const DU=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&mU(Uint8Array)),FU=yU("HTMLFormElement"),LU=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),UU=yU("RegExp"),jU=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};MU(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},qU="abcdefghijklmnopqrstuvwxyz",zU="0123456789",HU={DIGIT:zU,ALPHA:qU,ALPHA_DIGIT:qU+qU.toUpperCase()+zU};const GU=yU("AsyncFunction");var VU={isArray:vU,isArrayBuffer:_U,isBuffer:function(e){return null!==e&&!wU(e)&&null!==e.constructor&&!wU(e.constructor)&&TU(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||TU(e.append)&&("formdata"===(t=bU(e))||"object"===t&&TU(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&_U(e.buffer),t},isString:EU,isNumber:AU,isBoolean:e=>!0===e||!1===e,isObject:SU,isPlainObject:RU,isUndefined:wU,isDate:kU,isFile:OU,isBlob:IU,isRegExp:UU,isFunction:TU,isStream:e=>SU(e)&&TU(e.pipe),isURLSearchParams:CU,isTypedArray:DU,isFileList:xU,forEach:MU,merge:function e(){const{caseless:t}=BU(this)&&this||{},r={},n=(n,i)=>{const a=t&&PU(r,i)||i;RU(r[a])&&RU(n)?r[a]=e(r[a],n):RU(n)?r[a]=e({},n):vU(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&MU(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(MU(t,((t,n)=>{r&&TU(t)?e[n]=hU(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,a,o;const s={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],n&&!n(o,e,t)||s[o]||(t[o]=e[o],s[o]=!0);e=!1!==r&&mU(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:bU,kindOfTest:yU,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(vU(e))return e;let t=e.length;if(!AU(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:FU,hasOwnProperty:LU,hasOwnProp:LU,reduceDescriptors:jU,freezeMethods:e=>{jU(e,((t,r)=>{if(TU(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];TU(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return vU(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:PU,global:NU,isContextDefined:BU,ALPHABET:HU,generateString:(e=16,t=HU.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&TU(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(SU(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=vU(e)?[]:{};return MU(e,((e,t)=>{const a=r(e,n+1);!wU(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:GU,isThenable:e=>e&&(SU(e)||TU(e))&&TU(e.then)&&TU(e.catch)};function WU(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}VU.inherits(WU,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:VU.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const KU=WU.prototype,XU={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{XU[e]={value:e}})),Object.defineProperties(WU,XU),Object.defineProperty(KU,"isAxiosError",{value:!0}),WU.from=(e,t,r,n,i,a)=>{const o=Object.create(KU);return VU.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),WU.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function $U(e){return VU.isPlainObject(e)||VU.isArray(e)}function JU(e){return VU.endsWith(e,"[]")?e.slice(0,-2):e}function YU(e,t,r){return e?e.concat(t).map((function(e,t){return e=JU(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const QU=VU.toFlatObject(VU,{},null,(function(e){return/^is[A-Z]/.test(e)}));function ZU(e,t,r){if(!VU.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=VU.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!VU.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&VU.isSpecCompliantForm(t);if(!VU.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(VU.isDate(e))return e.toISOString();if(!s&&VU.isBlob(e))throw new WU("Blob is not supported. Use a Buffer instead.");return VU.isArrayBuffer(e)||VU.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(VU.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(VU.isArray(e)&&function(e){return VU.isArray(e)&&!e.some($U)}(e)||(VU.isFileList(e)||VU.endsWith(r,"[]"))&&(s=VU.toArray(e)))return r=JU(r),s.forEach((function(e,n){!VU.isUndefined(e)&&null!==e&&t.append(!0===o?YU([r],n,a):null===o?r:r+"[]",c(e))})),!1;return!!$U(e)||(t.append(YU(i,r,a),c(e)),!1)}const f=[],d=Object.assign(QU,{defaultVisitor:u,convertValue:c,isVisitable:$U});if(!VU.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!VU.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),VU.forEach(r,(function(r,a){!0===(!(VU.isUndefined(r)||null===r)&&i.call(t,r,VU.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),f.pop()}}(e),t}function ej(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function tj(e,t){this._pairs=[],e&&ZU(e,this,t)}const rj=tj.prototype;function nj(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ij(e,t,r){if(!t)return e;const n=r&&r.encode||nj,i=r&&r.serialize;let a;if(a=i?i(t,r):VU.isURLSearchParams(t)?t.toString():new tj(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}rj.append=function(e,t){this._pairs.push([e,t])},rj.toString=function(e){const t=e?function(t){return e.call(this,t,ej)}:ej;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var aj=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){VU.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},oj={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var sj={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:tj,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function cj(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&VU.isArray(n)?n.length:a,s)return VU.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&VU.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&VU.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(VU.isFormData(e)&&VU.isFunction(e.entries)){const r={};return VU.forEachEntry(e,((e,n)=>{t(function(e){return VU.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const uj={"Content-Type":void 0};const fj={transitional:oj,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=VU.isObject(e);i&&VU.isHTMLForm(e)&&(e=new FormData(e));if(VU.isFormData(e))return n&&n?JSON.stringify(cj(e)):e;if(VU.isArrayBuffer(e)||VU.isBuffer(e)||VU.isStream(e)||VU.isFile(e)||VU.isBlob(e))return e;if(VU.isArrayBufferView(e))return e.buffer;if(VU.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ZU(e,new sj.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return sj.isNode&&VU.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=VU.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ZU(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(VU.isString(e))try{return(t||JSON.parse)(e),VU.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||fj.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&VU.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw WU.from(e,WU.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:sj.classes.FormData,Blob:sj.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};VU.forEach(["delete","get","head"],(function(e){fj.headers[e]={}})),VU.forEach(["post","put","patch"],(function(e){fj.headers[e]=VU.merge(uj)}));var dj=fj;const lj=VU.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const hj=Symbol("internals");function pj(e){return e&&String(e).trim().toLowerCase()}function mj(e){return!1===e||null==e?e:VU.isArray(e)?e.map(mj):String(e)}function bj(e,t,r,n,i){return VU.isFunction(n)?n.call(this,t,r):(i&&(t=r),VU.isString(t)?VU.isString(n)?-1!==t.indexOf(n):VU.isRegExp(n)?n.test(t):void 0:void 0)}class yj{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=pj(t);if(!i)throw new Error("header name must be a non-empty string");const a=VU.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=mj(e))}const a=(e,t)=>VU.forEach(e,((e,r)=>i(e,r,t)));return VU.isPlainObject(e)||e instanceof this.constructor?a(e,t):VU.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&lj[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=pj(e)){const r=VU.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(VU.isFunction(t))return t.call(this,e,r);if(VU.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=pj(e)){const r=VU.findKey(this,e);return!(!r||void 0===this[r]||t&&!bj(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=pj(e)){const i=VU.findKey(r,e);!i||t&&!bj(0,r[i],i,t)||(delete r[i],n=!0)}}return VU.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!bj(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return VU.forEach(this,((n,i)=>{const a=VU.findKey(r,i);if(a)return t[a]=mj(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=mj(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return VU.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&VU.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[hj]=this[hj]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=pj(e);t[n]||(!function(e,t){const r=VU.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return VU.isArray(e)?e.forEach(n):n(e),this}}yj.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),VU.freezeMethods(yj.prototype),VU.freezeMethods(yj);var gj=yj;function vj(e,t){const r=this||dj,n=t||r,i=gj.from(n.headers);let a=n.data;return VU.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function wj(e){return!(!e||!e.__CANCEL__)}function _j(e,t,r){WU.call(this,null==e?"canceled":e,WU.ERR_CANCELED,t,r),this.name="CanceledError"}VU.inherits(_j,WU,{__CANCEL__:!0});var Ej=sj.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),VU.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),VU.isString(n)&&o.push("path="+n),VU.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Tj(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Aj=sj.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=VU.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function Sj(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=n[o];i||(i=c),r[a]=s,n[a]=c;let f=o,d=0;for(;f!==a;)d+=r[f++],f%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),c-i<t)return;const l=u&&c-u;return l?Math.round(1e3*d/l):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,c=n(s);r=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:c||void 0,estimated:c&&o&&a<=o?(o-a)/c:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var Rj="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=gj.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}VU.isFormData(n)&&(sj.isStandardBrowserEnv||sj.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=Tj(e.baseURL,e.url);function f(){if(!c)return;const n=gj.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new WU("Request failed with status code "+r.status,[WU.ERR_BAD_REQUEST,WU.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),ij(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=f:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(f)},c.onabort=function(){c&&(r(new WU("Request aborted",WU.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new WU("Network Error",WU.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||oj;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new WU(t,n.clarifyTimeoutError?WU.ETIMEDOUT:WU.ECONNABORTED,e,c)),c=null},sj.isStandardBrowserEnv){const t=(e.withCredentials||Aj(u))&&e.xsrfCookieName&&Ej.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&VU.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),VU.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",Sj(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",Sj(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{c&&(r(!t||t.type?new _j(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===sj.protocols.indexOf(d)?r(new WU("Unsupported protocol "+d+":",WU.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const kj={http:null,xhr:Rj};VU.forEach(kj,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Oj=e=>{e=VU.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=VU.isString(r)?kj[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new WU(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(VU.hasOwnProp(kj,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!VU.isFunction(n))throw new TypeError("adapter is not a function");return n};function Ij(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _j(null,e)}function xj(e){Ij(e),e.headers=gj.from(e.headers),e.data=vj.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Oj(e.adapter||dj.adapter)(e).then((function(t){return Ij(e),t.data=vj.call(e,e.transformResponse,t),t.headers=gj.from(t.headers),t}),(function(t){return wj(t)||(Ij(e),t&&t.response&&(t.response.data=vj.call(e,e.transformResponse,t.response),t.response.headers=gj.from(t.response.headers))),Promise.reject(t)}))}const Cj=e=>e instanceof gj?e.toJSON():e;function Mj(e,t){t=t||{};const r={};function n(e,t,r){return VU.isPlainObject(e)&&VU.isPlainObject(t)?VU.merge.call({caseless:r},e,t):VU.isPlainObject(t)?VU.merge({},t):VU.isArray(t)?t.slice():t}function i(e,t,r){return VU.isUndefined(t)?VU.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!VU.isUndefined(t))return n(void 0,t)}function o(e,t){return VU.isUndefined(t)?VU.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t)=>i(Cj(e),Cj(t),!0)};return VU.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||i,o=a(e[n],t[n],n);VU.isUndefined(o)&&a!==s||(r[n]=o)})),r}const Pj="1.4.0",Nj={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Nj[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Bj={};Nj.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new WU(n(i," has been removed"+(t?" in "+t:"")),WU.ERR_DEPRECATED);return t&&!Bj[i]&&(Bj[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}};var Dj={assertOptions:function(e,t,r){if("object"!=typeof e)throw new WU("options must be an object",WU.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new WU("option "+a+" must be "+r,WU.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new WU("Unknown option "+a,WU.ERR_BAD_OPTION)}},validators:Nj};const Fj=Dj.validators;class Lj{constructor(e){this.defaults=e,this.interceptors={request:new aj,response:new aj}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Mj(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Dj.assertOptions(r,{silentJSONParsing:Fj.transitional(Fj.boolean),forcedJSONParsing:Fj.transitional(Fj.boolean),clarifyTimeoutError:Fj.transitional(Fj.boolean)},!1),null!=n&&(VU.isFunction(n)?t.paramsSerializer={serialize:n}:Dj.assertOptions(n,{encode:Fj.function,serialize:Fj.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&VU.merge(i.common,i[t.method]),a&&VU.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=gj.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let f,d=0;if(!s){const e=[xj.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,c),f=e.length,u=Promise.resolve(t);d<f;)u=u.then(e[d++],e[d++]);return u}f=o.length;let l=t;for(d=0;d<f;){const e=o[d++],t=o[d++];try{l=e(l)}catch(e){t.call(this,e);break}}try{u=xj.call(this,l)}catch(e){return Promise.reject(e)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(e){return ij(Tj((e=Mj(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}VU.forEach(["delete","get","head","options"],(function(e){Lj.prototype[e]=function(t,r){return this.request(Mj(r||{},{method:e,url:t,data:(r||{}).data}))}})),VU.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Mj(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Lj.prototype[e]=t(),Lj.prototype[e+"Form"]=t(!0)}));var Uj=Lj;class jj{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new _j(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;const t=new jj((function(t){e=t}));return{token:t,cancel:e}}}var qj=jj;const zj={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(zj).forEach((([e,t])=>{zj[t]=e}));var Hj=zj;const Gj=function e(t){const r=new Uj(t),n=hU(Uj.prototype.request,r);return VU.extend(n,Uj.prototype,r,{allOwnKeys:!0}),VU.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Mj(t,r))},n}(dj);Gj.Axios=Uj,Gj.CanceledError=_j,Gj.CancelToken=qj,Gj.isCancel=wj,Gj.VERSION=Pj,Gj.toFormData=ZU,Gj.AxiosError=WU,Gj.Cancel=Gj.CanceledError,Gj.all=function(e){return Promise.all(e)},Gj.spread=function(e){return function(t){return e.apply(null,t)}},Gj.isAxiosError=function(e){return VU.isObject(e)&&!0===e.isAxiosError},Gj.mergeConfig=Mj,Gj.AxiosHeaders=gj,Gj.formToJSON=e=>cj(VU.isHTMLForm(e)?new FormData(e):e),Gj.HttpStatusCode=Hj,Gj.default=Gj;var Vj=Gj;const Wj="https://guardian.sandbox.imtbl.com".replace(/\/+$/,"");class Kj{basePath;axios;configuration;constructor(e,t=Wj,r=Vj){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Xj extends Error{field;name="RequiredError";constructor(e,t){super(t),this.field=e}}const $j="https://example.com",Jj=function(e,t,r){if(null==r)throw new Xj(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Yj=async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}};function Qj(e,t,r=""){"object"==typeof t?Array.isArray(t)?t.forEach((t=>Qj(e,t,r))):Object.keys(t).forEach((n=>Qj(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t)}const Zj=function(e,...t){const r=new URLSearchParams(e.search);Qj(r,t),e.search=r.toString()},eq=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},tq=function(e){return e.pathname+e.search+e.hash},rq=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||a)+e.url};return i.request(o)}},nq=function(e){const t=function(e){return{approvePendingMessage:async(t,r={})=>{Jj("approvePendingMessage","messageID",t);const n="/guardian/v1/messages/{messageID}/approve".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,$j);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...r},s={};await Yj(s,e),Zj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:tq(i),options:o}},evaluateMessage:async(t,r={})=>{Jj("evaluateMessage","messageEvaluationRequest",t);const n=new URL("/guardian/v1/messages/evaluate",$j);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...r},o={};await Yj(o,e),o["Content-Type"]="application/json",Zj(n,{});let s=i&&i.headers?i.headers:{};return a.headers={...o,...s,...r.headers},a.data=eq(t,a,e),{url:tq(n),options:a}},getMessageByID:async(t,r={})=>{Jj("getMessageByID","messageID",t);const n="/guardian/v1/messages/{messageID}".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,$j);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...r},s={};await Yj(s,e),Zj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:tq(i),options:o}}}}(e);return{async approvePendingMessage(r,n){const i=await t.approvePendingMessage(r,n);return rq(i,Vj,Wj,e)},async evaluateMessage(r,n){const i=await t.evaluateMessage(r,n);return rq(i,Vj,Wj,e)},async getMessageByID(r,n){const i=await t.getMessageByID(r,n);return rq(i,Vj,Wj,e)}}};class iq extends Kj{approvePendingMessage(e,t){return nq(this.configuration).approvePendingMessage(e.messageID,t).then((e=>e(this.axios,this.basePath)))}evaluateMessage(e,t){return nq(this.configuration).evaluateMessage(e.messageEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getMessageByID(e,t){return nq(this.configuration).getMessageByID(e.messageID,t).then((e=>e(this.axios,this.basePath)))}}const aq=function(e){const t=function(e){return{approvePendingTransaction:async(t,r,n={})=>{Jj("approvePendingTransaction","payloadHash",t),Jj("approvePendingTransaction","transactionApprovalRequest",r);const i="/guardian/v1/transactions/{payloadHash}/approve".replace("{payloadHash}",encodeURIComponent(String(t))),a=new URL(i,$j);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Yj(c,e),c["Content-Type"]="application/json",Zj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=eq(r,s,e),{url:tq(a),options:s}},evaluateTransaction:async(t,r,n={})=>{Jj("evaluateTransaction","id",t),Jj("evaluateTransaction","transactionEvaluationRequest",r);const i="/guardian/v1/transactions/{id}/evaluate".replace("{id}",encodeURIComponent(String(t))),a=new URL(i,$j);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Yj(c,e),c["Content-Type"]="application/json",Zj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=eq(r,s,e),{url:tq(a),options:s}},getTransactionByID:async(t,r,n,i={})=>{Jj("getTransactionByID","transactionID",t),Jj("getTransactionByID","chainType",r);const a="/guardian/v1/transactions/{transactionID}".replace("{transactionID}",encodeURIComponent(String(t))),o=new URL(a,$j);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i},u={},f={};await Yj(u,e),void 0!==r&&(f.chainType=r),void 0!==n&&(f.chainID=n),Zj(o,f);let d=s&&s.headers?s.headers:{};return c.headers={...u,...d,...i.headers},{url:tq(o),options:c}}}}(e);return{async approvePendingTransaction(r,n,i){const a=await t.approvePendingTransaction(r,n,i);return rq(a,Vj,Wj,e)},async evaluateTransaction(r,n,i){const a=await t.evaluateTransaction(r,n,i);return rq(a,Vj,Wj,e)},async getTransactionByID(r,n,i,a){const o=await t.getTransactionByID(r,n,i,a);return rq(o,Vj,Wj,e)}}};class oq extends Kj{approvePendingTransaction(e,t){return aq(this.configuration).approvePendingTransaction(e.payloadHash,e.transactionApprovalRequest,t).then((e=>e(this.axios,this.basePath)))}evaluateTransaction(e,t){return aq(this.configuration).evaluateTransaction(e.id,e.transactionEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionByID(e,t){return aq(this.configuration).getTransactionByID(e.transactionID,e.chainType,e.chainID,t).then((e=>e(this.axios,this.basePath)))}}class sq{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const cq="starkex",uq="evm";function fq(e){const t=-1!==new fn(e,16).cmp(new fn(27))?new fn(e,16).sub(new fn(27)).toNumber():new fn(e,16).toNumber();return e.trim()?t:void 0}async function dq(e,t){const r=function(e,t=64){const r=Ib(e);return{r:new fn(r.substring(0,t),"hex"),s:new fn(r.substring(t,2*t),"hex"),recoveryParam:fq(r.substring(2*t,2*t+2))}}(await t.signMessage(e));return Cb(kb((n=r).r.toString(16),64)+kb(n.s.toString(16),64)+kb(n.recoveryParam?.toString(16)||"",2));var n}function lq(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};default:return{type:"ETH",data:{decimals:18}}}}const hq={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 pq(){return pq=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},pq.apply(this,arguments)}var mq;!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"}(mq||(mq={}));function bq(e,t){return function(...r){const n=Array.prototype.slice.call(r);return new Promise((async(r,i)=>{try{n.push(((e,t)=>e?i(e):r(t))),await e.apply(t,n)}catch(e){i(e)}}))}}new class{constructor(e){this.config=e,this.logLevel=void 0,this.configure(e)}configure(e){switch(this.config=pq({},this.config,e),this.config.logLevel){case"DEBUG":this.logLevel=mq.DEBUG;break;case"INFO":default:this.logLevel=mq.INFO;break;case"WARN":this.logLevel=mq.WARN;break;case"ERROR":this.logLevel=mq.ERROR;break;case"DISABLED":this.logLevel=mq.DISABLED}void 0===this.config.silence&&(this.config.silence=!1)}debug(e,...t){!0!==this.config.silence&&this.logLevel===mq.DEBUG&&console.log(e,...t)}info(e,...t){!0!==this.config.silence&&this.logLevel<=mq.INFO&&console.log(e,...t)}warn(e,...t){!0!==this.config.silence&&this.logLevel<=mq.WARN&&(console.warn(e,...t),this.config.onwarn&&this.config.onwarn(e,t))}error(e,...t){!0!==this.config.silence&&this.logLevel<=mq.ERROR&&(console.error(e,...t),this.config.onerror&&this.config.onerror(e,t))}}({logLevel:"INFO",silence:!0});const yq=(e=0,t=Number.MAX_SAFE_INTEGER)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function gq(){return gq=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},gq.apply(this,arguments)}const vq=(e,t=!1)=>(((e,t=!1,r=!1)=>{if(!e)throw new Error("invalid network config: empty config");const n=[];if(Array.isArray(e)?n.push(...e):n.push(e),0===n.length){if(t)throw new Error("invalid network config: empty config");return!1}const i=n.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}n.forEach((e=>e.name=e.name.toLowerCase()));const o=n.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 c=!1,u=!1;for(let e=0;e<n.length;e++){const i=n[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(!r&&!i.relayer){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: relayer must be provided`);return!1}if(i.isDefaultChain){if(c){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: DefaultChain is already set by another config`);return!1}c=!0}if(i.isAuthChain){if(u&&t)throw new Error(`invalid network config for chainId ${i.chainId}: AuthChain is already set by another config`);u=!0}}if(!c){if(t)throw new Error("invalid network config: DefaultChain must be set");return!1}if(!u){if(t)throw new Error("invalid network config: AuthChain must be set");return!1}})(e,!0,t),e),wq=e=>vq(_q(e)),_q=e=>{if(!e)return[];const t=e.sort(((e,t)=>e.chainId===t.chainId?0:e.chainId<t.chainId?-1:1)),r=t.findIndex((e=>e.isDefaultChain));r>0&&t.splice(0,0,t.splice(r,1)[0]);const n=t.findIndex((e=>e.isAuthChain&&!0!==e.isDefaultChain));return n>0&&t.splice(1,0,t.splice(n,1)[0]),t},Eq=(e,t)=>"string"==typeof e?(t=t||{},e.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim,(function(e,r){let n=t[r];return n="function"==typeof n?n():null==n?"":"object"==typeof n||"symbol"==typeof n?n.toString():n.valueOf(),n}))):"";let Tq;!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"}(Tq||(Tq={}));const Aq=e=>Eq("https://${network}-indexer.sequence.app",{network:e}),Sq=e=>Eq("https://${network}-relayer.sequence.app",{network:e}),Rq=e=>Eq("https://nodes.sequence.app/${network}",{network:e}),kq={[Tq.MAINNET]:{chainId:Tq.MAINNET,name:"mainnet",title:"Ethereum",blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[Tq.ROPSTEN]:{chainId:Tq.ROPSTEN,name:"ropsten",title:"Ropsten",testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[Tq.RINKEBY]:{chainId:Tq.RINKEBY,name:"rinkeby",title:"Rinkeby",testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",disabled:!0},[Tq.GOERLI]:{chainId:Tq.GOERLI,name:"goerli",title:"Goerli",testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[Tq.KOVAN]:{chainId:Tq.KOVAN,name:"kovan",title:"Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"}},[Tq.POLYGON]:{chainId:Tq.POLYGON,name:"polygon",title:"Polygon",blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"}},[Tq.POLYGON_MUMBAI]:{chainId:Tq.POLYGON_MUMBAI,name:"mumbai",title:"Polygon Mumbai",testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"}},[Tq.POLYGON_ZKEVM]:{chainId:Tq.POLYGON_ZKEVM,name:"polygon-zkevm",title:"Polygon zkEVM",blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"}},[Tq.BSC]:{chainId:Tq.BSC,name:"bsc",title:"BNB Smart Chain",blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"}},[Tq.BSC_TESTNET]:{chainId:Tq.BSC_TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"}},[Tq.OPTIMISM]:{chainId:Tq.OPTIMISM,name:"optimism",title:"Optimism",blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"}},[Tq.OPTIMISM_TESTNET]:{chainId:Tq.OPTIMISM_TESTNET,name:"optimism-testnet",title:"Optimistic Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Optimism Testnet)",rootUrl:"https://kovan-optimistic.etherscan.io/"}},[Tq.ARBITRUM]:{chainId:Tq.ARBITRUM,name:"arbitrum",title:"Arbitrum One",blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"}},[Tq.ARBITRUM_GOERLI]:{chainId:Tq.ARBITRUM_GOERLI,name:"arbitrum-goerli",title:"Arbitrum Goerli",testnet:!0,blockExplorer:{name:"Arbiscan (Testnet)",rootUrl:"https://testnet.arbiscan.io/"}},[Tq.ARBITRUM_NOVA]:{chainId:Tq.ARBITRUM_NOVA,name:"arbitrum-nova",title:"Arbitrum Nova",blockExplorer:{name:"Nova Explorer",rootUrl:"https://nova-explorer.arbitrum.io/"}},[Tq.AVALANCHE]:{chainId:Tq.AVALANCHE,name:"avalanche",title:"Avalanche",blockExplorer:{name:"Snowtrace",rootUrl:"https://snowtrace.io/"}},[Tq.AVALANCHE_TESTNET]:{chainId:Tq.AVALANCHE_TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://testnet.snowtrace.io/"}},[Tq.FANTOM]:{chainId:Tq.FANTOM,name:"fantom",title:"Fantom",blockExplorer:{name:"FTMScan",rootUrl:"https://ftmscan.com/"}},[Tq.FANTOM_TESTNET]:{chainId:Tq.FANTOM_TESTNET,name:"fantom-testnet",title:"Fantom Testnet",testnet:!0,blockExplorer:{name:"FTMScan (Testnet)",rootUrl:"https://testnet.ftmscan.com/"}},[Tq.GNOSIS]:{chainId:Tq.GNOSIS,name:"gnosis",title:"Gnosis Chain",blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"}},[Tq.AURORA]:{chainId:Tq.AURORA,name:"aurora",title:"Aurora",blockExplorer:{name:"Aurora Explorer",rootUrl:"https://aurorascan.dev/"}},[Tq.AURORA_TESTNET]:{chainId:Tq.AURORA_TESTNET,name:"aurora-testnet",title:"Aurora Testnet",blockExplorer:{name:"Aurora Explorer (Testnet)",rootUrl:"https://testnet.aurorascan.dev/"}},[Tq.BASE_GOERLI]:{chainId:Tq.BASE_GOERLI,name:"base-goerli",title:"Base Goerli",blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"}}};wq([gq({},kq[Tq.MAINNET],{rpcUrl:Rq("mainnet"),relayer:{url:Sq("mainnet")},indexerUrl:Aq("mainnet")}),gq({},kq[Tq.POLYGON],{rpcUrl:Rq("polygon"),relayer:{url:Sq("polygon")},indexerUrl:Aq("polygon"),isDefaultChain:!0,isAuthChain:!0}),gq({},kq[Tq.BSC],{rpcUrl:Rq("bsc"),indexerUrl:Aq("bsc"),relayer:{url:Sq("bsc")}}),gq({},kq[Tq.AVALANCHE],{rpcUrl:Rq("avalanche"),indexerUrl:Aq("avalanche"),relayer:{url:Sq("avalanche")}}),gq({},kq[Tq.ARBITRUM],{rpcUrl:Rq("arbitrum"),indexerUrl:Aq("arbitrum"),relayer:{url:Sq("arbitrum")}}),gq({},kq[Tq.ARBITRUM_NOVA],{rpcUrl:Rq("arbitrum-nova"),indexerUrl:Aq("arbitrum-nova"),relayer:{url:Sq("arbitrum-nova")}}),gq({},kq[Tq.OPTIMISM],{rpcUrl:Rq("optimism"),indexerUrl:Aq("optimism"),relayer:{url:Sq("optimism")}}),gq({},kq[Tq.POLYGON_ZKEVM],{rpcUrl:Rq("polygon-zkevm"),indexerUrl:Aq("polygon-zkevm"),relayer:{url:Sq("polygon-zkevm")}}),gq({},kq[Tq.GNOSIS],{rpcUrl:Rq("gnosis"),indexerUrl:Aq("gnosis"),relayer:{url:Sq("gnosis")}})]),wq([gq({},kq[Tq.RINKEBY],{rpcUrl:Rq("rinkeby"),relayer:{url:Sq("rinkeby")},indexerUrl:Aq("rinkeby")}),gq({},kq[Tq.GOERLI],{rpcUrl:Rq("goerli"),relayer:{url:Sq("goerli")},indexerUrl:Aq("goerli")}),gq({},kq[Tq.POLYGON_MUMBAI],{rpcUrl:Rq("mumbai"),relayer:{url:Sq("mumbai")},indexerUrl:Aq("mumbai"),isDefaultChain:!0,isAuthChain:!0}),gq({},kq[Tq.BSC_TESTNET],{rpcUrl:Rq("bsc-testnet"),relayer:{url:Sq("bsc-testnet")},indexerUrl:Aq("bsc-testnet")}),gq({},kq[Tq.ARBITRUM_GOERLI],{rpcUrl:Rq("arbitrum-goerli"),relayer:{url:Sq("arbitrum-goerli")},indexerUrl:Aq("arbitrum-goerli")}),gq({},kq[Tq.BASE_GOERLI],{rpcUrl:Rq("base-goerli"),relayer:{url:Sq("base-goerli")},indexerUrl:Aq("base-goerli")})]);const Oq="2.0";function Iq(){return Iq=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Iq.apply(this,arguments)}let xq;function Cq(e,t){return e.reduce((function(e,r,n){return t(r,n)?e[0].push(r):e[1].push(r),e}),[[],[]])}!function(e){e.ethCall="eth_call",e.ethGetBalance="eth_getBalance",e.ethGetCode="eth_getCode"}(xq||(xq={}));const Mq={batchSize:50,timeWindow:50,contract:"0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E",verbose:!1};let Pq=class e{constructor(t){var r=this;if(this.batchableJsonRpcMethods=[xq.ethCall,xq.ethGetCode,xq.ethGetBalance],this.multicallInterface=new Ps(hq.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,r)=>this.batchableJsonRpcMethods.find((e=>e===t.method))?(this.queue.push({request:t,callback:r,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,r)),this.run=async function(){r.options.verbose&&console.log("Processing multicall");const e=Math.min(r.options.batchSize,r.queue.length);if(0===e)return;if(1===e)return r.forward(r.queue[0]),r.queue=[],void(r.options.verbose&&console.log("Skip multicall, single item"));r.options.verbose&&console.log("Resolving",e);var t=r.queue.slice(0,e);r.queue=e===r.queue.length?[]:r.queue.slice(e),r.options.verbose&&console.log("Updated queue",r.queue.length),0!==r.queue.length&&r.scheduleExecution();const n=t[0].next;let i;var[t,a]=Cq(t,(e=>{try{if(e.next!==n)return!1;switch(e.request.method){case xq.ethCall:if(e.request.params[0].from||e.request.params[0].gasPrice||e.request.params[0].value)return!1;case xq.ethGetBalance:case xq.ethGetCode:const t=function(e){if(void 0===e)return"latest";switch(e){case"earliest":case"latest":case"pending":return e}return Jn.from(e)}(e.request.params[1]);if(void 0===i&&(i=t),!function(e,t){return e===t||(Jn.isBigNumber(e)?!!Jn.isBigNumber(t)&&e.eq(t):!Jn.isBigNumber(t)&&e===t)}(t,i))return!1}return!0}catch(e){return!1}}));if(0!==a.length&&(r.options.verbose&&console.log("Forwarding incompatible calls",a.length),r.forward(a),0===t.length))return;let o=t.map((e=>{try{switch(e.request.method){case xq.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 xq.ethGetCode:return{delegateCall:!1,revertOnError:!1,target:r.options.contract,gasLimit:0,value:0,data:r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("callCode"),[e.request.params[0]])};case xq.ethGetBalance:return{delegateCall:!1,revertOnError:!1,target:r.options.contract,gasLimit:0,value:0,data:r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("callBalanceOf"),[e.request.params[0]])};default:return null}}catch(e){return null}}));var[t,a]=Cq(t,((e,t)=>void 0!==o[t]));if(o=o.filter((e=>e)),0!==a.length&&(r.options.verbose&&console.log("Forwarding calls on error",a.length),r.forward(a),0===t.length))return;let s;try{s=r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("multiCall"),[o])}catch(e){return void r.forward(t)}const c=yq(),u=await async function(e,t){try{return await e}catch(e){return t instanceof Function?t(e):t}}(bq(n)({id:c,jsonrpc:Oq,method:xq.ethCall,params:[{to:r.options.contract,value:0,data:s},Jn.isBigNumber(i)?i.toNumber():i]}),(e=>({jsonrpc:Oq,id:c,result:void 0,error:e})));if(u.error)return r.forward(t);let f;try{f=r.multicallInterface.decodeFunctionResult(r.multicallInterface.getFunction("multiCall"),u.result)}catch(e){return void r.forward(t)}r.options.verbose&&console.log("Got response for",t.length),t.forEach(((e,t)=>{if(f[0][t])switch(e.request.method){case xq.ethCall:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:f[1][t]});break;case xq.ethGetCode:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:ko.decode(["bytes"],f[1][t])[0]});break;case xq.ethGetBalance:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:ko.decode(["uint256"],f[1][t])[0]})}else r.forward(e)}))},this.options=t?Iq({},e.DefaultOptions,t):e.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(t){return t&&void 0!==t.handle&&void 0!==t.conf&&e.isMulticallOptions(t.options)}static isMulticallOptions(e){return void 0!==e&&void 0!==e.batchSize&&void 0!==e.timeWindow&&void 0!==e.contract}};Pq.DefaultOptions=Iq({},Mq);const Nq=["getNetwork","getBlockNumber","getGasPrice","getTransactionCount","getStorageAt","sendTransaction","estimateGas","getBlock","getTransaction","getTransactionReceipt","getLogs","emit","litenerCount","addListener","removeListener","waitForTransaction","detectNetwork","getBlockWithTransactions"];var Bq=Object.freeze({__proto__:null,ProxyMethods:Nq,MulticallProvider:class extends Vh{constructor(e,t){var r;super(e.getNetwork()),r=this,this.provider=e,this.multicall=void 0,this.listenerCount=this.provider.listenerCount,this.getResolver=async function(e){const t=r.provider;if(t.getResolver){const n=await t.getResolver(await e);return n?new zh(r,n.address,n.name):null}return t.getResolver(await e)},this.next=async function(e,t){try{switch(e.method){case xq.ethCall:r.callback(e,t,await r.provider.call(e.params[0],e.params[1]));break;case xq.ethGetCode:r.callback(e,t,await r.provider.getCode(e.params[0],e.params[1]));break;case xq.ethGetBalance:r.callback(e,t,await r.provider.getBalance(e.params[0],e.params[1]))}}catch(n){r.callback(e,t,void 0,n)}},this.multicall=Pq.isMulticall(t)?t:new Pq(t),Nq.forEach((t=>{void 0!==e[t]&&(this[t]=(...r)=>e[t](...r))}))}callback(e,t,r,n){t(n,{jsonrpc:Oq,id:e.id,result:r,error:n})}async call(e,t){return this.rpcCall(xq.ethCall,e,t)}async getCode(e,t){return this.rpcCall(xq.ethGetCode,e,t)}async getBalance(e,t){return this.rpcCall(xq.ethGetBalance,e,t)}async rpcCall(e,...t){const r=yq();return(await bq(this.multicall.handle)(this.next,{jsonrpc:Oq,id:r,method:e,params:t})).result}},MulticallExternalProvider:class{constructor(e,t){if(this.provider=e,this.multicall=void 0,this.multicall=Pq.isMulticall(t)?t:new Pq(t),e.send){const t=async function(t,r){e.send(t,r)};this.send=(e,r)=>{this.multicall.handle(t,e,r)}}if(e.sendAsync){const t=async function(t,r){e.sendAsync(t,r)};this.sendAsync=(e,r)=>{this.multicall.handle(t,e,r)}}}get isMetaMask(){return this.provider.isMetaMask}get isStatus(){return this.provider.isStatus}},multicallMiddleware:e=>t=>{const r=Pq.isMulticall(e)?e:new Pq(e);return(e,n)=>r.handle(t,e,n)}}),Dq=Object.freeze({__proto__:null,Multicall:Pq,providers:Bq});let Fq,Lq;try{Fq=localStorage}catch(e){const t=new Map;Fq={getItem:e=>{var r;return null!=(r=t.get(e))?r:null},setItem:(e,r)=>t.set(e,r),removeItem:e=>t.delete(e)}}function Uq(e){return void 0!==e.address&&!function(e){return jq(e)||qq(e)||zq(e)}(e)}function jq(e){const t=e;return void 0!==t.signature&&void 0===t.address}function qq(e){const t=e;return void 0!==t.r&&void 0!==t.s&&void 0!==t.v&&void 0!==t.t}function zq(e){const t=e;return void 0!==t.address&&void 0!==t.signature}!function(e){e[e.EOA=0]="EOA",e[e.Address=1]="Address",e[e.Full=2]="Full"}(Lq||(Lq={}));const Hq=e=>{if("string"!=typeof e)return e;const t=e.replace("0x",""),r=Jn.from(`0x${t.slice(0,4)}`).toNumber(),n=[];for(let e=4;e<t.length;){const r=Jn.from(t.slice(e,e+2)).toNumber();e+=2;const i=Jn.from(`0x${t.slice(e,e+2)}`).toNumber();switch(e+=2,r){case Lq.Address:const r=va(t.slice(e,e+40));e+=40,n.push({weight:i,address:r});break;case Lq.EOA:const a=On(`0x${t.slice(e,e+132)}`);e+=132;const o=qn(a.slice(0,65)),s=o.r,c=o.s,u=o.v,f=Jn.from(a[a.length-1]).toNumber();n.push({weight:i,signature:a,r:s,s:c,v:u,t:f});break;case Lq.Full:const d=va(t.slice(e,e+40));e+=40;const l=Jn.from(`0x${t.slice(e,e+4)}`).mul(2).toNumber();e+=4;const h=On(`0x${t.slice(e,e+l)}`);e+=l,n.push({weight:i,address:d,signature:h});break;default:throw Error("Signature type not supported")}}return{threshold:r,signers:n}},Gq=e=>{if("string"==typeof e)return Gq(Hq(e));const t=e.signers.map((e=>{if(Uq(e))return bm(["uint8","uint8","address"],[Lq.Address,e.weight,e.address]);if(qq(e))return bm(["uint8","uint8","bytes32","bytes32","uint8","uint8"],[Lq.EOA,e.weight,e.r,e.s,e.v,e.t]);if(zq(e)){const t=On(e.signature).length;return bm(["uint8","uint8","address","uint16","bytes"],[Lq.Full,e.weight,e.address,t,e.signature])}if(jq(e))return bm(["uint8","uint8","bytes"],[Lq.EOA,e.weight,e.signature]);throw Error("Unkwnown signature part type")}));return bm(["uint16",...Array(t.length).fill("bytes")],[e.threshold,...t])};var Vq;!function(e){e.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",e.INVALID_CONFIGURATION="INVALID_CONFIGURATION",e.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",e.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",e.SILENT_LOGIN_ERROR="SILENT_LOGIN_ERROR",e.REFRESH_TOKEN_ERROR="REFRESH_TOKEN_ERROR",e.USER_REGISTRATION_ERROR="USER_REGISTRATION_ERROR",e.USER_NOT_REGISTERED_ERROR="USER_NOT_REGISTERED_ERROR",e.LOGOUT_ERROR="LOGOUT_ERROR",e.TRANSFER_ERROR="TRANSFER_ERROR",e.CREATE_ORDER_ERROR="CREATE_ORDER_ERROR",e.CANCEL_ORDER_ERROR="CANCEL_ORDER_ERROR",e.EXCHANGE_TRANSFER_ERROR="EXCHANGE_TRANSFER_ERROR",e.CREATE_TRADE_ERROR="CREATE_TRADE_ERROR",e.OPERATION_NOT_SUPPORTED_ERROR="OPERATION_NOT_SUPPORTED_ERROR"}(Vq||(Vq={}));class Wq extends Error{type;constructor(e,t){super(e),this.type=t}}const Kq=async(e,t)=>{try{return await e()}catch(e){let r;throw r=He(e)&&e.response?.data&&function(e){return"code"in e&&"message"in e}(e.response.data)?e.response.data.message:e.message,new Wq(r,t)}},Xq="passport_credentials",$q="pkce_state",Jq="pkce_verifier";class Yq{saveCredentials(e){if(!this.areValid(e))throw Error("Invalid credentials.");localStorage.setItem(Xq,JSON.stringify(e))}getCredentials(){const e=localStorage.getItem(Xq);return e?JSON.parse(e):null}areValid(e){if(e){const t=this.isTokenValid(e.access_token),r=this.isTokenValid(e.id_token);return t&&r}return!1}isTokenValid(e){try{const t=bB(e).exp??0;return t>Date.now()/1e3+3600}catch(e){return!1}}clearCredentials(){localStorage.removeItem(Xq)}savePKCEData(e){localStorage.setItem($q,e.state),localStorage.setItem(Jq,e.verifier)}getPKCEData(){const e=localStorage.getItem($q),t=localStorage.getItem(Jq);return e&&t?{state:e,verifier:t}:null}}function Qq(e){const{id_token:t,expired:r}=e;return!!r||function(e){if(!e)return!1;const t=bB(e),r=Math.floor(Date.now()/1e3);return t.exp<r}(t)}const Zq={headers:{"Content-Type":"application/x-www-form-urlencoded"}};function ez(e){return new Promise((t=>{setTimeout(t,e)}))}class tz{userManager;config;deviceCredentialsManager;logoutMode;refreshingPromise=null;constructor(e){this.config=e,this.userManager=new class{constructor(e){this._logger=new EB("UserManager"),this.settings=new YB(e),this._client=new class{constructor(e){this._logger=new EB("OidcClient"),this.settings=new DB(e),this.metadataService=new class{constructor(e){this._settings=e,this._logger=new EB("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new NB(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,t),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const r=this._logger.create(`_getMetadataProperty('${e}')`),n=await this.getMetadata();if(r.debug("resolved"),void 0===n[e]){if(!0===t)return void r.warn("Metadata does not contain optional property");r.throw(new Error("Metadata does not contain property "+e))}return n[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const r=await this._jsonService.getJson(t);if(e.debug("got key set",r),!Array.isArray(r.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=r.keys,this._signingKeys}}(this.settings),this._claimsService=new class{constructor(e){this._settings=e,this._logger=new EB("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:qB;for(const r of e)zB.includes(r)||delete t[r]}return t}mergeClaims(e,t){const r={...e};for(const[e,n]of Object.entries(t))for(const t of Array.isArray(n)?n:[n]){const n=r[e];n?Array.isArray(n)?n.includes(t)||n.push(t):r[e]!==t&&("object"==typeof t&&this._settings.mergeClaims?r[e]=this.mergeClaims(n,t):r[e]=[n,t]):r[e]=t}return r}}(this.settings),this._validator=new class{constructor(e,t,r){this._settings=e,this._metadataService=t,this._claimsService=r,this._logger=new EB("ResponseValidator"),this._userInfoService=new class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new EB("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const r=RB.decode(e);return t.debug("JWT decoding successful"),r}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new NB(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const r=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",r);const n=await this._jsonService.getJson(r,{token:e,credentials:this._settings.fetchRequestCredentials});return t.debug("got claims",n),n}}(this._settings,this._metadataService),this._tokenClient=new FB(this._settings,this._metadataService)}async validateSigninResponse(e,t){const r=this._logger.create("validateSigninResponse");this._processSigninState(e,t),r.debug("state processed"),await this._processCode(e,t),r.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,null==t?void 0:t.skipUserInfo,e.isOpenId),r.debug("claims processed")}async validateCredentialsResponse(e,t){const r=this._logger.create("validateCredentialsResponse");e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),r.debug("claims processed")}async validateRefreshResponse(e,t){const r=this._logger.create("validateRefreshResponse");e.userState=t.data,null!=e.session_state||(e.session_state=t.session_state),null!=e.scope||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),r.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);const n=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,n),r.debug("claims processed")}validateSignoutResponse(e,t){const r=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&r.throw(new Error("State does not match")),r.debug("state validated"),e.userState=t.data,e.error)throw r.warn("Response was error",e.error),new xB(e)}_processSigninState(e,t){const r=this._logger.create("_processSigninState");if(t.id!==e.state&&r.throw(new Error("State does not match")),t.client_id||r.throw(new Error("No client_id on state")),t.authority||r.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&r.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&r.throw(new Error("client_id mismatch on settings vs. signin state")),r.debug("state validated"),e.userState=t.data,null!=e.scope||(e.scope=t.scope),e.error)throw r.warn("Response was error",e.error),new xB(e);t.code_verifier&&!e.code&&r.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,r=!0){const n=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token)return void n.debug("not loading user info");n.debug("loading user info");const i=await this._userInfoService.getClaims(e.access_token);n.debug("user info claims received from user info endpoint"),r&&i.sub!==e.profile.sub&&n.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(i)),n.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t){const r=this._logger.create("_processCode");if(e.code){r.debug("Validating code");const n=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,...t.extraTokenParams});Object.assign(e,n)}else r.debug("No code to process")}_validateIdTokenAttributes(e,t){var r;const n=this._logger.create("_validateIdTokenAttributes");n.debug("decoding ID Token JWT");const i=RB.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){const e=RB.decode(t);i.sub!==e.sub&&n.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==e.auth_time&&n.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==e.azp&&n.throw(new Error("azp in id_token does not match original azp")),!i.azp&&e.azp&&n.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}}(this.settings,this.metadataService,this._claimsService),this._tokenClient=new FB(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:r,request_type:n,id_token_hint:i,login_hint:a,skipUserInfo:o,nonce:s,response_type:c=this.settings.response_type,scope:u=this.settings.scope,redirect_uri:f=this.settings.redirect_uri,prompt:d=this.settings.prompt,display:l=this.settings.display,max_age:h=this.settings.max_age,ui_locales:p=this.settings.ui_locales,acr_values:m=this.settings.acr_values,resource:b=this.settings.resource,response_mode:y=this.settings.response_mode,extraQueryParams:g=this.settings.extraQueryParams,extraTokenParams:v=this.settings.extraTokenParams}){const w=this._logger.create("createSigninRequest");if("code"!==c)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const _=await this.metadataService.getAuthorizationEndpoint();w.debug("Received authorization endpoint",_);const E=new class{constructor({url:e,authority:t,client_id:r,redirect_uri:n,response_type:i,scope:a,state_data:o,response_mode:s,request_type:c,client_secret:u,nonce:f,resource:d,skipUserInfo:l,extraQueryParams:h,extraTokenParams:p,disablePKCE:m,...b}){if(this._logger=new EB("SigninRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");if(!r)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!n)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!i)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!a)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!t)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new UB({data:o,request_type:c,code_verifier:!m,client_id:r,authority:t,redirect_uri:n,response_mode:s,client_secret:u,scope:a,extraTokenParams:p,skipUserInfo:l});const y=new URL(e);y.searchParams.append("client_id",r),y.searchParams.append("redirect_uri",n),y.searchParams.append("response_type",i),y.searchParams.append("scope",a),f&&y.searchParams.append("nonce",f),y.searchParams.append("state",this.state.id),this.state.code_challenge&&(y.searchParams.append("code_challenge",this.state.code_challenge),y.searchParams.append("code_challenge_method","S256")),d&&(Array.isArray(d)?d:[d]).forEach((e=>y.searchParams.append("resource",e)));for(const[e,t]of Object.entries({response_mode:s,...b,...h}))null!=t&&y.searchParams.append(e,t.toString());this.url=y.href}}({url:_,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:f,response_type:c,scope:u,state_data:e,prompt:d,display:l,max_age:h,ui_locales:p,id_token_hint:i,login_hint:a,acr_values:m,resource:b,request:t,request_uri:r,extraQueryParams:g,extraTokenParams:v,request_type:n,response_mode:y,client_secret:this.settings.client_secret,skipUserInfo:o,nonce:s,disablePKCE:this.settings.disablePKCE});await this.clearStaleState();const T=E.state;return await this.settings.stateStore.set(T.id,T.toStorageString()),E}async readSigninResponseState(e,t=!1){const r=this._logger.create("readSigninResponseState"),n=new jB(IB.readParams(e,this.settings.response_mode));if(!n.state)throw r.throw(new Error("No state in response")),null;const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:UB.fromStorageString(i),response:n}}async processSigninResponse(e){const t=this._logger.create("processSigninResponse"),{state:r,response:n}=await this.readSigninResponseState(e,!0);return t.debug("received state from storage; validating response"),await this._validator.validateSigninResponse(n,r),n}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r=!1,extraTokenParams:n={}}){const i=await this._tokenClient.exchangeCredentials({username:e,password:t,...n}),a=new jB(new URLSearchParams);return Object.assign(a,i),await this._validator.validateCredentialsResponse(a,r),a}async useRefreshToken({state:e,timeoutInSeconds:t}){var r;const n=this._logger.create("useRefreshToken");let i;if(void 0===this.settings.refreshTokenAllowedScope)i=e.scope;else{const t=this.settings.refreshTokenAllowedScope.split(" ");i=((null==(r=e.scope)?void 0:r.split(" "))||[]).filter((e=>t.includes(e))).join(" ")}const a=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:i,timeoutInSeconds:t}),o=new jB(new URLSearchParams);return Object.assign(o,a),n.debug("validating response",o),await this._validator.validateRefreshResponse(o,{...e,scope:i}),o}async createSignoutRequest({state:e,id_token_hint:t,request_type:r,post_logout_redirect_uri:n=this.settings.post_logout_redirect_uri,extraQueryParams:i=this.settings.extraQueryParams}={}){const a=this._logger.create("createSignoutRequest"),o=await this.metadataService.getEndSessionEndpoint();if(!o)throw a.throw(new Error("No end session endpoint")),null;a.debug("Received end session endpoint",o);const s=new class{constructor({url:e,state_data:t,id_token_hint:r,post_logout_redirect_uri:n,extraQueryParams:i,request_type:a}){if(this._logger=new EB("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const o=new URL(e);r&&o.searchParams.append("id_token_hint",r),n&&(o.searchParams.append("post_logout_redirect_uri",n),t&&(this.state=new LB({data:t,request_type:a}),o.searchParams.append("state",this.state.id)));for(const[e,t]of Object.entries({...i}))null!=t&&o.searchParams.append(e,t.toString());this.url=o.href}}({url:o,id_token_hint:t,post_logout_redirect_uri:n,state_data:e,extraQueryParams:i,request_type:r});await this.clearStaleState();const c=s.state;return c&&(a.debug("Signout request has state to persist"),await this.settings.stateStore.set(c.id,c.toStorageString())),s}async readSignoutResponseState(e,t=!1){const r=this._logger.create("readSignoutResponseState"),n=new class{constructor(e){this.state=e.get("state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}}(IB.readParams(e,this.settings.response_mode));if(!n.state){if(r.debug("No state in response"),n.error)throw r.warn("Response was error:",n.error),new xB(n);return{state:void 0,response:n}}const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:LB.fromStorageString(i),response:n}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:r,response:n}=await this.readSignoutResponseState(e,!0);return r?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(n,r)):t.debug("No state from storage; skipping response validation"),n}clearStaleState(){return this._logger.create("clearStaleState"),LB.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}}(e),this._redirectNavigator=new class{constructor(e){this._settings=e,this._logger=new EB("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var r;this._logger.create("prepare");let n=window.self;"top"===t&&(n=null!=(r=window.top)?r:window.self);const i=n.location[e].bind(n.location);let a;return{navigate:async e=>{this._logger.create("navigate");const t=new Promise(((e,t)=>{a=t}));return i(e.url),await t},close:()=>{this._logger.create("close"),null==a||a(new Error("Redirect aborted")),n.stop()}}}}(this.settings),this._popupNavigator=new class{constructor(e){this._settings=e,this._logger=new EB("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new ZB({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,t=!1){this._logger.create("callback"),ZB.notifyOpener(e,t)}}(this.settings),this._iframeNavigator=new class{constructor(e){this._settings=e,this._logger=new EB("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new QB({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),QB.notifyParent(e,this._settings.iframeNotifyParentOrigin)}}(this.settings),this._events=new eD(this.settings),this._silentRenewService=new class{constructor(e){this._userManager=e,this._logger=new EB("SilentRenewService"),this._isStarted=!1,this._retryTimer=new OB("Retry Silent Renew"),this._tokenExpiring=async()=>{const e=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),e.debug("silent token renewal successful")}catch(t){if(t instanceof CB)return e.warn("ErrorTimeout from signinSilent:",t,"retry in 5s"),void this._retryTimer.init(5);e.error("Error from signinSilent:",t),this._userManager.events._raiseSilentRenewError(t)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}}(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new class{constructor(e){this._userManager=e,this._logger=new EB("SessionMonitor"),this._start=async e=>{const t=e.session_state;if(!t)return;const r=this._logger.create("_start");if(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,r.debug("session_state",t,", sub",this._sub)):(this._sub=void 0,this._sid=void 0,r.debug("session_state",t,", anonymous user")),this._checkSessionIFrame)this._checkSessionIFrame.start(t);else try{const e=await this._userManager.metadataService.getCheckSessionIframe();if(e){r.debug("initializing check session iframe");const n=this._userManager.settings.client_id,i=this._userManager.settings.checkSessionIntervalInSeconds,a=this._userManager.settings.stopCheckSessionOnError,o=new class{constructor(e,t,r,n,i){this._callback=e,this._client_id=t,this._intervalInSeconds=n,this._stopOnError=i,this._logger=new EB("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=e=>{e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(e.data+" message from check session op iframe"))};const a=new URL(r);this._frame_origin=a.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=a.href}load(){return new Promise((e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)}))}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{this._frame.contentWindow&&this._session_state&&this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}}(this._callback,n,e,i,a);await o.load(),this._checkSessionIFrame=o,o.start(t)}else r.warn("no check session iframe found in the metadata")}catch(e){r.error("Error from getCheckSessionIframe:",e instanceof Error?e.message:e)}},this._stop=()=>{const e=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const t=setInterval((async()=>{clearInterval(t);try{const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}catch(t){e.error("error from querySessionStatus",t instanceof Error?t.message:t)}}),1e3)}},this._callback=async()=>{const e=this._logger.create("_callback");try{const t=await this._userManager.querySessionStatus();let r=!0;t&&this._checkSessionIFrame?t.sub===this._sub?(r=!1,this._checkSessionIFrame.start(t.session_state),t.sid===this._sid?e.debug("same sub still logged in at OP, restarting check session iframe; session_state",t.session_state):(e.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",t.session_state),this._userManager.events._raiseUserSessionChanged())):e.debug("different subject signed into OP",t.sub):e.debug("subject no longer signed into OP"),r?this._sub?this._userManager.events._raiseUserSignedOut():this._userManager.events._raiseUserSignedIn():e.debug("no change in session detected, no event to raise")}catch(t){this._sub&&(e.debug("Error calling queryCurrentSigninSession; raising signed out event",t),this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((e=>{this._logger.error(e)}))}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}}}(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(){const e=this._logger.create("getUser"),t=await this._loadUser();return t?(e.info("user loaded"),this._events.load(t,!1),t):(e.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),this._events.unload()}async signinRedirect(e={}){this._logger.create("signinRedirect");const{redirectMethod:t,...r}=e,n=await this._redirectNavigator.prepare({redirectMethod:t});await this._signinStart({request_type:"si:r",...r},n)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),r=await this._signinEnd(e);return r.profile&&r.profile.sub?t.info("success, signed in subject",r.profile.sub):t.info("no subject"),r}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:r=!1}){const n=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r,extraTokenParams:this.settings.extraTokenParams});n.debug("got signin response");const a=await this._buildUser(i);return a.profile&&a.profile.sub?n.info("success, signed in subject",a.profile.sub):n.info("no subject"),a}async signinPopup(e={}){const t=this._logger.create("signinPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,a=this.settings.popup_redirect_uri;a||t.throw(new Error("No popup_redirect_uri configured"));const o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n}),s=await this._signin({request_type:"si:p",redirect_uri:a,display:"popup",...i},o);return s&&(s.profile&&s.profile.sub?t.info("success, signed in subject",s.profile.sub):t.info("no subject")),s}async signinPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async signinSilent(e={}){var t;const r=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:n,...i}=e;let a=await this._loadUser();if(null==a?void 0:a.refresh_token){r.debug("using refresh token");const e=new class{constructor(e){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.data=e.state}}(a);return await this._useRefreshToken(e)}const o=this.settings.silent_redirect_uri;let s;o||r.throw(new Error("No silent_redirect_uri configured")),a&&this.settings.validateSubOnSilentRenew&&(r.debug("subject prior to silent renew:",a.profile.sub),s=a.profile.sub);const c=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});return a=await this._signin({request_type:"si:s",redirect_uri:o,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0,...i},c,s),a&&((null==(t=a.profile)?void 0:t.sub)?r.info("success, signed in subject",a.profile.sub):r.info("no subject")),a}async _useRefreshToken(e){const t=await this._client.useRefreshToken({state:e,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds}),r=new HB({...e,...t});return await this.storeUser(r),this._events.load(r),r}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":return await this.signinPopupCallback(e);case"si:s":return await this.signinSilentCallback(e);default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:r}=await this._client.readSignoutResponseState(e);if(r)switch(r.request_type){case"so:r":await this.signoutRedirectCallback(e);break;case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:r,...n}=e,i=this.settings.silent_redirect_uri;i||t.throw(new Error("No silent_redirect_uri configured"));const a=await this._loadUser(),o=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r}),s=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...n},o);try{const e=await this._client.processSigninResponse(s.url);return t.debug("got signin response"),e.session_state&&e.profile.sub?(t.info("success for subject",e.profile.sub),{session_state:e.session_state,sub:e.profile.sub,sid:e.profile.sid}):(t.info("success, user not authenticated"),null)}catch(e){if(this.settings.monitorAnonymousSession&&e instanceof xB)switch(e.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:e.session_state}}throw e}}async _signin(e,t,r){const n=await this._signinStart(e,t);return await this._signinEnd(n.url,r)}async _signinStart(e,t){const r=this._logger.create("_signinStart");try{const n=await this._client.createSigninRequest(e);return r.debug("got signin request"),await t.navigate({url:n.url,state:n.state.id,response_mode:n.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(e){throw r.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signinEnd(e,t){const r=this._logger.create("_signinEnd"),n=await this._client.processSigninResponse(e);return r.debug("got signin response"),await this._buildUser(n,t)}async _buildUser(e,t){const r=this._logger.create("_buildUser"),n=new HB(e);if(t){if(t!==n.profile.sub)throw r.debug("current user does not match user returned from signin. sub from signin:",n.profile.sub),new xB({...e,error:"login_required"});r.debug("current user matches user returned from signin")}return await this.storeUser(n),r.debug("user stored"),this._events.load(n),n}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:r,...n}=e,i=await this._redirectNavigator.prepare({redirectMethod:r});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...n},i),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),r=await this._signoutEnd(e);return t.info("success"),r}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,a=this.settings.popup_post_logout_redirect_uri,o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n});await this._signout({request_type:"so:p",post_logout_redirect_uri:a,state:null==a?void 0:{},...i},o),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async _signout(e,t){const r=await this._signoutStart(e,t);return await this._signoutEnd(r.url)}async _signoutStart(e={},t){var r;const n=this._logger.create("_signoutStart");try{const i=await this._loadUser();n.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);const a=e.id_token_hint||i&&i.id_token;a&&(n.debug("setting id_token_hint in signout request"),e.id_token_hint=a),await this.removeUser(),n.debug("user removed, creating signout request");const o=await this._client.createSignoutRequest(e);return n.debug("got signout request"),await t.navigate({url:o.url,state:null==(r=o.state)?void 0:r.id})}catch(e){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),r=await this._client.processSignoutResponse(e);return t.debug("got signout response"),r}async signoutSilent(e={}){var t;const r=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:n,...i}=e,a=this.settings.includeIdTokenInSilentSignout?null==(t=await this._loadUser())?void 0:t.id_token:void 0,o=this.settings.popup_post_logout_redirect_uri,s=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});await this._signout({request_type:"so:s",post_logout_redirect_uri:o,id_token_hint:a,...i},s),r.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const r=this._logger.create("_revokeInternal");if(!e)return;const n=t.filter((t=>"string"==typeof e[t]));if(n.length){for(const t of n)await this._client.revokeToken(e[t],t),r.info(`${t} revoked successfully`),"access_token"!==t&&(e[t]=null);await this.storeUser(e),r.debug("user stored"),this._events.load(e)}else r.debug("no need to revoke due to no token(s)")}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),HB.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const r=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,r)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey)}async clearStaleState(){await this._client.clearStaleState()}}((({oidcConfiguration:e,authenticationDomain:t})=>{const r="undefined"!=typeof window?window.localStorage:new PB,n=new BB({store:r}),i={authority:t,redirect_uri:e.redirectUri,popup_redirect_uri:e.redirectUri,client_id:e.clientId,metadata:{authorization_endpoint:`${t}/authorize`,token_endpoint:`${t}/oauth/token`,userinfo_endpoint:`${t}/userinfo`,end_session_endpoint:`${t}/v2/logout?returnTo=${encodeURIComponent(e.logoutRedirectUri)}&client_id=${e.clientId}`},mergeClaims:!0,loadUserInfo:!0,scope:e.scope,userStore:n};return e.audience&&(i.extraQueryParams={audience:e.audience}),i})(e)),this.deviceCredentialsManager=new Yq,this.logoutMode=e.oidcConfiguration.logoutMode||"redirect"}static mapOidcUserToDomainModel=e=>{const t=e.profile?.passport,r={expired:e.expired,idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:e.profile.sub,email:e.profile.email,nickname:e.profile.nickname}};return t?.imx_eth_address&&(r.imx={ethAddress:t?.imx_eth_address,starkAddress:t?.imx_stark_address,userAdminAddress:t?.imx_user_admin_address}),t?.zkevm_eth_address&&(r.zkEvm={ethAddress:t?.zkevm_eth_address,userAdminAddress:t?.zkevm_user_admin_address}),r};static mapDeviceTokenResponseToDomainUserModel=e=>{const t=bB(e.id_token),r={idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:t.sub,email:t.email,nickname:t.nickname}};return t?.passport?.imx_eth_address&&(r.imx={ethAddress:t?.passport?.imx_eth_address,starkAddress:t?.passport?.imx_stark_address,userAdminAddress:t?.passport?.imx_user_admin_address}),t?.passport?.zkevm_eth_address&&(r.zkEvm={ethAddress:t?.passport?.zkevm_eth_address,userAdminAddress:t?.passport?.zkevm_user_admin_address}),r};async login(){return Kq((async()=>{const e=await this.userManager.signinPopup({popupWindowFeatures:{width:410,height:450}});return tz.mapOidcUserToDomainModel(e)}),Vq.AUTHENTICATION_ERROR)}async loginCallback(){return Kq((async()=>this.userManager.signinPopupCallback()),Vq.AUTHENTICATION_ERROR)}async loginWithDeviceFlow(){return Kq((async()=>{const e=await Ne.post(`${this.config.authenticationDomain}/oauth/device/code`,{client_id:this.config.oidcConfiguration.clientId,scope:this.config.oidcConfiguration.scope,audience:this.config.oidcConfiguration.audience},Zq);return{code:e.data.user_code,deviceCode:e.data.device_code,url:e.data.verification_uri_complete,interval:e.data.interval}}),Vq.AUTHENTICATION_ERROR)}async connectImxDeviceFlow(e,t,r){return Kq((async()=>{const n=Date.now();for(;;){if(null!=r&&Date.now()-n>r)throw new Error("Timed out");await ez(1e3*t);try{const t=await this.getDeviceFlowToken(e),r=tz.mapDeviceTokenResponseToDomainUserModel(t);return r.imx?.ethAddress&&r.imx?.starkAddress&&r.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(t),r}catch(e){if(!Ne.isAxiosError(e))throw e;{const t=e.response?.data;switch(t.error){case"authorization_pending":case"slow_down":break;case"expired_token":throw new Error("Token expired, please log in again");case"access_denied":throw new Error("User denied access");default:throw new Error("Error getting token")}}}}throw new Error("Failed to get credentials")}),Vq.AUTHENTICATION_ERROR)}async getDeviceFlowToken(e){return(await Ne.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e},Zq)).data}static base64URLEncode(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static sha256(e){return(void 0)("sha256").update(e).digest()}getPKCEAuthorizationUrl(){const e=tz.base64URLEncode((void 0)(32)),t=tz.base64URLEncode(tz.sha256(e)),r=tz.base64URLEncode((void 0)(32));return this.deviceCredentialsManager.savePKCEData({state:r,verifier:e}),`${this.config.authenticationDomain}/authorize?response_type=code&code_challenge=${t}&code_challenge_method=S256&client_id=${this.config.oidcConfiguration.clientId}&redirect_uri=${this.config.oidcConfiguration.redirectUri}&scope=${this.config.oidcConfiguration.scope}&state=${r}&audience=${this.config.oidcConfiguration.audience}`}async connectImxPKCEFlow(e,t){return Kq((async()=>{const r=this.deviceCredentialsManager.getPKCEData();if(!r)throw new Error("No code verifier or state for PKCE");if(t!==r.state)throw new Error("Provided state does not match stored state");const n=await this.getPKCEToken(e,r.verifier),i=tz.mapDeviceTokenResponseToDomainUserModel(n);return i.imx?.ethAddress&&i.imx?.starkAddress&&i.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(n),i}),Vq.AUTHENTICATION_ERROR)}async getPKCEToken(e,t){return(await Ne.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"authorization_code",code_verifier:t,code:e,redirect_uri:this.config.oidcConfiguration.redirectUri},Zq)).data}async connectImxWithCredentials(e){return Kq((async()=>{if(this.deviceCredentialsManager.areValid(e))return tz.mapDeviceTokenResponseToDomainUserModel(e);const t=e?.refresh_token??null;if(t){return await this.refreshToken(t)}return null}),Vq.AUTHENTICATION_ERROR)}async refreshToken(e){const t=(await Ne.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"refresh_token",refresh_token:e},Zq)).data;return tz.mapDeviceTokenResponseToDomainUserModel(t)}async logout(){return Kq((async()=>"silent"===this.logoutMode?this.userManager.signoutSilent():this.userManager.signoutRedirect()),Vq.LOGOUT_ERROR)}async logoutSilentCallback(e){return this.userManager.signoutSilentCallback(e)}async logoutDeviceFlow(){return Kq((async()=>{this.deviceCredentialsManager.clearCredentials()}),Vq.LOGOUT_ERROR)}async loginSilent({forceRefresh:e}={forceRefresh:!1}){return Kq((async()=>this.getUser({forceRefresh:e})),Vq.SILENT_LOGIN_ERROR)}async getAuthenticatedUser({forceRefresh:e=!1}){if(e)return this.refreshTokenAndUpdatePromise();const t=await this.userManager.getUser();return t?Qq(t)?t.refresh_token?this.refreshTokenAndUpdatePromise():null:tz.mapOidcUserToDomainModel(t):null}async refreshTokenAndUpdatePromise(){return this.refreshingPromise||(this.refreshingPromise=new Promise((async(e,t)=>{try{const t=await this.userManager.signinSilent();if(t)return void e(tz.mapOidcUserToDomainModel(t));e(null)}catch(e){t(e)}finally{this.refreshingPromise=null}}))),this.refreshingPromise}async getUser({forceRefresh:e}={forceRefresh:!1}){return Kq((async()=>{const t=await this.getAuthenticatedUser({forceRefresh:e});if(t)return t;const r=this.deviceCredentialsManager.getCredentials();return r?tz.mapDeviceTokenResponseToDomainUserModel(r):null}),Vq.NOT_LOGGED_IN_ERROR)}async getUserDeviceFlow(){return Kq((async()=>{const e=this.deviceCredentialsManager.getCredentials();return e?tz.mapDeviceTokenResponseToDomainUserModel(e):null}),Vq.NOT_LOGGED_IN_ERROR)}checkStoredDeviceFlowCredentials(){return this.deviceCredentialsManager.getCredentials()}}class rz{config;lazyMagicClient;constructor(e){this.config=e,"undefined"!=typeof window&&(this.lazyMagicClient=((e,t)=>e().then(t))((()=>new Promise((e=>{if("complete"===window.document.readyState)e();else{const t=()=>{"complete"===window.document.readyState&&(e(),window.document.removeEventListener("readystatechange",t))};window.document.addEventListener("readystatechange",t)}}))),(()=>{const e=new fU(this.config.magicPublishableApiKey,{extensions:[new lU],network:this.config.network});return e.preload(),e})))}get magicClient(){if(!this.lazyMagicClient)throw new Error("Cannot perform this action outside of the browser");return this.lazyMagicClient}async login(e){return Kq((async()=>{const t=await this.magicClient;return await t.openid.loginWithOIDC({jwt:e,providerId:this.config.magicProviderId}),t.rpcProvider}),Vq.WALLET_CONNECTION_ERROR)}async logout(){const e=await this.magicClient;e.user&&await e.user.logout()}}const nz=1e3,iz=3,az=async(e,t)=>{const{retries:r=iz,interval:n=nz,finalErr:i=Error("Retry failed"),finallyFn:a=(()=>{})}=t||{};try{return await e()}catch(t){return r<=0?Promise.reject(i):(await(o=n,new Promise((e=>{setTimeout((()=>e()),o)}))),az(e,{retries:r-1,finalErr:i,finallyFn:a}))}finally{r<=0&&a()}var o};var oz,sz;!function(e){e[e.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",e[e.UNAUTHORIZED=4100]="UNAUTHORIZED",e[e.UNSUPPORTED_METHOD=4200]="UNSUPPORTED_METHOD",e[e.DISCONNECTED=4900]="DISCONNECTED"}(oz||(oz={})),function(e){e[e.RPC_SERVER_ERROR=-32e3]="RPC_SERVER_ERROR",e[e.INVALID_REQUEST=-32600]="INVALID_REQUEST",e[e.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",e[e.INVALID_PARAMS=-32602]="INVALID_PARAMS",e[e.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e[e.PARSE_ERROR=-32700]="PARSE_ERROR",e[e.TRANSACTION_REJECTED=-32003]="TRANSACTION_REJECTED"}(sz||(sz={}));class cz extends Error{message;code;constructor(e,t){super(t),this.message=t,this.code=e}}const uz="Transaction requires confirmation but this functionality is not supported in this environment. Please contact Immutable support if you need to enable this feature.",fz=e=>Jn.from(e).toString();class dz{transactionAPI;messageAPI;confirmationScreen;crossSdkBridgeEnabled;constructor({confirmationScreen:e,config:t}){const r=new sq({basePath:t.imxPublicApiDomain});this.confirmationScreen=e,this.crossSdkBridgeEnabled=t.crossSdkBridgeEnabled,this.messageAPI=new iq(r),this.transactionAPI=new oq(r)}withConfirmationScreen(e){return t=>this.withConfirmationScreenTask(e)(t)()}withConfirmationScreenTask(e){return t=>async()=>{this.confirmationScreen.loading(e);try{return await t()}catch(e){throw this.confirmationScreen.closeWindow(),e}}}withDefaultConfirmationScreenTask(e){return this.withConfirmationScreenTask()(e)}async evaluateImxTransaction({payloadHash:e,user:t}){const r={Authorization:`Bearer ${t.accessToken}`};if(!(await az((async()=>this.transactionAPI.getTransactionByID({transactionID:e,chainType:"starkex"},{headers:r})),{finallyFn:()=>{this.confirmationScreen.closeWindow()}})).data.id)throw new Error("Transaction doesn't exists");const n=await this.transactionAPI.evaluateTransaction({id:e,transactionEvaluationRequest:{chainType:"starkex"}},{headers:r}),{confirmationRequired:i}=n.data;if(i){if(this.crossSdkBridgeEnabled)throw new Error(uz);if(!(await this.confirmationScreen.requestConfirmation(e,t.imx.ethAddress,cq)).confirmed)throw new Error("Transaction rejected by user")}else this.confirmationScreen.closeWindow()}async evaluateEVMTransaction({chainId:e,nonce:t,user:r,metaTransactions:n}){const i={Authorization:`Bearer ${r.accessToken}`},a=(e=>{try{return e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit?fz(e.gasLimit):"0",target:e.to??Da,value:e.value?fz(e.value):"0",data:e.data?e.data.toString():"0x"})))}catch(e){const t=e instanceof Error?e.message:String(e);throw new cz(sz.INVALID_PARAMS,`Transaction failed to parsing: ${t}`)}})(n);try{return(await this.transactionAPI.evaluateTransaction({id:"evm",transactionEvaluationRequest:{chainType:"evm",chainId:e,transactionData:{nonce:t,userAddress:r.zkEvm.ethAddress,metaTransactions:a}}},{headers:i})).data}catch(e){const t=e instanceof Error?e.message:String(e);throw new cz(sz.INTERNAL_ERROR,`Transaction failed to validate with error: ${t}`)}}async validateEVMTransaction({chainId:e,nonce:t,user:r,metaTransactions:n}){const i=await this.evaluateEVMTransaction({chainId:e,nonce:t,user:r,metaTransactions:n}),{confirmationRequired:a,transactionId:o}=i;if(a&&this.crossSdkBridgeEnabled)throw new cz(sz.TRANSACTION_REJECTED,uz);if(a&&o){if(!(await this.confirmationScreen.requestConfirmation(o,r.zkEvm.ethAddress,uq,e)).confirmed)throw new cz(sz.TRANSACTION_REJECTED,"Transaction rejected by user")}else this.confirmationScreen.closeWindow()}async evaluateMessage({chainID:e,payload:t,user:r}){try{return(await this.messageAPI.evaluateMessage({messageEvaluationRequest:{chainID:e,payload:t}},{headers:{Authorization:`Bearer ${r.accessToken}`}})).data}catch(e){const t=e instanceof Error?e.message:String(e);throw new cz(sz.INTERNAL_ERROR,`Message failed to validate with error: ${t}`)}}async validateMessage({chainID:e,payload:t,user:r}){const{messageId:n,confirmationRequired:i}=await this.evaluateMessage({chainID:e,payload:t,user:r});if(i&&this.crossSdkBridgeEnabled)throw new cz(sz.TRANSACTION_REJECTED,uz);if(i&&n){if(!(await this.confirmationScreen.requestMessageConfirmation(n,r.zkEvm.ethAddress)).confirmed)throw new cz(sz.TRANSACTION_REJECTED,"Signature rejected by user")}else this.confirmationScreen.closeWindow()}}var lz,hz;!function(e){e.LOGGED_OUT="loggedOut"}(lz||(lz={})),function(e){e.PRODUCTION="mainnet",e.SANDBOX="sepolia"}(hz||(hz={}));const pz="ERC721";const mz="ERC721";class bz{authManager;starkSigner;immutableXClient;guardianClient;constructor({authManager:e,starkSigner:t,immutableXClient:r,confirmationScreen:n,config:i,passportEventEmitter:a}){this.authManager=e,this.starkSigner=t,this.immutableXClient=r,this.guardianClient=new dz({confirmationScreen:n,config:i}),a.on(lz.LOGGED_OUT,this.handleLogout)}handleLogout=()=>{this.starkSigner=void 0};async getAuthenticatedUserSigner(){const e=await this.authManager.getUser();if(!e||void 0===this.starkSigner)throw new Wq("User has been logged out",Vq.NOT_LOGGED_IN_ERROR);if(t=e,void 0===t?.imx)throw new Wq("User has not been registered with StarkEx",Vq.USER_NOT_REGISTERED_ERROR);var t;return{user:e,starkSigner:this.starkSigner}}async transfer(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({request:e,transfersApi:t,starkSigner:r,user:n,guardianClient:i}){return Kq(i.withDefaultConfirmationScreenTask((async()=>{const a=e.type===mz?"1":e.amount,o={sender:n.imx.ethAddress,token:lq(e),amount:a,receiver:e.receiver},s={Authorization:`Bearer ${n.accessToken}`},c=await t.getSignableTransferV1({getSignableTransferRequest:o},{headers:s});await i.evaluateImxTransaction({user:n,payloadHash:c.data.payload_hash});const u=c.data,{payload_hash:f}=u,d=await r.signMessage(f),l=await r.getAddress(),h={createTransferRequest:{sender_stark_key:u.sender_stark_key||l,sender_vault_id:u.sender_vault_id,receiver_stark_key:u.receiver_stark_key,receiver_vault_id:u.receiver_vault_id,asset_id:u.asset_id,amount:u.amount,nonce:u.nonce,expiration_timestamp:u.expiration_timestamp,stark_signature:d}},{data:p}=await t.createTransferV1(h,{headers:s});return{sent_signature:p.sent_signature,status:p.status?.toString(),time:p.time,transfer_id:p.transfer_id}})),Vq.TRANSFER_ERROR)}({request:e,user:t,starkSigner:r,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}registerOffchain(){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOffchain(){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOnchain(){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}async createOrder(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({starkSigner:e,user:t,request:r,ordersApi:n,guardianClient:i}){return Kq(i.withDefaultConfirmationScreenTask((async()=>{const{ethAddress:a}=t.imx,o=r.sell.type===pz?"1":r.sell.amount,s=r.buy.type===pz?"1":r.buy.amount,c={Authorization:`Bearer ${t.accessToken}`},u={user:a,amount_buy:s,token_buy:lq(r.buy),amount_sell:o,token_sell:lq(r.sell),fees:r.fees,split_fees:!0,expiration_timestamp:r.expiration_timestamp},f=await n.getSignableOrder({getSignableOrderRequestV3:u},{headers:c});await i.evaluateImxTransaction({user:t,payloadHash:f.data.payload_hash});const{payload_hash:d}=f.data,l=await e.signMessage(d),h=f.data,p={createOrderRequest:{include_fees:!0,fees:r.fees,stark_signature:l,amount_buy:h.amount_buy,amount_sell:h.amount_sell,asset_id_buy:h.asset_id_buy,asset_id_sell:h.asset_id_sell,expiration_timestamp:h.expiration_timestamp,nonce:h.nonce,stark_key:h.stark_key,vault_id_buy:h.vault_id_buy,vault_id_sell:h.vault_id_sell}};return{...(await n.createOrderV3(p,{headers:c})).data}})),Vq.CREATE_ORDER_ERROR)}({request:e,user:t,starkSigner:r,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}async cancelOrder(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({user:e,starkSigner:t,request:r,ordersApi:n,guardianClient:i}){return Kq(i.withDefaultConfirmationScreenTask((async()=>{const a={order_id:r.order_id},o={Authorization:`Bearer ${e.accessToken}`},s=await n.getSignableCancelOrderV3({getSignableCancelOrderRequest:a},{headers:o});await i.evaluateImxTransaction({user:e,payloadHash:s.data.payload_hash});const{payload_hash:c}=s.data,u=await t.signMessage(c),f=await n.cancelOrderV3({id:r.order_id.toString(),cancelOrderRequest:{order_id:r.order_id,stark_signature:u}},{headers:o});return{order_id:f.data.order_id,status:f.data.status}})),Vq.CANCEL_ORDER_ERROR)}({request:e,user:t,starkSigner:r,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}async createTrade(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({request:e,tradesApi:t,user:r,starkSigner:n,guardianClient:i}){return Kq(i.withDefaultConfirmationScreenTask((async()=>{const{ethAddress:a}=r.imx,o={expiration_timestamp:e.expiration_timestamp,fees:e.fees,order_id:e.order_id,user:a},s={Authorization:`Bearer ${r.accessToken}`},c=await t.getSignableTrade({getSignableTradeRequest:o},{headers:s});await i.evaluateImxTransaction({user:r,payloadHash:c.data.payload_hash});const{payload_hash:u}=c.data,f=await n.signMessage(u),{data:d}=c,l={createTradeRequest:{include_fees:!0,fees:e?.fees,stark_signature:f,order_id:e?.order_id,fee_info:d.fee_info,amount_buy:d.amount_buy,amount_sell:d.amount_sell,asset_id_buy:d.asset_id_buy,asset_id_sell:d.asset_id_sell,expiration_timestamp:d.expiration_timestamp,nonce:d.nonce,stark_key:d.stark_key,vault_id_buy:d.vault_id_buy,vault_id_sell:d.vault_id_sell}},{data:h}=await t.createTradeV3(l,{headers:s});return h})),Vq.CREATE_TRADE_ERROR)}({request:e,user:t,starkSigner:r,tradesApi:this.immutableXClient.tradesApi,guardianClient:this.guardianClient})}async batchNftTransfer(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({user:e,starkSigner:t,request:r,transfersApi:n,guardianClient:i}){return Kq(i.withConfirmationScreenTask({width:480,height:784})((async()=>{const{ethAddress:a}=e.imx,o=r.map((e=>({amount:"1",token:lq({type:mz,tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver}))),s={Authorization:`Bearer ${e.accessToken}`},c=await n.getSignableTransfer({getSignableTransferRequestV2:{sender_ether_key:a,signable_requests:o}},{headers:s});await i.evaluateImxTransaction({user:e,payloadHash:c.data.signable_responses[0]?.payload_hash});const u=await Promise.all(c.data.signable_responses.map((async e=>{const r=await t.signMessage(e.payload_hash);return{sender_vault_id:e.sender_vault_id,receiver_stark_key:e.receiver_stark_key,receiver_vault_id:e.receiver_vault_id,asset_id:e.asset_id,amount:e.amount,nonce:e.nonce,expiration_timestamp:e.expiration_timestamp,stark_signature:r}}))),f={sender_stark_key:c.data.sender_stark_key,requests:u},d=await n.createTransfer({createTransferRequestV2:f},{headers:s});return{transfer_ids:d?.data.transfer_ids}})),Vq.TRANSFER_ERROR)}({request:e,user:t,starkSigner:r,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}async exchangeTransfer(e){const{user:t,starkSigner:r}=await this.getAuthenticatedUserSigner();return async function({user:e,starkSigner:t,request:r,exchangesApi:n}){return Kq((async()=>{const{ethAddress:i}=e.imx,a=r.amount,o=await n.getExchangeSignableTransfer({id:r.transactionID,getSignableTransferRequest:{sender:i,token:lq(r),amount:a,receiver:r.receiver}}),s=await t.getAddress(),{payload_hash:c}=o.data,u=await t.signMessage(c),f={sender_stark_key:o.data.sender_stark_key||s,sender_vault_id:o.data.sender_vault_id,receiver_stark_key:o.data.receiver_stark_key,receiver_vault_id:o.data.receiver_vault_id,asset_id:o.data.asset_id,amount:o.data.amount,nonce:o.data.nonce,expiration_timestamp:o.data.expiration_timestamp,stark_signature:u},d={Authorization:`Bearer ${e.accessToken}`},l=await n.createExchangeTransfer({id:r.transactionID,createTransferRequest:f},{headers:d});return{sent_signature:l?.data.sent_signature,status:l?.data.status?.toString(),time:l?.data.time,transfer_id:l?.data.transfer_id}}),Vq.EXCHANGE_TRANSFER_ERROR)}({request:e,user:t,starkSigner:r,exchangesApi:this.immutableXClient.exchangeApi})}deposit(e){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}prepareWithdrawal(e){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}completeWithdrawal(e,t){throw new Wq("Operation not supported",Vq.OPERATION_NOT_SUPPORTED_ERROR)}async getAddress(){const{user:e}=await this.getAuthenticatedUserSigner();return Promise.resolve(e.imx.ethAddress)}}class yz{authManager;config;confirmationScreen;immutableXClient;magicAdapter;passportEventEmitter;constructor({authManager:e,config:t,confirmationScreen:r,immutableXClient:n,magicAdapter:i,passportEventEmitter:a}){this.authManager=e,this.config=t,this.confirmationScreen=r,this.immutableXClient=n,this.magicAdapter=i,this.passportEventEmitter=a}async getProvider(){let e=null;try{e=await this.authManager.loginSilent()}catch(e){console.warn(e)}return e||(e=await this.authManager.login()),this.createProviderInstance(e)}async getProviderSilent(){const e=await this.authManager.loginSilent();return e?this.createProviderInstance(e):null}async getProviderWithDeviceFlow(e,t,r){const n=await this.authManager.connectImxDeviceFlow(e,t,r);return this.createProviderInstance(n)}async getProviderWithPKCEFlow(e,t){const r=await this.authManager.connectImxPKCEFlow(e,t);return this.createProviderInstance(r)}async getProviderWithCredentials(e){const t=await this.authManager.connectImxWithCredentials(e);return t?this.createProviderInstance(t):null}async createProviderInstance(e){if(!e.idToken)throw new Wq("Failed to initialise",Vq.WALLET_CONNECTION_ERROR);const t=await this.magicAdapter.login(e.idToken),r=new om(t).getSigner(),n=await(async e=>Kq((async()=>Nx(await JN(e))),Vq.WALLET_CONNECTION_ERROR))(r);return e.imx?.ethAddress||await this.registerStarkEx(r,n,e.accessToken),new bz({authManager:this.authManager,starkSigner:n,immutableXClient:this.immutableXClient,confirmationScreen:this.confirmationScreen,config:this.config,passportEventEmitter:this.passportEventEmitter})}async registerStarkEx(e,t,r){return Kq((async()=>{await async function({ethSigner:e,starkSigner:t,usersApi:r},n){return Kq((async()=>{const[i,a]=await Promise.all([e.getAddress(),t.getAddress()]),o=await r.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:i,stark_key:a}}),{signable_message:s,payload_hash:c}=o.data,[u,f]=await Promise.all([dq(s,e),t.signMessage(c)]);return(await r.registerPassportUser({authorization:`Bearer ${n}`,registerPassportUserRequest:{eth_signature:u,ether_key:i,stark_signature:f,stark_key:a}})).statusText}),Vq.USER_REGISTRATION_ERROR)}({ethSigner:e,starkSigner:t,usersApi:this.immutableXClient.usersApi},r);return await az((async()=>{const e=await this.authManager.loginSilent({forceRefresh:!0});return!!e?.imx?e:Promise.reject(new Error("user wallet addresses not exist"))}))}),Vq.REFRESH_TOKEN_ERROR)}}const gz=(e,t,r)=>{const n=t.map((t=>!e[t]&&t)).filter((e=>e)).join(", ");if(""!==n){throw new Wq(r?`${r} - ${n} cannot be null`:`${n} cannot be null`,Vq.INVALID_CONFIGURATION)}};class vz{network;authenticationDomain;passportDomain;imxPublicApiDomain;magicPublishableApiKey;magicProviderId;oidcConfiguration;baseConfig;zkEvmRpcUrl;relayerUrl;multiRollupConfig;crossSdkBridgeEnabled;constructor({baseConfig:e,overrides:t,crossSdkBridgeEnabled:r,...n}){if(gz(n,["clientId","logoutRedirectUri","redirectUri"]),this.oidcConfiguration=n,this.baseConfig=e,this.crossSdkBridgeEnabled=r||!1,t)gz(t,["network","authenticationDomain","passportDomain","magicPublishableApiKey","magicProviderId","zkEvmRpcUrl","relayerUrl","imxPublicApiDomain","indexerMrBasePath","orderBookMrBasePath","passportMrBasePath"],"overrides"),this.network=t.network,this.authenticationDomain=t.authenticationDomain,this.passportDomain=t.passportDomain,this.imxPublicApiDomain=t.imxPublicApiDomain,this.magicPublishableApiKey=t.magicPublishableApiKey,this.magicProviderId=t.magicProviderId,this.zkEvmRpcUrl=t.zkEvmRpcUrl,this.relayerUrl=t.relayerUrl,this.multiRollupConfig={indexer:Kt({basePath:t.indexerMrBasePath}),orderBook:Kt({basePath:t.orderBookMrBasePath}),passport:Kt({basePath:t.passportMrBasePath})};else switch(e.environment){case Je.PRODUCTION:this.network=hz.PRODUCTION,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.immutable.com",this.imxPublicApiDomain="https://api.immutable.com",this.zkEvmRpcUrl="",this.relayerUrl="https://api.immutable.com/relayer-mr",this.multiRollupConfig=Xt();break;case Je.SANDBOX:default:this.network=hz.SANDBOX,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.sandbox.immutable.com",this.imxPublicApiDomain="https://api.sandbox.immutable.com",this.zkEvmRpcUrl="https://rpc.testnet.immutable.com",this.relayerUrl="https://api.sandbox.immutable.com/relayer-mr",this.multiRollupConfig=$t()}}}var wz;!function(e){e.CONFIRMATION_WINDOW_READY="confirmation_window_ready",e.TRANSACTION_CONFIRMED="transaction_confirmed",e.TRANSACTION_ERROR="transaction_error",e.MESSAGE_CONFIRMED="message_confirmed",e.MESSAGE_REJECTED="message_rejected",e.LOGOUT_SUCCESS="logout_success"}(wz||(wz={}));const _z="imx_passport_confirmation";class Ez{config;confirmationWindow;constructor(e){this.config=e}getHref(e,t){let r=`${this.config.passportDomain}/transaction-confirmation/${e}`;if(t){const e=t?Object.keys(t).map((e=>`${e}=${t[e]}`)).join("&"):"";r=`${r}?${e}`}return r}requestConfirmation(e,t,r,n){return new Promise(((i,a)=>{const o=({data:e,origin:t})=>{if(t===this.config.passportDomain&&e.eventType===_z)switch(e.messageType){case wz.CONFIRMATION_WINDOW_READY:break;case wz.TRANSACTION_CONFIRMED:i({confirmed:!0});break;case wz.TRANSACTION_ERROR:a(new Error("Transaction error"));break;default:a(new Error("Unsupported message type"))}};if(!this.confirmationWindow)return void i({confirmed:!1});window.addEventListener("message",o);let s="";s=r===cq?this.getHref("transaction",{transactionId:e,etherAddress:t,chainType:r}):this.getHref("zkevm",{transactionId:e,etherAddress:t,chainType:r,chainId:n}),this.showConfirmationScreen(s,o,i)}))}requestMessageConfirmation(e,t){return new Promise(((r,n)=>{const i=({data:e,origin:t})=>{if(t===this.config.passportDomain&&e.eventType===_z)switch(e.messageType){case wz.CONFIRMATION_WINDOW_READY:break;case wz.MESSAGE_CONFIRMED:r({confirmed:!0});break;case wz.MESSAGE_REJECTED:n(new Error("Message rejected"));break;default:n(new Error("Unsupported message type"))}};if(!this.confirmationWindow)return void r({confirmed:!1});window.addEventListener("message",i);const a=this.getHref("zkevm/message",{messageID:e,etherAddress:t});this.showConfirmationScreen(a,i,r)}))}loading(e){this.config.crossSdkBridgeEnabled||(this.confirmationWindow=(({url:e,title:t,width:r,height:n})=>{const i=Math.max(0,Math.round(window.screenX+(window.outerWidth-r)/2)),a=Math.max(0,Math.round(window.screenY+(window.outerHeight-n)/2)),o=window.open(e,t,`\n scrollbars=yes,\n width=${r}, \n height=${n}, \n top=${a}, \n left=${i}\n `);if(!o)throw new Error("Failed to open confirmation screen");return o.focus(),o})({url:this.getHref("loading"),title:"Confirm this transaction",width:e?.width||480,height:e?.height||380}))}closeWindow(){this.confirmationWindow?.close()}logout(){return new Promise(((e,t)=>{const r=document.createElement("iframe");r.setAttribute("id","passport-confirm"),r.setAttribute("src",this.getHref("logout")),r.setAttribute("style","display: none; position: absolute;width:0px;height:0px;border:0;");const n=({data:i,origin:a})=>{a===this.config.passportDomain&&i.eventType===_z&&(window.removeEventListener("message",n),r.remove(),i.messageType===wz.LOGOUT_SUCCESS&&e({logout:!0}),t(new Error("Unsupported logout type")))};window.addEventListener("message",n),document.body.appendChild(r)}))}showConfirmationScreen(e,t,r){this.confirmationWindow.location.href=e;const n=setInterval((()=>{this.confirmationWindow?.closed&&(clearInterval(n),window.removeEventListener("message",t),r({confirmed:!1}))}),1e3)}}var Tz,Az;!function(e){e.PENDING="PENDING",e.SUBMITTED="SUBMITTED",e.SUCCESSFUL="SUCCESSFUL",e.REVERTED="REVERTED",e.FAILED="FAILED"}(Tz||(Tz={})),function(e){e.ACCOUNTS_CHANGED="accountsChanged"}(Az||(Az={}));class Sz{emitter=new S_;emit(e,...t){this.emitter.emit(e,...t)}on(e,t){this.emitter.on(e,t)}removeListener(e,t){this.emitter.removeListener(e,t)}}const Rz=(e,t,r)=>bm(["string","uint256","address","bytes32"],["",e,t,r]),kz=async(e,t,r,n,i)=>{const a=e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit??La,target:e.to??Da,value:e.value??La,data:e.data??[]})));const o=function(e,t){return na(ko.encode(["uint256","tuple(\n bool delegateCall,\n bool revertOnError,\n uint256 gasLimit,\n address target,\n uint256 value,\n bytes data\n)[]"],[e,t]))}(t,a),s=On(na(Rz(r,n,o))),c=await i.signMessage(s),u=Gq({threshold:1,signers:[{weight:1,signature:`${c}02`}]}),f=new Ps(hq.mainModule.abi);return f.encodeFunctionData(f.getFunction("execute"),[a,t,u])},Oz=async(e,t,r,n,i)=>{const a={...e.types};delete a.EIP712Domain;const o=As.hash(e.domain,a,e.message),s=On(na(Rz(r,n,o))),c=`${await i.signMessage(s)}02`,{signers:u}=(e=>Hq(`0000${e}`))(t);return Gq({threshold:2,signers:[...u,{weight:1,signature:c}]})},Iz=e=>`eip155:${e}`;class xz{config;jsonRpcProvider;user;constructor({config:e,jsonRpcProvider:t,user:r}){this.config=e,this.jsonRpcProvider=t,this.user=r}async postToRelayer(e){const t={id:1,jsonrpc:"2.0",...e},r=await fetch(`${this.config.relayerUrl}/v1/transactions`,{method:"POST",headers:{Authorization:`Bearer ${this.user.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await r.json();if(n.error)throw n.error;return n}async ethSendTransaction(e,t){const{chainId:r}=await this.jsonRpcProvider.ready,n={method:"eth_sendTransaction",params:[{to:e,data:t,chainId:Iz(r)}]},{result:i}=await this.postToRelayer(n);return i}async imGetTransactionByHash(e){const t={method:"im_getTransactionByHash",params:[e]},{result:r}=await this.postToRelayer(t);return r}async imGetFeeOptions(e,t){const{chainId:r}=await this.jsonRpcProvider.ready,n={method:"im_getFeeOptions",params:[{userAddress:e,data:t,chainId:Iz(r)}]},{result:i}=await this.postToRelayer(n);return i}async imSignTypedData(e,t){const{chainId:r}=await this.jsonRpcProvider.ready,n={method:"im_signTypedData",params:[{address:e,eip712Payload:t,chainId:Iz(r)}]},{result:i}=await this.postToRelayer(n);return i}}const Cz=async({authManager:e,config:t,magicAdapter:r,multiRollupApiClients:n})=>{const i=await e.getUser()||await e.getUserDeviceFlow()||await e.login();if(!i.idToken)throw new Error("User is missing idToken");const a=await r.login(i.idToken);if(!i.zkEvm){const r=await async function({authManager:e,config:t,magicProvider:r,multiRollupApiClients:n,accessToken:i}){const a=new om(r).getSigner(),o=await a.getAddress(),s=await dq("Only sign this message from Immutable Passport",a),c={Authorization:`Bearer ${i}`};try{await n.passportApi.createCounterfactualAddress({createCounterfactualAddressRequest:{ethereumAddress:o,ethereumSignature:s}},{headers:c})}catch(e){throw new cz(sz.INTERNAL_ERROR,`Failed to create counterfactual address: ${e}`)}let u;if(t.crossSdkBridgeEnabled){const t=e.checkStoredDeviceFlowCredentials();if(!t||!t.refresh_token)throw new cz(sz.INTERNAL_ERROR,"Cross SDK bridge: Failed to refresh user details");u=await e.refreshToken(t.refresh_token)}else u=await e.loginSilent({forceRefresh:!0});if(!u?.zkEvm)throw new cz(sz.INTERNAL_ERROR,"Failed to refresh user details");return u}({authManager:e,config:t,magicProvider:a,multiRollupApiClients:n,accessToken:i.accessToken});return{user:r,magicProvider:a}}return{user:i,magicProvider:a}},Mz=({params:e,magicProvider:t,jsonRpcProvider:r,relayerClient:n,guardianClient:i,user:a})=>i.withConfirmationScreen({width:480,height:520})((async()=>{const o=e[0];if(!o.to)throw new cz(sz.INVALID_PARAMS,'eth_sendTransaction requires a "to" field');const{chainId:s}=await r.ready,c=Jn.from(s),u=new om(t).getSigner(),f=await(async(e,t)=>{const r=await e.send("eth_getCode",[t,"latest"]);if(r&&"0x"!==r)return new bd(t,hq.mainModule.abi,e).nonce();return 0})(r,a.zkEvm.ethAddress),d={to:o.to,data:o.data,nonce:f,value:o.value,revertOnError:!0},l=await(async(e,t,r,n,i,a)=>{const o=await kz([e],t,r,n,i),s=(await a.imGetFeeOptions(n,o)).find((e=>"IMX"===e.tokenSymbol));if(!s)throw new Error("Failed to retrieve fees for IMX token");const c={nonce:t,to:s.recipientAddress,value:s.tokenPrice,revertOnError:!0};return Jn.from(c.value).isZero()?[e]:[e,c]})(d,f,c,a.zkEvm.ethAddress,u,n);await i.validateEVMTransaction({chainId:Iz(s),nonce:fz(f),user:a,metaTransactions:l});const h=await kz(l,f,c,a.zkEvm.ethAddress,u),p=await n.ethSendTransaction(a.zkEvm.ethAddress,h),m=await az((async()=>{const e=await n.imGetTransactionByHash(p);if(e.status===Tz.PENDING)throw new Error;return e}),{retries:30,interval:1e3,finalErr:new cz(sz.RPC_SERVER_ERROR,"transaction hash not generated in time")});if(![Tz.SUBMITTED,Tz.SUCCESSFUL].includes(m.status)){let e=`Transaction failed to submit with status ${m.status}.`;throw m.statusMessage&&(e+=` Error message: ${m.statusMessage}`),new cz(sz.RPC_SERVER_ERROR,e)}return m.hash})),Pz=["types","domain","primaryType","message"],Nz=(e,t)=>{let r;if("string"==typeof e)try{r=JSON.parse(e)}catch(e){throw new cz(sz.INVALID_PARAMS,`Failed to parse typed data JSON: ${e}`)}else{if("object"!=typeof e)throw new cz(sz.INVALID_PARAMS,`Invalid typed data argument: ${e}`);r=e}if(!(e=>Pz.every((t=>t in e)))(r))throw new cz(sz.INVALID_PARAMS,`Invalid typed data argument. The following properties are required: ${Pz.join(", ")}`);const n=r.domain?.chainId;if(n&&("string"==typeof n&&(n.startsWith("0x")?r.domain.chainId=parseInt(n,16):r.domain.chainId=parseInt(n,10)),r.domain.chainId!==t))throw new cz(sz.INVALID_PARAMS,`Invalid chainId, expected ${t}`);return r};class Bz{authManager;config;confirmationScreen;magicAdapter;multiRollupApiClients;jsonRpcProvider;eventEmitter;guardianClient;relayerClient;magicProvider;user;isPassport=!0;constructor({authManager:e,magicAdapter:t,config:r,confirmationScreen:n,multiRollupApiClients:i,passportEventEmitter:a}){this.authManager=e,this.magicAdapter=t,this.config=r,this.confirmationScreen=n,r.crossSdkBridgeEnabled?this.jsonRpcProvider=new ip({url:this.config.zkEvmRpcUrl,fetchOptions:{referrer:"http://imtblgamesdk.local"}}):this.jsonRpcProvider=new ip(this.config.zkEvmRpcUrl),this.multiRollupApiClients=i,this.eventEmitter=new Sz,a.on(lz.LOGGED_OUT,this.handleLogout)}handleLogout=()=>{const e=this.isLoggedIn();this.magicProvider=void 0,this.user=void 0,this.relayerClient=void 0,this.guardianClient=void 0,e&&this.eventEmitter.emit(Az.ACCOUNTS_CHANGED,[])};isLoggedIn(){return void 0!==this.magicProvider&&void 0!==this.user&&void 0!==this.relayerClient&&void 0!==this.guardianClient}async performRequest(e){switch(e.method){case"eth_requestAccounts":{if(this.isLoggedIn())return[this.user.zkEvm.ethAddress];const{magicProvider:e,user:t}=await Cz({authManager:this.authManager,config:this.config,magicAdapter:this.magicAdapter,multiRollupApiClients:this.multiRollupApiClients});return this.user=t,this.magicProvider=e,this.relayerClient=new xz({config:this.config,jsonRpcProvider:this.jsonRpcProvider,user:this.user}),this.guardianClient=new dz({confirmationScreen:this.confirmationScreen,config:this.config}),this.eventEmitter.emit(Az.ACCOUNTS_CHANGED,[this.user.zkEvm.ethAddress]),[this.user.zkEvm.ethAddress]}case"eth_sendTransaction":if(!this.isLoggedIn())throw new cz(oz.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");return Mz({params:e.params||[],magicProvider:this.magicProvider,guardianClient:this.guardianClient,jsonRpcProvider:this.jsonRpcProvider,relayerClient:this.relayerClient,user:this.user});case"eth_accounts":return this.isLoggedIn()?[this.user.zkEvm.ethAddress]:[];case"eth_signTypedData":case"eth_signTypedData_v4":if(!this.isLoggedIn())throw new cz(oz.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");return(async({params:e,method:t,magicProvider:r,jsonRpcProvider:n,relayerClient:i,guardianClient:a,user:o})=>a.withConfirmationScreen({width:480,height:730})((async()=>{const s=e[0],c=e[1];if(!s||!c)throw new cz(sz.INVALID_PARAMS,`${t} requires an address and a typed data JSON`);const{chainId:u}=await n.ready,f=Nz(c,u);await a.validateMessage({chainID:String(u),payload:f,user:o});const d=await i.imSignTypedData(s,f),l=new om(r).getSigner();return Oz(f,d,Jn.from(u),s,l)})))({method:e.method,params:e.params||[],magicProvider:this.magicProvider,jsonRpcProvider:this.jsonRpcProvider,relayerClient:this.relayerClient,user:this.user,guardianClient:this.guardianClient});case"eth_gasPrice":case"eth_getBalance":case"eth_getCode":case"eth_getStorageAt":case"eth_estimateGas":case"eth_call":case"eth_blockNumber":case"eth_chainId":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":case"eth_getTransactionCount":return this.jsonRpcProvider.send(e.method,e.params||[]);default:throw new cz(oz.UNSUPPORTED_METHOD,"Method not supported")}}async performJsonRpcRequest(e){const{id:t,jsonrpc:r}=e;try{return{id:t,jsonrpc:r,result:await this.performRequest(e)}}catch(e){let n;return n=e instanceof cz?e:e instanceof Error?new cz(sz.INTERNAL_ERROR,e.message):new cz(sz.INTERNAL_ERROR,"Internal error"),{id:t,jsonrpc:r,error:n}}}async request(e){try{return this.performRequest(e)}catch(e){if(e instanceof cz)throw e;if(e instanceof Error)throw new cz(sz.INTERNAL_ERROR,e.message);throw new cz(sz.INTERNAL_ERROR,"Internal error")}}sendAsync(e,t){if(!t)throw new Error("No callback provided");Array.isArray(e)?Promise.all(e.map(this.performJsonRpcRequest)).then((e=>{t(null,e)})).catch((e=>{t(e,[])})):this.performJsonRpcRequest(e).then((e=>{t(null,e)})).catch((e=>{t(e,null)}))}async send(e,t,r){if("string"==typeof e)return"function"==typeof t?this.sendAsync({method:e,params:[]},t):r?this.sendAsync({method:e,params:Array.isArray(t)?t:[]},r):this.request({method:e,params:Array.isArray(t)?t:[]});if("function"==typeof t)return this.sendAsync(e,t);if(!Array.isArray(e)&&"object"==typeof e)return this.performJsonRpcRequest(e);throw new cz(sz.INVALID_REQUEST,"Invalid request")}on(e,t){this.eventEmitter.on(e,t)}removeListener(e,t){this.eventEmitter.removeListener(e,t)}}var Dz=Object.freeze({__proto__:null,JsonRpcError:cz,get Networks(){return hz},Passport:class{authManager;config;confirmationScreen;immutableXClient;magicAdapter;multiRollupApiClients;passportImxProviderFactory;passportEventEmitter;constructor(e){this.config=new vz(e),this.authManager=new tz(this.config),this.magicAdapter=new rz(this.config),this.confirmationScreen=new Ez(this.config),this.immutableXClient=e.overrides?.immutableXClient||new tB({baseConfig:e.baseConfig}),this.multiRollupApiClients=new Vt(this.config.multiRollupConfig),this.passportEventEmitter=new Sz,this.passportImxProviderFactory=new yz({authManager:this.authManager,config:this.config,confirmationScreen:this.confirmationScreen,immutableXClient:this.immutableXClient,magicAdapter:this.magicAdapter,passportEventEmitter:this.passportEventEmitter})}async connectImxSilent(){return this.passportImxProviderFactory.getProviderSilent()}async connectImx(){return this.passportImxProviderFactory.getProvider()}async connectImxDeviceFlow(e,t,r){return this.passportImxProviderFactory.getProviderWithDeviceFlow(e,t,r)}getPKCEAuthorizationUrl(){return this.authManager.getPKCEAuthorizationUrl()}async connectImxPKCEFlow(e,t){return this.passportImxProviderFactory.getProviderWithPKCEFlow(e,t)}checkStoredDeviceFlowCredentials(){return this.authManager.checkStoredDeviceFlowCredentials()}async connectImxWithCredentials(e){return this.passportImxProviderFactory.getProviderWithCredentials(e)}connectEvm(){if(this.config.network===hz.PRODUCTION)throw new Error("EVM is not supported on production network");return new Bz({passportEventEmitter:this.passportEventEmitter,authManager:this.authManager,magicAdapter:this.magicAdapter,config:this.config,confirmationScreen:this.confirmationScreen,multiRollupApiClients:this.multiRollupApiClients})}async login(e){const{useCachedSession:t=!1}=e||{};let r=null;try{r=await this.authManager.loginSilent()}catch(e){console.warn("loginSilent failed with error:",e)}return r||t||(r=await this.authManager.login()),r?r.profile:null}async loginWithDeviceFlow(){return this.authManager.loginWithDeviceFlow()}async loginCallback(){return this.authManager.loginCallback()}async logout(){await this.authManager.logout(),await this.confirmationScreen.logout(),await this.magicAdapter.logout(),this.passportEventEmitter.emit(lz.LOGGED_OUT)}async logoutSilentCallback(e){return this.authManager.logoutSilentCallback(e)}async logoutDeviceFlow(){return this.authManager.logoutDeviceFlow()}async getUserInfo(){const e=await this.authManager.getUser();return e?.profile}async getUserInfoDeviceFlow(){const e=await this.authManager.getUserDeviceFlow();return e?.profile}async getIdToken(){const e=await this.authManager.getUser();return e?.idToken}async getAccessToken(){const e=await this.authManager.getUser();return e?.accessToken}async getLinkedAddresses(){const e=await this.authManager.getUser();if(!e?.profile.sub)return[];const t={Authorization:`Bearer ${e.accessToken}`};return(await this.multiRollupApiClients.passportApi.getLinkedAddresses({userId:e?.profile.sub},{headers:t})).data.linkedAddresses}},PassportError:Wq,get ProviderErrorCode(){return oz},get ProviderEvent(){return Az},get RpcErrorCode(){return sz}}),Fz=ir("object"==typeof self?self.FormData:window.FormData),Lz={},Uz={},jz=ar(Dq),qz=ar(Mm),zz={},Hz=ar(Ns),Gz=ar(Aa),Vz=ar(Mo),Wz=ar(Ed),Kz=ar(Hn),Xz=ar(Ss),$z=ar(Qd),Jz=ar(Bl),Yz=ar(ia),Qz=ar(_n),Zz=ar(Od),eH=ar(vm),tH=ar(il),rH=ar(Ri),nH=ar(ha),iH=ar(Df),aH=ar(wo),oH=ar(ed),sH=ar(km),cH=ar(ql),uH=ar(ah);!function(e){var t=nr&&nr.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=nr&&nr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=nr&&nr.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&t(n,e,i);return r(n,e),n};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=Hz;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=Gz;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=n(Vz);e.base64=o;var s=Wz;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var c=Kz;Object.defineProperty(e,"arrayify",{enumerable:!0,get:function(){return c.arrayify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return c.concat}}),Object.defineProperty(e,"hexConcat",{enumerable:!0,get:function(){return c.hexConcat}}),Object.defineProperty(e,"hexDataSlice",{enumerable:!0,get:function(){return c.hexDataSlice}}),Object.defineProperty(e,"hexDataLength",{enumerable:!0,get:function(){return c.hexDataLength}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return c.hexlify}}),Object.defineProperty(e,"hexStripZeros",{enumerable:!0,get:function(){return c.hexStripZeros}}),Object.defineProperty(e,"hexValue",{enumerable:!0,get:function(){return c.hexValue}}),Object.defineProperty(e,"hexZeroPad",{enumerable:!0,get:function(){return c.hexZeroPad}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return c.isBytes}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return c.isBytesLike}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return c.isHexString}}),Object.defineProperty(e,"joinSignature",{enumerable:!0,get:function(){return c.joinSignature}}),Object.defineProperty(e,"zeroPad",{enumerable:!0,get:function(){return c.zeroPad}}),Object.defineProperty(e,"splitSignature",{enumerable:!0,get:function(){return c.splitSignature}}),Object.defineProperty(e,"stripZeros",{enumerable:!0,get:function(){return c.stripZeros}});var u=Xz;Object.defineProperty(e,"_TypedDataEncoder",{enumerable:!0,get:function(){return u._TypedDataEncoder}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return u.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return u.hashMessage}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return u.id}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return u.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return u.namehash}});var f=$z;Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return f.defaultPath}}),Object.defineProperty(e,"entropyToMnemonic",{enumerable:!0,get:function(){return f.entropyToMnemonic}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return f.getAccountPath}}),Object.defineProperty(e,"HDNode",{enumerable:!0,get:function(){return f.HDNode}}),Object.defineProperty(e,"isValidMnemonic",{enumerable:!0,get:function(){return f.isValidMnemonic}}),Object.defineProperty(e,"mnemonicToEntropy",{enumerable:!0,get:function(){return f.mnemonicToEntropy}}),Object.defineProperty(e,"mnemonicToSeed",{enumerable:!0,get:function(){return f.mnemonicToSeed}});var d=Jz;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return d.getJsonWalletAddress}});var l=Yz;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return l.keccak256}});var h=Qz;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return h.Logger}});var p=Zz;Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return p.computeHmac}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return p.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return p.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return p.sha512}});var m=eH;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 b=tH;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return b.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return b.shuffled}});var y=rH;Object.defineProperty(e,"checkProperties",{enumerable:!0,get:function(){return y.checkProperties}}),Object.defineProperty(e,"deepCopy",{enumerable:!0,get:function(){return y.deepCopy}}),Object.defineProperty(e,"defineReadOnly",{enumerable:!0,get:function(){return y.defineReadOnly}}),Object.defineProperty(e,"getStatic",{enumerable:!0,get:function(){return y.getStatic}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return y.resolveProperties}}),Object.defineProperty(e,"shallowCopy",{enumerable:!0,get:function(){return y.shallowCopy}});var g=n(nH);e.RLP=g;var v=iH;Object.defineProperty(e,"computePublicKey",{enumerable:!0,get:function(){return v.computePublicKey}}),Object.defineProperty(e,"recoverPublicKey",{enumerable:!0,get:function(){return v.recoverPublicKey}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return v.SigningKey}});var w=aH;Object.defineProperty(e,"formatBytes32String",{enumerable:!0,get:function(){return w.formatBytes32String}}),Object.defineProperty(e,"nameprep",{enumerable:!0,get:function(){return w.nameprep}}),Object.defineProperty(e,"parseBytes32String",{enumerable:!0,get:function(){return w.parseBytes32String}}),Object.defineProperty(e,"_toEscapedUtf8String",{enumerable:!0,get:function(){return w._toEscapedUtf8String}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return w.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return w.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return w.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return w.Utf8ErrorFuncs}});var _=oH;Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return _.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return _.computeAddress}}),Object.defineProperty(e,"parseTransaction",{enumerable:!0,get:function(){return _.parse}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return _.recoverAddress}}),Object.defineProperty(e,"serializeTransaction",{enumerable:!0,get:function(){return _.serialize}}),Object.defineProperty(e,"TransactionTypes",{enumerable:!0,get:function(){return _.TransactionTypes}});var E=sH;Object.defineProperty(e,"commify",{enumerable:!0,get:function(){return E.commify}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return E.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return E.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return E.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return E.parseUnits}});var T=cH;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return T.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return T.verifyTypedData}});var A=uH;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return A._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return A.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return A.poll}});var S=Zz;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return S.SupportedAlgorithm}});var R=aH;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return R.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return R.Utf8ErrorReason}})}(zz);var fH={};Object.defineProperty(fH,"__esModule",{value:!0}),fH.DomainRegistryABI=void 0;fH.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 dH={};Object.defineProperty(dH,"__esModule",{value:!0}),dH.SeaportABIv14=void 0;dH.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 lH={};!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=qz;var r,n,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"}(r||(e.OrderType=r={})),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"}(n||(e.ItemType=n={})),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"}(lH);var hH={},pH={};Object.defineProperty(pH,"__esModule",{value:!0}),pH.ERC20ABI=void 0;pH.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 mH={};Object.defineProperty(mH,"__esModule",{value:!0}),mH.ERC721ABI=void 0;mH.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 bH,yH={},gH={};function vH(){if(bH)return gH;bH=1,Object.defineProperty(gH,"__esModule",{value:!0}),gH.getItemToCriteriaMap=gH.generateCriteriaResolvers=void 0;const e=lH,t=EH();gH.generateCriteriaResolvers=({orders:r,offerCriterias:n=[[]],considerationCriterias:i=[[]]})=>{const a=r.flatMap(((r,n)=>r.parameters.offer.map(((t,r)=>({orderIndex:n,item:t,index:r,side:e.Side.OFFER}))).filter((({item:e})=>(0,t.isCriteriaItem)(e.itemType))))),o=r.flatMap(((r,n)=>r.parameters.consideration.map(((t,r)=>({orderIndex:n,item:t,index:r,side:e.Side.CONSIDERATION}))).filter((({item:e})=>(0,t.isCriteriaItem)(e.itemType))))),s=(e,t)=>e.map((({orderIndex:e,item:r,index:n,side:i})=>{const a=r.identifierOrCriteria||"0",o=t[e][n];return{orderIndex:e,index:n,side:i,identifier:o.identifier,criteriaProof:"0"===a?[]:o.proof}}));return[...s(a,n),...s(o,i)]};return gH.getItemToCriteriaMap=(e,r)=>{const n=[...r];return e.reduce(((e,r)=>((0,t.isCriteriaItem)(r.itemType)&&e.set(r,n.shift()),e)),new Map)},gH}var wH,_H={};function EH(){return wH||(wH=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=qz,r=lH,n=vH(),i=_H;e.isCurrencyItem=({itemType:e})=>[r.ItemType.NATIVE,r.ItemType.ERC20].includes(e);e.isNativeCurrencyItem=({itemType:e})=>e===r.ItemType.NATIVE;e.isErc20Item=e=>e===r.ItemType.ERC20;e.isErc721Item=e=>[r.ItemType.ERC721,r.ItemType.ERC721_WITH_CRITERIA].includes(e);e.isErc1155Item=e=>[r.ItemType.ERC1155,r.ItemType.ERC1155_WITH_CRITERIA].includes(e);e.isCriteriaItem=e=>[r.ItemType.ERC721_WITH_CRITERIA,r.ItemType.ERC1155_WITH_CRITERIA].includes(e);e.getPresentItemAmount=({startAmount:e,endAmount:r,timeBasedItemParams:n})=>{const i=t.BigNumber.from(e),a=t.BigNumber.from(r);if(!n)return i.gt(a)?i:a;const{isConsiderationItem:o,currentBlockTimestamp:s,ascendingAmountTimestampBuffer:c,startTime:u,endTime:f}=n,d=t.BigNumber.from(f).sub(u),l=a.gt(e),h=t.BigNumber.from(l?s+c:s);if(h.lt(u))return i;const p=(h.gt(f)?t.BigNumber.from(f):h).sub(u),m=d.sub(p);return i.mul(m).add(a.mul(p)).add(o?d.sub(1):0).div(d)};e.getSummedTokenAndIdentifierAmounts=({items:r,criterias:i,timeBasedItemParams:a})=>{const o=(0,n.getItemToCriteriaMap)(r,i),s=r.reduce(((r,n)=>{var i,s,c,u;const f=null!==(s=null===(i=o.get(n))||void 0===i?void 0:i.identifier)&&void 0!==s?s:n.identifierOrCriteria;return Object.assign(Object.assign({},r),{[n.token]:Object.assign(Object.assign({},r[n.token]),{[f]:(null!==(u=null===(c=r[n.token])||void 0===c?void 0:c[f])&&void 0!==u?u:t.BigNumber.from(0)).add((0,e.getPresentItemAmount)({startAmount:n.startAmount,endAmount:n.endAmount,timeBasedItemParams:a}))})})}),{});return s};e.getMaximumSizeForOrder=({parameters:{offer:e,consideration:t}})=>{const r=[...e,...t].flatMap((({startAmount:e,endAmount:t})=>[e,t]));return(0,i.findGcd)(r)}}(yH)),yH}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findGcd=e.gcd=void 0;const t=qz;e.gcd=(r,n)=>{const i=t.BigNumber.from(r),a=t.BigNumber.from(n);return i.eq(0)?a:(0,e.gcd)(a.mod(r),i)};e.findGcd=r=>{let n=t.BigNumber.from(r[0]);for(let t=1;t<r.length;t++)if(n=(0,e.gcd)(r[t],n),n.eq(1))return n;return n}}(_H);var TH={};!function(e){var t=nr&&nr.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getTagFromDomain=e.getTransactionMethods=e.executeAllActions=void 0;const r=zz;e.executeAllActions=e=>t(void 0,void 0,void 0,(function*(){for(let t=0;t<e.length-1;t++){const r=e[t];if("approval"===r.type){const e=yield r.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=(r,n,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 c=o=>t(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},s),o),c=yield r.populateTransaction[n](...i,t);if(a){const t=(0,e.getTagFromDomain)(a);c.data=c.data+t}return c}));return{callStatic:e=>{const t=Object.assign(Object.assign({},s),e);return r.callStatic[n](...i,t)},estimateGas:e=>{const t=Object.assign(Object.assign({},s),e);return r.estimateGas[n](...i,t)},transact:e=>t(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},s),e),n=yield c(t);return r.signer.sendTransaction(n)})),buildTransaction:c}};e.getTagFromDomain=e=>(0,r.keccak256)((0,r.toUtf8Bytes)(e)).slice(2,10)}(TH);var AH=nr&&nr.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(hH,"__esModule",{value:!0}),hH.getApprovalActions=hH.approvedItemAmount=void 0;const SH=qz,RH=pH,kH=mH,OH=lH,IH=EH(),xH=TH;hH.approvedItemAmount=(e,t,r,n)=>AH(void 0,void 0,void 0,(function*(){if((0,IH.isErc721Item)(t.itemType)||(0,IH.isErc1155Item)(t.itemType)){return new SH.Contract(t.token,kH.ERC721ABI,n).isApprovedForAll(e,r).then((e=>e?OH.MAX_INT:SH.BigNumber.from(0)))}if(t.itemType===OH.ItemType.ERC20){return new SH.Contract(t.token,RH.ERC20ABI,n).allowance(e,r)}return OH.MAX_INT})),hH.getApprovalActions=function(e,t,r){return e.filter(((t,r)=>r===e.length-1||e[r+1].token!==t.token)).map((({token:e,operator:n,itemType:i,identifierOrCriteria:a,requiredApprovedAmount:o})=>{const s=(0,IH.isErc1155Item)(i);if((0,IH.isErc721Item)(i)||s){const o=new SH.Contract(e,kH.ERC721ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,operator:n,transactionMethods:(0,xH.getTransactionMethods)(o.connect(r),t&&!s?"approve":"setApprovalForAll",[n,!(t&&!s)||a])}}{const s=new SH.Contract(e,RH.ERC20ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,transactionMethods:(0,xH.getTransactionMethods)(s.connect(r),"approve",[n,t?o:OH.MAX_INT]),operator:n}}}))};var CH={},MH={},PH={};Object.defineProperty(PH,"__esModule",{value:!0}),PH.ERC1155ABI=void 0;PH.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 NH=nr&&nr.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(MH,"__esModule",{value:!0}),MH.balanceOf=void 0;const BH=qz,DH=PH,FH=pH,LH=mH,UH=lH,jH=EH();MH.balanceOf=(e,t,r,n)=>NH(void 0,void 0,void 0,(function*(){if((0,jH.isErc721Item)(t.itemType)){const i=new BH.Contract(t.token,LH.ERC721ABI,r);return t.itemType===UH.ItemType.ERC721_WITH_CRITERIA?n?i.ownerOf(n.identifier).then((t=>BH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase())))):i.balanceOf(e):i.ownerOf(t.identifierOrCriteria).then((t=>BH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase()))))}if((0,jH.isErc1155Item)(t.itemType)){const i=new BH.Contract(t.token,DH.ERC1155ABI,r);if(t.itemType===UH.ItemType.ERC1155_WITH_CRITERIA){if(!n){const e=BH.BigNumber.from(t.startAmount),r=BH.BigNumber.from(t.endAmount);return e.gt(r)?e:r}return i.balanceOf(e,n.identifier)}return i.balanceOf(e,t.identifierOrCriteria)}if((0,jH.isErc20Item)(t.itemType)){return new BH.Contract(t.token,FH.ERC20ABI,r).balanceOf(e)}return r.getBalance(e)})),function(e){var t=nr&&nr.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.validateStandardFulfillBalancesAndApprovals=e.validateBasicFulfillBalancesAndApprovals=e.validateOfferBalancesAndApprovals=e.getInsufficientBalanceAndApprovalAmounts=e.getBalancesAndApprovals=void 0;const r=qz,n=lH,i=hH,a=MH,o=vH(),s=EH(),c=(e,t,r)=>{const n=e.find((({token:e,identifierOrCriteria:n})=>t.toLowerCase()===e.toLowerCase()&&n.toLowerCase()===r.toLowerCase()));if(!n)throw new Error("Balances and approvals didn't contain all tokens and identifiers");return n};e.getBalancesAndApprovals=({owner:e,items:c,criterias:u,operator:f,multicallProvider:d})=>t(void 0,void 0,void 0,(function*(){const l=(0,o.getItemToCriteriaMap)(c,u);return Promise.all(c.map((o=>t(void 0,void 0,void 0,(function*(){var t,c;let u=Promise.resolve(r.BigNumber.from(0));return u=(0,s.isErc721Item)(o.itemType)||(0,s.isErc1155Item)(o.itemType)||(0,s.isErc20Item)(o.itemType)?(0,i.approvedItemAmount)(e,o,f,d):Promise.resolve(n.MAX_INT),{token:o.token,identifierOrCriteria:null!==(c=null===(t=l.get(o))||void 0===t?void 0:t.identifier)&&void 0!==c?c:o.identifierOrCriteria,balance:yield(0,a.balanceOf)(e,o,d,l.get(o)),approvedAmount:yield u,itemType:o.itemType}})))))}));e.getInsufficientBalanceAndApprovalAmounts=({balancesAndApprovals:e,tokenAndIdentifierAmounts:t,operator:r})=>{const n=[...Object.entries(t).map((([e,t])=>Object.entries(t).map((([t,r])=>[e,t,r]))))].flat(),i=t=>n.filter((([r,n,i])=>c(e,r,n)[t].lt(i))).map((([r,n,i])=>{const a=c(e,r,n);return{token:r,identifierOrCriteria:n,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:r})))];return{insufficientBalances:a,insufficientApprovals:o}};e.validateOfferBalancesAndApprovals=({offer:t,criterias:r,balancesAndApprovals:n,timeBasedItemParams:i,throwOnInsufficientBalances:a=!0,throwOnInsufficientApprovals:o,operator:c})=>{const{insufficientBalances:u,insufficientApprovals:f}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:n,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:t,criterias:r,timeBasedItemParams:i?Object.assign(Object.assign({},i),{isConsiderationItem:!1}):void 0}),operator:c});if(a&&u.length>0)throw new Error("The offerer does not have the amount needed to create or fulfill.");if(o&&f.length>0)throw new Error("The offerer does not have the sufficient approvals.");return f};e.validateBasicFulfillBalancesAndApprovals=({offer:t,consideration:r,offererBalancesAndApprovals:n,fulfillerBalancesAndApprovals:i,timeBasedItemParams:a,offererOperator:o,fulfillerOperator:c})=>{(0,e.validateOfferBalancesAndApprovals)({offer:t,criterias:[],balancesAndApprovals:n,timeBasedItemParams:a,throwOnInsufficientApprovals:!0,operator:o});const u=r.filter((e=>e.itemType!==t[0].itemType)),{insufficientBalances:f,insufficientApprovals:d}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:i,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:u,criterias:[],timeBasedItemParams:Object.assign(Object.assign({},a),{isConsiderationItem:!0})}),operator:c});if(f.length>0)throw new Error("The fulfiller does not have the balances needed to fulfill.");return d};e.validateStandardFulfillBalancesAndApprovals=({offer:t,consideration:r,offerCriteria:n,considerationCriteria:i,offererBalancesAndApprovals:a,fulfillerBalancesAndApprovals:o,timeBasedItemParams:c,offererOperator:f,fulfillerOperator:d})=>{(0,e.validateOfferBalancesAndApprovals)({offer:t,criterias:n,balancesAndApprovals:a,timeBasedItemParams:c,throwOnInsufficientApprovals:!0,operator:f});const l=u({items:t,criterias:n,balancesAndApprovals:o,timeBasedItemParams:c}),{insufficientBalances:h,insufficientApprovals:p}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:l,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:r,criterias:i,timeBasedItemParams:Object.assign(Object.assign({},c),{isConsiderationItem:!0})}),operator:d});if(h.length>0)throw new Error("The fulfiller does not have the balances needed to fulfill.");return p};const u=({items:e,criterias:t,timeBasedItemParams:r,balancesAndApprovals:n})=>{const i=(0,s.getSummedTokenAndIdentifierAmounts)({items:e,criterias:t,timeBasedItemParams:Object.assign(Object.assign({},r),{isConsiderationItem:!1})}),a=n.map((e=>Object.assign({},e)));return Object.entries(i).forEach((([e,t])=>Object.entries(t).forEach((([t,r])=>{const n=c(a,e,t),i=a.indexOf(n);a[i].balance=a[i].balance.add(r)})))),a}}(CH);var qH,zH={},HH={},GH={},VH={},WH={exports:{}},KH={exports:{}};function XH(){return qH||(qH=1,function(e,t){e.exports=function(){var e=e||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},i=n.lib={},a=i.Base={extend:function(e){var t=r(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)}},o=i.WordArray=a.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=o<<24-(n+a)%4*8}else for(a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},a=0;a<t;a+=4){var s=i(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new o.init(n,t)}}),s=n.enc={},c=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},f=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},d=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.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 r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,u=e.min(4*c,i);if(c){for(var f=0;f<c;f+=a)this._doProcessBlock(n,f);var d=n.splice(0,c);r.sigBytes-=u}return new o.init(d,u)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=d.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.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,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new l.HMAC.init(e,r).finalize(t)}}});var l=n.algo={};return n}(Math);return e}()}(KH)),KH.exports}!function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(s[i]=r(t.pow(n,.5))),c[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],f=o.SHA256=a.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],f=r[5],d=r[6],l=r[7],h=0;h<64;h++){if(h<16)u[h]=0|e[t+h];else{var p=u[h-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,b=u[h-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;u[h]=m+u[h-7]+y+u[h-16]}var g=n&i^n&a^i&a,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&f^~s&d)+c[h]+u[h];l=d,d=f,f=s,s=o+w|0,o=a,a=i,i=n,n=w+(v+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+f|0,r[6]=r[6]+d|0,r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=a._createHelper(f),r.HmacSHA256=a._createHmacHelper(f)}(Math),e.SHA256}(XH())}(WH);var $H=WH.exports,JH={exports:{}};!function(e,t){e.exports=function(){function e(e,t){var r=t?"└":"├";return r+=e?"─ ":"──┐"}function t(e,t){var r=[];for(var n in e)e.hasOwnProperty(n)&&(t&&"function"==typeof e[n]||r.push(n));return r}function r(n,i,a,o,s,c,u){var f,d,l="",h=0,p=o.slice(0);if(p.push([i,a])&&o.length>0&&(o.forEach((function(e,t){t>0&&(l+=(e[1]?" ":"│")+" "),d||e[0]!==i||(d=!0)})),l+=e(n,a)+n,s&&("object"!=typeof i||i instanceof Date)&&(l+=": "+i),d&&(l+=" (circular ref.)"),u(l)),!d&&"object"==typeof i){var m=t(i,c);m.forEach((function(e){f=++h===m.length,r(e,i[e],f,p,s,c,u)}))}}var n={asLines:function(e,t,n,i){r(".",e,!1,[],t,"function"!=typeof n&&n,i||n)},asTree:function(e,t,n){var i="";return r(".",e,!1,[],t,n,(function(e){i+=e+"\n"})),i}};return n}()}(JH);var YH,QH=JH.exports,ZH={},eG={exports:{}},tG={exports:{}};function rG(){return YH||(YH=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.Base,a=n.WordArray,o=r.x64={};o.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),o.WordArray=i.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push(i.high),r.push(i.low)}return a.create(r,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}})}(),e}(XH())}(tG)),tG.exports}var nG,iG={exports:{}};function aG(){return nG||(nG=1,function(e,t){e.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,n=t.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 t=e.byteLength,n=[],i=0;i<t;i++)n[i>>>2]|=e[i]<<24-i%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=t}}(),e.lib.WordArray}(XH())}(iG)),iG.exports}var oG,sG={exports:{}};function cG(){return oG||(oG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var a=t[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],a=0;a<r;a+=2){var o=i(t[a>>>2]>>>16-a%4*8&65535);n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,n=[],a=0;a<t;a++)n[a>>>1]|=i(e.charCodeAt(a)<<16-a%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(XH())}(sG)),sG.exports}var uG,fG={exports:{}};function dG(){return uG||(uG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],a=0,o=0;o<t;o++)if(o%4){var s=n[e.charCodeAt(o-1)]<<o%4*2,c=n[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=(s|c)<<24-a%4*8,a++}return r.create(i,a)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],a=0;a<r;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<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<r.length;a++)i[r.charCodeAt(a)]=a}var o=r.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(XH())}(fG)),fG.exports}var lG,hG={exports:{}};function pG(){return lG||(lG=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=o.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,o=e[t+0],c=e[t+1],h=e[t+2],p=e[t+3],m=e[t+4],b=e[t+5],y=e[t+6],g=e[t+7],v=e[t+8],w=e[t+9],_=e[t+10],E=e[t+11],T=e[t+12],A=e[t+13],S=e[t+14],R=e[t+15],k=a[0],O=a[1],I=a[2],x=a[3];k=u(k,O,I,x,o,7,s[0]),x=u(x,k,O,I,c,12,s[1]),I=u(I,x,k,O,h,17,s[2]),O=u(O,I,x,k,p,22,s[3]),k=u(k,O,I,x,m,7,s[4]),x=u(x,k,O,I,b,12,s[5]),I=u(I,x,k,O,y,17,s[6]),O=u(O,I,x,k,g,22,s[7]),k=u(k,O,I,x,v,7,s[8]),x=u(x,k,O,I,w,12,s[9]),I=u(I,x,k,O,_,17,s[10]),O=u(O,I,x,k,E,22,s[11]),k=u(k,O,I,x,T,7,s[12]),x=u(x,k,O,I,A,12,s[13]),I=u(I,x,k,O,S,17,s[14]),k=f(k,O=u(O,I,x,k,R,22,s[15]),I,x,c,5,s[16]),x=f(x,k,O,I,y,9,s[17]),I=f(I,x,k,O,E,14,s[18]),O=f(O,I,x,k,o,20,s[19]),k=f(k,O,I,x,b,5,s[20]),x=f(x,k,O,I,_,9,s[21]),I=f(I,x,k,O,R,14,s[22]),O=f(O,I,x,k,m,20,s[23]),k=f(k,O,I,x,w,5,s[24]),x=f(x,k,O,I,S,9,s[25]),I=f(I,x,k,O,p,14,s[26]),O=f(O,I,x,k,v,20,s[27]),k=f(k,O,I,x,A,5,s[28]),x=f(x,k,O,I,h,9,s[29]),I=f(I,x,k,O,g,14,s[30]),k=d(k,O=f(O,I,x,k,T,20,s[31]),I,x,b,4,s[32]),x=d(x,k,O,I,v,11,s[33]),I=d(I,x,k,O,E,16,s[34]),O=d(O,I,x,k,S,23,s[35]),k=d(k,O,I,x,c,4,s[36]),x=d(x,k,O,I,m,11,s[37]),I=d(I,x,k,O,g,16,s[38]),O=d(O,I,x,k,_,23,s[39]),k=d(k,O,I,x,A,4,s[40]),x=d(x,k,O,I,o,11,s[41]),I=d(I,x,k,O,p,16,s[42]),O=d(O,I,x,k,y,23,s[43]),k=d(k,O,I,x,w,4,s[44]),x=d(x,k,O,I,T,11,s[45]),I=d(I,x,k,O,R,16,s[46]),k=l(k,O=d(O,I,x,k,h,23,s[47]),I,x,o,6,s[48]),x=l(x,k,O,I,g,10,s[49]),I=l(I,x,k,O,S,15,s[50]),O=l(O,I,x,k,b,21,s[51]),k=l(k,O,I,x,T,6,s[52]),x=l(x,k,O,I,p,10,s[53]),I=l(I,x,k,O,_,15,s[54]),O=l(O,I,x,k,c,21,s[55]),k=l(k,O,I,x,v,6,s[56]),x=l(x,k,O,I,R,10,s[57]),I=l(I,x,k,O,y,15,s[58]),O=l(O,I,x,k,A,21,s[59]),k=l(k,O,I,x,m,6,s[60]),x=l(x,k,O,I,E,10,s[61]),I=l(I,x,k,O,h,15,s[62]),O=l(O,I,x,k,w,21,s[63]),a[0]=a[0]+k|0,a[1]=a[1]+O|0,a[2]=a[2]+I|0,a[3]=a[3]+x|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var a=t.floor(n/4294967296),o=n;r[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var f=c[u];c[u]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,a,o){var s=e+(t&r|~t&n)+i+o;return(s<<a|s>>>32-a)+t}function f(e,t,r,n,i,a,o){var s=e+(t&n|r&~n)+i+o;return(s<<a|s>>>32-a)+t}function d(e,t,r,n,i,a,o){var s=e+(t^r^n)+i+o;return(s<<a|s>>>32-a)+t}function l(e,t,r,n,i,a,o){var s=e+(r^(t|~n))+i+o;return(s<<a|s>>>32-a)+t}r.MD5=a._createHelper(c),r.HmacMD5=a._createHmacHelper(c)}(Math),e.MD5}(XH())}(hG)),hG.exports}var mG,bG={exports:{}};function yG(){return mG||(mG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,i=r.Hasher,a=t.algo,o=[],s=a.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],s=r[3],c=r[4],u=0;u<80;u++){if(u<16)o[u]=0|e[t+u];else{var f=o[u-3]^o[u-8]^o[u-14]^o[u-16];o[u]=f<<1|f>>>31}var d=(n<<5|n>>>27)+c+o[u];d+=u<20?1518500249+(i&a|~i&s):u<40?1859775393+(i^a^s):u<60?(i&a|i&s|a&s)-1894007588:(i^a^s)-899497514,c=s,s=a,a=i<<30|i>>>2,i=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+s|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=i._createHelper(s),t.HmacSHA1=i._createHmacHelper(s)}(),e.SHA1}(XH())}(bG)),bG.exports}var gG,vG={exports:{}};var wG,_G={exports:{}};function EG(){return wG||(wG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,i=n.Word,a=n.WordArray,o=t.algo;function s(){return i.create.apply(i,arguments)}var c=[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)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var f=o.SHA512=r.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 r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],f=r[5],d=r[6],l=r[7],h=n.high,p=n.low,m=i.high,b=i.low,y=a.high,g=a.low,v=o.high,w=o.low,_=s.high,E=s.low,T=f.high,A=f.low,S=d.high,R=d.low,k=l.high,O=l.low,I=h,x=p,C=m,M=b,P=y,N=g,B=v,D=w,F=_,L=E,U=T,j=A,q=S,z=R,H=k,G=O,V=0;V<80;V++){var W=u[V];if(V<16)var K=W.high=0|e[t+2*V],X=W.low=0|e[t+2*V+1];else{var $=u[V-15],J=$.high,Y=$.low,Q=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Z=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=u[V-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ae=u[V-7],oe=ae.high,se=ae.low,ce=u[V-16],ue=ce.high,fe=ce.low;K=(K=(K=Q+oe+((X=Z+se)>>>0<Z>>>0?1:0))+ne+((X+=ie)>>>0<ie>>>0?1:0))+ue+((X+=fe)>>>0<fe>>>0?1:0),W.high=K,W.low=X}var de,le=F&U^~F&q,he=L&j^~L&z,pe=I&C^I&P^C&P,me=x&M^x&N^M&N,be=(I>>>28|x<<4)^(I<<30|x>>>2)^(I<<25|x>>>7),ye=(x>>>28|I<<4)^(x<<30|I>>>2)^(x<<25|I>>>7),ge=(F>>>14|L<<18)^(F>>>18|L<<14)^(F<<23|L>>>9),ve=(L>>>14|F<<18)^(L>>>18|F<<14)^(L<<23|F>>>9),we=c[V],_e=we.high,Ee=we.low,Te=H+ge+((de=G+ve)>>>0<G>>>0?1:0),Ae=ye+me;H=q,G=z,q=U,z=j,U=F,j=L,F=B+(Te=(Te=(Te=Te+le+((de+=he)>>>0<he>>>0?1:0))+_e+((de+=Ee)>>>0<Ee>>>0?1:0))+K+((de+=X)>>>0<X>>>0?1:0))+((L=D+de|0)>>>0<D>>>0?1:0)|0,B=P,D=N,P=C,N=M,C=I,M=x,I=Te+(be+pe+(Ae>>>0<ye>>>0?1:0))+((x=de+Ae|0)>>>0<de>>>0?1:0)|0}p=n.low=p+x,n.high=h+I+(p>>>0<x>>>0?1:0),b=i.low=b+M,i.high=m+C+(b>>>0<M>>>0?1:0),g=a.low=g+N,a.high=y+P+(g>>>0<N>>>0?1:0),w=o.low=w+D,o.high=v+B+(w>>>0<D>>>0?1:0),E=s.low=E+L,s.high=_+F+(E>>>0<L>>>0?1:0),A=f.low=A+j,f.high=T+U+(A>>>0<j>>>0?1:0),R=d.low=R+z,d.high=S+q+(R>>>0<z>>>0?1:0),O=l.low=O+G,l.high=k+H+(O>>>0<G>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(f),t.HmacSHA512=r._createHmacHelper(f)}(),e.SHA512}(XH(),rG())}(_G)),_G.exports}var TG,AG={exports:{}};var SG,RG={exports:{}};function kG(){return SG||(SG=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.x64.Word,s=r.algo,c=[],u=[],f=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[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,l=0;l<7;l++){if(1&i){var h=(1<<l)-1;h<32?d^=1<<h:s^=1<<h-32}128&i?i=i<<1^113:i<<=1}f[a]=o.create(s,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=o.create()}();var l=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 r=this._state,n=this.blockSize/2,i=0;i<n;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),(O=r[i]).high^=o,O.low^=a}for(var s=0;s<24;s++){for(var l=0;l<5;l++){for(var h=0,p=0,m=0;m<5;m++)h^=(O=r[l+5*m]).high,p^=O.low;var b=d[l];b.high=h,b.low=p}for(l=0;l<5;l++){var y=d[(l+4)%5],g=d[(l+1)%5],v=g.high,w=g.low;for(h=y.high^(v<<1|w>>>31),p=y.low^(w<<1|v>>>31),m=0;m<5;m++)(O=r[l+5*m]).high^=h,O.low^=p}for(var _=1;_<25;_++){var E=(O=r[_]).high,T=O.low,A=c[_];A<32?(h=E<<A|T>>>32-A,p=T<<A|E>>>32-A):(h=T<<A-32|E>>>64-A,p=E<<A-32|T>>>64-A);var S=d[u[_]];S.high=h,S.low=p}var R=d[0],k=r[0];for(R.high=k.high,R.low=k.low,l=0;l<5;l++)for(m=0;m<5;m++){var O=r[_=l+5*m],I=d[_],x=d[(l+1)%5+5*m],C=d[(l+2)%5+5*m];O.high=I.high^~x.high&C.high,O.low=I.low^~x.low&C.low}O=r[0];var M=f[s];O.high^=M.high,O.low^=M.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,a=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/a)*a>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,c=s/8,u=[],f=0;f<c;f++){var d=o[f],l=d.high,h=d.low;l=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),u.push(h),u.push(l)}return new i.init(u,s)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=a._createHelper(l),r.HmacSHA3=a._createHmacHelper(l)}(Math),e.SHA3}(XH(),rG())}(RG)),RG.exports}var OG,IG={exports:{}};var xG,CG={exports:{}};function MG(){return xG||(xG=1,function(e,t){e.exports=function(e){!function(){var t=e,r=t.lib.Base,n=t.enc.Utf8;t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),s=a.words,c=o.words,u=0;u<r;u++)s[u]^=1549556828,c[u]^=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,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}()}(XH())}(CG)),CG.exports}var PG,NG={exports:{}};var BG,DG={exports:{}};function FG(){return BG||(BG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,a=t.algo,o=a.MD5,s=a.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:o,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),a=i.create(),o=a.words,s=r.keySize,c=r.iterations;o.length<s;){u&&n.update(u);var u=n.update(e).finalize(t);n.reset();for(var f=1;f<c;f++)u=n.finalize(u),n.reset();a.concat(u)}return a.sigBytes=4*s,a}});t.EvpKDF=function(e,t,r){return s.create(r).compute(e,t)}}(),e.EvpKDF}(XH(),yG(),MG())}(DG)),DG.exports}var LG,UG={exports:{}};function jG(){return LG||(LG=1,function(e,t){e.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,i=n.Base,a=n.WordArray,o=n.BufferedBlockAlgorithm,s=r.enc;s.Utf8;var c=s.Base64,u=r.algo.EvpKDF,f=n.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,r){this.cfg=this.cfg.extend(r),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?v:y}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()});n.StreamCipher=f.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=r.mode={},l=n.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}}),h=d.CBC=function(){var e=l.extend();function r(e,r,n){var i=this._iv;if(i){var a=i;this._iv=t}else a=this._prevBlock;for(var o=0;o<n;o++)e[r+o]^=a[o]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,a=e.slice(t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=a}}),e}(),p=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(i);var c=a.create(o,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:h,padding:p}),reset:function(){f.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else n=r.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,t&&t.words):(this._mode=n.call(r,this,t&&t.words),this._mode.__creator=n)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var m=n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),b=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=a.create([1398893684,1701076831]).concat(r).concat(t);else n=t;return n.toString(c)},parse:function(e){var t=c.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=a.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return m.create({ciphertext:t,salt:n})}},y=n.SerializableCipher=i.extend({cfg:i.extend({format:b}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),a=i.finalize(t),o=i.cfg;return m.create({ciphertext:a,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),g=(r.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=a.random(8));var i=u.create({keySize:t+r}).compute(e,n),o=a.create(i.words.slice(t),4*r);return i.sigBytes=4*t,m.create({key:i,iv:o,salt:n})}},v=n.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:g}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var a=y.encrypt.call(this,e,t,i.key,n);return a.mixIn(i),a},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=i.iv,y.decrypt.call(this,e,t,i.key,n)}})}()}(XH(),FG())}(UG)),UG.exports}var qG,zG={exports:{}};function HG(){return qG||(qG=1,function(e,t){e.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,n){var i=this._iv;if(i){var a=i.slice(0);this._iv=void 0}else a=this._prevBlock;n.encryptBlock(a,0);for(var o=0;o<r;o++)e[t+o]^=a[o]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i,n),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,a=e.slice(t,t+i);r.call(this,e,t,i,n),this._prevBlock=a}}),t}(),e.mode.CFB}(XH(),jG())}(zG)),zG.exports}var GG,VG={exports:{}};function WG(){return GG||(GG=1,function(e,t){e.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=o[s]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(XH(),jG())}(VG)),VG.exports}var KG,XG={exports:{}};function $G(){return KG||(KG=1,function(e,t){e.exports=function(e){
|
|
32
32
|
/** @preserve
|
|
33
33
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
34
34
|
* derived from CryptoJS.mode.CTR
|
|
@@ -63,5 +63,5 @@ return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=i.create(
|
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the MIT license found in the
|
|
65
65
|
* LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/u4.exports=function(){if(h4)return f4;h4=1;var e=p4,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(e,r,o){var s,c={},u=null,f=null;for(s in void 0!==o&&(u=""+o),void 0!==r.key&&(u=""+r.key),void 0!==r.ref&&(f=r.ref),r)n.call(r,s)&&!a.hasOwnProperty(s)&&(c[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps)void 0===c[s]&&(c[s]=r[s]);return{$$typeof:t,type:e,key:u,ref:f,props:c,_owner:i.current}}return f4.Fragment=r,f4.jsx=o,f4.jsxs=o,f4}();var m4=u4.exports;function b4(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var y4,g4,v4,w4,_4={};b4(_4,"WidgetTheme",(()=>y4)),b4(_4,"CheckoutWidgetTagNames",(()=>v4)),(g4=y4||(y4={})).LIGHT="light",g4.DARK="dark",(w4=v4||(v4={})).CONNECT="imtbl-connect",w4.WALLET="imtbl-wallet",w4.SWAP="imtbl-swap",w4.BRIDGE="imtbl-bridge",w4.ONRAMP="imtbl-onramp";const E4=()=>!1,T4=()=>"0.28.
|
|
66
|
+
*/u4.exports=function(){if(h4)return f4;h4=1;var e=p4,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(e,r,o){var s,c={},u=null,f=null;for(s in void 0!==o&&(u=""+o),void 0!==r.key&&(u=""+r.key),void 0!==r.ref&&(f=r.ref),r)n.call(r,s)&&!a.hasOwnProperty(s)&&(c[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps)void 0===c[s]&&(c[s]=r[s]);return{$$typeof:t,type:e,key:u,ref:f,props:c,_owner:i.current}}return f4.Fragment=r,f4.jsx=o,f4.jsxs=o,f4}();var m4=u4.exports;function b4(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var y4,g4,v4,w4,_4={};b4(_4,"WidgetTheme",(()=>y4)),b4(_4,"CheckoutWidgetTagNames",(()=>v4)),(g4=y4||(y4={})).LIGHT="light",g4.DARK="dark",(w4=v4||(v4={})).CONNECT="imtbl-connect",w4.WALLET="imtbl-wallet",w4.SWAP="imtbl-swap",w4.BRIDGE="imtbl-bridge",w4.ONRAMP="imtbl-onramp";const E4=()=>!1,T4=()=>"0.28.10";function A4(e){const t=e.getAttribute("widgetconfig");if(!t)return null;try{return JSON.parse(t)}catch(t){console.warn(`Unable to decode widgetconfig for ${e}: `,t)}return null}function S4(e,t){e.setAttribute("widgetconfig",JSON.stringify(t))}function R4(e){void 0!==window?window.ImtblCheckoutWidgetConfig=JSON.stringify(e):console.error("missing window object: please run Checkout client side")}function k4(e){if(void 0===document)return void console.error("missing document object: please run Checkout client side");const t=function(e){const t=T4();if(void 0===e||void 0===e.major)return t;if(!Number.isInteger(e.major)||e.major<0)return t;if(void 0!==e.minor&&e.minor<0)return t;if(void 0!==e.patch&&e.patch<0)return t;if(0===e.major&&void 0===e.minor)return t;if(0===e.major&&0===e.minor&&void 0===e.patch)return t;if(0===e.major&&void 0===e.minor&&void 0===e.patch)return t;if(0===e.major&&0===e.minor&&0===e.patch)return t;let r=e.major.toString();return void 0===e.minor||(Number.isInteger(e.minor)&&(r+=`.${e.minor.toString()}`),void 0===e.patch||(Number.isInteger(e.patch)&&(r+=`.${e.patch.toString()}`),void 0===e.prerelease||"alpha"!==e.prerelease||("alpha"===e.prerelease&&(r+=`-${e.prerelease}`),void 0===e.build||Number.isInteger(e.build)&&e.build>=0&&(r+=`.${e.build.toString()}`)))),r}(e?.version);if(document.querySelector('[data-product="checkout"]'))return void console.warn("checkout script has already been loaded, it can only be loaded once.");const r=document.createElement("script");let n=`https://cdn.jsdelivr.net/npm/@imtbl/sdk@${t}/dist/browser/checkout.js`;E4()&&(n="http://localhost:3000/lib/js/imtbl-checkout.js"),r.setAttribute("data-product","checkout"),r.setAttribute("data-version",t),r.setAttribute("src",n),document.head.appendChild(r)}var O4,I4;b4({},"IMTBLWidgetEvents",(()=>O4)),(I4=O4||(O4={})).IMTBL_CONNECT_WIDGET_EVENT="imtbl-connect-widget",I4.IMTBL_WALLET_WIDGET_EVENT="imtbl-wallet-widget",I4.IMTBL_SWAP_WIDGET_EVENT="imtbl-swap-widget",I4.IMTBL_BRIDGE_WIDGET_EVENT="imtbl-bridge-widget",I4.IMTBL_ONRAMP_WIDGET_EVENT="imtbl-onramp-widget",I4.IMTBL_SALE_WIDGET_EVENT="imtbl-sale-widget";var x4,C4;b4({},"ConnectEventType",(()=>x4)),(C4=x4||(x4={})).CLOSE_WIDGET="close-widget",C4.SUCCESS="success",C4.FAILURE="failure";var M4,P4;b4({},"WalletEventType",(()=>M4)),(P4=M4||(M4={})).CLOSE_WIDGET="close-widget",P4.NETWORK_SWITCH="network-switch",P4.DISCONNECT_WALLET="disconnect-wallet";var N4,B4;b4({},"SwapEventType",(()=>N4)),(B4=N4||(N4={})).CLOSE_WIDGET="close-widget",B4.SUCCESS="success",B4.FAILURE="failure",B4.REJECTED="rejected";var D4,F4;b4({},"SaleEventType",(()=>D4)),(F4=D4||(D4={})).CLOSE_WIDGET="close-widget",F4.SUCCESS="success",F4.FAILURE="failure",F4.REJECTED="rejected",F4.TRANSACTION_SUCCESS="transaction-success";var L4,U4;b4({},"BridgeEventType",(()=>L4)),(U4=L4||(L4={})).CLOSE_WIDGET="close-widget",U4.SUCCESS="success",U4.FAILURE="failure";var j4,q4;b4({},"OrchestrationEventType",(()=>j4)),(q4=j4||(j4={})).REQUEST_CONNECT="request-connect",q4.REQUEST_WALLET="request-wallet",q4.REQUEST_SWAP="request-swap",q4.REQUEST_BRIDGE="request-bridge",q4.REQUEST_ONRAMP="request-onramp";var z4,H4;b4({},"OnRampEventType",(()=>z4)),(H4=z4||(z4={})).CLOSE_WIDGET="close-widget",H4.SUCCESS="success",H4.FAILURE="failure";function G4(e,t){if(!t)return void console.error("no provider parsed");if(void 0===window)return void console.error("missing window object: please run Checkout client side");let r=0;let n;const i=()=>{try{const r=document.getElementsByTagName(e);r[0].setProvider(t),window.clearInterval(n)}catch(e){r++,r>=10&&(window.clearInterval(n),console.error("failed to set the provider"))}};n=window.setInterval(i,10),i()}function V4(e,t){if(!t)return void console.error("no passport provided");if(void 0===window)return void console.error("missing window object: please run Checkout client side");let r=0;let n;const i=()=>{try{const r=document.getElementsByTagName(e);r[0].addPassportOption(t),window.clearInterval(n)}catch(e){r++,r>=10&&(window.clearInterval(n),console.error("failed to set the provider",e))}};n=window.setInterval(i,10),i()}function W4(e){const{walletProvider:t,fromContractAddress:r,amount:n,provider:i,passport:a}=e;p4.useEffect((()=>{i&&G4(v4.BRIDGE,i),a&&V4(v4.BRIDGE,a)}),[i,a]);const o=window.ImtblCheckoutWidgetConfig;return m4.jsx("imtbl-bridge",{widgetConfig:o,walletProvider:t,fromContractAddress:r??"",amount:n??""})}b4({},"BridgeReact",(()=>W4));function K4({passport:e}){const t=window.ImtblCheckoutWidgetConfig;return p4.useEffect((()=>{e&&V4(v4.CONNECT,e)}),[e]),m4.jsx("imtbl-connect",{widgetConfig:t})}b4({},"ConnectReact",(()=>K4));function X4(e){const{walletProvider:t,fromContractAddress:r,amount:n,toContractAddress:i,provider:a,passport:o}=e;p4.useEffect((()=>{a&&G4(v4.SWAP,a),o&&V4(v4.SWAP,o)}),[a,o]);const s=window.ImtblCheckoutWidgetConfig;return m4.jsx("imtbl-swap",{widgetConfig:s,walletProvider:t,fromContractAddress:r??"",toContractAddress:i??"",amount:n??""})}b4({},"SwapReact",(()=>X4));function $4(e){const{walletProvider:t,provider:r,passport:n}=e;p4.useEffect((()=>{r&&G4(v4.WALLET,r),n&&V4(v4.WALLET,n)}),[r,n]);const i=window.ImtblCheckoutWidgetConfig;return m4.jsx("imtbl-wallet",{widgetConfig:i,walletProvider:t})}b4({},"WalletReact",(()=>$4));function J4(e){const{walletProvider:t,amount:r,provider:n,passport:i,contractAddress:a}=e;p4.useEffect((()=>{n&&G4(v4.ONRAMP,n),i&&V4(v4.ONRAMP,i)}),[n,i]);const o=window.ImtblCheckoutWidgetConfig;return m4.jsx("imtbl-onramp",{widgetConfig:o,walletProvider:t,amount:r??"",contractAddress:a??""})}b4({},"OnRampReact",(()=>J4));var Y4=Object.freeze({__proto__:null,get BridgeEventType(){return L4},BridgeReact:W4,get CheckoutWidgetTagNames(){return v4},CheckoutWidgets:function(e){void 0!==window?void 0!==document?(k4(e||{}),R4(e||{})):console.error("missing document object: please run Checkout client side"):console.error("missing window object: please run Checkout client side")},get ConnectEventType(){return x4},ConnectReact:K4,get IMTBLWidgetEvents(){return O4},get OnRampEventType(){return z4},OnRampReact:J4,get OrchestrationEventType(){return j4},get SaleEventType(){return D4},get SwapEventType(){return N4},SwapReact:X4,UpdateConfig:function(e){if(void 0===window)return void console.error("missing window object: please run Checkout client side");if(void 0===document)return void console.error("missing document object: please run Checkout client side");let t={};try{t=JSON.parse(window.ImtblCheckoutWidgetConfig)}catch(e){console.warn("Unable to decode window.ImtblCheckoutWidgetConfig: ",e)}Object.values(v4).forEach((t=>{const r=document.getElementsByTagName(t);if(r)for(const t of r){S4(t,{...A4(t)||{},...e})}})),R4({...t,...e})},get WalletEventType(){return M4},WalletReact:$4,get WidgetTheme(){return y4}});e.blockchainData=rr,e.checkoutSdk=c4,e.checkoutWidgets=Y4,e.config=Qe,e.immutablexClient=rB,e.orderbook=CK,e.passport=Dz,e.provider=lX}));
|
|
67
67
|
//# sourceMappingURL=index.browser.js.map
|