@imtbl/sdk 0.24.0-alpha.3 → 0.24.1
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";var t;!function(e){e.PRODUCTION="production",e.SANDBOX="sandbox"}(t||(t={}));class r{environment;apiKey;constructor(e){this.environment=e.environment,this.apiKey=e.apiKey}}var n=Object.freeze({__proto__:null,get Environment(){return t},ImmutableConfiguration:r});function i(e,t){return function(){return e.apply(t,arguments)}}const{toString:a}=Object.prototype,{getPrototypeOf:o}=Object,s=(c=Object.create(null),e=>{const t=a.call(e);return c[t]||(c[t]=t.slice(8,-1).toLowerCase())});var c;const u=e=>(e=e.toLowerCase(),t=>s(t)===e),f=e=>t=>typeof t===e,{isArray:d}=Array,l=f("undefined");const h=u("ArrayBuffer");const p=f("string"),m=f("function"),b=f("number"),y=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==s(e))return!1;const t=o(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},v=u("Date"),w=u("File"),_=u("Blob"),E=u("FileList"),T=u("URLSearchParams");function A(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),d(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 S(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 R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,k=e=>!l(e)&&e!==R;const O=(I="undefined"!=typeof Uint8Array&&o(Uint8Array),e=>I&&e instanceof I);var I;const x=u("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),M=u("RegExp"),P=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};A(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},N="abcdefghijklmnopqrstuvwxyz",B="0123456789",D={DIGIT:B,ALPHA:N,ALPHA_DIGIT:N+N.toUpperCase()+B};const F=u("AsyncFunction");var L={isArray:d,isArrayBuffer:h,isBuffer:function(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&m(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||m(e.append)&&("formdata"===(t=s(e))||"object"===t&&m(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&h(e.buffer),t},isString:p,isNumber:b,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:g,isUndefined:l,isDate:v,isFile:w,isBlob:_,isRegExp:M,isFunction:m,isStream:e=>y(e)&&m(e.pipe),isURLSearchParams:T,isTypedArray:O,isFileList:E,forEach:A,merge:function e(){const{caseless:t}=k(this)&&this||{},r={},n=(n,i)=>{const a=t&&S(r,i)||i;g(r[a])&&g(n)?r[a]=e(r[a],n):g(n)?r[a]=e({},n):d(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&A(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(A(t,((t,n)=>{r&&m(t)?e[n]=i(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,s;const c={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)s=i[a],n&&!n(s,e,t)||c[s]||(t[s]=e[s],c[s]=!0);e=!1!==r&&o(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:u,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(d(e))return e;let t=e.length;if(!b(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:x,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:P,freezeMethods:e=>{P(e,((t,r)=>{if(m(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];m(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 d(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:S,global:R,isContextDefined:k,ALPHABET:D,generateString:(e=16,t=D.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&m(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=d(e)?[]:{};return A(e,((e,t)=>{const a=r(e,n+1);!l(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:F,isThenable:e=>e&&(y(e)||m(e))&&m(e.then)&&m(e.catch)};function U(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)}L.inherits(U,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:L.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const j=U.prototype,q={};["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=>{q[e]={value:e}})),Object.defineProperties(U,q),Object.defineProperty(j,"isAxiosError",{value:!0}),U.from=(e,t,r,n,i,a)=>{const o=Object.create(j);return L.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),U.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function z(e){return L.isPlainObject(e)||L.isArray(e)}function H(e){return L.endsWith(e,"[]")?e.slice(0,-2):e}function G(e,t,r){return e?e.concat(t).map((function(e,t){return e=H(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const V=L.toFlatObject(L,{},null,(function(e){return/^is[A-Z]/.test(e)}));function K(e,t,r){if(!L.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=L.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!L.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&L.isSpecCompliantForm(t);if(!L.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(L.isDate(e))return e.toISOString();if(!s&&L.isBlob(e))throw new U("Blob is not supported. Use a Buffer instead.");return L.isArrayBuffer(e)||L.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(L.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(L.isArray(e)&&function(e){return L.isArray(e)&&!e.some(z)}(e)||(L.isFileList(e)||L.endsWith(r,"[]"))&&(s=L.toArray(e)))return r=H(r),s.forEach((function(e,n){!L.isUndefined(e)&&null!==e&&t.append(!0===o?G([r],n,a):null===o?r:r+"[]",c(e))})),!1;return!!z(e)||(t.append(G(i,r,a),c(e)),!1)}const f=[],d=Object.assign(V,{defaultVisitor:u,convertValue:c,isVisitable:z});if(!L.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!L.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),L.forEach(r,(function(r,a){!0===(!(L.isUndefined(r)||null===r)&&i.call(t,r,L.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),f.pop()}}(e),t}function W(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function X(e,t){this._pairs=[],e&&K(e,this,t)}const $=X.prototype;function J(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Y(e,t,r){if(!t)return e;const n=r&&r.encode||J,i=r&&r.serialize;let a;if(a=i?i(t,r):L.isURLSearchParams(t)?t.toString():new X(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}$.append=function(e,t){this._pairs.push([e,t])},$.toString=function(e){const t=e?function(t){return e.call(this,t,W)}:W;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Q=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){L.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ee={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:X,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 te(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&L.isArray(n)?n.length:a,s)return L.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&L.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&L.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(L.isFormData(e)&&L.isFunction(e.entries)){const r={};return L.forEachEntry(e,((e,n)=>{t(function(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const re={"Content-Type":void 0};const ne={transitional:Z,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=L.isObject(e);i&&L.isHTMLForm(e)&&(e=new FormData(e));if(L.isFormData(e))return n&&n?JSON.stringify(te(e)):e;if(L.isArrayBuffer(e)||L.isBuffer(e)||L.isStream(e)||L.isFile(e)||L.isBlob(e))return e;if(L.isArrayBufferView(e))return e.buffer;if(L.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 K(e,new ee.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return ee.isNode&&L.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=L.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return K(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(L.isString(e))try{return(t||JSON.parse)(e),L.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ne.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&L.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 U.from(e,U.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:ee.classes.FormData,Blob:ee.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};L.forEach(["delete","get","head"],(function(e){ne.headers[e]={}})),L.forEach(["post","put","patch"],(function(e){ne.headers[e]=L.merge(re)}));var ie=ne;const ae=L.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 oe=Symbol("internals");function se(e){return e&&String(e).trim().toLowerCase()}function ce(e){return!1===e||null==e?e:L.isArray(e)?e.map(ce):String(e)}function ue(e,t,r,n,i){return L.isFunction(n)?n.call(this,t,r):(i&&(t=r),L.isString(t)?L.isString(n)?-1!==t.indexOf(n):L.isRegExp(n)?n.test(t):void 0:void 0)}let fe=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=se(t);if(!i)throw new Error("header name must be a non-empty string");const a=L.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=ce(e))}const a=(e,t)=>L.forEach(e,((e,r)=>i(e,r,t)));return L.isPlainObject(e)||e instanceof this.constructor?a(e,t):L.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]&&ae[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=se(e)){const r=L.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(L.isFunction(t))return t.call(this,e,r);if(L.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=se(e)){const r=L.findKey(this,e);return!(!r||void 0===this[r]||t&&!ue(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=se(e)){const i=L.findKey(r,e);!i||t&&!ue(0,r[i],i,t)||(delete r[i],n=!0)}}return L.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&&!ue(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return L.forEach(this,((n,i)=>{const a=L.findKey(r,i);if(a)return t[a]=ce(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]=ce(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return L.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&L.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[oe]=this[oe]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=se(e);t[n]||(!function(e,t){const r=L.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 L.isArray(e)?e.forEach(n):n(e),this}};fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),L.freezeMethods(fe.prototype),L.freezeMethods(fe);var de=fe;function le(e,t){const r=this||ie,n=t||r,i=de.from(n.headers);let a=n.data;return L.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function he(e){return!(!e||!e.__CANCEL__)}function pe(e,t,r){U.call(this,null==e?"canceled":e,U.ERR_CANCELED,t,r),this.name="CanceledError"}L.inherits(pe,U,{__CANCEL__:!0});var me=ee.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),L.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),L.isString(n)&&o.push("path="+n),L.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 be(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 ye=ee.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=L.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function ge(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 ve="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=de.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}L.isFormData(n)&&(ee.isStandardBrowserEnv||ee.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=be(e.baseURL,e.url);function f(){if(!c)return;const n=de.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new U("Request failed with status code "+r.status,[U.ERR_BAD_REQUEST,U.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(),Y(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 U("Request aborted",U.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new U("Network Error",U.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||Z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new U(t,n.clarifyTimeoutError?U.ETIMEDOUT:U.ECONNABORTED,e,c)),c=null},ee.isStandardBrowserEnv){const t=(e.withCredentials||ye(u))&&e.xsrfCookieName&&me.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&L.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),L.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",ge(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",ge(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{c&&(r(!t||t.type?new pe(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===ee.protocols.indexOf(d)?r(new U("Unsupported protocol "+d+":",U.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const we={http:null,xhr:ve};L.forEach(we,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var _e=e=>{e=L.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=L.isString(r)?we[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new U(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(L.hasOwnProp(we,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!L.isFunction(n))throw new TypeError("adapter is not a function");return n};function Ee(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pe(null,e)}function Te(e){Ee(e),e.headers=de.from(e.headers),e.data=le.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _e(e.adapter||ie.adapter)(e).then((function(t){return Ee(e),t.data=le.call(e,e.transformResponse,t),t.headers=de.from(t.headers),t}),(function(t){return he(t)||(Ee(e),t&&t.response&&(t.response.data=le.call(e,e.transformResponse,t.response),t.response.headers=de.from(t.response.headers))),Promise.reject(t)}))}const Ae=e=>e instanceof de?e.toJSON():e;function Se(e,t){t=t||{};const r={};function n(e,t,r){return L.isPlainObject(e)&&L.isPlainObject(t)?L.merge.call({caseless:r},e,t):L.isPlainObject(t)?L.merge({},t):L.isArray(t)?t.slice():t}function i(e,t,r){return L.isUndefined(t)?L.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!L.isUndefined(t))return n(void 0,t)}function o(e,t){return L.isUndefined(t)?L.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(Ae(e),Ae(t),!0)};return L.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||i,o=a(e[n],t[n],n);L.isUndefined(o)&&a!==s||(r[n]=o)})),r}const Re="1.4.0",ke={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{ke[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Oe={};ke.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 U(n(i," has been removed"+(t?" in "+t:"")),U.ERR_DEPRECATED);return t&&!Oe[i]&&(Oe[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 Ie={assertOptions:function(e,t,r){if("object"!=typeof e)throw new U("options must be an object",U.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 U("option "+a+" must be "+r,U.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new U("Unknown option "+a,U.ERR_BAD_OPTION)}},validators:ke};const xe=Ie.validators;let Ce=class{constructor(e){this.defaults=e,this.interceptors={request:new Q,response:new Q}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Se(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Ie.assertOptions(r,{silentJSONParsing:xe.transitional(xe.boolean),forcedJSONParsing:xe.transitional(xe.boolean),clarifyTimeoutError:xe.transitional(xe.boolean)},!1),null!=n&&(L.isFunction(n)?t.paramsSerializer={serialize:n}:Ie.assertOptions(n,{encode:xe.function,serialize:xe.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&L.merge(i.common,i[t.method]),a&&L.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=de.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=[Te.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=Te.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 Y(be((e=Se(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};L.forEach(["delete","get","head","options"],(function(e){Ce.prototype[e]=function(t,r){return this.request(Se(r||{},{method:e,url:t,data:(r||{}).data}))}})),L.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Se(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ce.prototype[e]=t(),Ce.prototype[e+"Form"]=t(!0)}));var Me=Ce;var Pe=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 pe(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 Ne={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(Ne).forEach((([e,t])=>{Ne[t]=e}));var Be=Ne;const De=function e(t){const r=new Me(t),n=i(Me.prototype.request,r);return L.extend(n,Me.prototype,r,{allOwnKeys:!0}),L.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Se(t,r))},n}(ie);De.Axios=Me,De.CanceledError=pe,De.CancelToken=Pe,De.isCancel=he,De.VERSION=Re,De.toFormData=K,De.AxiosError=U,De.Cancel=De.CanceledError,De.all=function(e){return Promise.all(e)},De.spread=function(e){return function(t){return e.apply(null,t)}},De.isAxiosError=function(e){return L.isObject(e)&&!0===e.isAxiosError},De.mergeConfig=Se,De.AxiosHeaders=de,De.formToJSON=e=>te(L.isHTMLForm(e)?new FormData(e):e),De.HttpStatusCode=Be,De.default=De;var Fe=De;const{Axios:Le,AxiosError:Ue,CanceledError:je,isCancel:qe,CancelToken:ze,VERSION:He,all:Ge,Cancel:Ve,isAxiosError:Ke,spread:We,toFormData:Xe,AxiosHeaders:$e,HttpStatusCode:Je,formToJSON:Ye,mergeConfig:Qe}=Fe;const Ze="https://api.sandbox.immutable.com".replace(/\/+$/,"");let et=class{basePath;axios;configuration;constructor(e,t=Ze,r=Fe){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}},tt=class extends Error{field;name="RequiredError";constructor(e,t){super(t),this.field=e}};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=""){"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||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,Fe,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,Fe,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,Fe,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={})=>{nt("listCollections","chainName",t);const a="/v1/chains/{chain_name}/collections".replace("{chain_name}",encodeURIComponent(String(t))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i},u={};void 0!==r&&(u.page_cursor=r),void 0!==n&&(u.page_size=n),st(o,u);let f=s&&s.headers?s.headers:{};return c.headers={...f,...i.headers},{url:ut(o),options:c}},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,Fe,Ze,e)},async listCollections(r,n,i,a){const o=await t.listCollections(r,n,i,a);return ft(o,Fe,Ze,e)},async listCollectionsByNFTOwner(r,n,i,a,o){const s=await t.listCollectionsByNFTOwner(r,n,i,a,o);return ft(s,Fe,Ze,e)},async refreshCollectionMetadata(r,n,i,a){const o=await t.refreshCollectionMetadata(r,n,i,a);return ft(o,Fe,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.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}},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,Fe,Ze,e)},async refreshMetadataByID(r,n,i,a){const o=await t.refreshMetadataByID(r,n,i,a);return ft(o,Fe,Ze,e)},async refreshNFTMetadataByTokenID(r,n,i,a){const o=await t.refreshNFTMetadataByTokenID(r,n,i,a);return ft(o,Fe,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}}}},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,Fe,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)))}}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}},listNFTs:async(t,r,n,i,a={})=>{nt("listNFTs","contractAddress",t),nt("listNFTs","chainName",r);const o="/v1/chains/{chain_name}/collections/{contract_address}/nfts".replace("{contract_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}},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,Fe,Ze,e)},async listNFTs(r,n,i,a,o){const s=await t.listNFTs(r,n,i,a,o);return ft(s,Fe,Ze,e)},async listNFTsByAccountAddress(r,n,i,a,o,s){const c=await t.listNFTsByAccountAddress(r,n,i,a,o,s);return ft(c,Fe,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)))}listNFTs(e,t){return Rt(this.configuration).listNFTs(e.contractAddress,e.chainName,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{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 createListing(r,n,i){const a=await t.createListing(r,n,i);return ft(a,Fe,Ze,e)},async fulfillmentData(r,n,i){const a=await t.fulfillmentData(r,n,i);return ft(a,Fe,Ze,e)},async getListing(r,n,i){const a=await t.getListing(r,n,i);return ft(a,Fe,Ze,e)},async getTrade(r,n,i){const a=await t.getTrade(r,n,i);return ft(a,Fe,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,Fe,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,Fe,Ze,e)}}};class xt extends et{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,Fe,Ze,e)},async getLinkedAddresses(r,n){const i=await t.getLinkedAddresses(r,n);return ft(i,Fe,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={})=>{nt("listERC20Tokens","chainName",t);const a="/v1/chains/{chain_name}/tokens".replace("{chain_name}",encodeURIComponent(String(t))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i},u={};void 0!==r&&(u.page_cursor=r),void 0!==n&&(u.page_size=n),st(o,u);let f=s&&s.headers?s.headers:{};return c.headers={...f,...i.headers},{url:ut(o),options:c}}}},Bt=function(e){const t=Nt(e);return{async getERC20Token(r,n,i){const a=await t.getERC20Token(r,n,i);return ft(a,Fe,Ze,e)},async listERC20Tokens(r,n,i,a){const o=await t.listERC20Tokens(r,n,i,a);return ft(o,Fe,Ze,e)}}};var Dt=Object.freeze({__proto__:null,APIError400AllOfCodeEnum:{ValidationError:"VALIDATION_ERROR"},APIError401AllOfCodeEnum:{UnauthorisedRequest:"UNAUTHORISED_REQUEST"},APIError403AllOfCodeEnum:{AuthenticationError:"AUTHENTICATION_ERROR"},APIError404AllOfCodeEnum:{ResourceNotFound:"RESOURCE_NOT_FOUND"},APIError429AllOfCodeEnum:{TooManyRequestsError:"TOO_MANY_REQUESTS_ERROR"},APIError500AllOfCodeEnum:{InternalServerError:"INTERNAL_SERVER_ERROR"},ActivitiesApi:ht,ActivitiesApiAxiosParamCreator:dt,ActivitiesApiFactory:function(e,t,r){const n=lt(e);return{getActivity:(e,i,a)=>n.getActivity(e,i,a).then((e=>e(r,t))),listActivities:(e,i,a,o,s,c,u,f,d,l,h)=>n.listActivities(e,i,a,o,s,c,u,f,d,l,h).then((e=>e(r,t)))}},ActivitiesApiFp:lt,ActivityType:{Mint:"mint",Burn:"burn",Transfer:"transfer",Sale:"sale",Deposit:"deposit",Withdrawal:"withdrawal"},ChainsApi:bt,ChainsApiAxiosParamCreator:pt,ChainsApiFactory:function(e,t,r){const n=mt(e);return{listChains:(e,i,a)=>n.listChains(e,i,a).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,a)=>n.getCollection(e,i,a).then((e=>e(r,t))),listCollections:(e,i,a,o)=>n.listCollections(e,i,a,o).then((e=>e(r,t))),listCollectionsByNFTOwner:(e,i,a,o,s)=>n.listCollectionsByNFTOwner(e,i,a,o,s).then((e=>e(r,t))),refreshCollectionMetadata:(e,i,a,o)=>n.refreshCollectionMetadata(e,i,a,o).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"},FeeFeeTypeEnum:{Royalty:"ROYALTY",MakerMarketplace:"MAKER_MARKETPLACE",TakerMarketplace:"TAKER_MARKETPLACE",Protocol:"PROTOCOL"},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)))}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,a,o)=>n.getMetadata(e,i,a,o).then((e=>e(r,t))),refreshMetadataByID:(e,i,a,o)=>n.refreshMetadataByID(e,i,a,o).then((e=>e(r,t))),refreshNFTMetadataByTokenID:(e,i,a,o)=>n.refreshNFTMetadataByTokenID(e,i,a,o).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,a,o,s,c)=>n.listNFTOwners(e,i,a,o,s,c).then((e=>e(r,t)))}},NftOwnersApiFp:Tt,NftsApi:kt,NftsApiAxiosParamCreator:St,NftsApiFactory:function(e,t,r){const n=Rt(e);return{getNFT:(e,i,a,o)=>n.getNFT(e,i,a,o).then((e=>e(r,t))),listNFTs:(e,i,a,o,s)=>n.listNFTs(e,i,a,o,s).then((e=>e(r,t))),listNFTsByAccountAddress:(e,i,a,o,s,c)=>n.listNFTsByAccountAddress(e,i,a,o,s,c).then((e=>e(r,t)))}},NftsApiFp:Rt,OrderStatus:{Pending:"PENDING",Active:"ACTIVE",Inactive:"INACTIVE",Filled:"FILLED",Cancelled:"CANCELLED",Expired:"EXPIRED"},OrdersApi:xt,OrdersApiAxiosParamCreator:Ot,OrdersApiFactory:function(e,t,r){const n=It(e);return{createListing:(e,i,a)=>n.createListing(e,i,a).then((e=>e(r,t))),fulfillmentData:(e,i,a)=>n.fulfillmentData(e,i,a).then((e=>e(r,t))),getListing:(e,i,a)=>n.getListing(e,i,a).then((e=>e(r,t))),getTrade:(e,i,a)=>n.getTrade(e,i,a).then((e=>e(r,t))),listListings:(e,i,a,o,s,c,u,f,d,l)=>n.listListings(e,i,a,o,s,c,u,f,d,l).then((e=>e(r,t))),listTrades:(e,i,a,o,s,c,u)=>n.listTrades(e,i,a,o,s,c,u).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,i).then((e=>e(r,t))),getLinkedAddresses:(e,i)=>n.getLinkedAddresses(e,i).then((e=>e(r,t)))}},PassportApiFp:Mt,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.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,a)=>n.getERC20Token(e,i,a).then((e=>e(r,t))),listERC20Tokens:(e,i,a,o)=>n.listERC20Tokens(e,i,a,o).then((e=>e(r,t)))}},TokensApiFp:Bt});class Ft{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 Lt={"x-sdk-version":"ts-immutable-sdk-0.24.0-alpha.3"},Ut=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...Lt,...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)},jt=()=>({indexer:Ut({basePath:"https://indexer-mr.imtbl.com"}),orderBook:Ut({basePath:"https://order-book-mr.imtbl.com"}),passport:Ut({basePath:"https://api.immutable.com"})}),qt=()=>({indexer:Ut({basePath:"https://api.sandbox.immutable.com"}),orderBook:Ut({basePath:"https://api.sandbox.immutable.com"}),passport:Ut({basePath:"https://api.sandbox.immutable.com"})});class zt 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 Ht={sdkVersion:"ts-immutable-sdk-multi-rollup-api-client-0.24.0-alpha.3"},Gt=({baseConfig:e,basePath:t,headers:r})=>{if(!t.trim())throw Error("basePath can not be empty");const n={...e,basePath:t,baseOptions:{headers:{...r||{},...Ht}}};return new Dt.Configuration(n)};class Vt{apiConfig;baseConfig;constructor({baseConfig:e,overrides:r}){if(this.baseConfig=e,r)this.apiConfig=Gt(r);else switch(e.environment){case t.SANDBOX:this.apiConfig=Gt({basePath:"https://api.sandbox.immutable.com",baseConfig:e});break;case t.PRODUCTION:this.apiConfig=Gt({basePath:"https://indexer-mr.imtbl.com",baseConfig:e});break;default:this.apiConfig=Gt({basePath:"https://api.sandbox.immutable.com",baseConfig:e})}}}function Kt(e){if(Fe.isAxiosError(e)&&e.response){const t=e.response.data;return t.code&&t.message?new zt({code:t.code,message:t.message,details:t.details||null,link:t.link||"",trace_id:t.trace_id||""}):new zt({code:e.code??e.response?.status.toString()??"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}return new zt({code:"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}class Wt{config;activities;chains;collections;nfts;nftOwners;tokens;metadata;constructor(e){this.config=new Vt(e),this.activities=new Dt.ActivitiesApi(this.config.apiConfig),this.chains=new Dt.ChainsApi(this.config.apiConfig),this.collections=new Dt.CollectionsApi(this.config.apiConfig),this.nfts=new Dt.NftsApi(this.config.apiConfig),this.nftOwners=new Dt.NftOwnersApi(this.config.apiConfig),this.tokens=new Dt.TokensApi(this.config.apiConfig),this.metadata=new Dt.MetadataApi(this.config.apiConfig)}async listActivities(e){return await this.activities.listActivities(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async getActivity(e){return await this.activities.getActivity(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listChains(e){return await this.chains.listChains(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listCollections(e){return await this.collections.listCollections(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listCollectionsByNFTOwner(e){return await this.collections.listCollectionsByNFTOwner(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async getCollection(e){return await this.collections.getCollection(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async getNFT(e){return await this.nfts.getNFT(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listNFTs(e){return await this.nfts.listNFTs(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listTokens(e){return await this.tokens.listERC20Tokens(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async getToken(e){return await this.tokens.getERC20Token(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async refreshCollectionMetadata(e){return await this.collections.refreshCollectionMetadata(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async refreshNFTMetadata(e){return await this.metadata.refreshNFTMetadataByTokenID(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async refreshStackedMetadata(e){return await this.metadata.refreshMetadataByID(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}}var Xt=Object.freeze({__proto__:null,APIError:zt,BlockchainData:Wt}),$t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Jt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Yt(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 Qt={exports:{}},Zt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},er=[],tr=[],rr="undefined"!=typeof Uint8Array?Uint8Array:Array,nr=!1;function ir(){nr=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)er[t]=e[t],tr[e.charCodeAt(t)]=t;tr["-".charCodeAt(0)]=62,tr["_".charCodeAt(0)]=63}function ar(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(er[(i=n)>>18&63]+er[i>>12&63]+er[i>>6&63]+er[63&i]);return a.join("")}function or(e){var t;nr||ir();for(var r=e.length,n=r%3,i="",a=[],o=16383,s=0,c=r-n;s<c;s+=o)a.push(ar(e,s,s+o>c?c:s+o));return 1===n?(t=e[r-1],i+=er[t>>2],i+=er[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=er[t>>10],i+=er[t>>4&63],i+=er[t<<2&63],i+="="),a.push(i),a.join("")}function sr(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 cr(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 ur={}.toString,fr=Array.isArray||function(e){return"[object Array]"==ur.call(e)};pr.TYPED_ARRAY_SUPPORT=void 0===Zt.TYPED_ARRAY_SUPPORT||Zt.TYPED_ARRAY_SUPPORT;var dr=lr();function lr(){return pr.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function hr(e,t){if(lr()<t)throw new RangeError("Invalid typed array length");return pr.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=pr.prototype:(null===e&&(e=new pr(t)),e.length=t),e}function pr(e,t,r){if(!(pr.TYPED_ARRAY_SUPPORT||this instanceof pr))return new pr(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 yr(this,e)}return mr(this,e,t,r)}function mr(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);pr.TYPED_ARRAY_SUPPORT?(e=t).__proto__=pr.prototype:e=gr(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!pr.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|_r(t,r);e=hr(e,n);var i=e.write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(wr(t)){var r=0|vr(t.length);return 0===(e=hr(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?hr(e,0):gr(e,t);if("Buffer"===t.type&&fr(t.data))return gr(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function br(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 yr(e,t){if(br(t),e=hr(e,t<0?0:0|vr(t)),!pr.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function gr(e,t){var r=t.length<0?0:0|vr(t.length);e=hr(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function vr(e){if(e>=lr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+lr().toString(16)+" bytes");return 0|e}function wr(e){return!(null==e||!e._isBuffer)}function _r(e,t){if(wr(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 Xr(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $r(e).length;default:if(n)return Xr(e).length;t=(""+t).toLowerCase(),n=!0}}function Er(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 Fr(this,t,r);case"utf8":case"utf-8":return Pr(this,t,r);case"ascii":return Br(this,t,r);case"latin1":case"binary":return Dr(this,t,r);case"base64":return Mr(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lr(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Tr(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Ar(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=pr.from(t,n)),wr(t))return 0===t.length?-1:Sr(e,t,r,n,i);if("number"==typeof t)return t&=255,pr.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Sr(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Sr(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 Rr(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 kr(e,t,r,n){return Jr(Xr(t,e.length-r),e,r,n)}function Or(e,t,r,n){return Jr(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function Ir(e,t,r,n){return Or(e,t,r,n)}function xr(e,t,r,n){return Jr($r(t),e,r,n)}function Cr(e,t,r,n){return Jr(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 Mr(e,t,r){return 0===t&&r===e.length?or(e):or(e.slice(t,r))}function Pr(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<=Nr)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Nr));return r}(n)}pr.poolSize=8192,pr._augment=function(e){return e.__proto__=pr.prototype,e},pr.from=function(e,t,r){return mr(null,e,t,r)},pr.TYPED_ARRAY_SUPPORT&&(pr.prototype.__proto__=Uint8Array.prototype,pr.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&pr[Symbol.species]),pr.alloc=function(e,t,r){return function(e,t,r,n){return br(t),t<=0?hr(e,t):void 0!==r?"string"==typeof n?hr(e,t).fill(r,n):hr(e,t).fill(r):hr(e,t)}(null,e,t,r)},pr.allocUnsafe=function(e){return yr(null,e)},pr.allocUnsafeSlow=function(e){return yr(null,e)},pr.isBuffer=Yr,pr.compare=function(e,t){if(!wr(e)||!wr(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},pr.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}},pr.concat=function(e,t){if(!fr(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return pr.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=pr.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!wr(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},pr.byteLength=_r,pr.prototype._isBuffer=!0,pr.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)Tr(this,t,t+1);return this},pr.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)Tr(this,t,t+3),Tr(this,t+1,t+2);return this},pr.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)Tr(this,t,t+7),Tr(this,t+1,t+6),Tr(this,t+2,t+5),Tr(this,t+3,t+4);return this},pr.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Pr(this,0,e):Er.apply(this,arguments)},pr.prototype.equals=function(e){if(!wr(e))throw new TypeError("Argument must be a Buffer");return this===e||0===pr.compare(this,e)},pr.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+">"},pr.prototype.compare=function(e,t,r,n,i){if(!wr(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},pr.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},pr.prototype.indexOf=function(e,t,r){return Ar(this,e,t,r,!0)},pr.prototype.lastIndexOf=function(e,t,r){return Ar(this,e,t,r,!1)},pr.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 Rr(this,e,t,r);case"utf8":case"utf-8":return kr(this,e,t,r);case"ascii":return Or(this,e,t,r);case"latin1":case"binary":return Ir(this,e,t,r);case"base64":return xr(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Cr(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},pr.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Nr=4096;function Br(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 Dr(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 Fr(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+=Wr(e[a]);return i}function Lr(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 Ur(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 jr(e,t,r,n,i,a){if(!wr(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 qr(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 zr(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 Hr(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 Gr(e,t,r,n,i){return i||Hr(e,0,r,4),cr(e,t,r,n,23,4),r+4}function Vr(e,t,r,n,i){return i||Hr(e,0,r,8),cr(e,t,r,n,52,8),r+8}pr.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),pr.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=pr.prototype;else{var i=t-e;r=new pr(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},pr.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Ur(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},pr.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Ur(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},pr.prototype.readUInt8=function(e,t){return t||Ur(e,1,this.length),this[e]},pr.prototype.readUInt16LE=function(e,t){return t||Ur(e,2,this.length),this[e]|this[e+1]<<8},pr.prototype.readUInt16BE=function(e,t){return t||Ur(e,2,this.length),this[e]<<8|this[e+1]},pr.prototype.readUInt32LE=function(e,t){return t||Ur(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},pr.prototype.readUInt32BE=function(e,t){return t||Ur(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},pr.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Ur(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},pr.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Ur(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},pr.prototype.readInt8=function(e,t){return t||Ur(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},pr.prototype.readInt16LE=function(e,t){t||Ur(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},pr.prototype.readInt16BE=function(e,t){t||Ur(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},pr.prototype.readInt32LE=function(e,t){return t||Ur(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},pr.prototype.readInt32BE=function(e,t){return t||Ur(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},pr.prototype.readFloatLE=function(e,t){return t||Ur(e,4,this.length),sr(this,e,!0,23,4)},pr.prototype.readFloatBE=function(e,t){return t||Ur(e,4,this.length),sr(this,e,!1,23,4)},pr.prototype.readDoubleLE=function(e,t){return t||Ur(e,8,this.length),sr(this,e,!0,52,8)},pr.prototype.readDoubleBE=function(e,t){return t||Ur(e,8,this.length),sr(this,e,!1,52,8)},pr.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||jr(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},pr.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||jr(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},pr.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,1,255,0),pr.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},pr.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,2,65535,0),pr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):qr(this,e,t,!0),t+2},pr.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,2,65535,0),pr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):qr(this,e,t,!1),t+2},pr.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,4,4294967295,0),pr.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):zr(this,e,t,!0),t+4},pr.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,4,4294967295,0),pr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):zr(this,e,t,!1),t+4},pr.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);jr(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},pr.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);jr(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},pr.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,1,127,-128),pr.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},pr.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,2,32767,-32768),pr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):qr(this,e,t,!0),t+2},pr.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,2,32767,-32768),pr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):qr(this,e,t,!1),t+2},pr.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,4,2147483647,-2147483648),pr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):zr(this,e,t,!0),t+4},pr.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),pr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):zr(this,e,t,!1),t+4},pr.prototype.writeFloatLE=function(e,t,r){return Gr(this,e,t,!0,r)},pr.prototype.writeFloatBE=function(e,t,r){return Gr(this,e,t,!1,r)},pr.prototype.writeDoubleLE=function(e,t,r){return Vr(this,e,t,!0,r)},pr.prototype.writeDoubleBE=function(e,t,r){return Vr(this,e,t,!1,r)},pr.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||!pr.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},pr.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&&!pr.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=wr(e)?e:Xr(new pr(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var Kr=/[^+\/0-9A-Za-z-_]/g;function Wr(e){return e<16?"0"+e.toString(16):e.toString(16)}function Xr(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 $r(e){return function(e){var t,r,n,i,a,o;nr||ir();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 rr(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=tr[e.charCodeAt(t)]<<18|tr[e.charCodeAt(t+1)]<<12|tr[e.charCodeAt(t+2)]<<6|tr[e.charCodeAt(t+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=255&i;return 2===a?(i=tr[e.charCodeAt(t)]<<2|tr[e.charCodeAt(t+1)]>>4,o[c++]=255&i):1===a&&(i=tr[e.charCodeAt(t)]<<10|tr[e.charCodeAt(t+1)]<<4|tr[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(Kr,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Jr(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 Yr(e){return null!=e&&(!!e._isBuffer||Qr(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Qr(e.slice(0,0))}(e))}function Qr(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Zr=Yt(Object.freeze({__proto__:null,Buffer:pr,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),pr.alloc(+e)},isBuffer:Yr,kMaxLength:dr}));!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:Zr.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,K=0|s[2],W=8191&K,X=K>>>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,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(l,W)|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,W)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,W)|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,W)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(g,W)|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,W)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,W)|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,W)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(A,W)|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,W)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(k,W)|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,W)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,W)|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,W)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(P,W)|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,W)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(D,W)|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,W),i=(i=Math.imul(L,X))+Math.imul(U,W)|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,$t)}(Qt);var en=Qt.exports,tn=Jt(en);let rn=!1,nn=!1;const an={debug:1,default:2,info:2,warning:3,error:4,off:5};let on=an.default,sn=null;const cn=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 un,fn;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(un||(un={})),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"}(fn||(fn={}));const dn="0123456789abcdef";let ln=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==an[r]&&this.throwArgumentError("invalid log level name","logLevel",e),on>an[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(nn)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+=dn[t[e]>>4],r+=dn[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 fn.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 fn.CALL_EXCEPTION:case fn.INSUFFICIENT_FUNDS:case fn.MISSING_NEW:case fn.NONCE_EXPIRED:case fn.REPLACEMENT_UNDERPRICED:case fn.TRANSACTION_REPLACED:case fn.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){cn&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:cn})}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 sn||(sn=new e("logger/5.7.0")),sn}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),rn){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}nn=!!t,rn=!!r}static setLogLevel(t){const r=an[t.toLowerCase()];null!=r?on=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};ln.errors=fn,ln.levels=un;var hn=Object.freeze({__proto__:null,get ErrorCode(){return fn},get LogLevel(){return un},Logger:ln});const pn=new ln("bytes/5.7.0");function mn(e){return!!e.toHexString}function bn(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return bn(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function yn(e){return An(e)&&!(e.length%2)||vn(e)}function gn(e){return"number"==typeof e&&e==e&&e%1==0}function vn(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!gn(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!gn(r)||r<0||r>=256)return!1}return!0}function wn(e,t){if(t||(t={}),"number"==typeof e){pn.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),bn(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),mn(e)&&(e=e.toHexString()),An(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":pn.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 bn(new Uint8Array(n))}return vn(e)?bn(new Uint8Array(e)):pn.throwArgumentError("invalid arrayify value","value",e)}function _n(e){const t=e.map((e=>wn(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),bn(n)}function En(e){let t=wn(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 Tn(e,t){(e=wn(e)).length>t&&pn.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),bn(r)}function An(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Sn="0123456789abcdef";function Rn(e,t){if(t||(t={}),"number"==typeof e){pn.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Sn[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),mn(e))return e.toHexString();if(An(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":pn.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(vn(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Sn[(240&n)>>4]+Sn[15&n]}return t}return pn.throwArgumentError("invalid hexlify value","value",e)}function kn(e){if("string"!=typeof e)e=Rn(e);else if(!An(e)||e.length%2)return null;return(e.length-2)/2}function On(e,t,r){return"string"!=typeof e?e=Rn(e):(!An(e)||e.length%2)&&pn.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function In(e){let t="0x";return e.forEach((e=>{t+=Rn(e).substring(2)})),t}function xn(e){const t=Cn(Rn(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function Cn(e){"string"!=typeof e&&(e=Rn(e)),An(e)||pn.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 Mn(e,t){for("string"!=typeof e?e=Rn(e):An(e)||pn.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&pn.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Pn(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(yn(e)){let r=wn(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Rn(r.slice(0,32)),t.s=Rn(r.slice(32,64))):65===r.length?(t.r=Rn(r.slice(0,32)),t.s=Rn(r.slice(32,64)),t.v=r[64]):pn.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:pn.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Rn(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=Tn(wn(t._vs),32);t._vs=Rn(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&pn.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=Rn(r);null==t.s?t.s=i:t.s!==i&&pn.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?pn.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&&pn.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&An(t.r)?t.r=Mn(t.r,32):pn.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&An(t.s)?t.s=Mn(t.s,32):pn.throwArgumentError("signature missing or invalid s","signature",e);const r=wn(t.s);r[0]>=128&&pn.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Rn(r);t._vs&&(An(t._vs)||pn.throwArgumentError("signature invalid _vs","signature",e),t._vs=Mn(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&pn.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Nn(e){return Rn(_n([(e=Pn(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var Bn=Object.freeze({__proto__:null,arrayify:wn,concat:_n,hexConcat:In,hexDataLength:kn,hexDataSlice:On,hexStripZeros:Cn,hexValue:xn,hexZeroPad:Mn,hexlify:Rn,isBytes:vn,isBytesLike:yn,isHexString:An,joinSignature:Nn,splitSignature:Pn,stripZeros:En,zeroPad:Tn});const Dn="bignumber/5.7.0";var Fn=tn.BN;const Ln=new ln(Dn),Un={},jn=9007199254740991;let qn=!1,zn=class e{constructor(e,t){e!==Un&&Ln.throwError("cannot call constructor directly; use BigNumber.from",ln.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Gn(Vn(this).fromTwos(e))}toTwos(e){return Gn(Vn(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Gn(Vn(this).add(Vn(e)))}sub(e){return Gn(Vn(this).sub(Vn(e)))}div(t){return e.from(t).isZero()&&Kn("division-by-zero","div"),Gn(Vn(this).div(Vn(t)))}mul(e){return Gn(Vn(this).mul(Vn(e)))}mod(e){const t=Vn(e);return t.isNeg()&&Kn("division-by-zero","mod"),Gn(Vn(this).umod(t))}pow(e){const t=Vn(e);return t.isNeg()&&Kn("negative-power","pow"),Gn(Vn(this).pow(t))}and(e){const t=Vn(e);return(this.isNegative()||t.isNeg())&&Kn("unbound-bitwise-result","and"),Gn(Vn(this).and(t))}or(e){const t=Vn(e);return(this.isNegative()||t.isNeg())&&Kn("unbound-bitwise-result","or"),Gn(Vn(this).or(t))}xor(e){const t=Vn(e);return(this.isNegative()||t.isNeg())&&Kn("unbound-bitwise-result","xor"),Gn(Vn(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Kn("negative-width","mask"),Gn(Vn(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Kn("negative-width","shl"),Gn(Vn(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Kn("negative-width","shr"),Gn(Vn(this).shrn(e))}eq(e){return Vn(this).eq(Vn(e))}lt(e){return Vn(this).lt(Vn(e))}lte(e){return Vn(this).lte(Vn(e))}gt(e){return Vn(this).gt(Vn(e))}gte(e){return Vn(this).gte(Vn(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Vn(this).isZero()}toNumber(){try{return Vn(this).toNumber()}catch(e){Kn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ln.throwError("this platform does not support BigInt",ln.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?qn||(qn=!0,Ln.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ln.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ln.errors.UNEXPECTED_ARGUMENT,{}):Ln.throwError("BigNumber.toString does not accept parameters",ln.errors.UNEXPECTED_ARGUMENT,{})),Vn(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(Un,Hn(t)):t.match(/^-?[0-9]+$/)?new e(Un,Hn(new Fn(t))):Ln.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Kn("underflow","BigNumber.from",t),(t>=jn||t<=-jn)&&Kn("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(vn(r))return e.from(Rn(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&&(An(t)||"-"===t[0]&&An(t.substring(1))))return e.from(t)}return Ln.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Hn(e){if("string"!=typeof e)return Hn(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Ln.throwArgumentError("invalid hex","value",e),"0x00"===(e=Hn(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 Gn(e){return zn.from(Hn(e))}function Vn(e){const t=zn.from(e).toHexString();return"-"===t[0]?new Fn("-"+t.substring(3),16):new Fn(t.substring(2),16)}function Kn(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Ln.throwError(e,ln.errors.NUMERIC_FAULT,n)}const Wn=new ln(Dn),Xn={},$n=zn.from(0),Jn=zn.from(-1);function Yn(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),Wn.throwError(e,ln.errors.NUMERIC_FAULT,i)}let Qn="0";for(;Qn.length<256;)Qn+=Qn;function Zn(e){if("number"!=typeof e)try{e=zn.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Qn.substring(0,e):Wn.throwArgumentError("invalid decimal size","decimals",e)}function ei(e,t){null==t&&(t=0);const r=Zn(t),n=(e=zn.from(e)).lt($n);n&&(e=e.mul(Jn));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 ti(e,t){null==t&&(t=0);const r=Zn(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Wn.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&Wn.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Wn.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&&Yn("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=zn.from(a),c=zn.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(Jn)),u}class ri{constructor(e,t,r,n){e!==Xn&&Wn.throwError("cannot use FixedFormat constructor; use FixedFormat.from",ln.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=Zn(n),Object.freeze(this)}static from(e){if(e instanceof ri)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||Wn.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&&Wn.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&&Wn.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Wn.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new ri(Xn,t,r,n)}}class ni{constructor(e,t,r,n){e!==Xn&&Wn.throwError("cannot use FixedNumber constructor; use FixedNumber.from",ln.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&&Wn.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ti(this._value,this.format.decimals),r=ti(e._value,e.format.decimals);return ni.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ti(this._value,this.format.decimals),r=ti(e._value,e.format.decimals);return ni.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ti(this._value,this.format.decimals),r=ti(e._value,e.format.decimals);return ni.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ti(this._value,this.format.decimals),r=ti(e._value,e.format.decimals);return ni.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=ni.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(ii.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=ni.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(ii.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)&&Wn.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=ni.from("1"+Qn.substring(0,e),this.format),n=ai.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&&Wn.throwArgumentError("invalid byte width","width",e);return Mn(zn.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return ni.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(zn.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||An(e)||"bigint"==typeof e||vn(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),ni.fromString(ei(e,t),ri.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=ri.from(t),n=ti(e,r.decimals);!r.signed&&n.lt($n)&&Yn("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Mn(i,r.width/8));const a=ei(n,r.decimals);return new ni(Xn,i,a,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=ri.from(t);if(wn(e).length>r.width/8)throw new Error("overflow");let n=zn.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),a=ei(n,r.decimals);return new ni(Xn,i,a,r)}static from(e,t){if("string"==typeof e)return ni.fromString(e,t);if(vn(e))return ni.fromBytes(e,t);try{return ni.fromValue(e,0,t)}catch(e){if(e.code!==ln.errors.INVALID_ARGUMENT)throw e}return Wn.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const ii=ni.from(1),ai=ni.from("0.5");var oi=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 si=new ln("properties/5.7.0");function ci(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function ui(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 fi(e){return oi(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 di(e,t){e&&"object"==typeof e||si.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||si.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function li(e){const t={};for(const r in e)t[r]=e[r];return t}const hi={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function pi(e){if(null==e||hi[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(!pi(n))return!1}return!0}return si.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function mi(e){if(pi(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>bi(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&ci(t,r,bi(n))}return t}return si.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function bi(e){return mi(e)}let yi=class{constructor(e){for(const t in e)this[t]=bi(e[t])}};var gi=Object.freeze({__proto__:null,Description:yi,checkProperties:di,deepCopy:bi,defineReadOnly:ci,getStatic:ui,resolveProperties:fi,shallowCopy:li});const vi="abi/5.7.0",wi=new ln(vi),_i={};let Ei={calldata:!0,memory:!0,storage:!0},Ti={calldata:!0,memory:!0};function Ai(e,t){if("bytes"===e||"string"===e){if(Ei[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Ti[t])return!0;return(Ei[t]||"payable"===t)&&wi.throwArgumentError("invalid modifier","name",t),!1}function Si(e,t){for(let r in t)ci(e,r,t[r])}const Ri=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),ki=new RegExp(/^(.*)\[([0-9]*)\]$/);let Oi=class e{constructor(t,r){t!==_i&&wi.throwError("use fromString",ln.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Si(this,r);let n=this.type.match(ki);Si(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=Ri.sighash),Ri[e]||wi.throwArgumentError("invalid format type","format",e),e===Ri.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!==Ri.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Ri.full?", ":",")+")"):t+=this.type,e!==Ri.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Ri.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(_i,{name:t.name||null,type:Ui(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){wi.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=Ui(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=""),Ai(o.type,o.name)&&(o.name=""),o.type=Ui(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=""),Ai(o.type,o.name)&&(o.name=""),o.type=Ui(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=Ui(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=""):Ai(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&&wi.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=""):Ai(o.type,o.name)&&(o.name=""),a.type=Ui(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 Ii(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&&wi.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>Oi.fromString(e,t)))}let xi=class e{constructor(e,t){e!==_i&&wi.throwError("use a static from method",ln.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Si(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 Di.fromObject(t);case"event":return Ci.fromObject(t);case"constructor":return Bi.fromObject(t);case"error":return Li.fromObject(t);case"fallback":case"receive":return null}return wi.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]?Ci.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Di.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Bi.fromString(e.trim()):"error"===e.split(" ")[0]?Li.fromString(e.substring(5).trim()):wi.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}},Ci=class e extends xi{format(e){if(e||(e=Ri.sighash),Ri[e]||wi.throwArgumentError("invalid format type","format",e),e===Ri.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!==Ri.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ri.full?", ":",")+") ",e!==Ri.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&&wi.throwArgumentError("invalid event object","value",t);const r={name:qi(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Oi.fromObject):[],type:"event"};return new e(_i,r)}static fromString(t){let r=t.match(zi);r||wi.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:wi.warn("unknown modifier: "+e)}})),e.fromObject({name:r[1].trim(),anonymous:n,inputs:Ii(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}};function Mi(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&wi.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||wi.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=zn.from(r[1]),r[0]):e}function Pi(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 Ni(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&&wi.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&wi.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||wi.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&&wi.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&&wi.throwArgumentError("unable to determine stateMutability","value",e),t}let Bi=class e extends xi{format(e){if(e||(e=Ri.sighash),Ri[e]||wi.throwArgumentError("invalid format type","format",e),e===Ri.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===Ri.sighash&&wi.throwError("cannot format a constructor for sighash",ln.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Ri.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&&wi.throwArgumentError("invalid constructor object","value",t);let r=Ni(t);r.constant&&wi.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Oi.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?zn.from(t.gas):null};return new e(_i,n)}static fromString(t){let r={type:"constructor"},n=(t=Mi(t,r)).match(zi);return n&&"constructor"===n[1].trim()||wi.throwArgumentError("invalid constructor string","value",t),r.inputs=Ii(n[2].trim(),!1),Pi(n[3].trim(),r),e.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}},Di=class e extends Bi{format(e){if(e||(e=Ri.sighash),Ri[e]||wi.throwArgumentError("invalid format type","format",e),e===Ri.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!==Ri.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ri.full?", ":",")+") ",e!==Ri.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&&wi.throwArgumentError("invalid function object","value",t);let r=Ni(t);const n={type:t.type,name:qi(t.name),constant:r.constant,inputs:t.inputs?t.inputs.map(Oi.fromObject):[],outputs:t.outputs?t.outputs.map(Oi.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?zn.from(t.gas):null};return new e(_i,n)}static fromString(t){let r={type:"function"},n=(t=Mi(t,r)).split(" returns ");n.length>2&&wi.throwArgumentError("invalid function string","value",t);let i=n[0].match(zi);if(i||wi.throwArgumentError("invalid function signature","value",t),r.name=i[1].trim(),r.name&&qi(r.name),r.inputs=Ii(i[2],!1),Pi(i[3].trim(),r),n.length>1){let e=n[1].match(zi);""==e[1].trim()&&""==e[3].trim()||wi.throwArgumentError("unexpected tokens","value",t),r.outputs=Ii(e[2],!1)}else r.outputs=[];return e.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}};function Fi(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||wi.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}let Li=class e extends xi{format(e){if(e||(e=Ri.sighash),Ri[e]||wi.throwArgumentError("invalid format type","format",e),e===Ri.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ri.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ri.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&&wi.throwArgumentError("invalid error object","value",t);const r={type:t.type,name:qi(t.name),inputs:t.inputs?t.inputs.map(Oi.fromObject):[]};return Fi(new e(_i,r))}static fromString(t){let r={type:"error"},n=t.match(zi);return n||wi.throwArgumentError("invalid error signature","value",t),r.name=n[1].trim(),r.name&&qi(r.name),r.inputs=Ii(n[2],!1),Fi(e.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}};function Ui(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const ji=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function qi(e){return e&&e.match(ji)||wi.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const zi=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Hi=new ln(vi);function Gi(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 Vi=class{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Hi.throwArgumentError(e,this.localName,t)}},Ki=class{constructor(e){ci(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return In(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(_n(e._data))}writeBytes(e){let t=wn(e);const r=t.length%this.wordSize;return r&&(t=_n([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=wn(zn.from(e));return t.length>this.wordSize&&Hi.throwError("value out-of-bounds",ln.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=_n([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 Wi={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";var t;!function(e){e.PRODUCTION="production",e.SANDBOX="sandbox"}(t||(t={}));class r{environment;apiKey;constructor(e){this.environment=e.environment,this.apiKey=e.apiKey}}var n=Object.freeze({__proto__:null,get Environment(){return t},ImmutableConfiguration:r});function i(e,t){return function(){return e.apply(t,arguments)}}const{toString:a}=Object.prototype,{getPrototypeOf:o}=Object,s=(c=Object.create(null),e=>{const t=a.call(e);return c[t]||(c[t]=t.slice(8,-1).toLowerCase())});var c;const u=e=>(e=e.toLowerCase(),t=>s(t)===e),f=e=>t=>typeof t===e,{isArray:d}=Array,l=f("undefined");const h=u("ArrayBuffer");const p=f("string"),m=f("function"),b=f("number"),y=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==s(e))return!1;const t=o(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},v=u("Date"),w=u("File"),_=u("Blob"),E=u("FileList"),T=u("URLSearchParams");function A(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),d(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 S(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 R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,k=e=>!l(e)&&e!==R;const O=(I="undefined"!=typeof Uint8Array&&o(Uint8Array),e=>I&&e instanceof I);var I;const x=u("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),M=u("RegExp"),P=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};A(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},N="abcdefghijklmnopqrstuvwxyz",B="0123456789",D={DIGIT:B,ALPHA:N,ALPHA_DIGIT:N+N.toUpperCase()+B};const F=u("AsyncFunction");var L={isArray:d,isArrayBuffer:h,isBuffer:function(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&m(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||m(e.append)&&("formdata"===(t=s(e))||"object"===t&&m(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&h(e.buffer),t},isString:p,isNumber:b,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:g,isUndefined:l,isDate:v,isFile:w,isBlob:_,isRegExp:M,isFunction:m,isStream:e=>y(e)&&m(e.pipe),isURLSearchParams:T,isTypedArray:O,isFileList:E,forEach:A,merge:function e(){const{caseless:t}=k(this)&&this||{},r={},n=(n,i)=>{const a=t&&S(r,i)||i;g(r[a])&&g(n)?r[a]=e(r[a],n):g(n)?r[a]=e({},n):d(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&A(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(A(t,((t,n)=>{r&&m(t)?e[n]=i(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,s;const c={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)s=i[a],n&&!n(s,e,t)||c[s]||(t[s]=e[s],c[s]=!0);e=!1!==r&&o(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:u,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(d(e))return e;let t=e.length;if(!b(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:x,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:P,freezeMethods:e=>{P(e,((t,r)=>{if(m(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];m(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 d(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:S,global:R,isContextDefined:k,ALPHABET:D,generateString:(e=16,t=D.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&m(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=d(e)?[]:{};return A(e,((e,t)=>{const a=r(e,n+1);!l(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:F,isThenable:e=>e&&(y(e)||m(e))&&m(e.then)&&m(e.catch)};function U(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)}L.inherits(U,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:L.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const j=U.prototype,q={};["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=>{q[e]={value:e}})),Object.defineProperties(U,q),Object.defineProperty(j,"isAxiosError",{value:!0}),U.from=(e,t,r,n,i,a)=>{const o=Object.create(j);return L.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),U.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function z(e){return L.isPlainObject(e)||L.isArray(e)}function H(e){return L.endsWith(e,"[]")?e.slice(0,-2):e}function G(e,t,r){return e?e.concat(t).map((function(e,t){return e=H(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const V=L.toFlatObject(L,{},null,(function(e){return/^is[A-Z]/.test(e)}));function K(e,t,r){if(!L.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=L.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!L.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&L.isSpecCompliantForm(t);if(!L.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(L.isDate(e))return e.toISOString();if(!s&&L.isBlob(e))throw new U("Blob is not supported. Use a Buffer instead.");return L.isArrayBuffer(e)||L.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(L.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(L.isArray(e)&&function(e){return L.isArray(e)&&!e.some(z)}(e)||(L.isFileList(e)||L.endsWith(r,"[]"))&&(s=L.toArray(e)))return r=H(r),s.forEach((function(e,n){!L.isUndefined(e)&&null!==e&&t.append(!0===o?G([r],n,a):null===o?r:r+"[]",c(e))})),!1;return!!z(e)||(t.append(G(i,r,a),c(e)),!1)}const f=[],d=Object.assign(V,{defaultVisitor:u,convertValue:c,isVisitable:z});if(!L.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!L.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),L.forEach(r,(function(r,a){!0===(!(L.isUndefined(r)||null===r)&&i.call(t,r,L.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),f.pop()}}(e),t}function W(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function X(e,t){this._pairs=[],e&&K(e,this,t)}const $=X.prototype;function J(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Y(e,t,r){if(!t)return e;const n=r&&r.encode||J,i=r&&r.serialize;let a;if(a=i?i(t,r):L.isURLSearchParams(t)?t.toString():new X(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}$.append=function(e,t){this._pairs.push([e,t])},$.toString=function(e){const t=e?function(t){return e.call(this,t,W)}:W;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Q=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){L.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ee={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:X,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 te(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&L.isArray(n)?n.length:a,s)return L.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&L.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&L.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(L.isFormData(e)&&L.isFunction(e.entries)){const r={};return L.forEachEntry(e,((e,n)=>{t(function(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const re={"Content-Type":void 0};const ne={transitional:Z,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=L.isObject(e);i&&L.isHTMLForm(e)&&(e=new FormData(e));if(L.isFormData(e))return n&&n?JSON.stringify(te(e)):e;if(L.isArrayBuffer(e)||L.isBuffer(e)||L.isStream(e)||L.isFile(e)||L.isBlob(e))return e;if(L.isArrayBufferView(e))return e.buffer;if(L.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 K(e,new ee.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return ee.isNode&&L.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=L.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return K(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(L.isString(e))try{return(t||JSON.parse)(e),L.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ne.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&L.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 U.from(e,U.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:ee.classes.FormData,Blob:ee.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};L.forEach(["delete","get","head"],(function(e){ne.headers[e]={}})),L.forEach(["post","put","patch"],(function(e){ne.headers[e]=L.merge(re)}));var ie=ne;const ae=L.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 oe=Symbol("internals");function se(e){return e&&String(e).trim().toLowerCase()}function ce(e){return!1===e||null==e?e:L.isArray(e)?e.map(ce):String(e)}function ue(e,t,r,n,i){return L.isFunction(n)?n.call(this,t,r):(i&&(t=r),L.isString(t)?L.isString(n)?-1!==t.indexOf(n):L.isRegExp(n)?n.test(t):void 0:void 0)}let fe=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=se(t);if(!i)throw new Error("header name must be a non-empty string");const a=L.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=ce(e))}const a=(e,t)=>L.forEach(e,((e,r)=>i(e,r,t)));return L.isPlainObject(e)||e instanceof this.constructor?a(e,t):L.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]&&ae[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=se(e)){const r=L.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(L.isFunction(t))return t.call(this,e,r);if(L.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=se(e)){const r=L.findKey(this,e);return!(!r||void 0===this[r]||t&&!ue(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=se(e)){const i=L.findKey(r,e);!i||t&&!ue(0,r[i],i,t)||(delete r[i],n=!0)}}return L.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&&!ue(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return L.forEach(this,((n,i)=>{const a=L.findKey(r,i);if(a)return t[a]=ce(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]=ce(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return L.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&L.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[oe]=this[oe]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=se(e);t[n]||(!function(e,t){const r=L.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 L.isArray(e)?e.forEach(n):n(e),this}};fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),L.freezeMethods(fe.prototype),L.freezeMethods(fe);var de=fe;function le(e,t){const r=this||ie,n=t||r,i=de.from(n.headers);let a=n.data;return L.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function he(e){return!(!e||!e.__CANCEL__)}function pe(e,t,r){U.call(this,null==e?"canceled":e,U.ERR_CANCELED,t,r),this.name="CanceledError"}L.inherits(pe,U,{__CANCEL__:!0});var me=ee.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),L.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),L.isString(n)&&o.push("path="+n),L.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 be(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 ye=ee.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=L.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function ge(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 ve="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=de.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}L.isFormData(n)&&(ee.isStandardBrowserEnv||ee.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=be(e.baseURL,e.url);function f(){if(!c)return;const n=de.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new U("Request failed with status code "+r.status,[U.ERR_BAD_REQUEST,U.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(),Y(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 U("Request aborted",U.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new U("Network Error",U.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||Z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new U(t,n.clarifyTimeoutError?U.ETIMEDOUT:U.ECONNABORTED,e,c)),c=null},ee.isStandardBrowserEnv){const t=(e.withCredentials||ye(u))&&e.xsrfCookieName&&me.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&L.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),L.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",ge(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",ge(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{c&&(r(!t||t.type?new pe(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===ee.protocols.indexOf(d)?r(new U("Unsupported protocol "+d+":",U.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const we={http:null,xhr:ve};L.forEach(we,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var _e=e=>{e=L.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=L.isString(r)?we[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new U(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(L.hasOwnProp(we,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!L.isFunction(n))throw new TypeError("adapter is not a function");return n};function Ee(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pe(null,e)}function Te(e){Ee(e),e.headers=de.from(e.headers),e.data=le.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _e(e.adapter||ie.adapter)(e).then((function(t){return Ee(e),t.data=le.call(e,e.transformResponse,t),t.headers=de.from(t.headers),t}),(function(t){return he(t)||(Ee(e),t&&t.response&&(t.response.data=le.call(e,e.transformResponse,t.response),t.response.headers=de.from(t.response.headers))),Promise.reject(t)}))}const Ae=e=>e instanceof de?e.toJSON():e;function Se(e,t){t=t||{};const r={};function n(e,t,r){return L.isPlainObject(e)&&L.isPlainObject(t)?L.merge.call({caseless:r},e,t):L.isPlainObject(t)?L.merge({},t):L.isArray(t)?t.slice():t}function i(e,t,r){return L.isUndefined(t)?L.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!L.isUndefined(t))return n(void 0,t)}function o(e,t){return L.isUndefined(t)?L.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(Ae(e),Ae(t),!0)};return L.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||i,o=a(e[n],t[n],n);L.isUndefined(o)&&a!==s||(r[n]=o)})),r}const Re="1.4.0",ke={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{ke[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Oe={};ke.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 U(n(i," has been removed"+(t?" in "+t:"")),U.ERR_DEPRECATED);return t&&!Oe[i]&&(Oe[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 Ie={assertOptions:function(e,t,r){if("object"!=typeof e)throw new U("options must be an object",U.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 U("option "+a+" must be "+r,U.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new U("Unknown option "+a,U.ERR_BAD_OPTION)}},validators:ke};const xe=Ie.validators;let Ce=class{constructor(e){this.defaults=e,this.interceptors={request:new Q,response:new Q}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Se(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Ie.assertOptions(r,{silentJSONParsing:xe.transitional(xe.boolean),forcedJSONParsing:xe.transitional(xe.boolean),clarifyTimeoutError:xe.transitional(xe.boolean)},!1),null!=n&&(L.isFunction(n)?t.paramsSerializer={serialize:n}:Ie.assertOptions(n,{encode:xe.function,serialize:xe.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&L.merge(i.common,i[t.method]),a&&L.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=de.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=[Te.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=Te.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 Y(be((e=Se(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};L.forEach(["delete","get","head","options"],(function(e){Ce.prototype[e]=function(t,r){return this.request(Se(r||{},{method:e,url:t,data:(r||{}).data}))}})),L.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Se(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ce.prototype[e]=t(),Ce.prototype[e+"Form"]=t(!0)}));var Me=Ce;var Pe=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 pe(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 Ne={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(Ne).forEach((([e,t])=>{Ne[t]=e}));var Be=Ne;const De=function e(t){const r=new Me(t),n=i(Me.prototype.request,r);return L.extend(n,Me.prototype,r,{allOwnKeys:!0}),L.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Se(t,r))},n}(ie);De.Axios=Me,De.CanceledError=pe,De.CancelToken=Pe,De.isCancel=he,De.VERSION=Re,De.toFormData=K,De.AxiosError=U,De.Cancel=De.CanceledError,De.all=function(e){return Promise.all(e)},De.spread=function(e){return function(t){return e.apply(null,t)}},De.isAxiosError=function(e){return L.isObject(e)&&!0===e.isAxiosError},De.mergeConfig=Se,De.AxiosHeaders=de,De.formToJSON=e=>te(L.isHTMLForm(e)?new FormData(e):e),De.HttpStatusCode=Be,De.default=De;var Fe=De;const{Axios:Le,AxiosError:Ue,CanceledError:je,isCancel:qe,CancelToken:ze,VERSION:He,all:Ge,Cancel:Ve,isAxiosError:Ke,spread:We,toFormData:Xe,AxiosHeaders:$e,HttpStatusCode:Je,formToJSON:Ye,mergeConfig:Qe}=Fe;const Ze="https://api.sandbox.immutable.com".replace(/\/+$/,"");let et=class{basePath;axios;configuration;constructor(e,t=Ze,r=Fe){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}},tt=class extends Error{field;name="RequiredError";constructor(e,t){super(t),this.field=e}};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=""){"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||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,Fe,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,Fe,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,Fe,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={})=>{nt("listCollections","chainName",t);const a="/v1/chains/{chain_name}/collections".replace("{chain_name}",encodeURIComponent(String(t))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i},u={};void 0!==r&&(u.page_cursor=r),void 0!==n&&(u.page_size=n),st(o,u);let f=s&&s.headers?s.headers:{};return c.headers={...f,...i.headers},{url:ut(o),options:c}},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,Fe,Ze,e)},async listCollections(r,n,i,a){const o=await t.listCollections(r,n,i,a);return ft(o,Fe,Ze,e)},async listCollectionsByNFTOwner(r,n,i,a,o){const s=await t.listCollectionsByNFTOwner(r,n,i,a,o);return ft(s,Fe,Ze,e)},async refreshCollectionMetadata(r,n,i,a){const o=await t.refreshCollectionMetadata(r,n,i,a);return ft(o,Fe,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.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}},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,Fe,Ze,e)},async refreshMetadataByID(r,n,i,a){const o=await t.refreshMetadataByID(r,n,i,a);return ft(o,Fe,Ze,e)},async refreshNFTMetadataByTokenID(r,n,i,a){const o=await t.refreshNFTMetadataByTokenID(r,n,i,a);return ft(o,Fe,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}}}},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,Fe,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)))}}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}},listNFTs:async(t,r,n,i,a={})=>{nt("listNFTs","contractAddress",t),nt("listNFTs","chainName",r);const o="/v1/chains/{chain_name}/collections/{contract_address}/nfts".replace("{contract_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}},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,Fe,Ze,e)},async listNFTs(r,n,i,a,o){const s=await t.listNFTs(r,n,i,a,o);return ft(s,Fe,Ze,e)},async listNFTsByAccountAddress(r,n,i,a,o,s){const c=await t.listNFTsByAccountAddress(r,n,i,a,o,s);return ft(c,Fe,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)))}listNFTs(e,t){return Rt(this.configuration).listNFTs(e.contractAddress,e.chainName,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{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 createListing(r,n,i){const a=await t.createListing(r,n,i);return ft(a,Fe,Ze,e)},async fulfillmentData(r,n,i){const a=await t.fulfillmentData(r,n,i);return ft(a,Fe,Ze,e)},async getListing(r,n,i){const a=await t.getListing(r,n,i);return ft(a,Fe,Ze,e)},async getTrade(r,n,i){const a=await t.getTrade(r,n,i);return ft(a,Fe,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,Fe,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,Fe,Ze,e)}}};class xt extends et{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,Fe,Ze,e)},async getLinkedAddresses(r,n){const i=await t.getLinkedAddresses(r,n);return ft(i,Fe,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={})=>{nt("listERC20Tokens","chainName",t);const a="/v1/chains/{chain_name}/tokens".replace("{chain_name}",encodeURIComponent(String(t))),o=new URL(a,rt);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i},u={};void 0!==r&&(u.page_cursor=r),void 0!==n&&(u.page_size=n),st(o,u);let f=s&&s.headers?s.headers:{};return c.headers={...f,...i.headers},{url:ut(o),options:c}}}},Bt=function(e){const t=Nt(e);return{async getERC20Token(r,n,i){const a=await t.getERC20Token(r,n,i);return ft(a,Fe,Ze,e)},async listERC20Tokens(r,n,i,a){const o=await t.listERC20Tokens(r,n,i,a);return ft(o,Fe,Ze,e)}}};var Dt=Object.freeze({__proto__:null,APIError400AllOfCodeEnum:{ValidationError:"VALIDATION_ERROR"},APIError401AllOfCodeEnum:{UnauthorisedRequest:"UNAUTHORISED_REQUEST"},APIError403AllOfCodeEnum:{AuthenticationError:"AUTHENTICATION_ERROR"},APIError404AllOfCodeEnum:{ResourceNotFound:"RESOURCE_NOT_FOUND"},APIError429AllOfCodeEnum:{TooManyRequestsError:"TOO_MANY_REQUESTS_ERROR"},APIError500AllOfCodeEnum:{InternalServerError:"INTERNAL_SERVER_ERROR"},ActivitiesApi:ht,ActivitiesApiAxiosParamCreator:dt,ActivitiesApiFactory:function(e,t,r){const n=lt(e);return{getActivity:(e,i,a)=>n.getActivity(e,i,a).then((e=>e(r,t))),listActivities:(e,i,a,o,s,c,u,f,d,l,h)=>n.listActivities(e,i,a,o,s,c,u,f,d,l,h).then((e=>e(r,t)))}},ActivitiesApiFp:lt,ActivityType:{Mint:"mint",Burn:"burn",Transfer:"transfer",Sale:"sale",Deposit:"deposit",Withdrawal:"withdrawal"},ChainsApi:bt,ChainsApiAxiosParamCreator:pt,ChainsApiFactory:function(e,t,r){const n=mt(e);return{listChains:(e,i,a)=>n.listChains(e,i,a).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,a)=>n.getCollection(e,i,a).then((e=>e(r,t))),listCollections:(e,i,a,o)=>n.listCollections(e,i,a,o).then((e=>e(r,t))),listCollectionsByNFTOwner:(e,i,a,o,s)=>n.listCollectionsByNFTOwner(e,i,a,o,s).then((e=>e(r,t))),refreshCollectionMetadata:(e,i,a,o)=>n.refreshCollectionMetadata(e,i,a,o).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"},FeeFeeTypeEnum:{Royalty:"ROYALTY",MakerMarketplace:"MAKER_MARKETPLACE",TakerMarketplace:"TAKER_MARKETPLACE",Protocol:"PROTOCOL"},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)))}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,a,o)=>n.getMetadata(e,i,a,o).then((e=>e(r,t))),refreshMetadataByID:(e,i,a,o)=>n.refreshMetadataByID(e,i,a,o).then((e=>e(r,t))),refreshNFTMetadataByTokenID:(e,i,a,o)=>n.refreshNFTMetadataByTokenID(e,i,a,o).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,a,o,s,c)=>n.listNFTOwners(e,i,a,o,s,c).then((e=>e(r,t)))}},NftOwnersApiFp:Tt,NftsApi:kt,NftsApiAxiosParamCreator:St,NftsApiFactory:function(e,t,r){const n=Rt(e);return{getNFT:(e,i,a,o)=>n.getNFT(e,i,a,o).then((e=>e(r,t))),listNFTs:(e,i,a,o,s)=>n.listNFTs(e,i,a,o,s).then((e=>e(r,t))),listNFTsByAccountAddress:(e,i,a,o,s,c)=>n.listNFTsByAccountAddress(e,i,a,o,s,c).then((e=>e(r,t)))}},NftsApiFp:Rt,OrderStatus:{Pending:"PENDING",Active:"ACTIVE",Inactive:"INACTIVE",Filled:"FILLED",Cancelled:"CANCELLED",Expired:"EXPIRED"},OrdersApi:xt,OrdersApiAxiosParamCreator:Ot,OrdersApiFactory:function(e,t,r){const n=It(e);return{createListing:(e,i,a)=>n.createListing(e,i,a).then((e=>e(r,t))),fulfillmentData:(e,i,a)=>n.fulfillmentData(e,i,a).then((e=>e(r,t))),getListing:(e,i,a)=>n.getListing(e,i,a).then((e=>e(r,t))),getTrade:(e,i,a)=>n.getTrade(e,i,a).then((e=>e(r,t))),listListings:(e,i,a,o,s,c,u,f,d,l)=>n.listListings(e,i,a,o,s,c,u,f,d,l).then((e=>e(r,t))),listTrades:(e,i,a,o,s,c,u)=>n.listTrades(e,i,a,o,s,c,u).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,i).then((e=>e(r,t))),getLinkedAddresses:(e,i)=>n.getLinkedAddresses(e,i).then((e=>e(r,t)))}},PassportApiFp:Mt,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.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,a)=>n.getERC20Token(e,i,a).then((e=>e(r,t))),listERC20Tokens:(e,i,a,o)=>n.listERC20Tokens(e,i,a,o).then((e=>e(r,t)))}},TokensApiFp:Bt});class Ft{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 Lt={"x-sdk-version":"ts-immutable-sdk-0.24.1"},Ut=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...Lt,...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)},jt=()=>({indexer:Ut({basePath:"https://indexer-mr.imtbl.com"}),orderBook:Ut({basePath:"https://order-book-mr.imtbl.com"}),passport:Ut({basePath:"https://api.immutable.com"})}),qt=()=>({indexer:Ut({basePath:"https://api.sandbox.immutable.com"}),orderBook:Ut({basePath:"https://api.sandbox.immutable.com"}),passport:Ut({basePath:"https://api.sandbox.immutable.com"})});class zt 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 Ht={sdkVersion:"ts-immutable-sdk-multi-rollup-api-client-0.24.1"},Gt=({baseConfig:e,basePath:t,headers:r})=>{if(!t.trim())throw Error("basePath can not be empty");const n={...e,basePath:t,baseOptions:{headers:{...r||{},...Ht}}};return new Dt.Configuration(n)};class Vt{apiConfig;baseConfig;constructor({baseConfig:e,overrides:r}){if(this.baseConfig=e,r)this.apiConfig=Gt(r);else switch(e.environment){case t.SANDBOX:this.apiConfig=Gt({basePath:"https://api.sandbox.immutable.com",baseConfig:e});break;case t.PRODUCTION:this.apiConfig=Gt({basePath:"https://indexer-mr.imtbl.com",baseConfig:e});break;default:this.apiConfig=Gt({basePath:"https://api.sandbox.immutable.com",baseConfig:e})}}}function Kt(e){if(Fe.isAxiosError(e)&&e.response){const t=e.response.data;return t.code&&t.message?new zt({code:t.code,message:t.message,details:t.details||null,link:t.link||"",trace_id:t.trace_id||""}):new zt({code:e.code??e.response?.status.toString()??"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}return new zt({code:"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}class Wt{config;activities;chains;collections;nfts;nftOwners;tokens;metadata;constructor(e){this.config=new Vt(e),this.activities=new Dt.ActivitiesApi(this.config.apiConfig),this.chains=new Dt.ChainsApi(this.config.apiConfig),this.collections=new Dt.CollectionsApi(this.config.apiConfig),this.nfts=new Dt.NftsApi(this.config.apiConfig),this.nftOwners=new Dt.NftOwnersApi(this.config.apiConfig),this.tokens=new Dt.TokensApi(this.config.apiConfig),this.metadata=new Dt.MetadataApi(this.config.apiConfig)}async listActivities(e){return await this.activities.listActivities(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async getActivity(e){return await this.activities.getActivity(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listChains(e){return await this.chains.listChains(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listCollections(e){return await this.collections.listCollections(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listCollectionsByNFTOwner(e){return await this.collections.listCollectionsByNFTOwner(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async getCollection(e){return await this.collections.getCollection(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async getNFT(e){return await this.nfts.getNFT(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listNFTs(e){return await this.nfts.listNFTs(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async listTokens(e){return await this.tokens.listERC20Tokens(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async getToken(e){return await this.tokens.getERC20Token(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async refreshCollectionMetadata(e){return await this.collections.refreshCollectionMetadata(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async refreshNFTMetadata(e){return await this.metadata.refreshNFTMetadataByTokenID(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}async refreshStackedMetadata(e){return await this.metadata.refreshMetadataByID(e).then((e=>e.data)).catch((e=>{throw Kt(e)}))}}var Xt=Object.freeze({__proto__:null,APIError:zt,BlockchainData:Wt}),$t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Jt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Yt(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 Qt={exports:{}},Zt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},er=[],tr=[],rr="undefined"!=typeof Uint8Array?Uint8Array:Array,nr=!1;function ir(){nr=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)er[t]=e[t],tr[e.charCodeAt(t)]=t;tr["-".charCodeAt(0)]=62,tr["_".charCodeAt(0)]=63}function ar(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(er[(i=n)>>18&63]+er[i>>12&63]+er[i>>6&63]+er[63&i]);return a.join("")}function or(e){var t;nr||ir();for(var r=e.length,n=r%3,i="",a=[],o=16383,s=0,c=r-n;s<c;s+=o)a.push(ar(e,s,s+o>c?c:s+o));return 1===n?(t=e[r-1],i+=er[t>>2],i+=er[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=er[t>>10],i+=er[t>>4&63],i+=er[t<<2&63],i+="="),a.push(i),a.join("")}function sr(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 cr(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 ur={}.toString,fr=Array.isArray||function(e){return"[object Array]"==ur.call(e)};pr.TYPED_ARRAY_SUPPORT=void 0===Zt.TYPED_ARRAY_SUPPORT||Zt.TYPED_ARRAY_SUPPORT;var dr=lr();function lr(){return pr.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function hr(e,t){if(lr()<t)throw new RangeError("Invalid typed array length");return pr.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=pr.prototype:(null===e&&(e=new pr(t)),e.length=t),e}function pr(e,t,r){if(!(pr.TYPED_ARRAY_SUPPORT||this instanceof pr))return new pr(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 yr(this,e)}return mr(this,e,t,r)}function mr(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);pr.TYPED_ARRAY_SUPPORT?(e=t).__proto__=pr.prototype:e=gr(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!pr.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|_r(t,r);e=hr(e,n);var i=e.write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(wr(t)){var r=0|vr(t.length);return 0===(e=hr(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?hr(e,0):gr(e,t);if("Buffer"===t.type&&fr(t.data))return gr(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function br(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 yr(e,t){if(br(t),e=hr(e,t<0?0:0|vr(t)),!pr.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function gr(e,t){var r=t.length<0?0:0|vr(t.length);e=hr(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function vr(e){if(e>=lr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+lr().toString(16)+" bytes");return 0|e}function wr(e){return!(null==e||!e._isBuffer)}function _r(e,t){if(wr(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 Xr(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $r(e).length;default:if(n)return Xr(e).length;t=(""+t).toLowerCase(),n=!0}}function Er(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 Fr(this,t,r);case"utf8":case"utf-8":return Pr(this,t,r);case"ascii":return Br(this,t,r);case"latin1":case"binary":return Dr(this,t,r);case"base64":return Mr(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lr(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Tr(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Ar(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=pr.from(t,n)),wr(t))return 0===t.length?-1:Sr(e,t,r,n,i);if("number"==typeof t)return t&=255,pr.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Sr(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Sr(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 Rr(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 kr(e,t,r,n){return Jr(Xr(t,e.length-r),e,r,n)}function Or(e,t,r,n){return Jr(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function Ir(e,t,r,n){return Or(e,t,r,n)}function xr(e,t,r,n){return Jr($r(t),e,r,n)}function Cr(e,t,r,n){return Jr(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 Mr(e,t,r){return 0===t&&r===e.length?or(e):or(e.slice(t,r))}function Pr(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<=Nr)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Nr));return r}(n)}pr.poolSize=8192,pr._augment=function(e){return e.__proto__=pr.prototype,e},pr.from=function(e,t,r){return mr(null,e,t,r)},pr.TYPED_ARRAY_SUPPORT&&(pr.prototype.__proto__=Uint8Array.prototype,pr.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&pr[Symbol.species]),pr.alloc=function(e,t,r){return function(e,t,r,n){return br(t),t<=0?hr(e,t):void 0!==r?"string"==typeof n?hr(e,t).fill(r,n):hr(e,t).fill(r):hr(e,t)}(null,e,t,r)},pr.allocUnsafe=function(e){return yr(null,e)},pr.allocUnsafeSlow=function(e){return yr(null,e)},pr.isBuffer=Yr,pr.compare=function(e,t){if(!wr(e)||!wr(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},pr.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}},pr.concat=function(e,t){if(!fr(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return pr.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=pr.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!wr(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},pr.byteLength=_r,pr.prototype._isBuffer=!0,pr.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)Tr(this,t,t+1);return this},pr.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)Tr(this,t,t+3),Tr(this,t+1,t+2);return this},pr.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)Tr(this,t,t+7),Tr(this,t+1,t+6),Tr(this,t+2,t+5),Tr(this,t+3,t+4);return this},pr.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Pr(this,0,e):Er.apply(this,arguments)},pr.prototype.equals=function(e){if(!wr(e))throw new TypeError("Argument must be a Buffer");return this===e||0===pr.compare(this,e)},pr.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+">"},pr.prototype.compare=function(e,t,r,n,i){if(!wr(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},pr.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},pr.prototype.indexOf=function(e,t,r){return Ar(this,e,t,r,!0)},pr.prototype.lastIndexOf=function(e,t,r){return Ar(this,e,t,r,!1)},pr.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 Rr(this,e,t,r);case"utf8":case"utf-8":return kr(this,e,t,r);case"ascii":return Or(this,e,t,r);case"latin1":case"binary":return Ir(this,e,t,r);case"base64":return xr(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Cr(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},pr.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Nr=4096;function Br(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 Dr(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 Fr(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+=Wr(e[a]);return i}function Lr(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 Ur(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 jr(e,t,r,n,i,a){if(!wr(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 qr(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 zr(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 Hr(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 Gr(e,t,r,n,i){return i||Hr(e,0,r,4),cr(e,t,r,n,23,4),r+4}function Vr(e,t,r,n,i){return i||Hr(e,0,r,8),cr(e,t,r,n,52,8),r+8}pr.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),pr.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=pr.prototype;else{var i=t-e;r=new pr(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},pr.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Ur(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},pr.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Ur(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},pr.prototype.readUInt8=function(e,t){return t||Ur(e,1,this.length),this[e]},pr.prototype.readUInt16LE=function(e,t){return t||Ur(e,2,this.length),this[e]|this[e+1]<<8},pr.prototype.readUInt16BE=function(e,t){return t||Ur(e,2,this.length),this[e]<<8|this[e+1]},pr.prototype.readUInt32LE=function(e,t){return t||Ur(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},pr.prototype.readUInt32BE=function(e,t){return t||Ur(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},pr.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Ur(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},pr.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Ur(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},pr.prototype.readInt8=function(e,t){return t||Ur(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},pr.prototype.readInt16LE=function(e,t){t||Ur(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},pr.prototype.readInt16BE=function(e,t){t||Ur(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},pr.prototype.readInt32LE=function(e,t){return t||Ur(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},pr.prototype.readInt32BE=function(e,t){return t||Ur(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},pr.prototype.readFloatLE=function(e,t){return t||Ur(e,4,this.length),sr(this,e,!0,23,4)},pr.prototype.readFloatBE=function(e,t){return t||Ur(e,4,this.length),sr(this,e,!1,23,4)},pr.prototype.readDoubleLE=function(e,t){return t||Ur(e,8,this.length),sr(this,e,!0,52,8)},pr.prototype.readDoubleBE=function(e,t){return t||Ur(e,8,this.length),sr(this,e,!1,52,8)},pr.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||jr(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},pr.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||jr(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},pr.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,1,255,0),pr.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},pr.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,2,65535,0),pr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):qr(this,e,t,!0),t+2},pr.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,2,65535,0),pr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):qr(this,e,t,!1),t+2},pr.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,4,4294967295,0),pr.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):zr(this,e,t,!0),t+4},pr.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,4,4294967295,0),pr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):zr(this,e,t,!1),t+4},pr.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);jr(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},pr.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);jr(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},pr.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,1,127,-128),pr.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},pr.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,2,32767,-32768),pr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):qr(this,e,t,!0),t+2},pr.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,2,32767,-32768),pr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):qr(this,e,t,!1),t+2},pr.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,4,2147483647,-2147483648),pr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):zr(this,e,t,!0),t+4},pr.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||jr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),pr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):zr(this,e,t,!1),t+4},pr.prototype.writeFloatLE=function(e,t,r){return Gr(this,e,t,!0,r)},pr.prototype.writeFloatBE=function(e,t,r){return Gr(this,e,t,!1,r)},pr.prototype.writeDoubleLE=function(e,t,r){return Vr(this,e,t,!0,r)},pr.prototype.writeDoubleBE=function(e,t,r){return Vr(this,e,t,!1,r)},pr.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||!pr.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},pr.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&&!pr.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=wr(e)?e:Xr(new pr(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var Kr=/[^+\/0-9A-Za-z-_]/g;function Wr(e){return e<16?"0"+e.toString(16):e.toString(16)}function Xr(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 $r(e){return function(e){var t,r,n,i,a,o;nr||ir();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 rr(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=tr[e.charCodeAt(t)]<<18|tr[e.charCodeAt(t+1)]<<12|tr[e.charCodeAt(t+2)]<<6|tr[e.charCodeAt(t+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=255&i;return 2===a?(i=tr[e.charCodeAt(t)]<<2|tr[e.charCodeAt(t+1)]>>4,o[c++]=255&i):1===a&&(i=tr[e.charCodeAt(t)]<<10|tr[e.charCodeAt(t+1)]<<4|tr[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(Kr,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Jr(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 Yr(e){return null!=e&&(!!e._isBuffer||Qr(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Qr(e.slice(0,0))}(e))}function Qr(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Zr=Yt(Object.freeze({__proto__:null,Buffer:pr,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),pr.alloc(+e)},isBuffer:Yr,kMaxLength:dr}));!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:Zr.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,K=0|s[2],W=8191&K,X=K>>>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,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(l,W)|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,W)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,W)|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,W)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(g,W)|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,W)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,W)|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,W)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(A,W)|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,W)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(k,W)|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,W)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(x,W)|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,W)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(P,W)|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,W)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(D,W)|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,W),i=(i=Math.imul(L,X))+Math.imul(U,W)|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,$t)}(Qt);var en=Qt.exports,tn=Jt(en);let rn=!1,nn=!1;const an={debug:1,default:2,info:2,warning:3,error:4,off:5};let on=an.default,sn=null;const cn=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 un,fn;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(un||(un={})),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"}(fn||(fn={}));const dn="0123456789abcdef";let ln=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==an[r]&&this.throwArgumentError("invalid log level name","logLevel",e),on>an[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(nn)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+=dn[t[e]>>4],r+=dn[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 fn.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 fn.CALL_EXCEPTION:case fn.INSUFFICIENT_FUNDS:case fn.MISSING_NEW:case fn.NONCE_EXPIRED:case fn.REPLACEMENT_UNDERPRICED:case fn.TRANSACTION_REPLACED:case fn.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){cn&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:cn})}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 sn||(sn=new e("logger/5.7.0")),sn}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),rn){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}nn=!!t,rn=!!r}static setLogLevel(t){const r=an[t.toLowerCase()];null!=r?on=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};ln.errors=fn,ln.levels=un;var hn=Object.freeze({__proto__:null,get ErrorCode(){return fn},get LogLevel(){return un},Logger:ln});const pn=new ln("bytes/5.7.0");function mn(e){return!!e.toHexString}function bn(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return bn(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function yn(e){return An(e)&&!(e.length%2)||vn(e)}function gn(e){return"number"==typeof e&&e==e&&e%1==0}function vn(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!gn(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!gn(r)||r<0||r>=256)return!1}return!0}function wn(e,t){if(t||(t={}),"number"==typeof e){pn.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),bn(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),mn(e)&&(e=e.toHexString()),An(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":pn.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 bn(new Uint8Array(n))}return vn(e)?bn(new Uint8Array(e)):pn.throwArgumentError("invalid arrayify value","value",e)}function _n(e){const t=e.map((e=>wn(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),bn(n)}function En(e){let t=wn(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 Tn(e,t){(e=wn(e)).length>t&&pn.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),bn(r)}function An(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Sn="0123456789abcdef";function Rn(e,t){if(t||(t={}),"number"==typeof e){pn.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Sn[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),mn(e))return e.toHexString();if(An(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":pn.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(vn(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Sn[(240&n)>>4]+Sn[15&n]}return t}return pn.throwArgumentError("invalid hexlify value","value",e)}function kn(e){if("string"!=typeof e)e=Rn(e);else if(!An(e)||e.length%2)return null;return(e.length-2)/2}function On(e,t,r){return"string"!=typeof e?e=Rn(e):(!An(e)||e.length%2)&&pn.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function In(e){let t="0x";return e.forEach((e=>{t+=Rn(e).substring(2)})),t}function xn(e){const t=Cn(Rn(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function Cn(e){"string"!=typeof e&&(e=Rn(e)),An(e)||pn.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 Mn(e,t){for("string"!=typeof e?e=Rn(e):An(e)||pn.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&pn.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Pn(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(yn(e)){let r=wn(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Rn(r.slice(0,32)),t.s=Rn(r.slice(32,64))):65===r.length?(t.r=Rn(r.slice(0,32)),t.s=Rn(r.slice(32,64)),t.v=r[64]):pn.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:pn.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Rn(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=Tn(wn(t._vs),32);t._vs=Rn(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&pn.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=Rn(r);null==t.s?t.s=i:t.s!==i&&pn.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?pn.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&&pn.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&An(t.r)?t.r=Mn(t.r,32):pn.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&An(t.s)?t.s=Mn(t.s,32):pn.throwArgumentError("signature missing or invalid s","signature",e);const r=wn(t.s);r[0]>=128&&pn.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Rn(r);t._vs&&(An(t._vs)||pn.throwArgumentError("signature invalid _vs","signature",e),t._vs=Mn(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&pn.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Nn(e){return Rn(_n([(e=Pn(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var Bn=Object.freeze({__proto__:null,arrayify:wn,concat:_n,hexConcat:In,hexDataLength:kn,hexDataSlice:On,hexStripZeros:Cn,hexValue:xn,hexZeroPad:Mn,hexlify:Rn,isBytes:vn,isBytesLike:yn,isHexString:An,joinSignature:Nn,splitSignature:Pn,stripZeros:En,zeroPad:Tn});const Dn="bignumber/5.7.0";var Fn=tn.BN;const Ln=new ln(Dn),Un={},jn=9007199254740991;let qn=!1,zn=class e{constructor(e,t){e!==Un&&Ln.throwError("cannot call constructor directly; use BigNumber.from",ln.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Gn(Vn(this).fromTwos(e))}toTwos(e){return Gn(Vn(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Gn(Vn(this).add(Vn(e)))}sub(e){return Gn(Vn(this).sub(Vn(e)))}div(t){return e.from(t).isZero()&&Kn("division-by-zero","div"),Gn(Vn(this).div(Vn(t)))}mul(e){return Gn(Vn(this).mul(Vn(e)))}mod(e){const t=Vn(e);return t.isNeg()&&Kn("division-by-zero","mod"),Gn(Vn(this).umod(t))}pow(e){const t=Vn(e);return t.isNeg()&&Kn("negative-power","pow"),Gn(Vn(this).pow(t))}and(e){const t=Vn(e);return(this.isNegative()||t.isNeg())&&Kn("unbound-bitwise-result","and"),Gn(Vn(this).and(t))}or(e){const t=Vn(e);return(this.isNegative()||t.isNeg())&&Kn("unbound-bitwise-result","or"),Gn(Vn(this).or(t))}xor(e){const t=Vn(e);return(this.isNegative()||t.isNeg())&&Kn("unbound-bitwise-result","xor"),Gn(Vn(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Kn("negative-width","mask"),Gn(Vn(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Kn("negative-width","shl"),Gn(Vn(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Kn("negative-width","shr"),Gn(Vn(this).shrn(e))}eq(e){return Vn(this).eq(Vn(e))}lt(e){return Vn(this).lt(Vn(e))}lte(e){return Vn(this).lte(Vn(e))}gt(e){return Vn(this).gt(Vn(e))}gte(e){return Vn(this).gte(Vn(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Vn(this).isZero()}toNumber(){try{return Vn(this).toNumber()}catch(e){Kn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ln.throwError("this platform does not support BigInt",ln.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?qn||(qn=!0,Ln.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ln.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ln.errors.UNEXPECTED_ARGUMENT,{}):Ln.throwError("BigNumber.toString does not accept parameters",ln.errors.UNEXPECTED_ARGUMENT,{})),Vn(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(Un,Hn(t)):t.match(/^-?[0-9]+$/)?new e(Un,Hn(new Fn(t))):Ln.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Kn("underflow","BigNumber.from",t),(t>=jn||t<=-jn)&&Kn("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(vn(r))return e.from(Rn(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&&(An(t)||"-"===t[0]&&An(t.substring(1))))return e.from(t)}return Ln.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Hn(e){if("string"!=typeof e)return Hn(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Ln.throwArgumentError("invalid hex","value",e),"0x00"===(e=Hn(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 Gn(e){return zn.from(Hn(e))}function Vn(e){const t=zn.from(e).toHexString();return"-"===t[0]?new Fn("-"+t.substring(3),16):new Fn(t.substring(2),16)}function Kn(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Ln.throwError(e,ln.errors.NUMERIC_FAULT,n)}const Wn=new ln(Dn),Xn={},$n=zn.from(0),Jn=zn.from(-1);function Yn(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),Wn.throwError(e,ln.errors.NUMERIC_FAULT,i)}let Qn="0";for(;Qn.length<256;)Qn+=Qn;function Zn(e){if("number"!=typeof e)try{e=zn.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Qn.substring(0,e):Wn.throwArgumentError("invalid decimal size","decimals",e)}function ei(e,t){null==t&&(t=0);const r=Zn(t),n=(e=zn.from(e)).lt($n);n&&(e=e.mul(Jn));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 ti(e,t){null==t&&(t=0);const r=Zn(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Wn.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&Wn.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Wn.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&&Yn("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=zn.from(a),c=zn.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(Jn)),u}class ri{constructor(e,t,r,n){e!==Xn&&Wn.throwError("cannot use FixedFormat constructor; use FixedFormat.from",ln.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=Zn(n),Object.freeze(this)}static from(e){if(e instanceof ri)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||Wn.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&&Wn.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&&Wn.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Wn.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new ri(Xn,t,r,n)}}class ni{constructor(e,t,r,n){e!==Xn&&Wn.throwError("cannot use FixedNumber constructor; use FixedNumber.from",ln.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&&Wn.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ti(this._value,this.format.decimals),r=ti(e._value,e.format.decimals);return ni.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ti(this._value,this.format.decimals),r=ti(e._value,e.format.decimals);return ni.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ti(this._value,this.format.decimals),r=ti(e._value,e.format.decimals);return ni.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ti(this._value,this.format.decimals),r=ti(e._value,e.format.decimals);return ni.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=ni.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(ii.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=ni.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(ii.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)&&Wn.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=ni.from("1"+Qn.substring(0,e),this.format),n=ai.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&&Wn.throwArgumentError("invalid byte width","width",e);return Mn(zn.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return ni.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(zn.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||An(e)||"bigint"==typeof e||vn(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),ni.fromString(ei(e,t),ri.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=ri.from(t),n=ti(e,r.decimals);!r.signed&&n.lt($n)&&Yn("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Mn(i,r.width/8));const a=ei(n,r.decimals);return new ni(Xn,i,a,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=ri.from(t);if(wn(e).length>r.width/8)throw new Error("overflow");let n=zn.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),a=ei(n,r.decimals);return new ni(Xn,i,a,r)}static from(e,t){if("string"==typeof e)return ni.fromString(e,t);if(vn(e))return ni.fromBytes(e,t);try{return ni.fromValue(e,0,t)}catch(e){if(e.code!==ln.errors.INVALID_ARGUMENT)throw e}return Wn.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const ii=ni.from(1),ai=ni.from("0.5");var oi=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 si=new ln("properties/5.7.0");function ci(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function ui(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 fi(e){return oi(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 di(e,t){e&&"object"==typeof e||si.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||si.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function li(e){const t={};for(const r in e)t[r]=e[r];return t}const hi={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function pi(e){if(null==e||hi[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(!pi(n))return!1}return!0}return si.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function mi(e){if(pi(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>bi(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&ci(t,r,bi(n))}return t}return si.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function bi(e){return mi(e)}let yi=class{constructor(e){for(const t in e)this[t]=bi(e[t])}};var gi=Object.freeze({__proto__:null,Description:yi,checkProperties:di,deepCopy:bi,defineReadOnly:ci,getStatic:ui,resolveProperties:fi,shallowCopy:li});const vi="abi/5.7.0",wi=new ln(vi),_i={};let Ei={calldata:!0,memory:!0,storage:!0},Ti={calldata:!0,memory:!0};function Ai(e,t){if("bytes"===e||"string"===e){if(Ei[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Ti[t])return!0;return(Ei[t]||"payable"===t)&&wi.throwArgumentError("invalid modifier","name",t),!1}function Si(e,t){for(let r in t)ci(e,r,t[r])}const Ri=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),ki=new RegExp(/^(.*)\[([0-9]*)\]$/);let Oi=class e{constructor(t,r){t!==_i&&wi.throwError("use fromString",ln.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Si(this,r);let n=this.type.match(ki);Si(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=Ri.sighash),Ri[e]||wi.throwArgumentError("invalid format type","format",e),e===Ri.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!==Ri.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Ri.full?", ":",")+")"):t+=this.type,e!==Ri.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Ri.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(_i,{name:t.name||null,type:Ui(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){wi.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=Ui(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=""),Ai(o.type,o.name)&&(o.name=""),o.type=Ui(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=""),Ai(o.type,o.name)&&(o.name=""),o.type=Ui(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=Ui(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=""):Ai(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&&wi.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=""):Ai(o.type,o.name)&&(o.name=""),a.type=Ui(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 Ii(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&&wi.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>Oi.fromString(e,t)))}let xi=class e{constructor(e,t){e!==_i&&wi.throwError("use a static from method",ln.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Si(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 Di.fromObject(t);case"event":return Ci.fromObject(t);case"constructor":return Bi.fromObject(t);case"error":return Li.fromObject(t);case"fallback":case"receive":return null}return wi.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]?Ci.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Di.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Bi.fromString(e.trim()):"error"===e.split(" ")[0]?Li.fromString(e.substring(5).trim()):wi.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}},Ci=class e extends xi{format(e){if(e||(e=Ri.sighash),Ri[e]||wi.throwArgumentError("invalid format type","format",e),e===Ri.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!==Ri.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ri.full?", ":",")+") ",e!==Ri.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&&wi.throwArgumentError("invalid event object","value",t);const r={name:qi(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Oi.fromObject):[],type:"event"};return new e(_i,r)}static fromString(t){let r=t.match(zi);r||wi.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:wi.warn("unknown modifier: "+e)}})),e.fromObject({name:r[1].trim(),anonymous:n,inputs:Ii(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}};function Mi(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&wi.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||wi.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=zn.from(r[1]),r[0]):e}function Pi(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 Ni(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&&wi.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&wi.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||wi.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&&wi.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&&wi.throwArgumentError("unable to determine stateMutability","value",e),t}let Bi=class e extends xi{format(e){if(e||(e=Ri.sighash),Ri[e]||wi.throwArgumentError("invalid format type","format",e),e===Ri.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===Ri.sighash&&wi.throwError("cannot format a constructor for sighash",ln.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Ri.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&&wi.throwArgumentError("invalid constructor object","value",t);let r=Ni(t);r.constant&&wi.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Oi.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?zn.from(t.gas):null};return new e(_i,n)}static fromString(t){let r={type:"constructor"},n=(t=Mi(t,r)).match(zi);return n&&"constructor"===n[1].trim()||wi.throwArgumentError("invalid constructor string","value",t),r.inputs=Ii(n[2].trim(),!1),Pi(n[3].trim(),r),e.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}},Di=class e extends Bi{format(e){if(e||(e=Ri.sighash),Ri[e]||wi.throwArgumentError("invalid format type","format",e),e===Ri.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!==Ri.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ri.full?", ":",")+") ",e!==Ri.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&&wi.throwArgumentError("invalid function object","value",t);let r=Ni(t);const n={type:t.type,name:qi(t.name),constant:r.constant,inputs:t.inputs?t.inputs.map(Oi.fromObject):[],outputs:t.outputs?t.outputs.map(Oi.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?zn.from(t.gas):null};return new e(_i,n)}static fromString(t){let r={type:"function"},n=(t=Mi(t,r)).split(" returns ");n.length>2&&wi.throwArgumentError("invalid function string","value",t);let i=n[0].match(zi);if(i||wi.throwArgumentError("invalid function signature","value",t),r.name=i[1].trim(),r.name&&qi(r.name),r.inputs=Ii(i[2],!1),Pi(i[3].trim(),r),n.length>1){let e=n[1].match(zi);""==e[1].trim()&&""==e[3].trim()||wi.throwArgumentError("unexpected tokens","value",t),r.outputs=Ii(e[2],!1)}else r.outputs=[];return e.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}};function Fi(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||wi.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}let Li=class e extends xi{format(e){if(e||(e=Ri.sighash),Ri[e]||wi.throwArgumentError("invalid format type","format",e),e===Ri.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ri.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ri.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&&wi.throwArgumentError("invalid error object","value",t);const r={type:t.type,name:qi(t.name),inputs:t.inputs?t.inputs.map(Oi.fromObject):[]};return Fi(new e(_i,r))}static fromString(t){let r={type:"error"},n=t.match(zi);return n||wi.throwArgumentError("invalid error signature","value",t),r.name=n[1].trim(),r.name&&qi(r.name),r.inputs=Ii(n[2],!1),Fi(e.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}};function Ui(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const ji=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function qi(e){return e&&e.match(ji)||wi.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const zi=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Hi=new ln(vi);function Gi(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 Vi=class{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Hi.throwArgumentError(e,this.localName,t)}},Ki=class{constructor(e){ci(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return In(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(_n(e._data))}writeBytes(e){let t=wn(e);const r=t.length%this.wordSize;return r&&(t=_n([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=wn(zn.from(e));return t.length>this.wordSize&&Hi.throwError("value out-of-bounds",ln.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=_n([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 Wi={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
|
-
*/cM=uM,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=ZI:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&cM.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,K,W,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],W=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,K=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^~W&$,e[31]=K^~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]=W^~$&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&K,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&W,e[39]=ee^~K&X,e[48]=ue^~te&ne,e[49]=fe^~re&ie,e[0]^=u[n],e[1]^=u[n+1]};if(i)cM.exports=_;else for(T=0;T<E.length;++T)r[E[T]]=_[E[T]]}();var fM=uM.exports;function dM(e){return"0x"+fM.keccak_256(wn(e))}let lM=!1,hM=!1;const pM={debug:1,default:2,info:2,warning:3,error:4,off:5};let mM=pM.default,bM=null;const yM=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 gM,vM;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(gM||(gM={})),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"}(vM||(vM={}));const wM="0123456789abcdef";let _M=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==pM[r]&&this.throwArgumentError("invalid log level name","logLevel",e),mM>pM[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(hM)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+=wM[t[e]>>4],r+=wM[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 vM.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 vM.CALL_EXCEPTION:case vM.INSUFFICIENT_FUNDS:case vM.MISSING_NEW:case vM.NONCE_EXPIRED:case vM.REPLACEMENT_UNDERPRICED:case vM.TRANSACTION_REPLACED:case vM.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){yM&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:yM})}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 bM||(bM=new e("logger/5.7.0")),bM}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),lM){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}hM=!!t,lM=!!r}static setLogLevel(t){const r=pM[t.toLowerCase()];null!=r?mM=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};_M.errors=vM,_M.levels=gM;var EM=tn.BN;const TM=new _M("bignumber/5.7.0"),AM={};let SM=!1,RM=class e{constructor(e,t){e!==AM&&TM.throwError("cannot call constructor directly; use BigNumber.from",_M.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return OM(IM(this).fromTwos(e))}toTwos(e){return OM(IM(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return OM(IM(this).add(IM(e)))}sub(e){return OM(IM(this).sub(IM(e)))}div(t){return e.from(t).isZero()&&xM("division-by-zero","div"),OM(IM(this).div(IM(t)))}mul(e){return OM(IM(this).mul(IM(e)))}mod(e){const t=IM(e);return t.isNeg()&&xM("division-by-zero","mod"),OM(IM(this).umod(t))}pow(e){const t=IM(e);return t.isNeg()&&xM("negative-power","pow"),OM(IM(this).pow(t))}and(e){const t=IM(e);return(this.isNegative()||t.isNeg())&&xM("unbound-bitwise-result","and"),OM(IM(this).and(t))}or(e){const t=IM(e);return(this.isNegative()||t.isNeg())&&xM("unbound-bitwise-result","or"),OM(IM(this).or(t))}xor(e){const t=IM(e);return(this.isNegative()||t.isNeg())&&xM("unbound-bitwise-result","xor"),OM(IM(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&xM("negative-width","mask"),OM(IM(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xM("negative-width","shl"),OM(IM(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xM("negative-width","shr"),OM(IM(this).shrn(e))}eq(e){return IM(this).eq(IM(e))}lt(e){return IM(this).lt(IM(e))}lte(e){return IM(this).lte(IM(e))}gt(e){return IM(this).gt(IM(e))}gte(e){return IM(this).gte(IM(e))}isNegative(){return"-"===this._hex[0]}isZero(){return IM(this).isZero()}toNumber(){try{return IM(this).toNumber()}catch(e){xM("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return TM.throwError("this platform does not support BigInt",_M.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?SM||(SM=!0,TM.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?TM.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",_M.errors.UNEXPECTED_ARGUMENT,{}):TM.throwError("BigNumber.toString does not accept parameters",_M.errors.UNEXPECTED_ARGUMENT,{})),IM(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(AM,kM(t)):t.match(/^-?[0-9]+$/)?new e(AM,kM(new EM(t))):TM.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&xM("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&xM("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(vn(r))return e.from(Rn(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&&(An(t)||"-"===t[0]&&An(t.substring(1))))return e.from(t)}return TM.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function kM(e){if("string"!=typeof e)return kM(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&TM.throwArgumentError("invalid hex","value",e),"0x00"===(e=kM(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 OM(e){return RM.from(kM(e))}function IM(e){const t=RM.from(e).toHexString();return"-"===t[0]?new EM("-"+t.substring(3),16):new EM(t.substring(2),16)}function xM(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),TM.throwError(e,_M.errors.NUMERIC_FAULT,n)}const CM=new _M("bignumber/5.7.0"),MM={},PM=RM.from(0),NM=RM.from(-1);function BM(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),CM.throwError(e,_M.errors.NUMERIC_FAULT,i)}let DM="0";for(;DM.length<256;)DM+=DM;function FM(e){if("number"!=typeof e)try{e=RM.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+DM.substring(0,e):CM.throwArgumentError("invalid decimal size","decimals",e)}function LM(e,t){null==t&&(t=0);const r=FM(t),n=(e=RM.from(e)).lt(PM);n&&(e=e.mul(NM));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 UM(e,t){null==t&&(t=0);const r=FM(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||CM.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&CM.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&CM.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&&BM("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=RM.from(a),c=RM.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(NM)),u}let jM=class e{constructor(e,t,r,n){e!==MM&&CM.throwError("cannot use FixedFormat constructor; use FixedFormat.from",_M.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=FM(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||CM.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&&CM.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&&CM.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&CM.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(MM,r,n,i)}},qM=class e{constructor(e,t,r,n){e!==MM&&CM.throwError("cannot use FixedNumber constructor; use FixedNumber.from",_M.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&&CM.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(t){this._checkFormat(t);const r=UM(this._value,this.format.decimals),n=UM(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=UM(this._value,this.format.decimals),n=UM(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=UM(this._value,this.format.decimals),n=UM(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=UM(this._value,this.format.decimals),n=UM(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(zM.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(zM.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)&&CM.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=e.from("1"+DM.substring(0,t),this.format),i=HM.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&&CM.throwArgumentError("invalid byte width","width",e);return Mn(RM.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&&(RM.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||An(e)||"bigint"==typeof e||vn(e))}(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(LM(t,r),jM.from(n))}static fromString(t,r){null==r&&(r="fixed");const n=jM.from(r),i=UM(t,n.decimals);!n.signed&&i.lt(PM)&&BM("unsigned value cannot be negative","overflow","value",t);let a=null;n.signed?a=i.toTwos(n.width).toHexString():(a=i.toHexString(),a=Mn(a,n.width/8));const o=LM(i,n.decimals);return new e(MM,a,o,n)}static fromBytes(t,r){null==r&&(r="fixed");const n=jM.from(r);if(wn(t).length>n.width/8)throw new Error("overflow");let i=RM.from(t);n.signed&&(i=i.fromTwos(n.width));const a=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=LM(i,n.decimals);return new e(MM,a,o,n)}static from(t,r){if("string"==typeof t)return e.fromString(t,r);if(vn(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(t){if(t.code!==_M.errors.INVALID_ARGUMENT)throw t}return CM.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}};const zM=qM.from(1),HM=qM.from("0.5"),GM=new _M("strings/5.7.0");var VM,KM;function WM(e,t=VM.current){t!=VM.current&&(GM.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 wn(r)}function XM(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 $M(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 JM(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 YM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?JM(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function QM(e,t,r){return ZM.apply(this,arguments)}function ZM(){return(ZM=QI(nx.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return nx.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 YM({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=YM(YM({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=dM(WM(JSON.stringify(o))),e.next=6,sx(s,t);case 6:return c=e.sent,u=YM(YM({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 eP(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 tP(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 rP(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)?rP(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 rP(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 nP(e){return iP.apply(this,arguments)}function iP(){return(iP=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return nx.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:eP(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,sx(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 aP(e){return oP.apply(this,arguments)}function oP(){return(oP=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return nx.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:eP({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,sx(u,r);case 13:f=e.sent,d=[],l=tP(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"}(VM||(VM={})),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"}(KM||(KM={})),$M("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))),XM("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"),XM("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"),XM("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})),$M("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 sP=new _M("units/5.7.0"),cP=["wei","kwei","mwei","gwei","szabo","finney","ether"];function uP(e,t){if("string"!=typeof e&&sP.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=cP.indexOf(t);-1!==e&&(t=3*e)}return UM(e,null!=t?t:18)}function fP(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 dP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fP(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function lP(e,t,r,n,i,a,o){return hP.apply(this,arguments)}function hP(){return(hP=QI(nx.mark((function e(t,r,n,i,a,o,s){var c,u,f;return nx.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,oM(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(dP(dP({},f),{},{value:r})));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pP(e,t,r,n,i,a){return mP.apply(this,arguments)}function mP(){return(mP=QI(nx.mark((function e(t,r,n,i,a,o){var s;return nx.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(dP(dP({},s),{},{value:r})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bP(e,t,r,n,i,a){return yP.apply(this,arguments)}function yP(){return(yP=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u,f,d,l,h,p,m,b,y;return nx.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=uP(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=UI.connect(o.ethConfiguration.coreContractAddress,t),y=$I.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,iM(p,y);case 19:if(e.sent){e.next=24;break}return e.abrupt("return",lP(t,u,h,p,m,b,i));case 24:return e.abrupt("return",pP(t,u,h,p,m,b));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gP(e,t,r,n,i,a){return vP.apply(this,arguments)}function vP(){return(vP=QI(nx.mark((function e(t,r,n,i,a,o){var s;return nx.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 wP(e,t,r,n,i,a,o){return _P.apply(this,arguments)}function _P(){return(_P=QI(nx.mark((function e(t,r,n,i,a,o,s){var c,u,f;return nx.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,oM(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 EP(e,t,r,n,i,a,o){return TP.apply(this,arguments)}function TP(){return(TP=QI(nx.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 nx.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=uP(r.amount,0),h=NI.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,_=RM.from(b.data.amount),E=UI.connect(s.ethConfiguration.coreContractAddress,t),T=$I.connect(s.ethConfiguration.registrationContractAddress,t),e.next=30,iM(v,T);case 30:if(e.sent){e.next=35;break}return e.abrupt("return",wP(t,_,g,v,w,E,i));case 35:return e.abrupt("return",gP(t,_,g,v,w,E));case 36: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=QI(nx.mark((function e(t,r,n,i,a,o){var s;return nx.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 RP(e,t,r,n,i,a){return kP.apply(this,arguments)}function kP(){return(kP=QI(nx.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 nx.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=UI.connect(o.ethConfiguration.coreContractAddress,t),b=$I.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,iM(h,b);case 19:return y=e.sent,g=DI.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,oM(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",AP(t,r.tokenId,l,h,p,m));case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var OP=function(e){if(void 0!==e)return e;throw new Error("undefined field exception")};function IP(e){return xP.apply(this,arguments)}function xP(){return(xP=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p;return nx.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=eP(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,dx(c,r);case 19:return d=e.sent,l=d.ethAddress,h=d.ethSignature,e.next=24,i.createWithdrawal({createWithdrawalRequest:{stark_key:OP(o.data.stark_key),amount:a,asset_id:OP(o.data.asset_id),vault_id:OP(o.data.vault_id),nonce:OP(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 CP(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 MP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?CP(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function PP(e,t,r,n){return NP.apply(this,arguments)}function NP(){return(NP=QI(nx.mark((function e(t,r,n,i){var a;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.encodeAsset({assetType:t,encodeAssetRequest:{token:MP({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 BP(e,t,r,n,i){return DP.apply(this,arguments)}function DP(){return(DP=QI(nx.mark((function e(t,r,n,i,a){var o,s,c;return nx.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,oM(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 FP(e,t,r,n){return LP.apply(this,arguments)}function LP(){return(LP=QI(nx.mark((function e(t,r,n,i){var a;return nx.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 UP(e,t,r,n,i,a){return jP.apply(this,arguments)}function jP(){return(jP=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PP("asset","ERC20",i,{token_address:n.tokenAddress});case 2:return s=e.sent,c=UI.connect(o.ethConfiguration.coreContractAddress,t),u=$I.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,iM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",BP(t,s.asset_type,r,u,a));case 12:return e.abrupt("return",FP(t,s.asset_type,r,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qP(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 zP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qP(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function HP(e,t,r,n,i){return GP.apply(this,arguments)}function GP(){return(GP=QI(nx.mark((function e(t,r,n,i,a){var o;return nx.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 VP(e,t,r,n,i,a){return KP.apply(this,arguments)}function KP(){return(KP=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u;return nx.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,oM(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 WP(e){var t=e.data.id,r=e.data.blueprint||"";return Ab(tb("{".concat(t,"}:{").concat(r,"}")))}function XP(e,t,r,n,i,a){return $P.apply(this,arguments)}function $P(){return($P=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u,f;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PP("mintable-asset","ERC721",i,zP({id:n.data.id,token_address:n.data.tokenAddress},n.data.blueprint&&{blueprint:n.data.blueprint}));case 2:return s=e.sent,c=WP(n),u=UI.connect(o.ethConfiguration.coreContractAddress,t),f=$I.connect(o.ethConfiguration.registrationContractAddress,t),e.next=8,iM(r,f);case 8:if(e.sent){e.next=13;break}return e.abrupt("return",VP(t,s.asset_type,r,c,f,a));case 13:return e.abrupt("return",HP(t,s.asset_type,r,c,u));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function JP(e,t,r,n,i,a){return YP.apply(this,arguments)}function YP(){return(YP=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u;return nx.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,oM(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 QP(e,t,r,n,i){return ZP.apply(this,arguments)}function ZP(){return(ZP=QI(nx.mark((function e(t,r,n,i,a){var o;return nx.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 eN(e,t,r,n,i,a){return tN.apply(this,arguments)}function tN(){return(tN=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PP("asset","ERC721",i,{token_id:n.tokenId,token_address:n.tokenAddress});case 2:return s=e.sent,c=UI.connect(o.ethConfiguration.coreContractAddress,t),u=$I.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,iM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",JP(t,s.asset_type,r,n.tokenId,u,a));case 12:return e.abrupt("return",QP(t,s.asset_type,r,n.tokenId,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function rN(e,t,r,n,i,a,o){return nN.apply(this,arguments)}function nN(){return(nN=QI(nx.mark((function e(t,r,n,i,a,o,s){var c,u;return nx.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 XP(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 eN(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 iN(e,t,r,n,i){return aN.apply(this,arguments)}function aN(){return(aN=QI(nx.mark((function e(t,r,n,i,a){var o,s,c;return nx.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,oM(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 oN(e,t,r,n){return sN.apply(this,arguments)}function sN(){return(sN=QI(nx.mark((function e(t,r,n,i){var a;return nx.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 cN(e,t,r,n,i){return uN.apply(this,arguments)}function uN(){return(uN=QI(nx.mark((function e(t,r,n,i,a){var o,s,c;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PP("asset","ETH",n);case 2:return o=e.sent,s=UI.connect(a.ethConfiguration.coreContractAddress,t),c=$I.connect(a.ethConfiguration.registrationContractAddress,t),e.next=7,iM(r,c);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",iN(t,o.asset_type,r,c,i));case 12:return e.abrupt("return",oN(t,o.asset_type,r,s));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fN(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 dN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fN(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function lN(e){return hN.apply(this,arguments)}function hN(){return(hN=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return nx.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:eP(i.buy),amount_sell:s,token_sell:eP(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,sx(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",dN({},g.data));case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pN(e){return mN.apply(this,arguments)}function mN(){return(mN=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return nx.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,sx(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 bN(e){return yN.apply(this,arguments)}function yN(){return(yN=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return nx.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,sx(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 gN(e){return vN.apply(this,arguments)}function vN(){return(vN=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return nx.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:eP(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,sx(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 wN(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 _N(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wN(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var EN=function(){function e(t){II(this,e),this.config=t;var r=t.apiConfiguration;this.config=t,this.depositsApi=new rC(r),this.encodingApi=new oC(r),this.mintsApi=new EC(r),this.ordersApi=new xC(r),this.tokensApi=new LC(r),this.tradesApi=new zC(r),this.transfersApi=new KC(r),this.usersApi=new JC(r),this.withdrawalsApi=new eM(r),this.projectsApi=new NC(r),this.collectionsApi=new Qx(r),this.metadataApi=new pC(r),this.metadataRefreshesApi=new gC(r),this.exchangesApi=new fC(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 CI(e,[{key:"isChainValid",value:function(e){return e===this.config.ethConfiguration.chainID}},{key:"validateChain",value:(O=QI(nx.mark((function e(t){var r;return nx.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=QI(nx.mark((function e(t){return nx.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",rM(_N(_N({},t),{},{usersApi:this.usersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"isRegisteredOnchain",value:(R=QI(nx.mark((function e(t){var r,n;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return r=$I.connect(this.config.ethConfiguration.registrationContractAddress,t.ethSigner),e.next=5,t.starkSigner.getAddress();case 5:return n=e.sent,e.abrupt("return",iM(n,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"mint",value:(S=QI(nx.mark((function e(t,r){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",QM(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=QI(nx.mark((function e(t,r){return nx.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",nP(_N(_N({},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=QI(nx.mark((function e(t,r){return nx.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",gN(_N(_N({},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=QI(nx.mark((function e(t,r){return nx.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",aP(_N(_N({},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:(_=QI(nx.mark((function e(t,r){return nx.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=QI(nx.mark((function e(t,r){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",bP(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=QI(nx.mark((function e(t,r){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",EP(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=QI(nx.mark((function e(t,r){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",RP(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=QI(nx.mark((function e(t,r){return nx.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",IP(_N(_N(_N({},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=QI(nx.mark((function e(t,r){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",cN(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=QI(nx.mark((function e(t,r,n){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",UP(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=QI(nx.mark((function e(t,r,n){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",rN(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=QI(nx.mark((function e(t,r){return nx.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",lN(_N(_N({},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=QI(nx.mark((function e(t,r){return nx.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",pN(_N(_N({},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=QI(nx.mark((function e(t,r){return nx.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",bN(_N(_N({},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=QI(nx.mark((function e(t,r){var n;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r){var n;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n,i,a){var o;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r){var n;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n){var i;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n){var i;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n,i){var a;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n,i){var a,o;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n,i){var a,o;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r){var n,i;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r){var n,i;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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 TN=function(e){HI(r,Ox(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=jI(e);if(t){var i=jI(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return KI(this,r)}}(r);function r(e){var n,i=e.code,a=e.details,o=e.message;return II(this,r),(n=t.call(this,o)).code=i,n.details=a,n}return CI(r)}();function AN(e){if(OI.isAxiosError(e)&&e.response){var t,r,n,i=e.response.data;return i.code&&i.message?new TN({code:i.code,details:i.details,message:i.message}):new TN({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 TN({code:"unknown_error_code",message:String(e)})}var SN=function(){function e(t){II(this,e),this.depositsApi=new rC(t.apiConfiguration),this.mintsApi=new EC(t.apiConfiguration),this.ordersApi=new xC(t.apiConfiguration),this.tokensApi=new LC(t.apiConfiguration),this.tradesApi=new zC(t.apiConfiguration),this.transfersApi=new KC(t.apiConfiguration),this.exchangeApi=new fC(t.apiConfiguration),this.usersApi=new JC(t.apiConfiguration),this.withdrawalsApi=new eM(t.apiConfiguration),this.balanceApi=new Xx(t.apiConfiguration),this.assetApi=new Gx(t.apiConfiguration),this.collectionApi=new Qx(t.apiConfiguration),this.metadataApi=new pC(t.apiConfiguration),this.metadataRefreshesApi=new gC(t.apiConfiguration),this.nftCheckoutPrimaryApi=new RC(t.apiConfiguration),this.projectsApi=new NC(t.apiConfiguration),this.workflows=new EN(t)}var t,r,n;return CI(e,[{key:"deposit",value:function(e,t){return this.workflows.deposit(e,t).catch((function(e){throw AN(e)}))}},{key:"getDeposit",value:function(e){return this.depositsApi.getDeposit(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listDeposits",value:function(e){return this.depositsApi.listDeposits(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"registerOffchain",value:function(e){return this.workflows.registerOffchain(e).catch((function(e){throw AN(e)}))}},{key:"isRegisteredOnchain",value:function(e){return this.workflows.isRegisteredOnchain(e).catch((function(e){throw AN(e)}))}},{key:"getUser",value:function(e){return this.usersApi.getUsers({user:e}).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"getAsset",value:function(e){return this.assetApi.getAsset(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listAssets",value:function(e){return this.assetApi.listAssets(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"createCollection",value:function(e,t){return this.workflows.createCollection(e,t).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"getCollection",value:function(e){return this.collectionApi.getCollection(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listCollectionFilters",value:function(e){return this.collectionApi.listCollectionFilters(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listCollections",value:function(e){return this.collectionApi.listCollections(e).then((function(e){return e.data})).catch((function(e){throw AN(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 AN(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 AN(e)}))}},{key:"getMetadataSchema",value:function(e){return this.metadataApi.getMetadataSchema(e).then((function(e){return e.data})).catch((function(e){throw AN(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 AN(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 AN(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 AN(e)}))}},{key:"getMetadataRefreshResults",value:function(e,t){return this.workflows.getMetadataRefreshResults(e,t).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"createMetadataRefresh",value:function(e,t){return this.workflows.createMetadataRefresh(e,t).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"createProject",value:(n=QI(nx.mark((function e(t,r){return nx.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 AN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getProject",value:(r=QI(nx.mark((function e(t,r){return nx.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 AN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getProjects",value:(t=QI(nx.mark((function e(t,r,n,i,a){return nx.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 AN(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 AN(e)}))}},{key:"listBalances",value:function(e){return this.balanceApi.listBalances(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"getMint",value:function(e){return this.mintsApi.getMint(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listMints",value:function(e){return this.mintsApi.listMints(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"mint",value:function(e,t){return this.workflows.mint(e,t).catch((function(e){throw AN(e)}))}},{key:"listWithdrawals",value:function(e){return this.withdrawalsApi.listWithdrawals(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"getWithdrawal",value:function(e){return this.withdrawalsApi.getWithdrawal(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"prepareWithdrawal",value:function(e,t){return this.workflows.prepareWithdrawal(e,t).catch((function(e){throw AN(e)}))}},{key:"completeWithdrawal",value:function(e,t,r){return this.workflows.completeWithdrawal(e,t,r).catch((function(e){throw AN(e)}))}},{key:"getOrder",value:function(e){return this.ordersApi.getOrderV3(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listOrders",value:function(e){return this.ordersApi.listOrdersV3(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"createOrder",value:function(e,t){return this.workflows.createOrder(e,t).catch((function(e){throw AN(e)}))}},{key:"cancelOrder",value:function(e,t){return this.workflows.cancelOrder(e,t).catch((function(e){throw AN(e)}))}},{key:"getTrade",value:function(e){return this.tradesApi.getTrade(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listTrades",value:function(e){return this.tradesApi.listTradesV3(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"createTrade",value:function(e,t){return this.workflows.createTrade(e,t).catch((function(e){throw AN(e)}))}},{key:"getToken",value:function(e){return this.tokensApi.getToken(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listTokens",value:function(e){return this.tokensApi.listTokens(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"getTransfer",value:function(e){return this.transfersApi.getTransfer(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listTransfers",value:function(e){return this.transfersApi.listTransfers(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"transfer",value:function(e,t){return this.workflows.transfer(e,t).catch((function(e){throw AN(e)}))}},{key:"batchNftTransfer",value:function(e,t){return this.workflows.batchNftTransfer(e,t).catch((function(e){throw AN(e)}))}},{key:"createExchange",value:function(e){return this.exchangeApi.createExchange(e).catch((function(e){throw AN(e)}))}},{key:"getExchange",value:function(e){return this.exchangeApi.getExchange(e).catch((function(e){throw AN(e)}))}},{key:"getExchanges",value:function(e){return this.exchangeApi.getExchanges(e).catch((function(e){throw AN(e)}))}},{key:"exchangeTransfer",value:function(e,t){return this.workflows.exchangeTransfer(e,t).catch((function(e){throw AN(e)}))}},{key:"createNftPrimary",value:function(e){return this.nftCheckoutPrimaryApi.createNftPrimary(e).catch((function(e){throw AN(e)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(e){return this.nftCheckoutPrimaryApi.getCurrenciesNFTCheckoutPrimary(e).catch((function(e){throw AN(e)}))}},{key:"getNftPrimaryTransaction",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransaction(e).catch((function(e){throw AN(e)}))}},{key:"getNftPrimaryTransactions",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransactions(e).catch((function(e){throw AN(e)}))}}]),e}();function RN(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 kN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?RN(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):RN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ON={"x-sdk-version":"imx-core-sdk-ts-".concat("2.0.2")},IN=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&&(ON["x-sdk-version"]=o),a=kN(kN({},a||{}),ON),{apiConfiguration:new tM({basePath:i,baseOptions:{headers:a}}),ethConfiguration:{coreContractAddress:t,registrationContractAddress:r,chainID:n}}},xN={get PRODUCTION(){return IN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"})},get SANDBOX(){return IN({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"})},createConfig:IN},CN=new tn("08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f",16);new kb.ec(new kb.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:CN.toString("hex"),hash:Fu.sha256,gRed:!1,g:["1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca","5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"]}));var MN=function(){var e=new tn("1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000",16);return e.sub(e.mod(CN))};function PN(e,t){return new tn(Fu.sha256().update($m(_b(e)+yb(rb(t),2))).digest("hex"),16)}function NN(e){for(var t=MN(),r=PN(e.toString("hex",64),0),n=0;r.gte(t);n++)r=PN(r.toString("hex"),n);return r.umod(CN).toString("hex")}function BN(e){for(var t=MN(),r=PN(e.toString("hex",64),0),n=1;r.gte(t);n++)r=PN(r.toString("hex"),n);return r.umod(CN).toString("hex")}function DN(e){var t=MN();return PN(e.toString("hex",64),0).gte(t)}function FN(e){return LN.apply(this,arguments)}function LN(){return(LN=QI(nx.mark((function e(t){var r,n;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=new SN(xN.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 TN&&"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 UN(e,t){var r=Hk.hdkey.fromMasterSeed(Buffer.from(e.slice(2),"hex")).derivePath(t).getWallet().getPrivateKey();return new tn(r)}function jN(e,t,r){return qN.apply(this,arguments)}function qN(){return(qN=QI(nx.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=UN(t,r),a=BN(i),DN(i)){e.next=4;break}return e.abrupt("return",a);case 4:return e.next=6,FN(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 tn(_b(o.starkPublicKey),16),e.next=14,Rx(a).getAddress();case 14:if(c=e.sent,!s.eq(new tn(_b(c),16))){e.next=17;break}return e.abrupt("return",a);case 17:return u=NN(i),e.next=20,Rx(u).getAddress();case 20:if(c=e.sent,!s.eq(new tn(_b(c),16))){e.next=23;break}return e.abrupt("return",u);case 23:return f=Ax(t,r),d=Tx(f),e.next=27,Rx(d).getAddress();case 27:if(c=e.sent,!s.eq(new tn(_b(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 zN(e){return HN.apply(this,arguments)}function HN(){return(HN=QI(nx.mark((function e(t){var r,n,i,a,o;return nx.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=Pn(n).s,a=_x("starkex","immutablex",r,"1"),e.next=10,jN(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)}_M.errors.INSUFFICIENT_FUNDS,_M.errors.NONCE_EXPIRED,_M.errors.REPLACEMENT_UNDERPRICED;const GN=({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n})=>xN.createConfig({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n,sdkVersion:"ts-immutable-sdk-0.24.0-alpha.3"}),VN=()=>GN({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"});class KN{immutableXConfig;baseConfig;constructor({baseConfig:e,overrides:r}){if(this.baseConfig=e,r)this.immutableXConfig=r.immutableXConfig;else switch(e.environment){case t.SANDBOX:this.immutableXConfig=VN();break;case t.PRODUCTION:this.immutableXConfig=GN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"});break;default:this.immutableXConfig=VN()}}}class WN{immutableX;depositsApi;mintsApi;ordersApi;tokensApi;tradesApi;transfersApi;exchangeApi;nftCheckoutPrimaryApi;usersApi;withdrawalsApi;balanceApi;assetApi;collectionApi;metadataApi;metadataRefreshesApi;projectsApi;constructor(e){const t=new KN(e);this.immutableX=new SN(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 XN=Object.freeze({__proto__:null,IMXError:TN,ImmutableXClient:WN,imxClientCreateStarkSigner:Rx,imxClientGenerateLegacyStarkPrivateKey:zN});var $N={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!==$t&&$t.crypto&&(r=$t.crypto),!r)try{r=Bb}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}()}($N);var JN=$N.exports,YN=Jt(JN),QN={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}(JN)}(QN);var ZN=Jt(QN.exports),eB={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}(JN)}(eB);var tB=Jt(eB.exports),rB={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(JN)}(rB);var nB=Jt(rB.exports);function iB(e){this.message=e}iB.prototype=new Error,iB.prototype.name="InvalidCharacterError";var aB="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new iB("'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 oB(e){this.message=e}function sB(e,t){if("string"!=typeof e)throw new oB("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(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(aB(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 aB(t)}}(e.split(".")[r]))}catch(e){throw new oB("Invalid token specified: "+e.message)}}oB.prototype=new Error,oB.prototype.name="InvalidTokenError";var cB,uB,fB,dB={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},lB=(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))(lB||{});(fB=lB||(lB={})).reset=function(){cB=3,uB=dB},fB.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");cB=e},fB.setLogger=function(e){uB=e};var hB=class{constructor(e){this._name=e}debug(...e){cB>=4&&uB.debug(hB._format(this._name,this._method),...e)}info(...e){cB>=3&&uB.info(hB._format(this._name,this._method),...e)}warn(...e){cB>=2&&uB.warn(hB._format(this._name,this._method),...e)}error(...e){cB>=1&&uB.error(hB._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 hB(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){const r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){cB>=4&&uB.debug(hB._format(e),...t)}static info(e,...t){cB>=3&&uB.info(hB._format(e),...t)}static warn(e,...t){cB>=2&&uB.warn(hB._format(e),...t)}static error(e,...t){cB>=1&&uB.error(hB._format(e),...t)}};lB.reset();var pB=class{static _randomWord(){return YN.lib.WordArray.random(1).words[0]}static generateUUIDv4(){const e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^pB._randomWord()&15>>+e/4).toString(16)));return e.replace(/-/g,"")}static generateCodeVerifier(){return pB.generateUUIDv4()+pB.generateUUIDv4()+pB.generateUUIDv4()}static generateCodeChallenge(e){try{const t=ZN(e);return tB.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw hB.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const r=nB.parse([e,t].join(":"));return tB.stringify(r)}},mB=class{constructor(e){this._name=e,this._logger=new hB(`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)}},bB=class{static decode(e){try{return sB(e)}catch(e){throw hB.error("JwtUtils.decode",e),e}}},yB=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(",")}},gB=class extends mB{constructor(){super(...arguments),this._logger=new hB(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-gB.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=gB.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=gB.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)}},vB=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))}},wB=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 hB.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}},_B=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},EB=class{constructor(e){this._logger=new hB("AccessTokenEvents"),this._expiringTimer=new gB("Access token expiring"),this._expiredTimer=new gB("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)}},TB=class{constructor(){this._logger=new hB("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]}},AB=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new hB("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 _B("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 wB(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 wB(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)}))}},SB=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new hB("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}},RB=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 TB;this.stateStore=new SB({store:e})}this.refreshTokenAllowedScope=x,this.extraQueryParams=C,this.extraTokenParams=M,this.extraHeaders=P}},kB=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new hB("TokenClient"),this._jsonService=new AB(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=pB.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=pB.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=pB.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")}},OB=class{constructor(e){this.id=e.id||pB.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=gB.getEpochTime(),this.request_type=e.request_type}toStorageString(){return new hB("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})}static fromStorageString(e){return hB.createStatic("State","fromStorageString"),new OB(JSON.parse(e))}static async clearStaleState(e,t){const r=hB.createStatic("State","clearStaleState"),n=gB.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=OB.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))}}},IB=class extends OB{constructor(e){super(e),!0===e.code_verifier?this.code_verifier=pB.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=pB.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 hB("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){hB.createStatic("SigninState","fromStorageString");const t=JSON.parse(e);return new IB(t)}},xB=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-gB.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+gB.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},CB=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],MB=["sub","iss","aud","exp","iat"],PB=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-gB.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+gB.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 hB("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 hB.createStatic("User","fromStorageString"),new PB(JSON.parse(e))}},NB="oidc-client",BB=class{constructor(){this._abort=new mB("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)===NB){try{const r=vB.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:NB,url:t,keepOpen:r},n)}},DB={location:!1,toolbar:!1,height:640},FB="_blank",LB=60,UB=2,jB=10,qB=class extends RB{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:n=DB,popupWindowTarget:i=FB,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=UB,query_status_response_type:y="code",stopCheckSessionOnError:g=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:w=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=LB,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 TB;this.userStore=new SB({store:e})}}},zB=class extends BB{constructor({silentRequestTimeoutInSeconds:e=jB}){super(),this._logger=new hB("IFrameWindow"),this._timeoutInSeconds=e,this._frame=zB.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 _B("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)}},HB=class extends BB{constructor({popupWindowTarget:e=FB,popupWindowFeatures:t={}}){super(),this._logger=new hB("PopupWindow");const r=yB.center({...DB,...t});this._window=window.open(void 0,e,yB.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)}},GB=class extends EB{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new hB("UserManagerEvents"),this._userLoaded=new mB("User loaded"),this._userUnloaded=new mB("User unloaded"),this._silentRenewError=new mB("Silent renew error"),this._userSignedIn=new mB("User signed in"),this._userSignedOut=new mB("User signed out"),this._userSessionChanged=new mB("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()}},VB=(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))(VB||{}),KB=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(KB||{}),WB=(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))(WB||{}),XB=(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.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_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="mc_get_wallet_info",e.ShowUI="mc_wallet",e.NFTPurchase="magic_nft_purchase",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.UpdatePhoneNumber="magic_auth_update_phone_number",e.UpdatePhoneNumberTestMode="magic_auth_update_phone_number_testing_mode",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e))(XB||{}),$B=(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))($B||{}),JB=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(JB||{}),YB=(e=>(e.Harmony="HARMONY",e))(YB||{}),QB=Object.create,ZB=Object.defineProperty,eD=Object.defineProperties,tD=Object.getOwnPropertyDescriptor,rD=Object.getOwnPropertyDescriptors,nD=Object.getOwnPropertyNames,iD=Object.getOwnPropertySymbols,aD=Object.getPrototypeOf,oD=Object.prototype.hasOwnProperty,sD=Object.prototype.propertyIsEnumerable,cD=(e,t,r)=>t in e?ZB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uD=(e,t)=>{for(var r in t||(t={}))oD.call(t,r)&&cD(e,r,t[r]);if(iD)for(var r of iD(t))sD.call(t,r)&&cD(e,r,t[r]);return e},fD=(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())})),dD=((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 lD={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},hD="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},pD=hD,mD=function(e){let t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=lD,n=(t=e.exports={}).re=[],i=t.src=[],a=t.t={},o=0,s=(e,t,r)=>{let s=o++;pD(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*$")})),bD=/^[0-9]+$/,yD=(e,t)=>{let r=bD.test(e),n=bD.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},gD={compareIdentifiers:yD,rcompareIdentifiers:(e,t)=>yD(t,e)},{MAX_LENGTH:vD,MAX_SAFE_INTEGER:wD}=lD,{re:_D,t:ED}=mD,{compareIdentifiers:TD}=gD,AD=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof AD){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>vD)throw new TypeError(`version is longer than ${vD} characters`);pD("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?_D[ED.LOOSE]:_D[ED.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>wD||this.major<0)throw new TypeError("Invalid major version");if(this.minor>wD||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>wD||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<wD)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(pD("SemVer.compare",this.version,this.options,e),!(e instanceof AD)){if("string"==typeof e&&e===this.version)return 0;e=new AD(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof AD||(e=new AD(e,this.options)),TD(this.major,e.major)||TD(this.minor,e.minor)||TD(this.patch,e.patch)}comparePre(e){if(e instanceof AD||(e=new AD(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(pD("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 TD(r,n)}while(++t)}compareBuild(e){e instanceof AD||(e=new AD(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(pD("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 TD(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}},SD=(e,t,r)=>new AD(e,r).compare(new AD(t,r)),RD=(e,t,r)=>0===SD(e,t,r),kD=(e,t,r)=>0!==SD(e,t,r),OD=(e,t,r)=>SD(e,t,r)>0,ID=(e,t,r)=>SD(e,t,r)>=0,xD=(e,t,r)=>SD(e,t,r)<0,CD=(e,t,r)=>SD(e,t,r)<=0,MD=(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 RD(e,r,n);case"!=":return kD(e,r,n);case">":return OD(e,r,n);case">=":return ID(e,r,n);case"<":return xD(e,r,n);case"<=":return CD(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},PD=Symbol("SemVer ANY"),ND=class{static get ANY(){return PD}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof ND){if(e.loose===!!t.loose)return e;e=e.value}pD("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===PD?this.value="":this.value=this.operator+this.semver.version,pD("comp",this)}parse(e){let t=this.options.loose?BD[DD.COMPARATORLOOSE]:BD[DD.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 AD(r[2],this.options.loose):this.semver=PD}toString(){return this.value}test(e){if(pD("Comparator.test",e,this.options.loose),this.semver===PD||e===PD)return!0;if("string"==typeof e)try{e=new AD(e,this.options)}catch(e){return!1}return MD(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof ND))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new FD(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new FD(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=MD(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),s=MD(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||i&&a||o||s}},{re:BD,t:DD}=mD,FD=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof FD)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new FD(e.raw,t);if(e instanceof ND)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?LD[UD.HYPHENRANGELOOSE]:LD[UD.HYPHENRANGE];e=e.replace(r,eF(this.options.includePrerelease)),pD("hyphen replace",e),e=e.replace(LD[UD.COMPARATORTRIM],jD),pD("comparator trim",e,LD[UD.COMPARATORTRIM]),e=(e=(e=e.replace(LD[UD.TILDETRIM],qD)).replace(LD[UD.CARETTRIM],zD)).split(/\s+/).join(" ");let n=t?LD[UD.COMPARATORLOOSE]:LD[UD.COMPARATOR];return e.split(" ").map((e=>GD(e,this.options))).join(" ").split(/\s+/).map((e=>ZD(e,this.options))).filter(this.options.loose?e=>!!e.match(n):()=>!0).map((e=>new ND(e,this.options)))}intersects(e,t){if(!(e instanceof FD))throw new TypeError("a Range is required");return this.set.some((r=>HD(r,t)&&e.set.some((e=>HD(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 AD(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(tF(this.set[t],e,this.options))return!0;return!1}},{re:LD,t:UD,comparatorTrimReplace:jD,tildeTrimReplace:qD,caretTrimReplace:zD}=mD,HD=(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},GD=(e,t)=>(pD("comp",e,t),e=XD(e,t),pD("caret",e),e=KD(e,t),pD("tildes",e),e=JD(e,t),pD("xrange",e),e=QD(e,t),pD("stars",e),e),VD=e=>!e||"x"===e.toLowerCase()||"*"===e,KD=(e,t)=>e.trim().split(/\s+/).map((e=>WD(e,t))).join(" "),WD=(e,t)=>{let r=t.loose?LD[UD.TILDELOOSE]:LD[UD.TILDE];return e.replace(r,((t,r,n,i,a)=>{let o;return pD("tilde",e,t,r,n,i,a),VD(r)?o="":VD(n)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:VD(i)?o=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(pD("replaceTilde pr",a),o=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):o=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,pD("tilde return",o),o}))},XD=(e,t)=>e.trim().split(/\s+/).map((e=>$D(e,t))).join(" "),$D=(e,t)=>{pD("caret",e,t);let r=t.loose?LD[UD.CARETLOOSE]:LD[UD.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,o)=>{let s;return pD("caret",e,t,r,i,a,o),VD(r)?s="":VD(i)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:VD(a)?s="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:o?(pD("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`):(pD("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`),pD("caret return",s),s}))},JD=(e,t)=>(pD("replaceXRanges",e,t),e.split(/\s+/).map((e=>YD(e,t))).join(" ")),YD=(e,t)=>{e=e.trim();let r=t.loose?LD[UD.XRANGELOOSE]:LD[UD.XRANGE];return e.replace(r,((r,n,i,a,o,s)=>{pD("xRange",e,r,n,i,a,o,s);let c=VD(i),u=c||VD(a),f=u||VD(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`),pD("xRange return",r),r}))},QD=(e,t)=>(pD("replaceStars",e,t),e.trim().replace(LD[UD.STAR],"")),ZD=(e,t)=>(pD("replaceGTE0",e,t),e.trim().replace(LD[t.includePrerelease?UD.GTE0PRE:UD.GTE0],"")),eF=e=>(t,r,n,i,a,o,s,c,u,f,d,l,h)=>`${r=VD(n)?"":VD(i)?`>=${n}.0.0${e?"-0":""}`:VD(a)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=VD(u)?"":VD(f)?`<${+u+1}.0.0-0`:VD(d)?`<${u}.${+f+1}.0-0`:l?`<=${u}.${f}.${d}-${l}`:e?`<${u}.${f}.${+d+1}-0`:`<=${c}`}`.trim(),tF=(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(pD(e[r].semver),e[r].semver!==ND.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},rF=(e,t,r)=>{try{t=new FD(t,r)}catch(e){return!1}return t.test(e)},{MAX_LENGTH:nF}=lD,{re:iF,t:aF}=mD,oF=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof AD)return e;if("string"!=typeof e||e.length>nF||!(t.loose?iF[aF.LOOSE]:iF[aF.FULL]).test(e))return null;try{return new AD(e,t)}catch(e){return null}},{re:sF,t:cF}=mD,uF=(e,t)=>{if(e instanceof AD)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=sF[cF.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),sF[cF.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;sF[cF.COERCERTL].lastIndex=-1}else r=e.match(sF[cF.COERCE]);return null===r?null:oF(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function fF(e){return String.fromCharCode(parseInt(e.slice(1),16))}function dF(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function lF(e){return function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,fF))}(JSON.stringify(e))}function hF(e){return JSON.parse(function(e){return decodeURIComponent(Array.from(atob(e),dF).join(""))}(e))}function pF(e){return void 0===e}function mF(e){return function(e){return null===e}(e)||pF(e)}function bF(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var yF={};var gF={"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"},vF=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,vF.prototype)}},wF=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!mF(e)&&"number"==typeof e&&Object.values(WB).includes(e)}(t)?t:WB.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(null==e?void 0:e.data)||void 0,Object.setPrototypeOf(this,wF.prototype)}},_F=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},EF=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,EF.prototype)}},TF=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 AF(){return new vF(VB.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function SF(){return new vF(VB.MalformedResponse,"Response from the Magic iframe is malformed.")}function RF(e){return new vF(VB.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 kF(e){let t=`Some extensions are incompatible with \`${yF.sdkName}@${yF.version}\`:`;return e.filter((e=>void 0!==e.compat&&null!==e.compat)).forEach((e=>{let r=e.compat[yF.sdkName];"string"==typeof r?t+=`\n - Extension \`${e.name}\` supports version(s) \`${r}\``:r||(t+=`\n - Extension \`${e.name}\` does not support ${yF.platform} environments.`)})),new vF(VB.IncompatibleExtensions,t)}function OF(e){return new vF(VB.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}\``)}function IF(){return new _F(KB.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 \`${yF.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}var xF=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function CF(){return xF.next().value}var MF=Symbol("Payload pre-processed by Magic SDK");function PF(e){return Object.defineProperty(e,MF,{value:!0,enumerable:!1}),e}function NF(e){var t,r,n;return function(e){return!!e[MF]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=CF(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],PF(e)),e}function BF(e,t=[]){return PF({params:t,method:e,jsonrpc:"2.0",id:CF()})}var DF=class{constructor(e){e instanceof DF?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):function(e){return!mF(e)&&!(pF(e.jsonrpc)||pF(e.id)||pF(e.result)&&pF(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}}},FF=((e,t,r)=>(r=null!=e?QB(aD(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of nD(t))!oD.call(e,i)&&i!==r&&ZB(e,i,{get:()=>t[i],enumerable:!(n=tD(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:ZB(r,"default",{value:e,enumerable:!0}),e)))(dD()),LF=class extends FF.default{};function UF(){let e=new LF;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var jF=Symbol("isPromiEvent");function qF(e){return!!e[jF]}function zF(e){let t=HF(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=UF(),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,{[jF]:!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 HF(e){return new Promise(((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)}))}var GF,VF=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(JB.MAGIC_HANDLE_REQUEST,NF(e)),r=zF(((e,r)=>{t.then((t=>{if(n(),t.hasError)r(new wF(t.payload.error));else{if(!t.hasResult)throw SF();e(t.payload.result)}})).catch((e=>{n(),r(e)}))})),n=this.overlay.on($B.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=BF(XB.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}},KF=class extends VF{loginWithMagicLink(e){let{email:t,showUI:r=!0,redirectURI:n}=e,i=BF(this.sdk.testMode?XB.LoginWithMagicLinkTestMode:XB.LoginWithMagicLink,[{email:t,showUI:r,redirectURI:n}]);return this.request(i)}loginWithSMS(e){let{phoneNumber:t}=e,r=BF(this.sdk.testMode?XB.LoginWithSmsTestMode:XB.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r}=e,n=BF(this.sdk.testMode?XB.LoginWithEmailOTPTestMode:XB.LoginWithEmailOTP,[{email:t,showUI:r}]);if(!r){let e=this.request(n);return e&&e.on("otp-input-sent",(e=>{this.createIntermediaryEvent("verify-email-otp",n.id)(e)})),e}return this.request(n)}loginWithCredential(e){let t=null!=e?e:"";if(!e&&"web"===yF.platform){t=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let r=BF(this.sdk.testMode?XB.LoginWithCredentialTestMode:XB.LoginWithCredential,[t]);return this.request(r)}},WF={};function XF(e){return(...t)=>fD(this,null,(function*(){return GF||(GF=yield yF.configureStorage()),yield GF.ready(),GF[e](...t)}))}((e,t)=>{for(var r in t)ZB(e,r,{get:t[r],enumerable:!0})})(WF,{clear:()=>QF,getItem:()=>$F,iterate:()=>rL,key:()=>eL,keys:()=>tL,length:()=>ZF,removeItem:()=>YF,setItem:()=>JF});var $F=XF("getItem"),JF=XF("setItem"),YF=XF("removeItem"),QF=XF("clear"),ZF=XF("length"),eL=XF("key"),tL=XF("keys"),rL=XF("iterate");function nL(){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 iL="STORE_KEY_PRIVATE_KEY",aL="STORE_KEY_PUBLIC_JWK",oL="ECDSA",sL="P-256",cL={name:oL,namedCurve:sL},uL={name:oL,namedCurve:sL};function fL(){YF(aL),YF(iL)}function dL(){return fD(this,null,(function*(){let e=yield function(){return fD(this,null,(function*(){if(function(){let e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return(yield $F(aL))||(yield function(){return fD(this,null,(function*(){let e=null,{subtle:t}=window.crypto,r=yield t.generateKey(cL,!0,["sign"]),n=yield t.exportKey("jwk",r.privateKey);e=yield t.exportKey("jwk",r.publicKey);let i=yield t.importKey("jwk",n,uL,!1,["sign"]);yield JF(iL,i),yield JF(aL,e)}))}()),$F(aL);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 $F(iL);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:nL()},i={typ:"dpop+jwt",alg:"ES256",jwk:e},a=lL(JSON.stringify(i)),o=lL(JSON.stringify(n)),s=function(e){return(new TextEncoder).encode(e)}(`${a}.${o}`),c={name:oL,hash:{name:"SHA-256"}},u=function(e){let t="";return e.forEach((e=>{t+=String.fromCharCode(e)})),hL(t)}(new Uint8Array(yield t.sign(c,r,s)));return`${a}.${o}.${u}`}))}function lL(e){return hL(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}(e))}function hL(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var pL=class extends VF{getIdToken(e){let t=BF(this.sdk.testMode?XB.GetIdTokenTestMode:XB.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=BF(this.sdk.testMode?XB.GenerateIdTokenTestMode:XB.GenerateIdToken,[e]);return this.request(t)}getMetadata(){let e=BF(this.sdk.testMode?XB.GetMetadataTestMode:XB.GetMetadata);return this.request(e)}updateEmail(e){let{email:t,showUI:r=!0}=e,n=BF(this.sdk.testMode?XB.UpdateEmailTestMode:XB.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}isLoggedIn(){let e=BF(this.sdk.testMode?XB.IsLoggedInTestMode:XB.IsLoggedIn);return this.request(e)}logout(){fL();let e=BF(this.sdk.testMode?XB.LogoutTestMode:XB.Logout);return this.request(e)}showSettings(){let e=BF(this.sdk.testMode?XB.UserSettingsTestMode:XB.UserSettings);return this.request(e)}updatePhoneNumber(){let e=BF(this.sdk.testMode?XB.UpdatePhoneNumberTestMode:XB.UpdatePhoneNumber);return this.request(e)}recoverAccount(e){let t=BF(this.sdk.testMode?XB.RecoverAccountTestMode:XB.RecoverAccount,[e]);return this.request(t)}},mL=class extends VF{connectWithUI(){let e=BF(XB.RequestAccounts);return this.request(e)}showUI(){let e=BF(XB.ShowUI);return this.request(e)}getInfo(){let e=BF(XB.GetInfo);return this.request(e)}requestUserInfoWithUI(e){let t=BF(XB.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}disconnect(){fL();let e=BF(XB.Disconnect);return this.request(e)}},{createBoundEmitterMethod:bL,createChainingEmitterMethod:yL}=UF(),gL=class extends VF{constructor(){super(...arguments),this.isMagic=!0,this.on=yL("on",this),this.once=yL("once",this),this.addListener=yL("addListener",this),this.off=yL("off",this),this.removeListener=yL("removeListener",this),this.removeAllListeners=yL("removeAllListeners",this),this.emit=bL("emit"),this.eventNames=bL("eventNames"),this.listeners=bL("listeners"),this.listenerCount=bL("listenerCount")}sendAsync(e,t){if(!t)throw OF({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(JB.MAGIC_HANDLE_REQUEST,e.map((e=>{let t=NF(e);return this.prefixPayloadMethodForTestMode(t),t}))).then((e=>{t(null,e.map((e=>((e,t)=>eD(e,rD(t)))(uD({},e.payload),{error:e.hasError?new wF(e.payload.error):null}))))}));else{let r=NF(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(JB.MAGIC_HANDLE_REQUEST,r).then((e=>{t(e.hasError?new wF(e.payload.error):null,e.payload)}))}}send(e,t){if("string"==typeof e){let r=BF(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new _F(KB.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 DF(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=BF("eth_accounts");return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){this.sdk.testMode&&(e.method=`testMode/eth/${e.method}`)}};function vL(e,t){return t?new URL(e,t):new URL(e)}var wL=["request","overlay","sdk"];function _L(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==VF.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var EL=class extends VF{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:zF,isPromiEvent:qF,encodeJSON:lF,decodeJSON:hF,createJsonRpcRequestPayload:BF,standardizeJsonRpcRequestPayload:NF,storage:WF};let e=[this,..._L(this)];wL.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 RF(t)}}))}))}init(e){this.__is_initialized__||(wL.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 TF(this,"DEPRECATION_NOTICE",`\`${t}\` will be removed from this Extension in version \`${r}\`.${n?` Use \`${n}\` instead.`:""}`)}createWarning(e,t){return new TF(this,e,t)}createError(e,t,r){return new EF(this,e,t,r)}},TL=class extends EL{};TL.Internal=class extends EL{},TL.Anonymous="anonymous extension";var AL=class extends VF{purchase(e){let t=BF(XB.NFTPurchase,[e]);return this.request(t)}};function SL(e){return!e.compat||null==e.compat[yF.sdkName]||("string"==typeof e.compat[yF.sdkName]?rF(uF(yF.version),e.compat[yF.sdkName]):!!e.compat[yF.sdkName])}function RL(e){var t;let r=null!=(t=null==e?void 0:e.extensions)?t:[],n={},i=[];if(Array.isArray(r)?r.forEach((e=>{SL(e)?(e.init(this),(e.name||e.name!==TL.Anonymous)&&(this[e.name]=e),e instanceof TL.Internal&&(bF(e.config)||(n[e.name]=e.config))):i.push(e)})):Object.keys(r).forEach((e=>{if(SL(r[e])){r[e].init(this);let t=r[e];this[e]=t,t instanceof TL.Internal&&(bF(t.config)||(n[r[e].name]=t.config))}else i.push(r[e])})),i.length)throw kF(i);return n}var kL=class{constructor(e,t){var r;if(this.apiKey=e,!e)throw AF();"react-native"===yF.platform&&(null==t?void 0:t.endpoint)&&IF().log();let{defaultEndpoint:n,version:i}=yF;this.testMode=!(null==t||!t.testMode),this.endpoint=vL(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new KF(this),this.user=new pL(this),this.wallet=new mL(this),this.nft=new AL(this),this.rpcProvider=new gL(this);let a=RL.call(this,t);this.parameters=lF(uD({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:vL(this.endpoint).host,sdk:gF[yF.sdkName],version:i,ext:bF(a)?void 0:a,locale:(null==t?void 0:t.locale)||"en_US"},yF.bundleId?{bundleId:yF.bundleId}:{}))}get overlay(){if(!kL.__overlays__.has(this.parameters)){let e=new yF.ViewController(this.endpoint,this.parameters);e.init(),kL.__overlays__.set(this.parameters,e)}return kL.__overlays__.get(this.parameters)}preload(){return fD(this,null,(function*(){yield this.overlay.ready}))}},OL=kL;function IL(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 DF(i).applyResult(t.data.response.result).applyError(t.data.response.error)}}return{}}OL.__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 fD(this,null,(function*(){return HF((r=>fD(this,null,(function*(){yield this.ready;let n=[],i=Array.isArray(t)?t.map((e=>e.id)):[],a=yield function(e,t){return fD(this,null,(function*(){let r,n=yield $F("rt");if("web"===yF.platform)try{r=yield dL()}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($B.MAGIC_HANDLE_RESPONSE,(e=>a=>{let{id:o,response:s}=IL(t,a);(function(e){fD(this,null,(function*(){!e.data.rt||(yield JF("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($B.MAGIC_OVERLAY_READY,(()=>e()))}))}listen(){this.on($B.MAGIC_HIDE_OVERLAY,(()=>{this.hideOverlay()})),this.on($B.MAGIC_SHOW_OVERLAY,(()=>{this.showOverlay()}))}},CL=Object.create,ML=Object.defineProperty,PL=Object.getOwnPropertyDescriptor,NL=Object.getOwnPropertyNames,BL=Object.getPrototypeOf,DL=Object.prototype.hasOwnProperty,FL=(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')})),LL=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),UL=(e,t,r)=>(r=null!=e?CL(BL(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of NL(t))!DL.call(e,i)&&i!==r&&ML(e,i,{get:()=>t[i],enumerable:!(n=PL(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:ML(r,"default",{value:e,enumerable:!0}),e)),jL=(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())})),qL=LL(((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 FL&&FL;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 FL&&FL,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 K(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 W={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+K(n))}else if("[object Blob]"===r){var a=new FileReader;a.onload=function(){var r="~~local_forage_type~"+e.type+"~"+K(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:K};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=W,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=W,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(W);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)}))})),zL=LL(((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})}))})),HL=UL(qL()),GL=UL(zL()),VL={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var KL=function(e,t){return Object.assign(yF,t),e}(OL,{platform:"web",sdkName:"magic-sdk",version:"13.6.2",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 _F(KB.DuplicateIframe,"Duplicate iframes found.").log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=vL(this.endpoint).host,t.title="Secure Modal",t.src=vL(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(let[t,r]of Object.entries(VL))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 jL(this,null,(function*(){let e=yield this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}))}hideOverlay(){return jL(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 jL(this,null,(function*(){let t=yield this.iframe;if(!t||!t.contentWindow)throw new vF(VB.ModalNotReady,"Modal is not ready.");t.contentWindow.postMessage(e,this.endpoint)}))}},configureStorage:()=>jL(void 0,null,(function*(){let e=HL.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(GL),yield e.setDriver([HL.default.INDEXEDDB,HL.default.LOCALSTORAGE,GL._driver]),e}))}),WL=(e=>(e.LoginWithOIDC="magic_auth_login_with_oidc",e))(WL||{}),XL=class extends TL.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 $L(e,t){return function(){return e.apply(t,arguments)}}const{toString:JL}=Object.prototype,{getPrototypeOf:YL}=Object,QL=(e=>t=>{const r=JL.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ZL=e=>(e=e.toLowerCase(),t=>QL(t)===e),eU=e=>t=>typeof t===e,{isArray:tU}=Array,rU=eU("undefined");const nU=ZL("ArrayBuffer");const iU=eU("string"),aU=eU("function"),oU=eU("number"),sU=e=>null!==e&&"object"==typeof e,cU=e=>{if("object"!==QL(e))return!1;const t=YL(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},uU=ZL("Date"),fU=ZL("File"),dU=ZL("Blob"),lU=ZL("FileList"),hU=ZL("URLSearchParams");function pU(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),tU(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 mU(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 bU="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,yU=e=>!rU(e)&&e!==bU;const gU=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&YL(Uint8Array)),vU=ZL("HTMLFormElement"),wU=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),_U=ZL("RegExp"),EU=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};pU(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},TU="abcdefghijklmnopqrstuvwxyz",AU="0123456789",SU={DIGIT:AU,ALPHA:TU,ALPHA_DIGIT:TU+TU.toUpperCase()+AU};const RU=ZL("AsyncFunction");var kU={isArray:tU,isArrayBuffer:nU,isBuffer:function(e){return null!==e&&!rU(e)&&null!==e.constructor&&!rU(e.constructor)&&aU(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||aU(e.append)&&("formdata"===(t=QL(e))||"object"===t&&aU(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&nU(e.buffer),t},isString:iU,isNumber:oU,isBoolean:e=>!0===e||!1===e,isObject:sU,isPlainObject:cU,isUndefined:rU,isDate:uU,isFile:fU,isBlob:dU,isRegExp:_U,isFunction:aU,isStream:e=>sU(e)&&aU(e.pipe),isURLSearchParams:hU,isTypedArray:gU,isFileList:lU,forEach:pU,merge:function e(){const{caseless:t}=yU(this)&&this||{},r={},n=(n,i)=>{const a=t&&mU(r,i)||i;cU(r[a])&&cU(n)?r[a]=e(r[a],n):cU(n)?r[a]=e({},n):tU(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&pU(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(pU(t,((t,n)=>{r&&aU(t)?e[n]=$L(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&&YL(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:QL,kindOfTest:ZL,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(tU(e))return e;let t=e.length;if(!oU(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:vU,hasOwnProperty:wU,hasOwnProp:wU,reduceDescriptors:EU,freezeMethods:e=>{EU(e,((t,r)=>{if(aU(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];aU(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 tU(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:mU,global:bU,isContextDefined:yU,ALPHABET:SU,generateString:(e=16,t=SU.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&aU(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=tU(e)?[]:{};return pU(e,((e,t)=>{const a=r(e,n+1);!rU(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:RU,isThenable:e=>e&&(sU(e)||aU(e))&&aU(e.then)&&aU(e.catch)};function OU(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)}kU.inherits(OU,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:kU.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const IU=OU.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(OU,xU),Object.defineProperty(IU,"isAxiosError",{value:!0}),OU.from=(e,t,r,n,i,a)=>{const o=Object.create(IU);return kU.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),OU.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function CU(e){return kU.isPlainObject(e)||kU.isArray(e)}function MU(e){return kU.endsWith(e,"[]")?e.slice(0,-2):e}function PU(e,t,r){return e?e.concat(t).map((function(e,t){return e=MU(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const NU=kU.toFlatObject(kU,{},null,(function(e){return/^is[A-Z]/.test(e)}));function BU(e,t,r){if(!kU.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=kU.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!kU.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&kU.isSpecCompliantForm(t);if(!kU.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(kU.isDate(e))return e.toISOString();if(!s&&kU.isBlob(e))throw new OU("Blob is not supported. Use a Buffer instead.");return kU.isArrayBuffer(e)||kU.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(kU.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(kU.isArray(e)&&function(e){return kU.isArray(e)&&!e.some(CU)}(e)||(kU.isFileList(e)||kU.endsWith(r,"[]"))&&(s=kU.toArray(e)))return r=MU(r),s.forEach((function(e,n){!kU.isUndefined(e)&&null!==e&&t.append(!0===o?PU([r],n,a):null===o?r:r+"[]",c(e))})),!1;return!!CU(e)||(t.append(PU(i,r,a),c(e)),!1)}const f=[],d=Object.assign(NU,{defaultVisitor:u,convertValue:c,isVisitable:CU});if(!kU.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!kU.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),kU.forEach(r,(function(r,a){!0===(!(kU.isUndefined(r)||null===r)&&i.call(t,r,kU.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),f.pop()}}(e),t}function DU(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function FU(e,t){this._pairs=[],e&&BU(e,this,t)}const LU=FU.prototype;function UU(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function jU(e,t,r){if(!t)return e;const n=r&&r.encode||UU,i=r&&r.serialize;let a;if(a=i?i(t,r):kU.isURLSearchParams(t)?t.toString():new FU(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}LU.append=function(e,t){this._pairs.push([e,t])},LU.toString=function(e){const t=e?function(t){return e.call(this,t,DU)}:DU;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var qU=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){kU.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},zU={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var HU={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:FU,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 GU(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&kU.isArray(n)?n.length:a,s)return kU.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&kU.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&kU.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(kU.isFormData(e)&&kU.isFunction(e.entries)){const r={};return kU.forEachEntry(e,((e,n)=>{t(function(e){return kU.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const VU={"Content-Type":void 0};const KU={transitional:zU,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=kU.isObject(e);i&&kU.isHTMLForm(e)&&(e=new FormData(e));if(kU.isFormData(e))return n&&n?JSON.stringify(GU(e)):e;if(kU.isArrayBuffer(e)||kU.isBuffer(e)||kU.isStream(e)||kU.isFile(e)||kU.isBlob(e))return e;if(kU.isArrayBufferView(e))return e.buffer;if(kU.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 BU(e,new HU.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return HU.isNode&&kU.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=kU.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return BU(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(kU.isString(e))try{return(t||JSON.parse)(e),kU.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||KU.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&kU.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 OU.from(e,OU.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:HU.classes.FormData,Blob:HU.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};kU.forEach(["delete","get","head"],(function(e){KU.headers[e]={}})),kU.forEach(["post","put","patch"],(function(e){KU.headers[e]=kU.merge(VU)}));var WU=KU;const XU=kU.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 $U=Symbol("internals");function JU(e){return e&&String(e).trim().toLowerCase()}function YU(e){return!1===e||null==e?e:kU.isArray(e)?e.map(YU):String(e)}function QU(e,t,r,n,i){return kU.isFunction(n)?n.call(this,t,r):(i&&(t=r),kU.isString(t)?kU.isString(n)?-1!==t.indexOf(n):kU.isRegExp(n)?n.test(t):void 0:void 0)}class ZU{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=JU(t);if(!i)throw new Error("header name must be a non-empty string");const a=kU.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=YU(e))}const a=(e,t)=>kU.forEach(e,((e,r)=>i(e,r,t)));return kU.isPlainObject(e)||e instanceof this.constructor?a(e,t):kU.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]&&XU[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=JU(e)){const r=kU.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(kU.isFunction(t))return t.call(this,e,r);if(kU.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=JU(e)){const r=kU.findKey(this,e);return!(!r||void 0===this[r]||t&&!QU(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=JU(e)){const i=kU.findKey(r,e);!i||t&&!QU(0,r[i],i,t)||(delete r[i],n=!0)}}return kU.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&&!QU(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return kU.forEach(this,((n,i)=>{const a=kU.findKey(r,i);if(a)return t[a]=YU(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]=YU(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return kU.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&kU.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[$U]=this[$U]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=JU(e);t[n]||(!function(e,t){const r=kU.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 kU.isArray(e)?e.forEach(n):n(e),this}}ZU.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),kU.freezeMethods(ZU.prototype),kU.freezeMethods(ZU);var ej=ZU;function tj(e,t){const r=this||WU,n=t||r,i=ej.from(n.headers);let a=n.data;return kU.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function rj(e){return!(!e||!e.__CANCEL__)}function nj(e,t,r){OU.call(this,null==e?"canceled":e,OU.ERR_CANCELED,t,r),this.name="CanceledError"}kU.inherits(nj,OU,{__CANCEL__:!0});var ij=HU.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),kU.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),kU.isString(n)&&o.push("path="+n),kU.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 aj(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 oj=HU.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=kU.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 cj="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=ej.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}kU.isFormData(n)&&(HU.isStandardBrowserEnv||HU.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=aj(e.baseURL,e.url);function f(){if(!c)return;const n=ej.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new OU("Request failed with status code "+r.status,[OU.ERR_BAD_REQUEST,OU.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(),jU(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 OU("Request aborted",OU.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new OU("Network Error",OU.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||zU;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new OU(t,n.clarifyTimeoutError?OU.ETIMEDOUT:OU.ECONNABORTED,e,c)),c=null},HU.isStandardBrowserEnv){const t=(e.withCredentials||oj(u))&&e.xsrfCookieName&&ij.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&kU.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),kU.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 nj(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===HU.protocols.indexOf(d)?r(new OU("Unsupported protocol "+d+":",OU.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const uj={http:null,xhr:cj};kU.forEach(uj,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var fj=e=>{e=kU.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=kU.isString(r)?uj[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new OU(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(kU.hasOwnProp(uj,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!kU.isFunction(n))throw new TypeError("adapter is not a function");return n};function dj(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nj(null,e)}function lj(e){dj(e),e.headers=ej.from(e.headers),e.data=tj.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return fj(e.adapter||WU.adapter)(e).then((function(t){return dj(e),t.data=tj.call(e,e.transformResponse,t),t.headers=ej.from(t.headers),t}),(function(t){return rj(t)||(dj(e),t&&t.response&&(t.response.data=tj.call(e,e.transformResponse,t.response),t.response.headers=ej.from(t.response.headers))),Promise.reject(t)}))}const hj=e=>e instanceof ej?e.toJSON():e;function pj(e,t){t=t||{};const r={};function n(e,t,r){return kU.isPlainObject(e)&&kU.isPlainObject(t)?kU.merge.call({caseless:r},e,t):kU.isPlainObject(t)?kU.merge({},t):kU.isArray(t)?t.slice():t}function i(e,t,r){return kU.isUndefined(t)?kU.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!kU.isUndefined(t))return n(void 0,t)}function o(e,t){return kU.isUndefined(t)?kU.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(hj(e),hj(t),!0)};return kU.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||i,o=a(e[n],t[n],n);kU.isUndefined(o)&&a!==s||(r[n]=o)})),r}const mj="1.4.0",bj={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{bj[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const yj={};bj.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 OU(n(i," has been removed"+(t?" in "+t:"")),OU.ERR_DEPRECATED);return t&&!yj[i]&&(yj[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 gj={assertOptions:function(e,t,r){if("object"!=typeof e)throw new OU("options must be an object",OU.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 OU("option "+a+" must be "+r,OU.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new OU("Unknown option "+a,OU.ERR_BAD_OPTION)}},validators:bj};const vj=gj.validators;class wj{constructor(e){this.defaults=e,this.interceptors={request:new qU,response:new qU}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=pj(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&gj.assertOptions(r,{silentJSONParsing:vj.transitional(vj.boolean),forcedJSONParsing:vj.transitional(vj.boolean),clarifyTimeoutError:vj.transitional(vj.boolean)},!1),null!=n&&(kU.isFunction(n)?t.paramsSerializer={serialize:n}:gj.assertOptions(n,{encode:vj.function,serialize:vj.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&kU.merge(i.common,i[t.method]),a&&kU.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=ej.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=[lj.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=lj.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 jU(aj((e=pj(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}kU.forEach(["delete","get","head","options"],(function(e){wj.prototype[e]=function(t,r){return this.request(pj(r||{},{method:e,url:t,data:(r||{}).data}))}})),kU.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(pj(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}wj.prototype[e]=t(),wj.prototype[e+"Form"]=t(!0)}));var _j=wj;class Ej{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 nj(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 Ej((function(t){e=t}));return{token:t,cancel:e}}}var Tj=Ej;const Aj={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(Aj).forEach((([e,t])=>{Aj[t]=e}));var Sj=Aj;const Rj=function e(t){const r=new _j(t),n=$L(_j.prototype.request,r);return kU.extend(n,_j.prototype,r,{allOwnKeys:!0}),kU.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(pj(t,r))},n}(WU);Rj.Axios=_j,Rj.CanceledError=nj,Rj.CancelToken=Tj,Rj.isCancel=rj,Rj.VERSION=mj,Rj.toFormData=BU,Rj.AxiosError=OU,Rj.Cancel=Rj.CanceledError,Rj.all=function(e){return Promise.all(e)},Rj.spread=function(e){return function(t){return e.apply(null,t)}},Rj.isAxiosError=function(e){return kU.isObject(e)&&!0===e.isAxiosError},Rj.mergeConfig=pj,Rj.AxiosHeaders=ej,Rj.formToJSON=e=>GU(kU.isHTMLForm(e)?new FormData(e):e),Rj.HttpStatusCode=Sj,Rj.default=Rj;var kj=Rj;const Oj="https://guardian.sandbox.imtbl.com".replace(/\/+$/,"");class Ij{basePath;axios;configuration;constructor(e,t=Oj,r=kj){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 Cj="https://example.com",Mj=function(e,t,r){if(null==r)throw new xj(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Pj=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 Nj(e,t,r=""){"object"==typeof t?Array.isArray(t)?t.forEach((t=>Nj(e,t,r))):Object.keys(t).forEach((n=>Nj(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t)}const Bj=function(e,...t){const r=new URLSearchParams(e.search);Nj(r,t),e.search=r.toString()},Dj=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||""},Fj=function(e){return e.pathname+e.search+e.hash},Lj=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||a)+e.url};return i.request(o)}},Uj=function(e){const t=function(e){return{approvePendingMessage:async(t,r={})=>{Mj("approvePendingMessage","messageID",t);const n="/guardian/v1/messages/{messageID}/approve".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,Cj);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...r},s={};await Pj(s,e),Bj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:Fj(i),options:o}},evaluateMessage:async(t,r={})=>{Mj("evaluateMessage","messageEvaluationRequest",t);const n=new URL("/guardian/v1/messages/evaluate",Cj);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...r},o={};await Pj(o,e),o["Content-Type"]="application/json",Bj(n,{});let s=i&&i.headers?i.headers:{};return a.headers={...o,...s,...r.headers},a.data=Dj(t,a,e),{url:Fj(n),options:a}},getMessageByID:async(t,r={})=>{Mj("getMessageByID","messageID",t);const n="/guardian/v1/messages/{messageID}".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,Cj);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...r},s={};await Pj(s,e),Bj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:Fj(i),options:o}}}}(e);return{async approvePendingMessage(r,n){const i=await t.approvePendingMessage(r,n);return Lj(i,kj,Oj,e)},async evaluateMessage(r,n){const i=await t.evaluateMessage(r,n);return Lj(i,kj,Oj,e)},async getMessageByID(r,n){const i=await t.getMessageByID(r,n);return Lj(i,kj,Oj,e)}}};class jj extends Ij{approvePendingMessage(e,t){return Uj(this.configuration).approvePendingMessage(e.messageID,t).then((e=>e(this.axios,this.basePath)))}evaluateMessage(e,t){return Uj(this.configuration).evaluateMessage(e.messageEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getMessageByID(e,t){return Uj(this.configuration).getMessageByID(e.messageID,t).then((e=>e(this.axios,this.basePath)))}}const qj=function(e){const t=function(e){return{approvePendingTransaction:async(t,r,n={})=>{Mj("approvePendingTransaction","payloadHash",t),Mj("approvePendingTransaction","transactionApprovalRequest",r);const i="/guardian/v1/transactions/{payloadHash}/approve".replace("{payloadHash}",encodeURIComponent(String(t))),a=new URL(i,Cj);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Pj(c,e),c["Content-Type"]="application/json",Bj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=Dj(r,s,e),{url:Fj(a),options:s}},evaluateTransaction:async(t,r,n={})=>{Mj("evaluateTransaction","id",t),Mj("evaluateTransaction","transactionEvaluationRequest",r);const i="/guardian/v1/transactions/{id}/evaluate".replace("{id}",encodeURIComponent(String(t))),a=new URL(i,Cj);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Pj(c,e),c["Content-Type"]="application/json",Bj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=Dj(r,s,e),{url:Fj(a),options:s}},getTransactionByID:async(t,r,n,i={})=>{Mj("getTransactionByID","transactionID",t),Mj("getTransactionByID","chainType",r);const a="/guardian/v1/transactions/{transactionID}".replace("{transactionID}",encodeURIComponent(String(t))),o=new URL(a,Cj);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i},u={},f={};await Pj(u,e),void 0!==r&&(f.chainType=r),void 0!==n&&(f.chainID=n),Bj(o,f);let d=s&&s.headers?s.headers:{};return c.headers={...u,...d,...i.headers},{url:Fj(o),options:c}}}}(e);return{async approvePendingTransaction(r,n,i){const a=await t.approvePendingTransaction(r,n,i);return Lj(a,kj,Oj,e)},async evaluateTransaction(r,n,i){const a=await t.evaluateTransaction(r,n,i);return Lj(a,kj,Oj,e)},async getTransactionByID(r,n,i,a){const o=await t.getTransactionByID(r,n,i,a);return Lj(o,kj,Oj,e)}}};class zj extends Ij{approvePendingTransaction(e,t){return qj(this.configuration).approvePendingTransaction(e.payloadHash,e.transactionApprovalRequest,t).then((e=>e(this.axios,this.basePath)))}evaluateTransaction(e,t){return qj(this.configuration).evaluateTransaction(e.id,e.transactionEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionByID(e,t){return qj(this.configuration).getTransactionByID(e.transactionID,e.chainType,e.chainID,t).then((e=>e(this.axios,this.basePath)))}}class Hj{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 Gj="starkex",Vj="evm";function Kj(e){const t=-1!==new tn(e,16).cmp(new tn(27))?new tn(e,16).sub(new tn(27)).toNumber():new tn(e,16).toNumber();return e.trim()?t:void 0}async function Wj(e,t){const r=function(e,t=64){const r=_b(e);return{r:new tn(r.substring(0,t),"hex"),s:new tn(r.substring(t,2*t),"hex"),recoveryParam:Kj(r.substring(2*t,2*t+2))}}(await t.signMessage(e));return Tb(vb((n=r).r.toString(16),64)+vb(n.s.toString(16),64)+vb(n.recoveryParam?.toString(16)||"",2));var n}function Xj(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 $j={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 Jj(){return Jj=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},Jj.apply(this,arguments)}var Yj;!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"}(Yj||(Yj={}));function Qj(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=Jj({},this.config,e),this.config.logLevel){case"DEBUG":this.logLevel=Yj.DEBUG;break;case"INFO":default:this.logLevel=Yj.INFO;break;case"WARN":this.logLevel=Yj.WARN;break;case"ERROR":this.logLevel=Yj.ERROR;break;case"DISABLED":this.logLevel=Yj.DISABLED}void 0===this.config.silence&&(this.config.silence=!1)}debug(e,...t){!0!==this.config.silence&&this.logLevel===Yj.DEBUG&&console.log(e,...t)}info(e,...t){!0!==this.config.silence&&this.logLevel<=Yj.INFO&&console.log(e,...t)}warn(e,...t){!0!==this.config.silence&&this.logLevel<=Yj.WARN&&(console.warn(e,...t),this.config.onwarn&&this.config.onwarn(e,t))}error(e,...t){!0!==this.config.silence&&this.logLevel<=Yj.ERROR&&(console.error(e,...t),this.config.onerror&&this.config.onerror(e,t))}}({logLevel:"INFO",silence:!0});const Zj=(e=0,t=Number.MAX_SAFE_INTEGER)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function eq(){return eq=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},eq.apply(this,arguments)}const tq=(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),rq=e=>tq(nq(e)),nq=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},iq=(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 aq;!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"}(aq||(aq={}));const oq=e=>iq("https://${network}-indexer.sequence.app",{network:e}),sq=e=>iq("https://${network}-relayer.sequence.app",{network:e}),cq=e=>iq("https://nodes.sequence.app/${network}",{network:e}),uq={[aq.MAINNET]:{chainId:aq.MAINNET,name:"mainnet",title:"Ethereum",blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[aq.ROPSTEN]:{chainId:aq.ROPSTEN,name:"ropsten",title:"Ropsten",testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[aq.RINKEBY]:{chainId:aq.RINKEBY,name:"rinkeby",title:"Rinkeby",testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",disabled:!0},[aq.GOERLI]:{chainId:aq.GOERLI,name:"goerli",title:"Goerli",testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[aq.KOVAN]:{chainId:aq.KOVAN,name:"kovan",title:"Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"}},[aq.POLYGON]:{chainId:aq.POLYGON,name:"polygon",title:"Polygon",blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"}},[aq.POLYGON_MUMBAI]:{chainId:aq.POLYGON_MUMBAI,name:"mumbai",title:"Polygon Mumbai",testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"}},[aq.POLYGON_ZKEVM]:{chainId:aq.POLYGON_ZKEVM,name:"polygon-zkevm",title:"Polygon zkEVM",blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"}},[aq.BSC]:{chainId:aq.BSC,name:"bsc",title:"BNB Smart Chain",blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"}},[aq.BSC_TESTNET]:{chainId:aq.BSC_TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"}},[aq.OPTIMISM]:{chainId:aq.OPTIMISM,name:"optimism",title:"Optimism",blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"}},[aq.OPTIMISM_TESTNET]:{chainId:aq.OPTIMISM_TESTNET,name:"optimism-testnet",title:"Optimistic Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Optimism Testnet)",rootUrl:"https://kovan-optimistic.etherscan.io/"}},[aq.ARBITRUM]:{chainId:aq.ARBITRUM,name:"arbitrum",title:"Arbitrum One",blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"}},[aq.ARBITRUM_GOERLI]:{chainId:aq.ARBITRUM_GOERLI,name:"arbitrum-goerli",title:"Arbitrum Goerli",testnet:!0,blockExplorer:{name:"Arbiscan (Testnet)",rootUrl:"https://testnet.arbiscan.io/"}},[aq.ARBITRUM_NOVA]:{chainId:aq.ARBITRUM_NOVA,name:"arbitrum-nova",title:"Arbitrum Nova",blockExplorer:{name:"Nova Explorer",rootUrl:"https://nova-explorer.arbitrum.io/"}},[aq.AVALANCHE]:{chainId:aq.AVALANCHE,name:"avalanche",title:"Avalanche",blockExplorer:{name:"Snowtrace",rootUrl:"https://snowtrace.io/"}},[aq.AVALANCHE_TESTNET]:{chainId:aq.AVALANCHE_TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://testnet.snowtrace.io/"}},[aq.FANTOM]:{chainId:aq.FANTOM,name:"fantom",title:"Fantom",blockExplorer:{name:"FTMScan",rootUrl:"https://ftmscan.com/"}},[aq.FANTOM_TESTNET]:{chainId:aq.FANTOM_TESTNET,name:"fantom-testnet",title:"Fantom Testnet",testnet:!0,blockExplorer:{name:"FTMScan (Testnet)",rootUrl:"https://testnet.ftmscan.com/"}},[aq.GNOSIS]:{chainId:aq.GNOSIS,name:"gnosis",title:"Gnosis Chain",blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"}},[aq.AURORA]:{chainId:aq.AURORA,name:"aurora",title:"Aurora",blockExplorer:{name:"Aurora Explorer",rootUrl:"https://aurorascan.dev/"}},[aq.AURORA_TESTNET]:{chainId:aq.AURORA_TESTNET,name:"aurora-testnet",title:"Aurora Testnet",blockExplorer:{name:"Aurora Explorer (Testnet)",rootUrl:"https://testnet.aurorascan.dev/"}},[aq.BASE_GOERLI]:{chainId:aq.BASE_GOERLI,name:"base-goerli",title:"Base Goerli",blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"}}};rq([eq({},uq[aq.MAINNET],{rpcUrl:cq("mainnet"),relayer:{url:sq("mainnet")},indexerUrl:oq("mainnet")}),eq({},uq[aq.POLYGON],{rpcUrl:cq("polygon"),relayer:{url:sq("polygon")},indexerUrl:oq("polygon"),isDefaultChain:!0,isAuthChain:!0}),eq({},uq[aq.BSC],{rpcUrl:cq("bsc"),indexerUrl:oq("bsc"),relayer:{url:sq("bsc")}}),eq({},uq[aq.AVALANCHE],{rpcUrl:cq("avalanche"),indexerUrl:oq("avalanche"),relayer:{url:sq("avalanche")}}),eq({},uq[aq.ARBITRUM],{rpcUrl:cq("arbitrum"),indexerUrl:oq("arbitrum"),relayer:{url:sq("arbitrum")}}),eq({},uq[aq.ARBITRUM_NOVA],{rpcUrl:cq("arbitrum-nova"),indexerUrl:oq("arbitrum-nova"),relayer:{url:sq("arbitrum-nova")}}),eq({},uq[aq.OPTIMISM],{rpcUrl:cq("optimism"),indexerUrl:oq("optimism"),relayer:{url:sq("optimism")}}),eq({},uq[aq.POLYGON_ZKEVM],{rpcUrl:cq("polygon-zkevm"),indexerUrl:oq("polygon-zkevm"),relayer:{url:sq("polygon-zkevm")}}),eq({},uq[aq.GNOSIS],{rpcUrl:cq("gnosis"),indexerUrl:oq("gnosis"),relayer:{url:sq("gnosis")}})]),rq([eq({},uq[aq.RINKEBY],{rpcUrl:cq("rinkeby"),relayer:{url:sq("rinkeby")},indexerUrl:oq("rinkeby")}),eq({},uq[aq.GOERLI],{rpcUrl:cq("goerli"),relayer:{url:sq("goerli")},indexerUrl:oq("goerli")}),eq({},uq[aq.POLYGON_MUMBAI],{rpcUrl:cq("mumbai"),relayer:{url:sq("mumbai")},indexerUrl:oq("mumbai"),isDefaultChain:!0,isAuthChain:!0}),eq({},uq[aq.BSC_TESTNET],{rpcUrl:cq("bsc-testnet"),relayer:{url:sq("bsc-testnet")},indexerUrl:oq("bsc-testnet")}),eq({},uq[aq.ARBITRUM_GOERLI],{rpcUrl:cq("arbitrum-goerli"),relayer:{url:sq("arbitrum-goerli")},indexerUrl:oq("arbitrum-goerli")}),eq({},uq[aq.BASE_GOERLI],{rpcUrl:cq("base-goerli"),relayer:{url:sq("base-goerli")},indexerUrl:oq("base-goerli")})]);const fq="2.0";function dq(){return dq=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},dq.apply(this,arguments)}let lq;function hq(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"}(lq||(lq={}));const pq={batchSize:50,timeWindow:50,contract:"0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E",verbose:!1};let mq=class e{constructor(t){var r=this;if(this.batchableJsonRpcMethods=[lq.ethCall,lq.ethGetCode,lq.ethGetBalance],this.multicallInterface=new Ss($j.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]=hq(t,(e=>{try{if(e.next!==n)return!1;switch(e.request.method){case lq.ethCall:if(e.request.params[0].from||e.request.params[0].gasPrice||e.request.params[0].value)return!1;case lq.ethGetBalance:case lq.ethGetCode:const t=function(e){if(void 0===e)return"latest";switch(e){case"earliest":case"latest":case"pending":return e}return zn.from(e)}(e.request.params[1]);if(void 0===i&&(i=t),!function(e,t){return e===t||(zn.isBigNumber(e)?!!zn.isBigNumber(t)&&e.eq(t):!zn.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 lq.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 lq.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 lq.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]=hq(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=Zj(),u=await async function(e,t){try{return await e}catch(e){return t instanceof Function?t(e):t}}(Qj(n)({id:c,jsonrpc:fq,method:lq.ethCall,params:[{to:r.options.contract,value:0,data:s},zn.isBigNumber(i)?i.toNumber():i]}),(e=>({jsonrpc:fq,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 lq.ethCall:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:f[1][t]});break;case lq.ethGetCode:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:vo.decode(["bytes"],f[1][t])[0]});break;case lq.ethGetBalance:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:vo.decode(["uint256"],f[1][t])[0]})}else r.forward(e)}))},this.options=t?dq({},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}};mq.DefaultOptions=dq({},pq);const bq=["getNetwork","getBlockNumber","getGasPrice","getTransactionCount","getStorageAt","sendTransaction","estimateGas","getBlock","getTransaction","getTransactionReceipt","getLogs","emit","litenerCount","addListener","removeListener","waitForTransaction","detectNetwork","getBlockWithTransactions"];var yq=Object.freeze({__proto__:null,ProxyMethods:bq,MulticallProvider:class extends Fh{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 Nh(r,n.address,n.name):null}return t.getResolver(await e)},this.next=async function(e,t){try{switch(e.method){case lq.ethCall:r.callback(e,t,await r.provider.call(e.params[0],e.params[1]));break;case lq.ethGetCode:r.callback(e,t,await r.provider.getCode(e.params[0],e.params[1]));break;case lq.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=mq.isMulticall(t)?t:new mq(t),bq.forEach((t=>{void 0!==e[t]&&(this[t]=(...r)=>e[t](...r))}))}callback(e,t,r,n){t(n,{jsonrpc:fq,id:e.id,result:r,error:n})}async call(e,t){return this.rpcCall(lq.ethCall,e,t)}async getCode(e,t){return this.rpcCall(lq.ethGetCode,e,t)}async getBalance(e,t){return this.rpcCall(lq.ethGetBalance,e,t)}async rpcCall(e,...t){const r=Zj();return(await Qj(this.multicall.handle)(this.next,{jsonrpc:fq,id:r,method:e,params:t})).result}},MulticallExternalProvider:class{constructor(e,t){if(this.provider=e,this.multicall=void 0,this.multicall=mq.isMulticall(t)?t:new mq(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=mq.isMulticall(e)?e:new mq(e);return(e,n)=>r.handle(t,e,n)}}),gq=Object.freeze({__proto__:null,Multicall:mq,providers:yq});let vq,wq;try{vq=localStorage}catch(e){const t=new Map;vq={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 _q(e){return void 0!==e.address&&!function(e){return Eq(e)||Tq(e)||Aq(e)}(e)}function Eq(e){const t=e;return void 0!==t.signature&&void 0===t.address}function Tq(e){const t=e;return void 0!==t.r&&void 0!==t.s&&void 0!==t.v&&void 0!==t.t}function Aq(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"}(wq||(wq={}));const Sq=e=>{if("string"!=typeof e)return e;const t=e.replace("0x",""),r=zn.from(`0x${t.slice(0,4)}`).toNumber(),n=[];for(let e=4;e<t.length;){const r=zn.from(t.slice(e,e+2)).toNumber();e+=2;const i=zn.from(`0x${t.slice(e,e+2)}`).toNumber();switch(e+=2,r){case wq.Address:const r=da(t.slice(e,e+40));e+=40,n.push({weight:i,address:r});break;case wq.EOA:const a=wn(`0x${t.slice(e,e+132)}`);e+=132;const o=Pn(a.slice(0,65)),s=o.r,c=o.s,u=o.v,f=zn.from(a[a.length-1]).toNumber();n.push({weight:i,signature:a,r:s,s:c,v:u,t:f});break;case wq.Full:const d=da(t.slice(e,e+40));e+=40;const l=zn.from(`0x${t.slice(e,e+4)}`).mul(2).toNumber();e+=4;const h=wn(`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}},Rq=e=>{if("string"==typeof e)return Rq(Sq(e));const t=e.signers.map((e=>{if(_q(e))return cm(["uint8","uint8","address"],[wq.Address,e.weight,e.address]);if(Tq(e))return cm(["uint8","uint8","bytes32","bytes32","uint8","uint8"],[wq.EOA,e.weight,e.r,e.s,e.v,e.t]);if(Aq(e)){const t=wn(e.signature).length;return cm(["uint8","uint8","address","uint16","bytes"],[wq.Full,e.weight,e.address,t,e.signature])}if(Eq(e))return cm(["uint8","uint8","bytes"],[wq.EOA,e.weight,e.signature]);throw Error("Unkwnown signature part type")}));return cm(["uint16",...Array(t.length).fill("bytes")],[e.threshold,...t])};var kq;!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.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"}(kq||(kq={}));class Oq extends Error{type;constructor(e,t){super(e),this.type=t}}const Iq=async(e,t)=>{try{return await e()}catch(e){let r;throw r=Ke(e)&&e.response?.data&&function(e){return"code"in e&&"message"in e}(e.response.data)?e.response.data.message:e.message,new Oq(r,t)}},xq="passport_credentials",Cq="pkce_state",Mq="pkce_verifier";class Pq{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=sB(e).exp??0;return t>Date.now()/1e3+3600}catch(e){return!1}}clearCredentials(){localStorage.removeItem(xq)}savePKCEData(e){localStorage.setItem(Cq,e.state),localStorage.setItem(Mq,e.verifier)}getPKCEData(){const e=localStorage.getItem(Cq),t=localStorage.getItem(Mq);return e&&t?{state:e,verifier:t}:null}}function Nq(e){const{id_token:t,expired:r}=e;return!!r||function(e){if(!e)return!1;const t=sB(e),r=Math.floor(Date.now()/1e3);return t.exp<r}(t)}const Bq={headers:{"Content-Type":"application/x-www-form-urlencoded"}};function Dq(e){return new Promise((t=>{setTimeout(t,e)}))}class Fq{userManager;config;deviceCredentialsManager;logoutMode;constructor(e){this.config=e,this.userManager=new class{constructor(e){this._logger=new hB("UserManager"),this.settings=new qB(e),this._client=new class{constructor(e){this._logger=new hB("OidcClient"),this.settings=new RB(e),this.metadataService=new class{constructor(e){this._settings=e,this._logger=new hB("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new AB(["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 hB("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:CB;for(const r of e)MB.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 hB("ResponseValidator"),this._userInfoService=new class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new hB("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const r=bB.decode(e);return t.debug("JWT decoding successful"),r}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new AB(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 kB(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 wB(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 wB(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=bB.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){const e=bB.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 kB(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 hB("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 IB({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 xB(vB.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:IB.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 xB(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 xB(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 hB("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 OB({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")}}(vB.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 wB(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:OB.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"),OB.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 hB("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 hB("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new HB({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,t=!1){this._logger.create("callback"),HB.notifyOpener(e,t)}}(this.settings),this._iframeNavigator=new class{constructor(e){this._settings=e,this._logger=new hB("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new zB({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),zB.notifyParent(e,this._settings.iframeNotifyParentOrigin)}}(this.settings),this._events=new GB(this.settings),this._silentRenewService=new class{constructor(e){this._userManager=e,this._logger=new hB("SilentRenewService"),this._isStarted=!1,this._retryTimer=new gB("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 _B)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 hB("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 hB("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 PB({...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 wB)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 PB(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 wB({...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"),PB.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 TB,n=new SB({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 Pq,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=sB(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 Iq((async()=>{const e=await this.userManager.signinPopup({popupWindowFeatures:{width:410,height:450}});return Fq.mapOidcUserToDomainModel(e)}),kq.AUTHENTICATION_ERROR)}async loginCallback(){return Iq((async()=>this.userManager.signinPopupCallback()),kq.AUTHENTICATION_ERROR)}async loginWithDeviceFlow(){return Iq((async()=>{const e=await Fe.post(`${this.config.authenticationDomain}/oauth/device/code`,{client_id:this.config.oidcConfiguration.clientId,scope:this.config.oidcConfiguration.scope,audience:this.config.oidcConfiguration.audience},Bq);return{code:e.data.user_code,deviceCode:e.data.device_code,url:e.data.verification_uri_complete,interval:e.data.interval}}),kq.AUTHENTICATION_ERROR)}async connectImxDeviceFlow(e,t,r){return Iq((async()=>{const n=Date.now();for(;;){if(null!=r&&Date.now()-n>r)throw new Error("Timed out");await Dq(1e3*t);try{const t=await this.getDeviceFlowToken(e),r=Fq.mapDeviceTokenResponseToDomainUserModel(t);return r.imx?.ethAddress&&r.imx?.starkAddress&&r.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(t),r}catch(e){if(!Fe.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")}),kq.AUTHENTICATION_ERROR)}async getDeviceFlowToken(e){return(await Fe.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},Bq)).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=Fq.base64URLEncode((void 0)(32)),t=Fq.base64URLEncode(Fq.sha256(e)),r=Fq.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 Iq((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=Fq.mapDeviceTokenResponseToDomainUserModel(n);return i.imx?.ethAddress&&i.imx?.starkAddress&&i.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(n),i}),kq.AUTHENTICATION_ERROR)}async getPKCEToken(e,t){return(await Fe.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},Bq)).data}async connectImxWithCredentials(e){return Iq((async()=>{if(this.deviceCredentialsManager.areValid(e))return Fq.mapDeviceTokenResponseToDomainUserModel(e);const t=e?.refresh_token??null;if(t){return await this.refreshToken(t)}return null}),kq.AUTHENTICATION_ERROR)}async refreshToken(e){const t=(await Fe.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"refresh_token",refresh_token:e},Bq)).data;return Fq.mapDeviceTokenResponseToDomainUserModel(t)}async logout(){return Iq((async()=>"silent"===this.logoutMode?this.userManager.signoutSilent():this.userManager.signoutRedirect()),kq.LOGOUT_ERROR)}async logoutSilentCallback(e){return this.userManager.signoutSilentCallback(e)}async logoutDeviceFlow(){return Iq((async()=>{this.deviceCredentialsManager.clearCredentials()}),kq.LOGOUT_ERROR)}async loginSilent({forceRefresh:e}={forceRefresh:!1}){return Iq((async()=>this.getUser({forceRefresh:e})),kq.SILENT_LOGIN_ERROR)}async getWebUser({forceRefresh:e=!1}){if(e){const e=await this.userManager.signinSilent();return e?Fq.mapOidcUserToDomainModel(e):null}const t=await this.userManager.getUser();if(!t)return null;if(!Nq(t))return Fq.mapOidcUserToDomainModel(t);if(t.refresh_token){const e=await this.userManager.signinSilent();if(e)return Fq.mapOidcUserToDomainModel(e)}return null}async getUser({forceRefresh:e}={forceRefresh:!1}){return Iq((async()=>{const t=await this.getWebUser({forceRefresh:e});if(t)return t;const r=this.deviceCredentialsManager.getCredentials();return r?Fq.mapDeviceTokenResponseToDomainUserModel(r):null}),kq.NOT_LOGGED_IN_ERROR)}async getUserDeviceFlow(){return Iq((async()=>{const e=this.deviceCredentialsManager.getCredentials();return e?Fq.mapDeviceTokenResponseToDomainUserModel(e):null}),kq.NOT_LOGGED_IN_ERROR)}checkStoredDeviceFlowCredentials(){return this.deviceCredentialsManager.getCredentials()}}class Lq{config;magicClient;constructor(e){this.config=e}async login(e,t){return Iq((async()=>(this.magicClient=new KL(this.config.magicPublishableApiKey,{extensions:[new XL],network:t}),await this.magicClient.openid.loginWithOIDC({jwt:e,providerId:this.config.magicProviderId}),this.magicClient.rpcProvider)),kq.WALLET_CONNECTION_ERROR)}async logout(){this.magicClient?.user&&await this.magicClient.user.logout()}}const Uq=1e3,jq=3,qq=async(e,t)=>{const{retries:r=jq,interval:n=Uq,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)}))),qq(e,{retries:r-1,finalErr:i,finallyFn:a}))}finally{r<=0&&a()}var o};var zq,Hq;!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"}(zq||(zq={})),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"}(Hq||(Hq={}));class Gq extends Error{message;code;constructor(e,t){super(t),this.message=t,this.code=e}}const Vq="Transaction requires confirmation but this functionality is not supported in this environment. Please contact Immutable support if you need to enable this feature.",Kq=e=>zn.from(e).toString();class Wq{transactionAPI;messageAPI;confirmationScreen;imxEtherAddress;crossSdkBridgeEnabled;constructor({accessToken:e,confirmationScreen:t,imxEtherAddress:r,config:n}){const i=new Hj({accessToken:e,basePath:n.imxPublicApiDomain});this.confirmationScreen=t,this.transactionAPI=new zj(new Hj(i)),this.imxEtherAddress=r,this.crossSdkBridgeEnabled=n.crossSdkBridgeEnabled,this.messageAPI=new jj(i)}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 validate({payloadHash:e}){if(!(await qq((async()=>this.transactionAPI.getTransactionByID({transactionID:e,chainType:"starkex"})),{finallyFn:()=>{this.confirmationScreen.closeWindow()}})).data.id)throw new Error("Transaction doesn't exists");const t=await this.transactionAPI.evaluateTransaction({id:e,transactionEvaluationRequest:{chainType:"starkex"}}),{confirmationRequired:r}=t.data;if(r){if(this.crossSdkBridgeEnabled)throw new Error(Vq);if(!(await this.confirmationScreen.requestConfirmation(e,this.imxEtherAddress,Gj)).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?Kq(e.gasLimit):"0",target:e.to??Oa,value:e.value?Kq(e.value):"0",data:e.data?e.data.toString():"0x"})))}catch(e){const t=e instanceof Error?e.message:String(e);throw new Gq(Hq.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 Gq(Hq.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 Gq(Hq.TRANSACTION_REJECTED,Vq);if(a&&o){if(!(await this.confirmationScreen.requestConfirmation(o,this.imxEtherAddress,Vj,e)).confirmed)throw new Gq(Hq.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 Gq(Hq.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 Gq(Hq.TRANSACTION_REJECTED,Vq);if(i&&n){if(!(await this.confirmationScreen.requestMessageConfirmation(n)).confirmed)throw new Gq(Hq.TRANSACTION_REJECTED,"Signature rejected by user")}else this.confirmationScreen.closeWindow()}}var Xq,$q;!function(e){e.LOGGED_OUT="loggedOut"}(Xq||(Xq={})),function(e){e.PRODUCTION="mainnet",e.SANDBOX="goerli"}($q||($q={}));const Jq="ERC721";const Yq="ERC721";class Qq{user;starkSigner;immutableXClient;confirmationScreen;guardianClient;constructor({user:e,starkSigner:t,immutableXClient:r,confirmationScreen:n,config:i,passportEventEmitter:a}){this.user=e,this.starkSigner=t,this.immutableXClient=r,this.confirmationScreen=n,this.guardianClient=new Wq({accessToken:e.accessToken,confirmationScreen:n,imxEtherAddress:e.imx.ethAddress,config:i}),a.on(Xq.LOGGED_OUT,this.handleLogout)}handleLogout=()=>{this.user=void 0,this.starkSigner=void 0};checkIsLoggedIn(){if(void 0===this.user||void 0===this.starkSigner)throw new Oq("User has been logged out",kq.NOT_LOGGED_IN_ERROR)}async transfer(e){return this.checkIsLoggedIn(),async function({request:e,transfersApi:t,starkSigner:r,user:n,guardianClient:i}){return Iq(i.withDefaultConfirmationScreenTask((async()=>{const a=e.type===Yq?"1":e.amount,o={sender:n.imx.ethAddress,token:Xj(e),amount:a,receiver:e.receiver},s={Authorization:`Bearer ${n.accessToken}`},c=await t.getSignableTransferV1({getSignableTransferRequest:o},{headers:s});await i.validate({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}})),kq.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}registerOffchain(){throw new Oq("Operation not supported",kq.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOnchain(){throw new Oq("Operation not supported",kq.OPERATION_NOT_SUPPORTED_ERROR)}createOrder(e){return this.checkIsLoggedIn(),async function({starkSigner:e,user:t,request:r,ordersApi:n,guardianClient:i}){return Iq(i.withDefaultConfirmationScreenTask((async()=>{const{ethAddress:a}=t.imx,o=r.sell.type===Jq?"1":r.sell.amount,s=r.buy.type===Jq?"1":r.buy.amount,c={Authorization:`Bearer ${t.accessToken}`},u={user:a,amount_buy:s,token_buy:Xj(r.buy),amount_sell:o,token_sell:Xj(r.sell),fees:r.fees,split_fees:!0,expiration_timestamp:r.expiration_timestamp},f=await n.getSignableOrder({getSignableOrderRequestV3:u},{headers:c});await i.validate({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}})),kq.CREATE_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}cancelOrder(e){return this.checkIsLoggedIn(),async function({user:e,starkSigner:t,request:r,ordersApi:n,guardianClient:i}){return Iq(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.validate({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}})),kq.CANCEL_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}createTrade(e){return this.checkIsLoggedIn(),async function({request:e,tradesApi:t,user:r,starkSigner:n,guardianClient:i}){return Iq(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.validate({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})),kq.CREATE_TRADE_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,tradesApi:this.immutableXClient.tradesApi,guardianClient:this.guardianClient})}batchNftTransfer(e){return this.checkIsLoggedIn(),async function({user:e,starkSigner:t,request:r,transfersApi:n,guardianClient:i}){return Iq(i.withConfirmationScreenTask({width:480,height:784})((async()=>{const{ethAddress:a}=e.imx,o={sender_ether_key:a,signable_requests:r.map((e=>({amount:"1",token:Xj({type:Yq,tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver})))},s={Authorization:`Bearer ${e.accessToken}`},c=await n.getSignableTransfer({getSignableTransferRequestV2:o},{headers:s});await i.validate({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}})),kq.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}exchangeTransfer(e){return this.checkIsLoggedIn(),async function({user:e,starkSigner:t,request:r,exchangesApi:n}){return Iq((async()=>{const{ethAddress:i}=e.imx,a=r.amount,o=await n.getExchangeSignableTransfer({id:r.transactionID,getSignableTransferRequest:{sender:i,token:Xj(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}}),kq.EXCHANGE_TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,exchangesApi:this.immutableXClient.exchangeApi})}deposit(e){throw new Oq("Operation not supported",kq.OPERATION_NOT_SUPPORTED_ERROR)}prepareWithdrawal(e){throw new Oq("Operation not supported",kq.OPERATION_NOT_SUPPORTED_ERROR)}completeWithdrawal(e,t){throw new Oq("Operation not supported",kq.OPERATION_NOT_SUPPORTED_ERROR)}getAddress(){return this.checkIsLoggedIn(),Promise.resolve(this.user.imx.ethAddress)}}class Zq{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(){const e=await this.authManager.login();return 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 Oq("Failed to initialise",kq.WALLET_CONNECTION_ERROR);const t=await this.magicAdapter.login(e.idToken,this.config.network),r=new Qp(t).getSigner(),n=await(async e=>Iq((async()=>Rx(await zN(e))),kq.WALLET_CONNECTION_ERROR))(r);if(!e.imx?.ethAddress){const t=await this.registerStarkEx(r,n,e.accessToken);return new Qq({user:t,starkSigner:n,immutableXClient:this.immutableXClient,confirmationScreen:this.confirmationScreen,config:this.config,passportEventEmitter:this.passportEventEmitter})}return new Qq({user:e,starkSigner:n,immutableXClient:this.immutableXClient,confirmationScreen:this.confirmationScreen,config:this.config,passportEventEmitter:this.passportEventEmitter})}async registerStarkEx(e,t,r){return Iq((async()=>{await async function({ethSigner:e,starkSigner:t,usersApi:r},n){return Iq((async()=>{const i=await e.getAddress(),a=await t.getAddress(),o=await r.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:i,stark_key:a}}),{signable_message:s,payload_hash:c}=o.data,u=await Wj(s,e),f=await t.signMessage(c);return(await r.registerPassportUser({authorization:`Bearer ${n}`,registerPassportUserRequest:{eth_signature:u,ether_key:i,stark_signature:f,stark_key:a}})).statusText}),kq.USER_REGISTRATION_ERROR)}({ethSigner:e,starkSigner:t,usersApi:this.immutableXClient.usersApi},r);return await qq((async()=>{const e=await this.authManager.loginSilent({forceRefresh:!0});return!!e?.imx?e:Promise.reject(new Error("user wallet addresses not exist"))}))}),kq.REFRESH_TOKEN_ERROR)}}const ez=(e,t,r)=>{const n=t.map((t=>!e[t]&&t)).filter((e=>e)).join(", ");if(""!==n){throw new Oq(r?`${r} - ${n} cannot be null`:`${n} cannot be null`,kq.INVALID_CONFIGURATION)}};class tz{network;authenticationDomain;passportDomain;imxPublicApiDomain;magicPublishableApiKey;magicProviderId;oidcConfiguration;baseConfig;zkEvmRpcUrl;relayerUrl;multiRollupConfig;crossSdkBridgeEnabled;constructor({baseConfig:e,overrides:r,crossSdkBridgeEnabled:n,...i}){if(ez(i,["clientId","logoutRedirectUri","redirectUri"]),this.oidcConfiguration=i,this.baseConfig=e,this.crossSdkBridgeEnabled=n||!1,r)ez(r,["network","authenticationDomain","passportDomain","magicPublishableApiKey","magicProviderId","zkEvmRpcUrl","relayerUrl","imxPublicApiDomain","indexerMrBasePath","orderBookMrBasePath","passportMrBasePath"],"overrides"),this.network=r.network,this.authenticationDomain=r.authenticationDomain,this.passportDomain=r.passportDomain,this.imxPublicApiDomain=r.imxPublicApiDomain,this.magicPublishableApiKey=r.magicPublishableApiKey,this.magicProviderId=r.magicProviderId,this.zkEvmRpcUrl=r.zkEvmRpcUrl,this.relayerUrl=r.relayerUrl,this.multiRollupConfig={indexer:Ut({basePath:r.indexerMrBasePath}),orderBook:Ut({basePath:r.orderBookMrBasePath}),passport:Ut({basePath:r.passportMrBasePath})};else switch(e.environment){case t.PRODUCTION:this.network=$q.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=jt();break;case t.SANDBOX:default:this.network=$q.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=qt()}}}var rz;!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"}(rz||(rz={}));const nz="imx_passport_confirmation";class iz{config;confirmationWindow;constructor(e){this.config=e}requestConfirmation(e,t,r,n){return new Promise(((i,a)=>{const o=({data:e,origin:t})=>{if(t===this.config.passportDomain&&e.eventType===nz)switch(e.messageType){case rz.CONFIRMATION_WINDOW_READY:break;case rz.TRANSACTION_CONFIRMED:i({confirmed:!0});break;case rz.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===Gj?`${this.config.passportDomain}/transaction-confirmation/transaction?transactionId=${e}&imxEtherAddress=${t}&chainType=starkex`:`${this.config.passportDomain}/transaction-confirmation/zkevm?transactionId=${e}&imxEtherAddress=${t}&chainType=evm&chainId=${n}`,this.showConfirmationScreen(s,o,i)}))}requestMessageConfirmation(e){return new Promise(((t,r)=>{const n=({data:e,origin:n})=>{if(n===this.config.passportDomain&&e.eventType===nz)switch(e.messageType){case rz.CONFIRMATION_WINDOW_READY:break;case rz.MESSAGE_CONFIRMED:t({confirmed:!0});break;case rz.MESSAGE_REJECTED:r(new Error("Message rejected"));break;default:r(new Error("Unsupported message type"))}};if(!this.confirmationWindow)return void t({confirmed:!1});window.addEventListener("message",n);const i=`${this.config.passportDomain}/transaction-confirmation/zkevm/message?messageID=${e}`;this.showConfirmationScreen(i,n,t)}))}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.config.passportDomain}/transaction-confirmation/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.config.passportDomain}/transaction-confirmation/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===nz&&(window.removeEventListener("message",n),r.remove(),i.messageType===rz.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 az,oz;!function(e){e.PENDING="PENDING",e.SUBMITTED="SUBMITTED",e.SUCCESSFUL="SUCCESSFUL",e.REVERTED="REVERTED",e.FAILED="FAILED"}(az||(az={})),function(e){e.ACCOUNTS_CHANGED="accountsChanged"}(oz||(oz={}));class sz{emitter=new y_;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 cz=(e,t,r)=>cm(["string","uint256","address","bytes32"],["",e,t,r]),uz=async(e,t,r,n,i)=>{const a=e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit??xa,target:e.to??Oa,value:e.value??xa,data:e.data??[]})));const o=function(e,t){return $i(vo.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=wn($i(cz(r,n,o))),c=await i.signMessage(s),u=Rq({threshold:1,signers:[{weight:1,signature:`${c}02`}]}),f=new Ss($j.mainModule.abi);return f.encodeFunctionData(f.getFunction("execute"),[a,t,u])},fz=async(e,t,r,n,i)=>{const a={...e.types};delete a.EIP712Domain;const o=bs.hash(e.domain,a,e.message),s=wn($i(cz(r,n,o))),c=`${await i.signMessage(s)}02`,{signers:u}=(e=>Sq(`0000${e}`))(t);return Rq({threshold:2,signers:[...u,{weight:1,signature:c}]})},dz=e=>`eip155:${e}`;class lz{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:dz(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:dz(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:dz(r)}]},{result:i}=await this.postToRelayer(n);return i}}const hz=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,t.network);if(!i.zkEvm){const r=await async function({authManager:e,config:t,magicProvider:r,multiRollupApiClients:n,accessToken:i}){const a=new Qp(r).getSigner(),o=await a.getAddress(),s=await Wj("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 Gq(Hq.INTERNAL_ERROR,`Failed to create counterfactual address: ${e}`)}let u;if(t.crossSdkBridgeEnabled){const t=e.checkStoredDeviceFlowCredentials();if(!t||!t.refresh_token)throw new Gq(Hq.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 Gq(Hq.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}},pz=({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 Gq(Hq.INVALID_PARAMS,'eth_sendTransaction requires a "to" field');const{chainId:s}=await r.ready,c=zn.from(s),u=new Qp(t).getSigner(),f=await(async(e,t)=>{const r=await e.send("eth_getCode",[t,"latest"]);if(r&&"0x"!==r)return new cd(t,$j.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 uz([d],f,c,a.zkEvm.ethAddress,u),h=(await n.imGetFeeOptions(a.zkEvm.ethAddress,l)).find((e=>"IMX"===e.tokenSymbol));if(!h)throw new Error("Failed to retrieve fees for IMX token");const p={nonce:f,to:h.recipientAddress,value:h.tokenPrice,revertOnError:!0};await i.validateEVMTransaction({chainId:dz(s),nonce:Kq(f),user:a,metaTransactions:[d,p]});const m=await uz([d,p],f,c,a.zkEvm.ethAddress,u),b=await n.ethSendTransaction(a.zkEvm.ethAddress,m),y=await qq((async()=>{const e=await n.imGetTransactionByHash(b);if(e.status===az.PENDING)throw new Error;return e}),{retries:30,interval:1e3,finalErr:new Gq(Hq.RPC_SERVER_ERROR,"transaction hash not generated in time")});if(![az.SUBMITTED,az.SUCCESSFUL].includes(y.status)){let e=`Transaction failed to submit with status ${y.status}.`;throw y.statusMessage&&(e+=` Error message: ${y.statusMessage}`),new Gq(Hq.RPC_SERVER_ERROR,e)}return y.hash})),mz=["types","domain","primaryType","message"],bz=(e,t)=>{let r;if("string"==typeof e)try{r=JSON.parse(e)}catch(e){throw new Gq(Hq.INVALID_PARAMS,`Failed to parse typed data JSON: ${e}`)}else{if("object"!=typeof e)throw new Gq(Hq.INVALID_PARAMS,`Invalid typed data argument: ${e}`);r=e}if(!(e=>mz.every((t=>t in e)))(r))throw new Gq(Hq.INVALID_PARAMS,`Invalid typed data argument. The following properties are required: ${mz.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 Gq(Hq.INVALID_PARAMS,`Invalid chainId, expected ${t}`);return r};class yz{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,this.jsonRpcProvider=new Jh(this.config.zkEvmRpcUrl),this.multiRollupApiClients=i,this.eventEmitter=new sz,a.on(Xq.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(oz.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 hz({authManager:this.authManager,config:this.config,magicAdapter:this.magicAdapter,multiRollupApiClients:this.multiRollupApiClients});return this.user=t,this.magicProvider=e,this.relayerClient=new lz({config:this.config,jsonRpcProvider:this.jsonRpcProvider,user:this.user}),this.guardianClient=new Wq({accessToken:this.user.accessToken,confirmationScreen:this.confirmationScreen,imxEtherAddress:this.user.zkEvm.ethAddress,config:this.config}),this.eventEmitter.emit(oz.ACCOUNTS_CHANGED,[this.user.zkEvm.ethAddress]),[this.user.zkEvm.ethAddress]}case"eth_sendTransaction":if(!this.isLoggedIn())throw new Gq(zq.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");return pz({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 Gq(zq.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 Gq(Hq.INVALID_PARAMS,`${t} requires an address and a typed data JSON`);const{chainId:u}=await n.ready,f=bz(c,u);await a.validateMessage({chainID:String(u),payload:f,user:o});const d=await i.imSignTypedData(s,f),l=new Qp(r).getSigner();return fz(f,d,zn.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 Gq(zq.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 Gq?e:e instanceof Error?new Gq(Hq.INTERNAL_ERROR,e.message):new Gq(Hq.INTERNAL_ERROR,"Internal error"),{id:t,jsonrpc:r,error:n}}}async request(e){try{return this.performRequest(e)}catch(e){if(e instanceof Gq)throw e;if(e instanceof Error)throw new Gq(Hq.INTERNAL_ERROR,e.message);throw new Gq(Hq.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 Gq(Hq.INVALID_REQUEST,"Invalid request")}on(e,t){this.eventEmitter.on(e,t)}removeListener(e,t){this.eventEmitter.removeListener(e,t)}}var gz=Object.freeze({__proto__:null,JsonRpcError:Gq,get Networks(){return $q},Passport:class{authManager;config;confirmationScreen;immutableXClient;magicAdapter;multiRollupApiClients;passportImxProviderFactory;passportEventEmitter;constructor(e){this.config=new tz(e),this.authManager=new Fq(this.config),this.magicAdapter=new Lq(this.config),this.confirmationScreen=new iz(this.config),this.immutableXClient=e.overrides?.immutableXClient||new WN({baseConfig:e.baseConfig}),this.multiRollupApiClients=new Ft(this.config.multiRollupConfig),this.passportEventEmitter=new sz,this.passportImxProviderFactory=new Zq({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 loginWithDeviceFlow(){return this.authManager.loginWithDeviceFlow()}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===$q.PRODUCTION)throw new Error("EVM is not supported on production network");return new yz({passportEventEmitter:this.passportEventEmitter,authManager:this.authManager,magicAdapter:this.magicAdapter,config:this.config,confirmationScreen:this.confirmationScreen,multiRollupApiClients:this.multiRollupApiClients})}async loginCallback(){return this.authManager.loginCallback()}async logout(){await this.authManager.logout(),await this.confirmationScreen.logout(),await this.magicAdapter.logout(),this.passportEventEmitter.emit(Xq.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:Oq,get ProviderErrorCode(){return zq},get ProviderEvent(){return oz},get RpcErrorCode(){return Hq}}),vz=Jt("object"==typeof self?self.FormData:window.FormData),wz={},_z={},Ez=Yt(gq),Tz=Yt(Am),Az={},Sz=Yt(Rs),Rz=Yt(ba),kz=Yt(Ao),Oz=Yt(pd),Iz=Yt(Bn),xz=Yt(ys),Cz=Yt(Gd),Mz=Yt(kl),Pz=Yt(Ji),Nz=Yt(hn),Bz=Yt(wd),Dz=Yt(dm),Fz=Yt(Jd),Lz=Yt(gi),Uz=Yt(aa),jz=Yt(Of),qz=Yt(lo),zz=Yt(Kf),Hz=Yt(vm),Gz=Yt(Pl),Vz=Yt(Yl);!function(e){var t=$t&&$t.__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=$t&&$t.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=$t&&$t.__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=Sz;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=Rz;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(kz);e.base64=o;var s=Oz;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var c=Iz;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=Cz;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=Mz;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return d.getJsonWalletAddress}});var l=Pz;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return l.keccak256}});var h=Nz;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return h.Logger}});var p=Bz;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=Dz;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=Fz;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return b.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return b.shuffled}});var y=Lz;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(Uz);e.RLP=g;var v=jz;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=qz;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 _=zz;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=Hz;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=Gz;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return T.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return T.verifyTypedData}});var A=Vz;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=Bz;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return S.SupportedAlgorithm}});var R=qz;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return R.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return R.Utf8ErrorReason}})}(Az);var Kz={};Object.defineProperty(Kz,"__esModule",{value:!0}),Kz.DomainRegistryABI=void 0;Kz.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 Wz={};Object.defineProperty(Wz,"__esModule",{value:!0}),Wz.SeaportABIv14=void 0;Wz.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 Xz={};!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=Tz;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"}(Xz);var $z={},Jz={};Object.defineProperty(Jz,"__esModule",{value:!0}),Jz.ERC20ABI=void 0;Jz.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 Yz={};Object.defineProperty(Yz,"__esModule",{value:!0}),Yz.ERC721ABI=void 0;Yz.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 Qz,Zz={},eH={};function tH(){if(Qz)return eH;Qz=1,Object.defineProperty(eH,"__esModule",{value:!0}),eH.getItemToCriteriaMap=eH.generateCriteriaResolvers=void 0;const e=Xz,t=iH();eH.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 eH.getItemToCriteriaMap=(e,r)=>{const n=[...r];return e.reduce(((e,r)=>((0,t.isCriteriaItem)(r.itemType)&&e.set(r,n.shift()),e)),new Map)},eH}var rH,nH={};function iH(){return rH||(rH=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=Tz,r=Xz,n=tH(),i=nH;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)}}(Zz)),Zz}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findGcd=e.gcd=void 0;const t=Tz;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}}(nH);var aH={};!function(e){var t=$t&&$t.__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=Az;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)}(aH);var oH=$t&&$t.__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($z,"__esModule",{value:!0}),$z.getApprovalActions=$z.approvedItemAmount=void 0;const sH=Tz,cH=Jz,uH=Yz,fH=Xz,dH=iH(),lH=aH;$z.approvedItemAmount=(e,t,r,n)=>oH(void 0,void 0,void 0,(function*(){if((0,dH.isErc721Item)(t.itemType)||(0,dH.isErc1155Item)(t.itemType)){return new sH.Contract(t.token,uH.ERC721ABI,n).isApprovedForAll(e,r).then((e=>e?fH.MAX_INT:sH.BigNumber.from(0)))}if(t.itemType===fH.ItemType.ERC20){return new sH.Contract(t.token,cH.ERC20ABI,n).allowance(e,r)}return fH.MAX_INT})),$z.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,dH.isErc1155Item)(i);if((0,dH.isErc721Item)(i)||s){const o=new sH.Contract(e,uH.ERC721ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,operator:n,transactionMethods:(0,lH.getTransactionMethods)(o.connect(r),t&&!s?"approve":"setApprovalForAll",[n,!(t&&!s)||a])}}{const s=new sH.Contract(e,cH.ERC20ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,transactionMethods:(0,lH.getTransactionMethods)(s.connect(r),"approve",[n,t?o:fH.MAX_INT]),operator:n}}}))};var hH={},pH={},mH={};Object.defineProperty(mH,"__esModule",{value:!0}),mH.ERC1155ABI=void 0;mH.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 bH=$t&&$t.__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(pH,"__esModule",{value:!0}),pH.balanceOf=void 0;const yH=Tz,gH=mH,vH=Jz,wH=Yz,_H=Xz,EH=iH();pH.balanceOf=(e,t,r,n)=>bH(void 0,void 0,void 0,(function*(){if((0,EH.isErc721Item)(t.itemType)){const i=new yH.Contract(t.token,wH.ERC721ABI,r);return t.itemType===_H.ItemType.ERC721_WITH_CRITERIA?n?i.ownerOf(n.identifier).then((t=>yH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase())))):i.balanceOf(e):i.ownerOf(t.identifierOrCriteria).then((t=>yH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase()))))}if((0,EH.isErc1155Item)(t.itemType)){const i=new yH.Contract(t.token,gH.ERC1155ABI,r);if(t.itemType===_H.ItemType.ERC1155_WITH_CRITERIA){if(!n){const e=yH.BigNumber.from(t.startAmount),r=yH.BigNumber.from(t.endAmount);return e.gt(r)?e:r}return i.balanceOf(e,n.identifier)}return i.balanceOf(e,t.identifierOrCriteria)}if((0,EH.isErc20Item)(t.itemType)){return new yH.Contract(t.token,vH.ERC20ABI,r).balanceOf(e)}return r.getBalance(e)})),function(e){var t=$t&&$t.__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=Tz,n=Xz,i=$z,a=pH,o=tH(),s=iH(),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}}(hH);var TH,AH={},SH={},RH={},kH={},OH={exports:{}},IH={exports:{}};function xH(){return TH||(TH=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}()}(IH)),IH.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())}(OH);var CH=OH.exports,MH={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}()}(MH);var PH,NH=MH.exports,BH={},DH={exports:{}},FH={exports:{}};function LH(){return PH||(PH=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())}(FH)),FH.exports}var UH,jH={exports:{}};function qH(){return UH||(UH=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())}(jH)),jH.exports}var zH,HH={exports:{}};function GH(){return zH||(zH=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())}(HH)),HH.exports}var VH,KH={exports:{}};function WH(){return VH||(VH=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())}(KH)),KH.exports}var XH,$H={exports:{}};function JH(){return XH||(XH=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())}($H)),$H.exports}var YH,QH={exports:{}};function ZH(){return YH||(YH=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())}(QH)),QH.exports}var eG,tG={exports:{}};var rG,nG={exports:{}};function iG(){return rG||(rG=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 K=u[V];if(V<16)var W=K.high=0|e[t+2*V],X=K.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;W=(W=(W=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),K.high=W,K.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))+W+((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(),LH())}(nG)),nG.exports}var aG,oG={exports:{}};var sG,cG={exports:{}};function uG(){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(),LH())}(cG)),cG.exports}var fG,dG={exports:{}};var lG,hG={exports:{}};function pG(){return lG||(lG=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())}(hG)),hG.exports}var mG,bG={exports:{}};var yG,gG={exports:{}};function vG(){return yG||(yG=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(),ZH(),pG())}(gG)),gG.exports}var wG,_G={exports:{}};function EG(){return wG||(wG=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(),vG())}(_G)),_G.exports}var TG,AG={exports:{}};function SG(){return TG||(TG=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(),EG())}(AG)),AG.exports}var RG,kG={exports:{}};function OG(){return RG||(RG=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(),EG())}(kG)),kG.exports}var IG,xG={exports:{}};function CG(){return IG||(IG=1,function(e,t){e.exports=function(e){
|
|
31
|
+
*/cM=uM,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=ZI:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&cM.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,K,W,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],W=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,K=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^~W&$,e[31]=K^~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]=W^~$&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&K,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&W,e[39]=ee^~K&X,e[48]=ue^~te&ne,e[49]=fe^~re&ie,e[0]^=u[n],e[1]^=u[n+1]};if(i)cM.exports=_;else for(T=0;T<E.length;++T)r[E[T]]=_[E[T]]}();var fM=uM.exports;function dM(e){return"0x"+fM.keccak_256(wn(e))}let lM=!1,hM=!1;const pM={debug:1,default:2,info:2,warning:3,error:4,off:5};let mM=pM.default,bM=null;const yM=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 gM,vM;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(gM||(gM={})),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"}(vM||(vM={}));const wM="0123456789abcdef";let _M=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==pM[r]&&this.throwArgumentError("invalid log level name","logLevel",e),mM>pM[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(hM)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+=wM[t[e]>>4],r+=wM[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 vM.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 vM.CALL_EXCEPTION:case vM.INSUFFICIENT_FUNDS:case vM.MISSING_NEW:case vM.NONCE_EXPIRED:case vM.REPLACEMENT_UNDERPRICED:case vM.TRANSACTION_REPLACED:case vM.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){yM&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:yM})}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 bM||(bM=new e("logger/5.7.0")),bM}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),lM){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}hM=!!t,lM=!!r}static setLogLevel(t){const r=pM[t.toLowerCase()];null!=r?mM=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};_M.errors=vM,_M.levels=gM;var EM=tn.BN;const TM=new _M("bignumber/5.7.0"),AM={};let SM=!1,RM=class e{constructor(e,t){e!==AM&&TM.throwError("cannot call constructor directly; use BigNumber.from",_M.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return OM(IM(this).fromTwos(e))}toTwos(e){return OM(IM(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return OM(IM(this).add(IM(e)))}sub(e){return OM(IM(this).sub(IM(e)))}div(t){return e.from(t).isZero()&&xM("division-by-zero","div"),OM(IM(this).div(IM(t)))}mul(e){return OM(IM(this).mul(IM(e)))}mod(e){const t=IM(e);return t.isNeg()&&xM("division-by-zero","mod"),OM(IM(this).umod(t))}pow(e){const t=IM(e);return t.isNeg()&&xM("negative-power","pow"),OM(IM(this).pow(t))}and(e){const t=IM(e);return(this.isNegative()||t.isNeg())&&xM("unbound-bitwise-result","and"),OM(IM(this).and(t))}or(e){const t=IM(e);return(this.isNegative()||t.isNeg())&&xM("unbound-bitwise-result","or"),OM(IM(this).or(t))}xor(e){const t=IM(e);return(this.isNegative()||t.isNeg())&&xM("unbound-bitwise-result","xor"),OM(IM(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&xM("negative-width","mask"),OM(IM(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xM("negative-width","shl"),OM(IM(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xM("negative-width","shr"),OM(IM(this).shrn(e))}eq(e){return IM(this).eq(IM(e))}lt(e){return IM(this).lt(IM(e))}lte(e){return IM(this).lte(IM(e))}gt(e){return IM(this).gt(IM(e))}gte(e){return IM(this).gte(IM(e))}isNegative(){return"-"===this._hex[0]}isZero(){return IM(this).isZero()}toNumber(){try{return IM(this).toNumber()}catch(e){xM("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return TM.throwError("this platform does not support BigInt",_M.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?SM||(SM=!0,TM.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?TM.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",_M.errors.UNEXPECTED_ARGUMENT,{}):TM.throwError("BigNumber.toString does not accept parameters",_M.errors.UNEXPECTED_ARGUMENT,{})),IM(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(AM,kM(t)):t.match(/^-?[0-9]+$/)?new e(AM,kM(new EM(t))):TM.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&xM("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&xM("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(vn(r))return e.from(Rn(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&&(An(t)||"-"===t[0]&&An(t.substring(1))))return e.from(t)}return TM.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function kM(e){if("string"!=typeof e)return kM(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&TM.throwArgumentError("invalid hex","value",e),"0x00"===(e=kM(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 OM(e){return RM.from(kM(e))}function IM(e){const t=RM.from(e).toHexString();return"-"===t[0]?new EM("-"+t.substring(3),16):new EM(t.substring(2),16)}function xM(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),TM.throwError(e,_M.errors.NUMERIC_FAULT,n)}const CM=new _M("bignumber/5.7.0"),MM={},PM=RM.from(0),NM=RM.from(-1);function BM(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),CM.throwError(e,_M.errors.NUMERIC_FAULT,i)}let DM="0";for(;DM.length<256;)DM+=DM;function FM(e){if("number"!=typeof e)try{e=RM.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+DM.substring(0,e):CM.throwArgumentError("invalid decimal size","decimals",e)}function LM(e,t){null==t&&(t=0);const r=FM(t),n=(e=RM.from(e)).lt(PM);n&&(e=e.mul(NM));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 UM(e,t){null==t&&(t=0);const r=FM(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||CM.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&CM.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&CM.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&&BM("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=RM.from(a),c=RM.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(NM)),u}let jM=class e{constructor(e,t,r,n){e!==MM&&CM.throwError("cannot use FixedFormat constructor; use FixedFormat.from",_M.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=FM(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||CM.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&&CM.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&&CM.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&CM.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(MM,r,n,i)}},qM=class e{constructor(e,t,r,n){e!==MM&&CM.throwError("cannot use FixedNumber constructor; use FixedNumber.from",_M.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&&CM.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(t){this._checkFormat(t);const r=UM(this._value,this.format.decimals),n=UM(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=UM(this._value,this.format.decimals),n=UM(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=UM(this._value,this.format.decimals),n=UM(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=UM(this._value,this.format.decimals),n=UM(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(zM.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(zM.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)&&CM.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=e.from("1"+DM.substring(0,t),this.format),i=HM.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&&CM.throwArgumentError("invalid byte width","width",e);return Mn(RM.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&&(RM.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||An(e)||"bigint"==typeof e||vn(e))}(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(LM(t,r),jM.from(n))}static fromString(t,r){null==r&&(r="fixed");const n=jM.from(r),i=UM(t,n.decimals);!n.signed&&i.lt(PM)&&BM("unsigned value cannot be negative","overflow","value",t);let a=null;n.signed?a=i.toTwos(n.width).toHexString():(a=i.toHexString(),a=Mn(a,n.width/8));const o=LM(i,n.decimals);return new e(MM,a,o,n)}static fromBytes(t,r){null==r&&(r="fixed");const n=jM.from(r);if(wn(t).length>n.width/8)throw new Error("overflow");let i=RM.from(t);n.signed&&(i=i.fromTwos(n.width));const a=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=LM(i,n.decimals);return new e(MM,a,o,n)}static from(t,r){if("string"==typeof t)return e.fromString(t,r);if(vn(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(t){if(t.code!==_M.errors.INVALID_ARGUMENT)throw t}return CM.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}};const zM=qM.from(1),HM=qM.from("0.5"),GM=new _M("strings/5.7.0");var VM,KM;function WM(e,t=VM.current){t!=VM.current&&(GM.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 wn(r)}function XM(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 $M(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 JM(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 YM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?JM(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function QM(e,t,r){return ZM.apply(this,arguments)}function ZM(){return(ZM=QI(nx.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return nx.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 YM({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=YM(YM({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=dM(WM(JSON.stringify(o))),e.next=6,sx(s,t);case 6:return c=e.sent,u=YM(YM({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 eP(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 tP(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 rP(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)?rP(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 rP(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 nP(e){return iP.apply(this,arguments)}function iP(){return(iP=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return nx.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:eP(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,sx(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 aP(e){return oP.apply(this,arguments)}function oP(){return(oP=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return nx.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:eP({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,sx(u,r);case 13:f=e.sent,d=[],l=tP(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"}(VM||(VM={})),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"}(KM||(KM={})),$M("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))),XM("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"),XM("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"),XM("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})),$M("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 sP=new _M("units/5.7.0"),cP=["wei","kwei","mwei","gwei","szabo","finney","ether"];function uP(e,t){if("string"!=typeof e&&sP.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=cP.indexOf(t);-1!==e&&(t=3*e)}return UM(e,null!=t?t:18)}function fP(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 dP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fP(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function lP(e,t,r,n,i,a,o){return hP.apply(this,arguments)}function hP(){return(hP=QI(nx.mark((function e(t,r,n,i,a,o,s){var c,u,f;return nx.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,oM(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(dP(dP({},f),{},{value:r})));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pP(e,t,r,n,i,a){return mP.apply(this,arguments)}function mP(){return(mP=QI(nx.mark((function e(t,r,n,i,a,o){var s;return nx.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(dP(dP({},s),{},{value:r})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bP(e,t,r,n,i,a){return yP.apply(this,arguments)}function yP(){return(yP=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u,f,d,l,h,p,m,b,y;return nx.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=uP(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=UI.connect(o.ethConfiguration.coreContractAddress,t),y=$I.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,iM(p,y);case 19:if(e.sent){e.next=24;break}return e.abrupt("return",lP(t,u,h,p,m,b,i));case 24:return e.abrupt("return",pP(t,u,h,p,m,b));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gP(e,t,r,n,i,a){return vP.apply(this,arguments)}function vP(){return(vP=QI(nx.mark((function e(t,r,n,i,a,o){var s;return nx.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 wP(e,t,r,n,i,a,o){return _P.apply(this,arguments)}function _P(){return(_P=QI(nx.mark((function e(t,r,n,i,a,o,s){var c,u,f;return nx.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,oM(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 EP(e,t,r,n,i,a,o){return TP.apply(this,arguments)}function TP(){return(TP=QI(nx.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 nx.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=uP(r.amount,0),h=NI.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,_=RM.from(b.data.amount),E=UI.connect(s.ethConfiguration.coreContractAddress,t),T=$I.connect(s.ethConfiguration.registrationContractAddress,t),e.next=30,iM(v,T);case 30:if(e.sent){e.next=35;break}return e.abrupt("return",wP(t,_,g,v,w,E,i));case 35:return e.abrupt("return",gP(t,_,g,v,w,E));case 36: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=QI(nx.mark((function e(t,r,n,i,a,o){var s;return nx.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 RP(e,t,r,n,i,a){return kP.apply(this,arguments)}function kP(){return(kP=QI(nx.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 nx.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=UI.connect(o.ethConfiguration.coreContractAddress,t),b=$I.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,iM(h,b);case 19:return y=e.sent,g=DI.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,oM(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",AP(t,r.tokenId,l,h,p,m));case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var OP=function(e){if(void 0!==e)return e;throw new Error("undefined field exception")};function IP(e){return xP.apply(this,arguments)}function xP(){return(xP=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p;return nx.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=eP(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,dx(c,r);case 19:return d=e.sent,l=d.ethAddress,h=d.ethSignature,e.next=24,i.createWithdrawal({createWithdrawalRequest:{stark_key:OP(o.data.stark_key),amount:a,asset_id:OP(o.data.asset_id),vault_id:OP(o.data.vault_id),nonce:OP(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 CP(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 MP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?CP(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function PP(e,t,r,n){return NP.apply(this,arguments)}function NP(){return(NP=QI(nx.mark((function e(t,r,n,i){var a;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.encodeAsset({assetType:t,encodeAssetRequest:{token:MP({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 BP(e,t,r,n,i){return DP.apply(this,arguments)}function DP(){return(DP=QI(nx.mark((function e(t,r,n,i,a){var o,s,c;return nx.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,oM(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 FP(e,t,r,n){return LP.apply(this,arguments)}function LP(){return(LP=QI(nx.mark((function e(t,r,n,i){var a;return nx.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 UP(e,t,r,n,i,a){return jP.apply(this,arguments)}function jP(){return(jP=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PP("asset","ERC20",i,{token_address:n.tokenAddress});case 2:return s=e.sent,c=UI.connect(o.ethConfiguration.coreContractAddress,t),u=$I.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,iM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",BP(t,s.asset_type,r,u,a));case 12:return e.abrupt("return",FP(t,s.asset_type,r,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qP(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 zP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qP(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function HP(e,t,r,n,i){return GP.apply(this,arguments)}function GP(){return(GP=QI(nx.mark((function e(t,r,n,i,a){var o;return nx.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 VP(e,t,r,n,i,a){return KP.apply(this,arguments)}function KP(){return(KP=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u;return nx.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,oM(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 WP(e){var t=e.data.id,r=e.data.blueprint||"";return Ab(tb("{".concat(t,"}:{").concat(r,"}")))}function XP(e,t,r,n,i,a){return $P.apply(this,arguments)}function $P(){return($P=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u,f;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PP("mintable-asset","ERC721",i,zP({id:n.data.id,token_address:n.data.tokenAddress},n.data.blueprint&&{blueprint:n.data.blueprint}));case 2:return s=e.sent,c=WP(n),u=UI.connect(o.ethConfiguration.coreContractAddress,t),f=$I.connect(o.ethConfiguration.registrationContractAddress,t),e.next=8,iM(r,f);case 8:if(e.sent){e.next=13;break}return e.abrupt("return",VP(t,s.asset_type,r,c,f,a));case 13:return e.abrupt("return",HP(t,s.asset_type,r,c,u));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function JP(e,t,r,n,i,a){return YP.apply(this,arguments)}function YP(){return(YP=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u;return nx.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,oM(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 QP(e,t,r,n,i){return ZP.apply(this,arguments)}function ZP(){return(ZP=QI(nx.mark((function e(t,r,n,i,a){var o;return nx.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 eN(e,t,r,n,i,a){return tN.apply(this,arguments)}function tN(){return(tN=QI(nx.mark((function e(t,r,n,i,a,o){var s,c,u;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PP("asset","ERC721",i,{token_id:n.tokenId,token_address:n.tokenAddress});case 2:return s=e.sent,c=UI.connect(o.ethConfiguration.coreContractAddress,t),u=$I.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,iM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",JP(t,s.asset_type,r,n.tokenId,u,a));case 12:return e.abrupt("return",QP(t,s.asset_type,r,n.tokenId,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function rN(e,t,r,n,i,a,o){return nN.apply(this,arguments)}function nN(){return(nN=QI(nx.mark((function e(t,r,n,i,a,o,s){var c,u;return nx.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 XP(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 eN(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 iN(e,t,r,n,i){return aN.apply(this,arguments)}function aN(){return(aN=QI(nx.mark((function e(t,r,n,i,a){var o,s,c;return nx.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,oM(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 oN(e,t,r,n){return sN.apply(this,arguments)}function sN(){return(sN=QI(nx.mark((function e(t,r,n,i){var a;return nx.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 cN(e,t,r,n,i){return uN.apply(this,arguments)}function uN(){return(uN=QI(nx.mark((function e(t,r,n,i,a){var o,s,c;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,PP("asset","ETH",n);case 2:return o=e.sent,s=UI.connect(a.ethConfiguration.coreContractAddress,t),c=$I.connect(a.ethConfiguration.registrationContractAddress,t),e.next=7,iM(r,c);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",iN(t,o.asset_type,r,c,i));case 12:return e.abrupt("return",oN(t,o.asset_type,r,s));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fN(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 dN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fN(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function lN(e){return hN.apply(this,arguments)}function hN(){return(hN=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return nx.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:eP(i.buy),amount_sell:s,token_sell:eP(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,sx(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",dN({},g.data));case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pN(e){return mN.apply(this,arguments)}function mN(){return(mN=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return nx.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,sx(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 bN(e){return yN.apply(this,arguments)}function yN(){return(yN=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return nx.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,sx(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 gN(e){return vN.apply(this,arguments)}function vN(){return(vN=QI(nx.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return nx.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:eP(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,sx(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 wN(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 _N(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wN(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var EN=function(){function e(t){II(this,e),this.config=t;var r=t.apiConfiguration;this.config=t,this.depositsApi=new rC(r),this.encodingApi=new oC(r),this.mintsApi=new EC(r),this.ordersApi=new xC(r),this.tokensApi=new LC(r),this.tradesApi=new zC(r),this.transfersApi=new KC(r),this.usersApi=new JC(r),this.withdrawalsApi=new eM(r),this.projectsApi=new NC(r),this.collectionsApi=new Qx(r),this.metadataApi=new pC(r),this.metadataRefreshesApi=new gC(r),this.exchangesApi=new fC(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 CI(e,[{key:"isChainValid",value:function(e){return e===this.config.ethConfiguration.chainID}},{key:"validateChain",value:(O=QI(nx.mark((function e(t){var r;return nx.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=QI(nx.mark((function e(t){return nx.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",rM(_N(_N({},t),{},{usersApi:this.usersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"isRegisteredOnchain",value:(R=QI(nx.mark((function e(t){var r,n;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return r=$I.connect(this.config.ethConfiguration.registrationContractAddress,t.ethSigner),e.next=5,t.starkSigner.getAddress();case 5:return n=e.sent,e.abrupt("return",iM(n,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"mint",value:(S=QI(nx.mark((function e(t,r){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",QM(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=QI(nx.mark((function e(t,r){return nx.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",nP(_N(_N({},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=QI(nx.mark((function e(t,r){return nx.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",gN(_N(_N({},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=QI(nx.mark((function e(t,r){return nx.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",aP(_N(_N({},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:(_=QI(nx.mark((function e(t,r){return nx.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=QI(nx.mark((function e(t,r){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",bP(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=QI(nx.mark((function e(t,r){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",EP(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=QI(nx.mark((function e(t,r){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",RP(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=QI(nx.mark((function e(t,r){return nx.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",IP(_N(_N(_N({},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=QI(nx.mark((function e(t,r){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",cN(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=QI(nx.mark((function e(t,r,n){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",UP(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=QI(nx.mark((function e(t,r,n){return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",rN(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=QI(nx.mark((function e(t,r){return nx.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",lN(_N(_N({},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=QI(nx.mark((function e(t,r){return nx.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",pN(_N(_N({},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=QI(nx.mark((function e(t,r){return nx.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",bN(_N(_N({},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=QI(nx.mark((function e(t,r){var n;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r){var n;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n,i,a){var o;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r){var n;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n){var i;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n){var i;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n,i){var a;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n,i){var a,o;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r,n,i){var a,o;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r){var n,i;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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=QI(nx.mark((function e(t,r){var n,i;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ux(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 TN=function(e){HI(r,Ox(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=jI(e);if(t){var i=jI(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return KI(this,r)}}(r);function r(e){var n,i=e.code,a=e.details,o=e.message;return II(this,r),(n=t.call(this,o)).code=i,n.details=a,n}return CI(r)}();function AN(e){if(OI.isAxiosError(e)&&e.response){var t,r,n,i=e.response.data;return i.code&&i.message?new TN({code:i.code,details:i.details,message:i.message}):new TN({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 TN({code:"unknown_error_code",message:String(e)})}var SN=function(){function e(t){II(this,e),this.depositsApi=new rC(t.apiConfiguration),this.mintsApi=new EC(t.apiConfiguration),this.ordersApi=new xC(t.apiConfiguration),this.tokensApi=new LC(t.apiConfiguration),this.tradesApi=new zC(t.apiConfiguration),this.transfersApi=new KC(t.apiConfiguration),this.exchangeApi=new fC(t.apiConfiguration),this.usersApi=new JC(t.apiConfiguration),this.withdrawalsApi=new eM(t.apiConfiguration),this.balanceApi=new Xx(t.apiConfiguration),this.assetApi=new Gx(t.apiConfiguration),this.collectionApi=new Qx(t.apiConfiguration),this.metadataApi=new pC(t.apiConfiguration),this.metadataRefreshesApi=new gC(t.apiConfiguration),this.nftCheckoutPrimaryApi=new RC(t.apiConfiguration),this.projectsApi=new NC(t.apiConfiguration),this.workflows=new EN(t)}var t,r,n;return CI(e,[{key:"deposit",value:function(e,t){return this.workflows.deposit(e,t).catch((function(e){throw AN(e)}))}},{key:"getDeposit",value:function(e){return this.depositsApi.getDeposit(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listDeposits",value:function(e){return this.depositsApi.listDeposits(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"registerOffchain",value:function(e){return this.workflows.registerOffchain(e).catch((function(e){throw AN(e)}))}},{key:"isRegisteredOnchain",value:function(e){return this.workflows.isRegisteredOnchain(e).catch((function(e){throw AN(e)}))}},{key:"getUser",value:function(e){return this.usersApi.getUsers({user:e}).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"getAsset",value:function(e){return this.assetApi.getAsset(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listAssets",value:function(e){return this.assetApi.listAssets(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"createCollection",value:function(e,t){return this.workflows.createCollection(e,t).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"getCollection",value:function(e){return this.collectionApi.getCollection(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listCollectionFilters",value:function(e){return this.collectionApi.listCollectionFilters(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listCollections",value:function(e){return this.collectionApi.listCollections(e).then((function(e){return e.data})).catch((function(e){throw AN(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 AN(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 AN(e)}))}},{key:"getMetadataSchema",value:function(e){return this.metadataApi.getMetadataSchema(e).then((function(e){return e.data})).catch((function(e){throw AN(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 AN(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 AN(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 AN(e)}))}},{key:"getMetadataRefreshResults",value:function(e,t){return this.workflows.getMetadataRefreshResults(e,t).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"createMetadataRefresh",value:function(e,t){return this.workflows.createMetadataRefresh(e,t).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"createProject",value:(n=QI(nx.mark((function e(t,r){return nx.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 AN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getProject",value:(r=QI(nx.mark((function e(t,r){return nx.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 AN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getProjects",value:(t=QI(nx.mark((function e(t,r,n,i,a){return nx.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 AN(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 AN(e)}))}},{key:"listBalances",value:function(e){return this.balanceApi.listBalances(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"getMint",value:function(e){return this.mintsApi.getMint(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listMints",value:function(e){return this.mintsApi.listMints(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"mint",value:function(e,t){return this.workflows.mint(e,t).catch((function(e){throw AN(e)}))}},{key:"listWithdrawals",value:function(e){return this.withdrawalsApi.listWithdrawals(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"getWithdrawal",value:function(e){return this.withdrawalsApi.getWithdrawal(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"prepareWithdrawal",value:function(e,t){return this.workflows.prepareWithdrawal(e,t).catch((function(e){throw AN(e)}))}},{key:"completeWithdrawal",value:function(e,t,r){return this.workflows.completeWithdrawal(e,t,r).catch((function(e){throw AN(e)}))}},{key:"getOrder",value:function(e){return this.ordersApi.getOrderV3(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listOrders",value:function(e){return this.ordersApi.listOrdersV3(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"createOrder",value:function(e,t){return this.workflows.createOrder(e,t).catch((function(e){throw AN(e)}))}},{key:"cancelOrder",value:function(e,t){return this.workflows.cancelOrder(e,t).catch((function(e){throw AN(e)}))}},{key:"getTrade",value:function(e){return this.tradesApi.getTrade(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listTrades",value:function(e){return this.tradesApi.listTradesV3(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"createTrade",value:function(e,t){return this.workflows.createTrade(e,t).catch((function(e){throw AN(e)}))}},{key:"getToken",value:function(e){return this.tokensApi.getToken(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listTokens",value:function(e){return this.tokensApi.listTokens(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"getTransfer",value:function(e){return this.transfersApi.getTransfer(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"listTransfers",value:function(e){return this.transfersApi.listTransfers(e).then((function(e){return e.data})).catch((function(e){throw AN(e)}))}},{key:"transfer",value:function(e,t){return this.workflows.transfer(e,t).catch((function(e){throw AN(e)}))}},{key:"batchNftTransfer",value:function(e,t){return this.workflows.batchNftTransfer(e,t).catch((function(e){throw AN(e)}))}},{key:"createExchange",value:function(e){return this.exchangeApi.createExchange(e).catch((function(e){throw AN(e)}))}},{key:"getExchange",value:function(e){return this.exchangeApi.getExchange(e).catch((function(e){throw AN(e)}))}},{key:"getExchanges",value:function(e){return this.exchangeApi.getExchanges(e).catch((function(e){throw AN(e)}))}},{key:"exchangeTransfer",value:function(e,t){return this.workflows.exchangeTransfer(e,t).catch((function(e){throw AN(e)}))}},{key:"createNftPrimary",value:function(e){return this.nftCheckoutPrimaryApi.createNftPrimary(e).catch((function(e){throw AN(e)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(e){return this.nftCheckoutPrimaryApi.getCurrenciesNFTCheckoutPrimary(e).catch((function(e){throw AN(e)}))}},{key:"getNftPrimaryTransaction",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransaction(e).catch((function(e){throw AN(e)}))}},{key:"getNftPrimaryTransactions",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransactions(e).catch((function(e){throw AN(e)}))}}]),e}();function RN(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 kN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?RN(Object(r),!0).forEach((function(t){MI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):RN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ON={"x-sdk-version":"imx-core-sdk-ts-".concat("2.0.2")},IN=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&&(ON["x-sdk-version"]=o),a=kN(kN({},a||{}),ON),{apiConfiguration:new tM({basePath:i,baseOptions:{headers:a}}),ethConfiguration:{coreContractAddress:t,registrationContractAddress:r,chainID:n}}},xN={get PRODUCTION(){return IN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"})},get SANDBOX(){return IN({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"})},createConfig:IN},CN=new tn("08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f",16);new kb.ec(new kb.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:CN.toString("hex"),hash:Fu.sha256,gRed:!1,g:["1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca","5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"]}));var MN=function(){var e=new tn("1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000",16);return e.sub(e.mod(CN))};function PN(e,t){return new tn(Fu.sha256().update($m(_b(e)+yb(rb(t),2))).digest("hex"),16)}function NN(e){for(var t=MN(),r=PN(e.toString("hex",64),0),n=0;r.gte(t);n++)r=PN(r.toString("hex"),n);return r.umod(CN).toString("hex")}function BN(e){for(var t=MN(),r=PN(e.toString("hex",64),0),n=1;r.gte(t);n++)r=PN(r.toString("hex"),n);return r.umod(CN).toString("hex")}function DN(e){var t=MN();return PN(e.toString("hex",64),0).gte(t)}function FN(e){return LN.apply(this,arguments)}function LN(){return(LN=QI(nx.mark((function e(t){var r,n;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=new SN(xN.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 TN&&"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 UN(e,t){var r=Hk.hdkey.fromMasterSeed(Buffer.from(e.slice(2),"hex")).derivePath(t).getWallet().getPrivateKey();return new tn(r)}function jN(e,t,r){return qN.apply(this,arguments)}function qN(){return(qN=QI(nx.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return nx.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=UN(t,r),a=BN(i),DN(i)){e.next=4;break}return e.abrupt("return",a);case 4:return e.next=6,FN(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 tn(_b(o.starkPublicKey),16),e.next=14,Rx(a).getAddress();case 14:if(c=e.sent,!s.eq(new tn(_b(c),16))){e.next=17;break}return e.abrupt("return",a);case 17:return u=NN(i),e.next=20,Rx(u).getAddress();case 20:if(c=e.sent,!s.eq(new tn(_b(c),16))){e.next=23;break}return e.abrupt("return",u);case 23:return f=Ax(t,r),d=Tx(f),e.next=27,Rx(d).getAddress();case 27:if(c=e.sent,!s.eq(new tn(_b(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 zN(e){return HN.apply(this,arguments)}function HN(){return(HN=QI(nx.mark((function e(t){var r,n,i,a,o;return nx.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=Pn(n).s,a=_x("starkex","immutablex",r,"1"),e.next=10,jN(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)}_M.errors.INSUFFICIENT_FUNDS,_M.errors.NONCE_EXPIRED,_M.errors.REPLACEMENT_UNDERPRICED;const GN=({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n})=>xN.createConfig({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n,sdkVersion:"ts-immutable-sdk-0.24.1"}),VN=()=>GN({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"});class KN{immutableXConfig;baseConfig;constructor({baseConfig:e,overrides:r}){if(this.baseConfig=e,r)this.immutableXConfig=r.immutableXConfig;else switch(e.environment){case t.SANDBOX:this.immutableXConfig=VN();break;case t.PRODUCTION:this.immutableXConfig=GN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"});break;default:this.immutableXConfig=VN()}}}class WN{immutableX;depositsApi;mintsApi;ordersApi;tokensApi;tradesApi;transfersApi;exchangeApi;nftCheckoutPrimaryApi;usersApi;withdrawalsApi;balanceApi;assetApi;collectionApi;metadataApi;metadataRefreshesApi;projectsApi;constructor(e){const t=new KN(e);this.immutableX=new SN(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 XN=Object.freeze({__proto__:null,IMXError:TN,ImmutableXClient:WN,imxClientCreateStarkSigner:Rx,imxClientGenerateLegacyStarkPrivateKey:zN});var $N={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!==$t&&$t.crypto&&(r=$t.crypto),!r)try{r=Bb}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}()}($N);var JN=$N.exports,YN=Jt(JN),QN={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}(JN)}(QN);var ZN=Jt(QN.exports),eB={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}(JN)}(eB);var tB=Jt(eB.exports),rB={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(JN)}(rB);var nB=Jt(rB.exports);function iB(e){this.message=e}iB.prototype=new Error,iB.prototype.name="InvalidCharacterError";var aB="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new iB("'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 oB(e){this.message=e}function sB(e,t){if("string"!=typeof e)throw new oB("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(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(aB(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 aB(t)}}(e.split(".")[r]))}catch(e){throw new oB("Invalid token specified: "+e.message)}}oB.prototype=new Error,oB.prototype.name="InvalidTokenError";var cB,uB,fB,dB={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},lB=(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))(lB||{});(fB=lB||(lB={})).reset=function(){cB=3,uB=dB},fB.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");cB=e},fB.setLogger=function(e){uB=e};var hB=class{constructor(e){this._name=e}debug(...e){cB>=4&&uB.debug(hB._format(this._name,this._method),...e)}info(...e){cB>=3&&uB.info(hB._format(this._name,this._method),...e)}warn(...e){cB>=2&&uB.warn(hB._format(this._name,this._method),...e)}error(...e){cB>=1&&uB.error(hB._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 hB(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){const r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){cB>=4&&uB.debug(hB._format(e),...t)}static info(e,...t){cB>=3&&uB.info(hB._format(e),...t)}static warn(e,...t){cB>=2&&uB.warn(hB._format(e),...t)}static error(e,...t){cB>=1&&uB.error(hB._format(e),...t)}};lB.reset();var pB=class{static _randomWord(){return YN.lib.WordArray.random(1).words[0]}static generateUUIDv4(){const e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^pB._randomWord()&15>>+e/4).toString(16)));return e.replace(/-/g,"")}static generateCodeVerifier(){return pB.generateUUIDv4()+pB.generateUUIDv4()+pB.generateUUIDv4()}static generateCodeChallenge(e){try{const t=ZN(e);return tB.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw hB.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const r=nB.parse([e,t].join(":"));return tB.stringify(r)}},mB=class{constructor(e){this._name=e,this._logger=new hB(`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)}},bB=class{static decode(e){try{return sB(e)}catch(e){throw hB.error("JwtUtils.decode",e),e}}},yB=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(",")}},gB=class extends mB{constructor(){super(...arguments),this._logger=new hB(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-gB.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=gB.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=gB.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)}},vB=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))}},wB=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 hB.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}},_B=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},EB=class{constructor(e){this._logger=new hB("AccessTokenEvents"),this._expiringTimer=new gB("Access token expiring"),this._expiredTimer=new gB("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)}},TB=class{constructor(){this._logger=new hB("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]}},AB=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new hB("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 _B("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 wB(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 wB(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)}))}},SB=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new hB("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}},RB=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 TB;this.stateStore=new SB({store:e})}this.refreshTokenAllowedScope=x,this.extraQueryParams=C,this.extraTokenParams=M,this.extraHeaders=P}},kB=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new hB("TokenClient"),this._jsonService=new AB(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=pB.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=pB.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=pB.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")}},OB=class{constructor(e){this.id=e.id||pB.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=gB.getEpochTime(),this.request_type=e.request_type}toStorageString(){return new hB("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})}static fromStorageString(e){return hB.createStatic("State","fromStorageString"),new OB(JSON.parse(e))}static async clearStaleState(e,t){const r=hB.createStatic("State","clearStaleState"),n=gB.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=OB.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))}}},IB=class extends OB{constructor(e){super(e),!0===e.code_verifier?this.code_verifier=pB.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=pB.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 hB("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){hB.createStatic("SigninState","fromStorageString");const t=JSON.parse(e);return new IB(t)}},xB=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-gB.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+gB.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},CB=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],MB=["sub","iss","aud","exp","iat"],PB=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-gB.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+gB.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 hB("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 hB.createStatic("User","fromStorageString"),new PB(JSON.parse(e))}},NB="oidc-client",BB=class{constructor(){this._abort=new mB("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)===NB){try{const r=vB.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:NB,url:t,keepOpen:r},n)}},DB={location:!1,toolbar:!1,height:640},FB="_blank",LB=60,UB=2,jB=10,qB=class extends RB{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:n=DB,popupWindowTarget:i=FB,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=UB,query_status_response_type:y="code",stopCheckSessionOnError:g=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:w=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=LB,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 TB;this.userStore=new SB({store:e})}}},zB=class extends BB{constructor({silentRequestTimeoutInSeconds:e=jB}){super(),this._logger=new hB("IFrameWindow"),this._timeoutInSeconds=e,this._frame=zB.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 _B("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)}},HB=class extends BB{constructor({popupWindowTarget:e=FB,popupWindowFeatures:t={}}){super(),this._logger=new hB("PopupWindow");const r=yB.center({...DB,...t});this._window=window.open(void 0,e,yB.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)}},GB=class extends EB{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new hB("UserManagerEvents"),this._userLoaded=new mB("User loaded"),this._userUnloaded=new mB("User unloaded"),this._silentRenewError=new mB("Silent renew error"),this._userSignedIn=new mB("User signed in"),this._userSignedOut=new mB("User signed out"),this._userSessionChanged=new mB("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()}},VB=(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))(VB||{}),KB=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(KB||{}),WB=(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))(WB||{}),XB=(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.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_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="mc_get_wallet_info",e.ShowUI="mc_wallet",e.NFTPurchase="magic_nft_purchase",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.UpdatePhoneNumber="magic_auth_update_phone_number",e.UpdatePhoneNumberTestMode="magic_auth_update_phone_number_testing_mode",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e))(XB||{}),$B=(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))($B||{}),JB=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(JB||{}),YB=(e=>(e.Harmony="HARMONY",e))(YB||{}),QB=Object.create,ZB=Object.defineProperty,eD=Object.defineProperties,tD=Object.getOwnPropertyDescriptor,rD=Object.getOwnPropertyDescriptors,nD=Object.getOwnPropertyNames,iD=Object.getOwnPropertySymbols,aD=Object.getPrototypeOf,oD=Object.prototype.hasOwnProperty,sD=Object.prototype.propertyIsEnumerable,cD=(e,t,r)=>t in e?ZB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uD=(e,t)=>{for(var r in t||(t={}))oD.call(t,r)&&cD(e,r,t[r]);if(iD)for(var r of iD(t))sD.call(t,r)&&cD(e,r,t[r]);return e},fD=(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())})),dD=((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 lD={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},hD="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},pD=hD,mD=function(e){let t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=lD,n=(t=e.exports={}).re=[],i=t.src=[],a=t.t={},o=0,s=(e,t,r)=>{let s=o++;pD(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*$")})),bD=/^[0-9]+$/,yD=(e,t)=>{let r=bD.test(e),n=bD.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},gD={compareIdentifiers:yD,rcompareIdentifiers:(e,t)=>yD(t,e)},{MAX_LENGTH:vD,MAX_SAFE_INTEGER:wD}=lD,{re:_D,t:ED}=mD,{compareIdentifiers:TD}=gD,AD=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof AD){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>vD)throw new TypeError(`version is longer than ${vD} characters`);pD("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?_D[ED.LOOSE]:_D[ED.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>wD||this.major<0)throw new TypeError("Invalid major version");if(this.minor>wD||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>wD||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<wD)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(pD("SemVer.compare",this.version,this.options,e),!(e instanceof AD)){if("string"==typeof e&&e===this.version)return 0;e=new AD(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof AD||(e=new AD(e,this.options)),TD(this.major,e.major)||TD(this.minor,e.minor)||TD(this.patch,e.patch)}comparePre(e){if(e instanceof AD||(e=new AD(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(pD("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 TD(r,n)}while(++t)}compareBuild(e){e instanceof AD||(e=new AD(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(pD("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 TD(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}},SD=(e,t,r)=>new AD(e,r).compare(new AD(t,r)),RD=(e,t,r)=>0===SD(e,t,r),kD=(e,t,r)=>0!==SD(e,t,r),OD=(e,t,r)=>SD(e,t,r)>0,ID=(e,t,r)=>SD(e,t,r)>=0,xD=(e,t,r)=>SD(e,t,r)<0,CD=(e,t,r)=>SD(e,t,r)<=0,MD=(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 RD(e,r,n);case"!=":return kD(e,r,n);case">":return OD(e,r,n);case">=":return ID(e,r,n);case"<":return xD(e,r,n);case"<=":return CD(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},PD=Symbol("SemVer ANY"),ND=class{static get ANY(){return PD}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof ND){if(e.loose===!!t.loose)return e;e=e.value}pD("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===PD?this.value="":this.value=this.operator+this.semver.version,pD("comp",this)}parse(e){let t=this.options.loose?BD[DD.COMPARATORLOOSE]:BD[DD.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 AD(r[2],this.options.loose):this.semver=PD}toString(){return this.value}test(e){if(pD("Comparator.test",e,this.options.loose),this.semver===PD||e===PD)return!0;if("string"==typeof e)try{e=new AD(e,this.options)}catch(e){return!1}return MD(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof ND))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new FD(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new FD(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=MD(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),s=MD(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||i&&a||o||s}},{re:BD,t:DD}=mD,FD=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof FD)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new FD(e.raw,t);if(e instanceof ND)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?LD[UD.HYPHENRANGELOOSE]:LD[UD.HYPHENRANGE];e=e.replace(r,eF(this.options.includePrerelease)),pD("hyphen replace",e),e=e.replace(LD[UD.COMPARATORTRIM],jD),pD("comparator trim",e,LD[UD.COMPARATORTRIM]),e=(e=(e=e.replace(LD[UD.TILDETRIM],qD)).replace(LD[UD.CARETTRIM],zD)).split(/\s+/).join(" ");let n=t?LD[UD.COMPARATORLOOSE]:LD[UD.COMPARATOR];return e.split(" ").map((e=>GD(e,this.options))).join(" ").split(/\s+/).map((e=>ZD(e,this.options))).filter(this.options.loose?e=>!!e.match(n):()=>!0).map((e=>new ND(e,this.options)))}intersects(e,t){if(!(e instanceof FD))throw new TypeError("a Range is required");return this.set.some((r=>HD(r,t)&&e.set.some((e=>HD(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 AD(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(tF(this.set[t],e,this.options))return!0;return!1}},{re:LD,t:UD,comparatorTrimReplace:jD,tildeTrimReplace:qD,caretTrimReplace:zD}=mD,HD=(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},GD=(e,t)=>(pD("comp",e,t),e=XD(e,t),pD("caret",e),e=KD(e,t),pD("tildes",e),e=JD(e,t),pD("xrange",e),e=QD(e,t),pD("stars",e),e),VD=e=>!e||"x"===e.toLowerCase()||"*"===e,KD=(e,t)=>e.trim().split(/\s+/).map((e=>WD(e,t))).join(" "),WD=(e,t)=>{let r=t.loose?LD[UD.TILDELOOSE]:LD[UD.TILDE];return e.replace(r,((t,r,n,i,a)=>{let o;return pD("tilde",e,t,r,n,i,a),VD(r)?o="":VD(n)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:VD(i)?o=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(pD("replaceTilde pr",a),o=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):o=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,pD("tilde return",o),o}))},XD=(e,t)=>e.trim().split(/\s+/).map((e=>$D(e,t))).join(" "),$D=(e,t)=>{pD("caret",e,t);let r=t.loose?LD[UD.CARETLOOSE]:LD[UD.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,o)=>{let s;return pD("caret",e,t,r,i,a,o),VD(r)?s="":VD(i)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:VD(a)?s="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:o?(pD("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`):(pD("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`),pD("caret return",s),s}))},JD=(e,t)=>(pD("replaceXRanges",e,t),e.split(/\s+/).map((e=>YD(e,t))).join(" ")),YD=(e,t)=>{e=e.trim();let r=t.loose?LD[UD.XRANGELOOSE]:LD[UD.XRANGE];return e.replace(r,((r,n,i,a,o,s)=>{pD("xRange",e,r,n,i,a,o,s);let c=VD(i),u=c||VD(a),f=u||VD(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`),pD("xRange return",r),r}))},QD=(e,t)=>(pD("replaceStars",e,t),e.trim().replace(LD[UD.STAR],"")),ZD=(e,t)=>(pD("replaceGTE0",e,t),e.trim().replace(LD[t.includePrerelease?UD.GTE0PRE:UD.GTE0],"")),eF=e=>(t,r,n,i,a,o,s,c,u,f,d,l,h)=>`${r=VD(n)?"":VD(i)?`>=${n}.0.0${e?"-0":""}`:VD(a)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=VD(u)?"":VD(f)?`<${+u+1}.0.0-0`:VD(d)?`<${u}.${+f+1}.0-0`:l?`<=${u}.${f}.${d}-${l}`:e?`<${u}.${f}.${+d+1}-0`:`<=${c}`}`.trim(),tF=(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(pD(e[r].semver),e[r].semver!==ND.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},rF=(e,t,r)=>{try{t=new FD(t,r)}catch(e){return!1}return t.test(e)},{MAX_LENGTH:nF}=lD,{re:iF,t:aF}=mD,oF=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof AD)return e;if("string"!=typeof e||e.length>nF||!(t.loose?iF[aF.LOOSE]:iF[aF.FULL]).test(e))return null;try{return new AD(e,t)}catch(e){return null}},{re:sF,t:cF}=mD,uF=(e,t)=>{if(e instanceof AD)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=sF[cF.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),sF[cF.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;sF[cF.COERCERTL].lastIndex=-1}else r=e.match(sF[cF.COERCE]);return null===r?null:oF(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function fF(e){return String.fromCharCode(parseInt(e.slice(1),16))}function dF(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function lF(e){return function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,fF))}(JSON.stringify(e))}function hF(e){return JSON.parse(function(e){return decodeURIComponent(Array.from(atob(e),dF).join(""))}(e))}function pF(e){return void 0===e}function mF(e){return function(e){return null===e}(e)||pF(e)}function bF(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var yF={};var gF={"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"},vF=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,vF.prototype)}},wF=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!mF(e)&&"number"==typeof e&&Object.values(WB).includes(e)}(t)?t:WB.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(null==e?void 0:e.data)||void 0,Object.setPrototypeOf(this,wF.prototype)}},_F=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},EF=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,EF.prototype)}},TF=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 AF(){return new vF(VB.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function SF(){return new vF(VB.MalformedResponse,"Response from the Magic iframe is malformed.")}function RF(e){return new vF(VB.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 kF(e){let t=`Some extensions are incompatible with \`${yF.sdkName}@${yF.version}\`:`;return e.filter((e=>void 0!==e.compat&&null!==e.compat)).forEach((e=>{let r=e.compat[yF.sdkName];"string"==typeof r?t+=`\n - Extension \`${e.name}\` supports version(s) \`${r}\``:r||(t+=`\n - Extension \`${e.name}\` does not support ${yF.platform} environments.`)})),new vF(VB.IncompatibleExtensions,t)}function OF(e){return new vF(VB.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}\``)}function IF(){return new _F(KB.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 \`${yF.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}var xF=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function CF(){return xF.next().value}var MF=Symbol("Payload pre-processed by Magic SDK");function PF(e){return Object.defineProperty(e,MF,{value:!0,enumerable:!1}),e}function NF(e){var t,r,n;return function(e){return!!e[MF]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=CF(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],PF(e)),e}function BF(e,t=[]){return PF({params:t,method:e,jsonrpc:"2.0",id:CF()})}var DF=class{constructor(e){e instanceof DF?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):function(e){return!mF(e)&&!(pF(e.jsonrpc)||pF(e.id)||pF(e.result)&&pF(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}}},FF=((e,t,r)=>(r=null!=e?QB(aD(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of nD(t))!oD.call(e,i)&&i!==r&&ZB(e,i,{get:()=>t[i],enumerable:!(n=tD(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:ZB(r,"default",{value:e,enumerable:!0}),e)))(dD()),LF=class extends FF.default{};function UF(){let e=new LF;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var jF=Symbol("isPromiEvent");function qF(e){return!!e[jF]}function zF(e){let t=HF(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=UF(),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,{[jF]:!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 HF(e){return new Promise(((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)}))}var GF,VF=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(JB.MAGIC_HANDLE_REQUEST,NF(e)),r=zF(((e,r)=>{t.then((t=>{if(n(),t.hasError)r(new wF(t.payload.error));else{if(!t.hasResult)throw SF();e(t.payload.result)}})).catch((e=>{n(),r(e)}))})),n=this.overlay.on($B.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=BF(XB.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}},KF=class extends VF{loginWithMagicLink(e){let{email:t,showUI:r=!0,redirectURI:n}=e,i=BF(this.sdk.testMode?XB.LoginWithMagicLinkTestMode:XB.LoginWithMagicLink,[{email:t,showUI:r,redirectURI:n}]);return this.request(i)}loginWithSMS(e){let{phoneNumber:t}=e,r=BF(this.sdk.testMode?XB.LoginWithSmsTestMode:XB.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r}=e,n=BF(this.sdk.testMode?XB.LoginWithEmailOTPTestMode:XB.LoginWithEmailOTP,[{email:t,showUI:r}]);if(!r){let e=this.request(n);return e&&e.on("otp-input-sent",(e=>{this.createIntermediaryEvent("verify-email-otp",n.id)(e)})),e}return this.request(n)}loginWithCredential(e){let t=null!=e?e:"";if(!e&&"web"===yF.platform){t=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let r=BF(this.sdk.testMode?XB.LoginWithCredentialTestMode:XB.LoginWithCredential,[t]);return this.request(r)}},WF={};function XF(e){return(...t)=>fD(this,null,(function*(){return GF||(GF=yield yF.configureStorage()),yield GF.ready(),GF[e](...t)}))}((e,t)=>{for(var r in t)ZB(e,r,{get:t[r],enumerable:!0})})(WF,{clear:()=>QF,getItem:()=>$F,iterate:()=>rL,key:()=>eL,keys:()=>tL,length:()=>ZF,removeItem:()=>YF,setItem:()=>JF});var $F=XF("getItem"),JF=XF("setItem"),YF=XF("removeItem"),QF=XF("clear"),ZF=XF("length"),eL=XF("key"),tL=XF("keys"),rL=XF("iterate");function nL(){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 iL="STORE_KEY_PRIVATE_KEY",aL="STORE_KEY_PUBLIC_JWK",oL="ECDSA",sL="P-256",cL={name:oL,namedCurve:sL},uL={name:oL,namedCurve:sL};function fL(){YF(aL),YF(iL)}function dL(){return fD(this,null,(function*(){let e=yield function(){return fD(this,null,(function*(){if(function(){let e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return(yield $F(aL))||(yield function(){return fD(this,null,(function*(){let e=null,{subtle:t}=window.crypto,r=yield t.generateKey(cL,!0,["sign"]),n=yield t.exportKey("jwk",r.privateKey);e=yield t.exportKey("jwk",r.publicKey);let i=yield t.importKey("jwk",n,uL,!1,["sign"]);yield JF(iL,i),yield JF(aL,e)}))}()),$F(aL);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 $F(iL);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:nL()},i={typ:"dpop+jwt",alg:"ES256",jwk:e},a=lL(JSON.stringify(i)),o=lL(JSON.stringify(n)),s=function(e){return(new TextEncoder).encode(e)}(`${a}.${o}`),c={name:oL,hash:{name:"SHA-256"}},u=function(e){let t="";return e.forEach((e=>{t+=String.fromCharCode(e)})),hL(t)}(new Uint8Array(yield t.sign(c,r,s)));return`${a}.${o}.${u}`}))}function lL(e){return hL(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}(e))}function hL(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var pL=class extends VF{getIdToken(e){let t=BF(this.sdk.testMode?XB.GetIdTokenTestMode:XB.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=BF(this.sdk.testMode?XB.GenerateIdTokenTestMode:XB.GenerateIdToken,[e]);return this.request(t)}getMetadata(){let e=BF(this.sdk.testMode?XB.GetMetadataTestMode:XB.GetMetadata);return this.request(e)}updateEmail(e){let{email:t,showUI:r=!0}=e,n=BF(this.sdk.testMode?XB.UpdateEmailTestMode:XB.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}isLoggedIn(){let e=BF(this.sdk.testMode?XB.IsLoggedInTestMode:XB.IsLoggedIn);return this.request(e)}logout(){fL();let e=BF(this.sdk.testMode?XB.LogoutTestMode:XB.Logout);return this.request(e)}showSettings(){let e=BF(this.sdk.testMode?XB.UserSettingsTestMode:XB.UserSettings);return this.request(e)}updatePhoneNumber(){let e=BF(this.sdk.testMode?XB.UpdatePhoneNumberTestMode:XB.UpdatePhoneNumber);return this.request(e)}recoverAccount(e){let t=BF(this.sdk.testMode?XB.RecoverAccountTestMode:XB.RecoverAccount,[e]);return this.request(t)}},mL=class extends VF{connectWithUI(){let e=BF(XB.RequestAccounts);return this.request(e)}showUI(){let e=BF(XB.ShowUI);return this.request(e)}getInfo(){let e=BF(XB.GetInfo);return this.request(e)}requestUserInfoWithUI(e){let t=BF(XB.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}disconnect(){fL();let e=BF(XB.Disconnect);return this.request(e)}},{createBoundEmitterMethod:bL,createChainingEmitterMethod:yL}=UF(),gL=class extends VF{constructor(){super(...arguments),this.isMagic=!0,this.on=yL("on",this),this.once=yL("once",this),this.addListener=yL("addListener",this),this.off=yL("off",this),this.removeListener=yL("removeListener",this),this.removeAllListeners=yL("removeAllListeners",this),this.emit=bL("emit"),this.eventNames=bL("eventNames"),this.listeners=bL("listeners"),this.listenerCount=bL("listenerCount")}sendAsync(e,t){if(!t)throw OF({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(JB.MAGIC_HANDLE_REQUEST,e.map((e=>{let t=NF(e);return this.prefixPayloadMethodForTestMode(t),t}))).then((e=>{t(null,e.map((e=>((e,t)=>eD(e,rD(t)))(uD({},e.payload),{error:e.hasError?new wF(e.payload.error):null}))))}));else{let r=NF(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(JB.MAGIC_HANDLE_REQUEST,r).then((e=>{t(e.hasError?new wF(e.payload.error):null,e.payload)}))}}send(e,t){if("string"==typeof e){let r=BF(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new _F(KB.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 DF(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=BF("eth_accounts");return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){this.sdk.testMode&&(e.method=`testMode/eth/${e.method}`)}};function vL(e,t){return t?new URL(e,t):new URL(e)}var wL=["request","overlay","sdk"];function _L(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==VF.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var EL=class extends VF{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:zF,isPromiEvent:qF,encodeJSON:lF,decodeJSON:hF,createJsonRpcRequestPayload:BF,standardizeJsonRpcRequestPayload:NF,storage:WF};let e=[this,..._L(this)];wL.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 RF(t)}}))}))}init(e){this.__is_initialized__||(wL.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 TF(this,"DEPRECATION_NOTICE",`\`${t}\` will be removed from this Extension in version \`${r}\`.${n?` Use \`${n}\` instead.`:""}`)}createWarning(e,t){return new TF(this,e,t)}createError(e,t,r){return new EF(this,e,t,r)}},TL=class extends EL{};TL.Internal=class extends EL{},TL.Anonymous="anonymous extension";var AL=class extends VF{purchase(e){let t=BF(XB.NFTPurchase,[e]);return this.request(t)}};function SL(e){return!e.compat||null==e.compat[yF.sdkName]||("string"==typeof e.compat[yF.sdkName]?rF(uF(yF.version),e.compat[yF.sdkName]):!!e.compat[yF.sdkName])}function RL(e){var t;let r=null!=(t=null==e?void 0:e.extensions)?t:[],n={},i=[];if(Array.isArray(r)?r.forEach((e=>{SL(e)?(e.init(this),(e.name||e.name!==TL.Anonymous)&&(this[e.name]=e),e instanceof TL.Internal&&(bF(e.config)||(n[e.name]=e.config))):i.push(e)})):Object.keys(r).forEach((e=>{if(SL(r[e])){r[e].init(this);let t=r[e];this[e]=t,t instanceof TL.Internal&&(bF(t.config)||(n[r[e].name]=t.config))}else i.push(r[e])})),i.length)throw kF(i);return n}var kL=class{constructor(e,t){var r;if(this.apiKey=e,!e)throw AF();"react-native"===yF.platform&&(null==t?void 0:t.endpoint)&&IF().log();let{defaultEndpoint:n,version:i}=yF;this.testMode=!(null==t||!t.testMode),this.endpoint=vL(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new KF(this),this.user=new pL(this),this.wallet=new mL(this),this.nft=new AL(this),this.rpcProvider=new gL(this);let a=RL.call(this,t);this.parameters=lF(uD({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:vL(this.endpoint).host,sdk:gF[yF.sdkName],version:i,ext:bF(a)?void 0:a,locale:(null==t?void 0:t.locale)||"en_US"},yF.bundleId?{bundleId:yF.bundleId}:{}))}get overlay(){if(!kL.__overlays__.has(this.parameters)){let e=new yF.ViewController(this.endpoint,this.parameters);e.init(),kL.__overlays__.set(this.parameters,e)}return kL.__overlays__.get(this.parameters)}preload(){return fD(this,null,(function*(){yield this.overlay.ready}))}},OL=kL;function IL(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 DF(i).applyResult(t.data.response.result).applyError(t.data.response.error)}}return{}}OL.__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 fD(this,null,(function*(){return HF((r=>fD(this,null,(function*(){yield this.ready;let n=[],i=Array.isArray(t)?t.map((e=>e.id)):[],a=yield function(e,t){return fD(this,null,(function*(){let r,n=yield $F("rt");if("web"===yF.platform)try{r=yield dL()}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($B.MAGIC_HANDLE_RESPONSE,(e=>a=>{let{id:o,response:s}=IL(t,a);(function(e){fD(this,null,(function*(){!e.data.rt||(yield JF("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($B.MAGIC_OVERLAY_READY,(()=>e()))}))}listen(){this.on($B.MAGIC_HIDE_OVERLAY,(()=>{this.hideOverlay()})),this.on($B.MAGIC_SHOW_OVERLAY,(()=>{this.showOverlay()}))}},CL=Object.create,ML=Object.defineProperty,PL=Object.getOwnPropertyDescriptor,NL=Object.getOwnPropertyNames,BL=Object.getPrototypeOf,DL=Object.prototype.hasOwnProperty,FL=(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')})),LL=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),UL=(e,t,r)=>(r=null!=e?CL(BL(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of NL(t))!DL.call(e,i)&&i!==r&&ML(e,i,{get:()=>t[i],enumerable:!(n=PL(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:ML(r,"default",{value:e,enumerable:!0}),e)),jL=(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())})),qL=LL(((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 FL&&FL;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 FL&&FL,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 K(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 W={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+K(n))}else if("[object Blob]"===r){var a=new FileReader;a.onload=function(){var r="~~local_forage_type~"+e.type+"~"+K(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:K};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=W,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=W,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(W);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)}))})),zL=LL(((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})}))})),HL=UL(qL()),GL=UL(zL()),VL={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var KL=function(e,t){return Object.assign(yF,t),e}(OL,{platform:"web",sdkName:"magic-sdk",version:"13.6.2",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 _F(KB.DuplicateIframe,"Duplicate iframes found.").log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=vL(this.endpoint).host,t.title="Secure Modal",t.src=vL(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(let[t,r]of Object.entries(VL))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 jL(this,null,(function*(){let e=yield this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}))}hideOverlay(){return jL(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 jL(this,null,(function*(){let t=yield this.iframe;if(!t||!t.contentWindow)throw new vF(VB.ModalNotReady,"Modal is not ready.");t.contentWindow.postMessage(e,this.endpoint)}))}},configureStorage:()=>jL(void 0,null,(function*(){let e=HL.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(GL),yield e.setDriver([HL.default.INDEXEDDB,HL.default.LOCALSTORAGE,GL._driver]),e}))}),WL=(e=>(e.LoginWithOIDC="magic_auth_login_with_oidc",e))(WL||{}),XL=class extends TL.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 $L(e,t){return function(){return e.apply(t,arguments)}}const{toString:JL}=Object.prototype,{getPrototypeOf:YL}=Object,QL=(e=>t=>{const r=JL.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ZL=e=>(e=e.toLowerCase(),t=>QL(t)===e),eU=e=>t=>typeof t===e,{isArray:tU}=Array,rU=eU("undefined");const nU=ZL("ArrayBuffer");const iU=eU("string"),aU=eU("function"),oU=eU("number"),sU=e=>null!==e&&"object"==typeof e,cU=e=>{if("object"!==QL(e))return!1;const t=YL(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},uU=ZL("Date"),fU=ZL("File"),dU=ZL("Blob"),lU=ZL("FileList"),hU=ZL("URLSearchParams");function pU(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),tU(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 mU(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 bU="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,yU=e=>!rU(e)&&e!==bU;const gU=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&YL(Uint8Array)),vU=ZL("HTMLFormElement"),wU=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),_U=ZL("RegExp"),EU=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};pU(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},TU="abcdefghijklmnopqrstuvwxyz",AU="0123456789",SU={DIGIT:AU,ALPHA:TU,ALPHA_DIGIT:TU+TU.toUpperCase()+AU};const RU=ZL("AsyncFunction");var kU={isArray:tU,isArrayBuffer:nU,isBuffer:function(e){return null!==e&&!rU(e)&&null!==e.constructor&&!rU(e.constructor)&&aU(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||aU(e.append)&&("formdata"===(t=QL(e))||"object"===t&&aU(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&nU(e.buffer),t},isString:iU,isNumber:oU,isBoolean:e=>!0===e||!1===e,isObject:sU,isPlainObject:cU,isUndefined:rU,isDate:uU,isFile:fU,isBlob:dU,isRegExp:_U,isFunction:aU,isStream:e=>sU(e)&&aU(e.pipe),isURLSearchParams:hU,isTypedArray:gU,isFileList:lU,forEach:pU,merge:function e(){const{caseless:t}=yU(this)&&this||{},r={},n=(n,i)=>{const a=t&&mU(r,i)||i;cU(r[a])&&cU(n)?r[a]=e(r[a],n):cU(n)?r[a]=e({},n):tU(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&pU(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(pU(t,((t,n)=>{r&&aU(t)?e[n]=$L(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&&YL(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:QL,kindOfTest:ZL,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(tU(e))return e;let t=e.length;if(!oU(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:vU,hasOwnProperty:wU,hasOwnProp:wU,reduceDescriptors:EU,freezeMethods:e=>{EU(e,((t,r)=>{if(aU(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];aU(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 tU(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:mU,global:bU,isContextDefined:yU,ALPHABET:SU,generateString:(e=16,t=SU.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&aU(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=tU(e)?[]:{};return pU(e,((e,t)=>{const a=r(e,n+1);!rU(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:RU,isThenable:e=>e&&(sU(e)||aU(e))&&aU(e.then)&&aU(e.catch)};function OU(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)}kU.inherits(OU,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:kU.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const IU=OU.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(OU,xU),Object.defineProperty(IU,"isAxiosError",{value:!0}),OU.from=(e,t,r,n,i,a)=>{const o=Object.create(IU);return kU.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),OU.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function CU(e){return kU.isPlainObject(e)||kU.isArray(e)}function MU(e){return kU.endsWith(e,"[]")?e.slice(0,-2):e}function PU(e,t,r){return e?e.concat(t).map((function(e,t){return e=MU(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const NU=kU.toFlatObject(kU,{},null,(function(e){return/^is[A-Z]/.test(e)}));function BU(e,t,r){if(!kU.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=kU.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!kU.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&kU.isSpecCompliantForm(t);if(!kU.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(kU.isDate(e))return e.toISOString();if(!s&&kU.isBlob(e))throw new OU("Blob is not supported. Use a Buffer instead.");return kU.isArrayBuffer(e)||kU.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(kU.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(kU.isArray(e)&&function(e){return kU.isArray(e)&&!e.some(CU)}(e)||(kU.isFileList(e)||kU.endsWith(r,"[]"))&&(s=kU.toArray(e)))return r=MU(r),s.forEach((function(e,n){!kU.isUndefined(e)&&null!==e&&t.append(!0===o?PU([r],n,a):null===o?r:r+"[]",c(e))})),!1;return!!CU(e)||(t.append(PU(i,r,a),c(e)),!1)}const f=[],d=Object.assign(NU,{defaultVisitor:u,convertValue:c,isVisitable:CU});if(!kU.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!kU.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),kU.forEach(r,(function(r,a){!0===(!(kU.isUndefined(r)||null===r)&&i.call(t,r,kU.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),f.pop()}}(e),t}function DU(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function FU(e,t){this._pairs=[],e&&BU(e,this,t)}const LU=FU.prototype;function UU(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function jU(e,t,r){if(!t)return e;const n=r&&r.encode||UU,i=r&&r.serialize;let a;if(a=i?i(t,r):kU.isURLSearchParams(t)?t.toString():new FU(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}LU.append=function(e,t){this._pairs.push([e,t])},LU.toString=function(e){const t=e?function(t){return e.call(this,t,DU)}:DU;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var qU=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){kU.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},zU={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var HU={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:FU,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 GU(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&kU.isArray(n)?n.length:a,s)return kU.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&kU.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&kU.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(kU.isFormData(e)&&kU.isFunction(e.entries)){const r={};return kU.forEachEntry(e,((e,n)=>{t(function(e){return kU.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const VU={"Content-Type":void 0};const KU={transitional:zU,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=kU.isObject(e);i&&kU.isHTMLForm(e)&&(e=new FormData(e));if(kU.isFormData(e))return n&&n?JSON.stringify(GU(e)):e;if(kU.isArrayBuffer(e)||kU.isBuffer(e)||kU.isStream(e)||kU.isFile(e)||kU.isBlob(e))return e;if(kU.isArrayBufferView(e))return e.buffer;if(kU.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 BU(e,new HU.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return HU.isNode&&kU.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=kU.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return BU(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(kU.isString(e))try{return(t||JSON.parse)(e),kU.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||KU.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&kU.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 OU.from(e,OU.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:HU.classes.FormData,Blob:HU.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};kU.forEach(["delete","get","head"],(function(e){KU.headers[e]={}})),kU.forEach(["post","put","patch"],(function(e){KU.headers[e]=kU.merge(VU)}));var WU=KU;const XU=kU.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 $U=Symbol("internals");function JU(e){return e&&String(e).trim().toLowerCase()}function YU(e){return!1===e||null==e?e:kU.isArray(e)?e.map(YU):String(e)}function QU(e,t,r,n,i){return kU.isFunction(n)?n.call(this,t,r):(i&&(t=r),kU.isString(t)?kU.isString(n)?-1!==t.indexOf(n):kU.isRegExp(n)?n.test(t):void 0:void 0)}class ZU{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=JU(t);if(!i)throw new Error("header name must be a non-empty string");const a=kU.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=YU(e))}const a=(e,t)=>kU.forEach(e,((e,r)=>i(e,r,t)));return kU.isPlainObject(e)||e instanceof this.constructor?a(e,t):kU.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]&&XU[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=JU(e)){const r=kU.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(kU.isFunction(t))return t.call(this,e,r);if(kU.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=JU(e)){const r=kU.findKey(this,e);return!(!r||void 0===this[r]||t&&!QU(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=JU(e)){const i=kU.findKey(r,e);!i||t&&!QU(0,r[i],i,t)||(delete r[i],n=!0)}}return kU.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&&!QU(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return kU.forEach(this,((n,i)=>{const a=kU.findKey(r,i);if(a)return t[a]=YU(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]=YU(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return kU.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&kU.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[$U]=this[$U]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=JU(e);t[n]||(!function(e,t){const r=kU.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 kU.isArray(e)?e.forEach(n):n(e),this}}ZU.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),kU.freezeMethods(ZU.prototype),kU.freezeMethods(ZU);var ej=ZU;function tj(e,t){const r=this||WU,n=t||r,i=ej.from(n.headers);let a=n.data;return kU.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function rj(e){return!(!e||!e.__CANCEL__)}function nj(e,t,r){OU.call(this,null==e?"canceled":e,OU.ERR_CANCELED,t,r),this.name="CanceledError"}kU.inherits(nj,OU,{__CANCEL__:!0});var ij=HU.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),kU.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),kU.isString(n)&&o.push("path="+n),kU.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 aj(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 oj=HU.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=kU.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 cj="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=ej.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}kU.isFormData(n)&&(HU.isStandardBrowserEnv||HU.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=aj(e.baseURL,e.url);function f(){if(!c)return;const n=ej.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new OU("Request failed with status code "+r.status,[OU.ERR_BAD_REQUEST,OU.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(),jU(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 OU("Request aborted",OU.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new OU("Network Error",OU.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||zU;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new OU(t,n.clarifyTimeoutError?OU.ETIMEDOUT:OU.ECONNABORTED,e,c)),c=null},HU.isStandardBrowserEnv){const t=(e.withCredentials||oj(u))&&e.xsrfCookieName&&ij.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&kU.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),kU.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 nj(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===HU.protocols.indexOf(d)?r(new OU("Unsupported protocol "+d+":",OU.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const uj={http:null,xhr:cj};kU.forEach(uj,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var fj=e=>{e=kU.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=kU.isString(r)?uj[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new OU(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(kU.hasOwnProp(uj,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!kU.isFunction(n))throw new TypeError("adapter is not a function");return n};function dj(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nj(null,e)}function lj(e){dj(e),e.headers=ej.from(e.headers),e.data=tj.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return fj(e.adapter||WU.adapter)(e).then((function(t){return dj(e),t.data=tj.call(e,e.transformResponse,t),t.headers=ej.from(t.headers),t}),(function(t){return rj(t)||(dj(e),t&&t.response&&(t.response.data=tj.call(e,e.transformResponse,t.response),t.response.headers=ej.from(t.response.headers))),Promise.reject(t)}))}const hj=e=>e instanceof ej?e.toJSON():e;function pj(e,t){t=t||{};const r={};function n(e,t,r){return kU.isPlainObject(e)&&kU.isPlainObject(t)?kU.merge.call({caseless:r},e,t):kU.isPlainObject(t)?kU.merge({},t):kU.isArray(t)?t.slice():t}function i(e,t,r){return kU.isUndefined(t)?kU.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!kU.isUndefined(t))return n(void 0,t)}function o(e,t){return kU.isUndefined(t)?kU.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(hj(e),hj(t),!0)};return kU.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||i,o=a(e[n],t[n],n);kU.isUndefined(o)&&a!==s||(r[n]=o)})),r}const mj="1.4.0",bj={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{bj[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const yj={};bj.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 OU(n(i," has been removed"+(t?" in "+t:"")),OU.ERR_DEPRECATED);return t&&!yj[i]&&(yj[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 gj={assertOptions:function(e,t,r){if("object"!=typeof e)throw new OU("options must be an object",OU.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 OU("option "+a+" must be "+r,OU.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new OU("Unknown option "+a,OU.ERR_BAD_OPTION)}},validators:bj};const vj=gj.validators;class wj{constructor(e){this.defaults=e,this.interceptors={request:new qU,response:new qU}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=pj(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&gj.assertOptions(r,{silentJSONParsing:vj.transitional(vj.boolean),forcedJSONParsing:vj.transitional(vj.boolean),clarifyTimeoutError:vj.transitional(vj.boolean)},!1),null!=n&&(kU.isFunction(n)?t.paramsSerializer={serialize:n}:gj.assertOptions(n,{encode:vj.function,serialize:vj.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&kU.merge(i.common,i[t.method]),a&&kU.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=ej.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=[lj.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=lj.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 jU(aj((e=pj(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}kU.forEach(["delete","get","head","options"],(function(e){wj.prototype[e]=function(t,r){return this.request(pj(r||{},{method:e,url:t,data:(r||{}).data}))}})),kU.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(pj(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}wj.prototype[e]=t(),wj.prototype[e+"Form"]=t(!0)}));var _j=wj;class Ej{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 nj(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 Ej((function(t){e=t}));return{token:t,cancel:e}}}var Tj=Ej;const Aj={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(Aj).forEach((([e,t])=>{Aj[t]=e}));var Sj=Aj;const Rj=function e(t){const r=new _j(t),n=$L(_j.prototype.request,r);return kU.extend(n,_j.prototype,r,{allOwnKeys:!0}),kU.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(pj(t,r))},n}(WU);Rj.Axios=_j,Rj.CanceledError=nj,Rj.CancelToken=Tj,Rj.isCancel=rj,Rj.VERSION=mj,Rj.toFormData=BU,Rj.AxiosError=OU,Rj.Cancel=Rj.CanceledError,Rj.all=function(e){return Promise.all(e)},Rj.spread=function(e){return function(t){return e.apply(null,t)}},Rj.isAxiosError=function(e){return kU.isObject(e)&&!0===e.isAxiosError},Rj.mergeConfig=pj,Rj.AxiosHeaders=ej,Rj.formToJSON=e=>GU(kU.isHTMLForm(e)?new FormData(e):e),Rj.HttpStatusCode=Sj,Rj.default=Rj;var kj=Rj;const Oj="https://guardian.sandbox.imtbl.com".replace(/\/+$/,"");class Ij{basePath;axios;configuration;constructor(e,t=Oj,r=kj){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 Cj="https://example.com",Mj=function(e,t,r){if(null==r)throw new xj(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Pj=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 Nj(e,t,r=""){"object"==typeof t?Array.isArray(t)?t.forEach((t=>Nj(e,t,r))):Object.keys(t).forEach((n=>Nj(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t)}const Bj=function(e,...t){const r=new URLSearchParams(e.search);Nj(r,t),e.search=r.toString()},Dj=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||""},Fj=function(e){return e.pathname+e.search+e.hash},Lj=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||a)+e.url};return i.request(o)}},Uj=function(e){const t=function(e){return{approvePendingMessage:async(t,r={})=>{Mj("approvePendingMessage","messageID",t);const n="/guardian/v1/messages/{messageID}/approve".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,Cj);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...r},s={};await Pj(s,e),Bj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:Fj(i),options:o}},evaluateMessage:async(t,r={})=>{Mj("evaluateMessage","messageEvaluationRequest",t);const n=new URL("/guardian/v1/messages/evaluate",Cj);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...r},o={};await Pj(o,e),o["Content-Type"]="application/json",Bj(n,{});let s=i&&i.headers?i.headers:{};return a.headers={...o,...s,...r.headers},a.data=Dj(t,a,e),{url:Fj(n),options:a}},getMessageByID:async(t,r={})=>{Mj("getMessageByID","messageID",t);const n="/guardian/v1/messages/{messageID}".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,Cj);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...r},s={};await Pj(s,e),Bj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:Fj(i),options:o}}}}(e);return{async approvePendingMessage(r,n){const i=await t.approvePendingMessage(r,n);return Lj(i,kj,Oj,e)},async evaluateMessage(r,n){const i=await t.evaluateMessage(r,n);return Lj(i,kj,Oj,e)},async getMessageByID(r,n){const i=await t.getMessageByID(r,n);return Lj(i,kj,Oj,e)}}};class jj extends Ij{approvePendingMessage(e,t){return Uj(this.configuration).approvePendingMessage(e.messageID,t).then((e=>e(this.axios,this.basePath)))}evaluateMessage(e,t){return Uj(this.configuration).evaluateMessage(e.messageEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getMessageByID(e,t){return Uj(this.configuration).getMessageByID(e.messageID,t).then((e=>e(this.axios,this.basePath)))}}const qj=function(e){const t=function(e){return{approvePendingTransaction:async(t,r,n={})=>{Mj("approvePendingTransaction","payloadHash",t),Mj("approvePendingTransaction","transactionApprovalRequest",r);const i="/guardian/v1/transactions/{payloadHash}/approve".replace("{payloadHash}",encodeURIComponent(String(t))),a=new URL(i,Cj);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Pj(c,e),c["Content-Type"]="application/json",Bj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=Dj(r,s,e),{url:Fj(a),options:s}},evaluateTransaction:async(t,r,n={})=>{Mj("evaluateTransaction","id",t),Mj("evaluateTransaction","transactionEvaluationRequest",r);const i="/guardian/v1/transactions/{id}/evaluate".replace("{id}",encodeURIComponent(String(t))),a=new URL(i,Cj);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Pj(c,e),c["Content-Type"]="application/json",Bj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=Dj(r,s,e),{url:Fj(a),options:s}},getTransactionByID:async(t,r,n,i={})=>{Mj("getTransactionByID","transactionID",t),Mj("getTransactionByID","chainType",r);const a="/guardian/v1/transactions/{transactionID}".replace("{transactionID}",encodeURIComponent(String(t))),o=new URL(a,Cj);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i},u={},f={};await Pj(u,e),void 0!==r&&(f.chainType=r),void 0!==n&&(f.chainID=n),Bj(o,f);let d=s&&s.headers?s.headers:{};return c.headers={...u,...d,...i.headers},{url:Fj(o),options:c}}}}(e);return{async approvePendingTransaction(r,n,i){const a=await t.approvePendingTransaction(r,n,i);return Lj(a,kj,Oj,e)},async evaluateTransaction(r,n,i){const a=await t.evaluateTransaction(r,n,i);return Lj(a,kj,Oj,e)},async getTransactionByID(r,n,i,a){const o=await t.getTransactionByID(r,n,i,a);return Lj(o,kj,Oj,e)}}};class zj extends Ij{approvePendingTransaction(e,t){return qj(this.configuration).approvePendingTransaction(e.payloadHash,e.transactionApprovalRequest,t).then((e=>e(this.axios,this.basePath)))}evaluateTransaction(e,t){return qj(this.configuration).evaluateTransaction(e.id,e.transactionEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionByID(e,t){return qj(this.configuration).getTransactionByID(e.transactionID,e.chainType,e.chainID,t).then((e=>e(this.axios,this.basePath)))}}class Hj{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 Gj="starkex",Vj="evm";function Kj(e){const t=-1!==new tn(e,16).cmp(new tn(27))?new tn(e,16).sub(new tn(27)).toNumber():new tn(e,16).toNumber();return e.trim()?t:void 0}async function Wj(e,t){const r=function(e,t=64){const r=_b(e);return{r:new tn(r.substring(0,t),"hex"),s:new tn(r.substring(t,2*t),"hex"),recoveryParam:Kj(r.substring(2*t,2*t+2))}}(await t.signMessage(e));return Tb(vb((n=r).r.toString(16),64)+vb(n.s.toString(16),64)+vb(n.recoveryParam?.toString(16)||"",2));var n}function Xj(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 $j={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 Jj(){return Jj=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},Jj.apply(this,arguments)}var Yj;!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"}(Yj||(Yj={}));function Qj(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=Jj({},this.config,e),this.config.logLevel){case"DEBUG":this.logLevel=Yj.DEBUG;break;case"INFO":default:this.logLevel=Yj.INFO;break;case"WARN":this.logLevel=Yj.WARN;break;case"ERROR":this.logLevel=Yj.ERROR;break;case"DISABLED":this.logLevel=Yj.DISABLED}void 0===this.config.silence&&(this.config.silence=!1)}debug(e,...t){!0!==this.config.silence&&this.logLevel===Yj.DEBUG&&console.log(e,...t)}info(e,...t){!0!==this.config.silence&&this.logLevel<=Yj.INFO&&console.log(e,...t)}warn(e,...t){!0!==this.config.silence&&this.logLevel<=Yj.WARN&&(console.warn(e,...t),this.config.onwarn&&this.config.onwarn(e,t))}error(e,...t){!0!==this.config.silence&&this.logLevel<=Yj.ERROR&&(console.error(e,...t),this.config.onerror&&this.config.onerror(e,t))}}({logLevel:"INFO",silence:!0});const Zj=(e=0,t=Number.MAX_SAFE_INTEGER)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function eq(){return eq=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},eq.apply(this,arguments)}const tq=(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),rq=e=>tq(nq(e)),nq=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},iq=(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 aq;!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"}(aq||(aq={}));const oq=e=>iq("https://${network}-indexer.sequence.app",{network:e}),sq=e=>iq("https://${network}-relayer.sequence.app",{network:e}),cq=e=>iq("https://nodes.sequence.app/${network}",{network:e}),uq={[aq.MAINNET]:{chainId:aq.MAINNET,name:"mainnet",title:"Ethereum",blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[aq.ROPSTEN]:{chainId:aq.ROPSTEN,name:"ropsten",title:"Ropsten",testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[aq.RINKEBY]:{chainId:aq.RINKEBY,name:"rinkeby",title:"Rinkeby",testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",disabled:!0},[aq.GOERLI]:{chainId:aq.GOERLI,name:"goerli",title:"Goerli",testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[aq.KOVAN]:{chainId:aq.KOVAN,name:"kovan",title:"Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"}},[aq.POLYGON]:{chainId:aq.POLYGON,name:"polygon",title:"Polygon",blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"}},[aq.POLYGON_MUMBAI]:{chainId:aq.POLYGON_MUMBAI,name:"mumbai",title:"Polygon Mumbai",testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"}},[aq.POLYGON_ZKEVM]:{chainId:aq.POLYGON_ZKEVM,name:"polygon-zkevm",title:"Polygon zkEVM",blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"}},[aq.BSC]:{chainId:aq.BSC,name:"bsc",title:"BNB Smart Chain",blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"}},[aq.BSC_TESTNET]:{chainId:aq.BSC_TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"}},[aq.OPTIMISM]:{chainId:aq.OPTIMISM,name:"optimism",title:"Optimism",blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"}},[aq.OPTIMISM_TESTNET]:{chainId:aq.OPTIMISM_TESTNET,name:"optimism-testnet",title:"Optimistic Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Optimism Testnet)",rootUrl:"https://kovan-optimistic.etherscan.io/"}},[aq.ARBITRUM]:{chainId:aq.ARBITRUM,name:"arbitrum",title:"Arbitrum One",blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"}},[aq.ARBITRUM_GOERLI]:{chainId:aq.ARBITRUM_GOERLI,name:"arbitrum-goerli",title:"Arbitrum Goerli",testnet:!0,blockExplorer:{name:"Arbiscan (Testnet)",rootUrl:"https://testnet.arbiscan.io/"}},[aq.ARBITRUM_NOVA]:{chainId:aq.ARBITRUM_NOVA,name:"arbitrum-nova",title:"Arbitrum Nova",blockExplorer:{name:"Nova Explorer",rootUrl:"https://nova-explorer.arbitrum.io/"}},[aq.AVALANCHE]:{chainId:aq.AVALANCHE,name:"avalanche",title:"Avalanche",blockExplorer:{name:"Snowtrace",rootUrl:"https://snowtrace.io/"}},[aq.AVALANCHE_TESTNET]:{chainId:aq.AVALANCHE_TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://testnet.snowtrace.io/"}},[aq.FANTOM]:{chainId:aq.FANTOM,name:"fantom",title:"Fantom",blockExplorer:{name:"FTMScan",rootUrl:"https://ftmscan.com/"}},[aq.FANTOM_TESTNET]:{chainId:aq.FANTOM_TESTNET,name:"fantom-testnet",title:"Fantom Testnet",testnet:!0,blockExplorer:{name:"FTMScan (Testnet)",rootUrl:"https://testnet.ftmscan.com/"}},[aq.GNOSIS]:{chainId:aq.GNOSIS,name:"gnosis",title:"Gnosis Chain",blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"}},[aq.AURORA]:{chainId:aq.AURORA,name:"aurora",title:"Aurora",blockExplorer:{name:"Aurora Explorer",rootUrl:"https://aurorascan.dev/"}},[aq.AURORA_TESTNET]:{chainId:aq.AURORA_TESTNET,name:"aurora-testnet",title:"Aurora Testnet",blockExplorer:{name:"Aurora Explorer (Testnet)",rootUrl:"https://testnet.aurorascan.dev/"}},[aq.BASE_GOERLI]:{chainId:aq.BASE_GOERLI,name:"base-goerli",title:"Base Goerli",blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"}}};rq([eq({},uq[aq.MAINNET],{rpcUrl:cq("mainnet"),relayer:{url:sq("mainnet")},indexerUrl:oq("mainnet")}),eq({},uq[aq.POLYGON],{rpcUrl:cq("polygon"),relayer:{url:sq("polygon")},indexerUrl:oq("polygon"),isDefaultChain:!0,isAuthChain:!0}),eq({},uq[aq.BSC],{rpcUrl:cq("bsc"),indexerUrl:oq("bsc"),relayer:{url:sq("bsc")}}),eq({},uq[aq.AVALANCHE],{rpcUrl:cq("avalanche"),indexerUrl:oq("avalanche"),relayer:{url:sq("avalanche")}}),eq({},uq[aq.ARBITRUM],{rpcUrl:cq("arbitrum"),indexerUrl:oq("arbitrum"),relayer:{url:sq("arbitrum")}}),eq({},uq[aq.ARBITRUM_NOVA],{rpcUrl:cq("arbitrum-nova"),indexerUrl:oq("arbitrum-nova"),relayer:{url:sq("arbitrum-nova")}}),eq({},uq[aq.OPTIMISM],{rpcUrl:cq("optimism"),indexerUrl:oq("optimism"),relayer:{url:sq("optimism")}}),eq({},uq[aq.POLYGON_ZKEVM],{rpcUrl:cq("polygon-zkevm"),indexerUrl:oq("polygon-zkevm"),relayer:{url:sq("polygon-zkevm")}}),eq({},uq[aq.GNOSIS],{rpcUrl:cq("gnosis"),indexerUrl:oq("gnosis"),relayer:{url:sq("gnosis")}})]),rq([eq({},uq[aq.RINKEBY],{rpcUrl:cq("rinkeby"),relayer:{url:sq("rinkeby")},indexerUrl:oq("rinkeby")}),eq({},uq[aq.GOERLI],{rpcUrl:cq("goerli"),relayer:{url:sq("goerli")},indexerUrl:oq("goerli")}),eq({},uq[aq.POLYGON_MUMBAI],{rpcUrl:cq("mumbai"),relayer:{url:sq("mumbai")},indexerUrl:oq("mumbai"),isDefaultChain:!0,isAuthChain:!0}),eq({},uq[aq.BSC_TESTNET],{rpcUrl:cq("bsc-testnet"),relayer:{url:sq("bsc-testnet")},indexerUrl:oq("bsc-testnet")}),eq({},uq[aq.ARBITRUM_GOERLI],{rpcUrl:cq("arbitrum-goerli"),relayer:{url:sq("arbitrum-goerli")},indexerUrl:oq("arbitrum-goerli")}),eq({},uq[aq.BASE_GOERLI],{rpcUrl:cq("base-goerli"),relayer:{url:sq("base-goerli")},indexerUrl:oq("base-goerli")})]);const fq="2.0";function dq(){return dq=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},dq.apply(this,arguments)}let lq;function hq(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"}(lq||(lq={}));const pq={batchSize:50,timeWindow:50,contract:"0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E",verbose:!1};let mq=class e{constructor(t){var r=this;if(this.batchableJsonRpcMethods=[lq.ethCall,lq.ethGetCode,lq.ethGetBalance],this.multicallInterface=new Ss($j.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]=hq(t,(e=>{try{if(e.next!==n)return!1;switch(e.request.method){case lq.ethCall:if(e.request.params[0].from||e.request.params[0].gasPrice||e.request.params[0].value)return!1;case lq.ethGetBalance:case lq.ethGetCode:const t=function(e){if(void 0===e)return"latest";switch(e){case"earliest":case"latest":case"pending":return e}return zn.from(e)}(e.request.params[1]);if(void 0===i&&(i=t),!function(e,t){return e===t||(zn.isBigNumber(e)?!!zn.isBigNumber(t)&&e.eq(t):!zn.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 lq.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 lq.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 lq.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]=hq(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=Zj(),u=await async function(e,t){try{return await e}catch(e){return t instanceof Function?t(e):t}}(Qj(n)({id:c,jsonrpc:fq,method:lq.ethCall,params:[{to:r.options.contract,value:0,data:s},zn.isBigNumber(i)?i.toNumber():i]}),(e=>({jsonrpc:fq,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 lq.ethCall:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:f[1][t]});break;case lq.ethGetCode:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:vo.decode(["bytes"],f[1][t])[0]});break;case lq.ethGetBalance:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:vo.decode(["uint256"],f[1][t])[0]})}else r.forward(e)}))},this.options=t?dq({},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}};mq.DefaultOptions=dq({},pq);const bq=["getNetwork","getBlockNumber","getGasPrice","getTransactionCount","getStorageAt","sendTransaction","estimateGas","getBlock","getTransaction","getTransactionReceipt","getLogs","emit","litenerCount","addListener","removeListener","waitForTransaction","detectNetwork","getBlockWithTransactions"];var yq=Object.freeze({__proto__:null,ProxyMethods:bq,MulticallProvider:class extends Fh{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 Nh(r,n.address,n.name):null}return t.getResolver(await e)},this.next=async function(e,t){try{switch(e.method){case lq.ethCall:r.callback(e,t,await r.provider.call(e.params[0],e.params[1]));break;case lq.ethGetCode:r.callback(e,t,await r.provider.getCode(e.params[0],e.params[1]));break;case lq.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=mq.isMulticall(t)?t:new mq(t),bq.forEach((t=>{void 0!==e[t]&&(this[t]=(...r)=>e[t](...r))}))}callback(e,t,r,n){t(n,{jsonrpc:fq,id:e.id,result:r,error:n})}async call(e,t){return this.rpcCall(lq.ethCall,e,t)}async getCode(e,t){return this.rpcCall(lq.ethGetCode,e,t)}async getBalance(e,t){return this.rpcCall(lq.ethGetBalance,e,t)}async rpcCall(e,...t){const r=Zj();return(await Qj(this.multicall.handle)(this.next,{jsonrpc:fq,id:r,method:e,params:t})).result}},MulticallExternalProvider:class{constructor(e,t){if(this.provider=e,this.multicall=void 0,this.multicall=mq.isMulticall(t)?t:new mq(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=mq.isMulticall(e)?e:new mq(e);return(e,n)=>r.handle(t,e,n)}}),gq=Object.freeze({__proto__:null,Multicall:mq,providers:yq});let vq,wq;try{vq=localStorage}catch(e){const t=new Map;vq={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 _q(e){return void 0!==e.address&&!function(e){return Eq(e)||Tq(e)||Aq(e)}(e)}function Eq(e){const t=e;return void 0!==t.signature&&void 0===t.address}function Tq(e){const t=e;return void 0!==t.r&&void 0!==t.s&&void 0!==t.v&&void 0!==t.t}function Aq(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"}(wq||(wq={}));const Sq=e=>{if("string"!=typeof e)return e;const t=e.replace("0x",""),r=zn.from(`0x${t.slice(0,4)}`).toNumber(),n=[];for(let e=4;e<t.length;){const r=zn.from(t.slice(e,e+2)).toNumber();e+=2;const i=zn.from(`0x${t.slice(e,e+2)}`).toNumber();switch(e+=2,r){case wq.Address:const r=da(t.slice(e,e+40));e+=40,n.push({weight:i,address:r});break;case wq.EOA:const a=wn(`0x${t.slice(e,e+132)}`);e+=132;const o=Pn(a.slice(0,65)),s=o.r,c=o.s,u=o.v,f=zn.from(a[a.length-1]).toNumber();n.push({weight:i,signature:a,r:s,s:c,v:u,t:f});break;case wq.Full:const d=da(t.slice(e,e+40));e+=40;const l=zn.from(`0x${t.slice(e,e+4)}`).mul(2).toNumber();e+=4;const h=wn(`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}},Rq=e=>{if("string"==typeof e)return Rq(Sq(e));const t=e.signers.map((e=>{if(_q(e))return cm(["uint8","uint8","address"],[wq.Address,e.weight,e.address]);if(Tq(e))return cm(["uint8","uint8","bytes32","bytes32","uint8","uint8"],[wq.EOA,e.weight,e.r,e.s,e.v,e.t]);if(Aq(e)){const t=wn(e.signature).length;return cm(["uint8","uint8","address","uint16","bytes"],[wq.Full,e.weight,e.address,t,e.signature])}if(Eq(e))return cm(["uint8","uint8","bytes"],[wq.EOA,e.weight,e.signature]);throw Error("Unkwnown signature part type")}));return cm(["uint16",...Array(t.length).fill("bytes")],[e.threshold,...t])};var kq;!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.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"}(kq||(kq={}));class Oq extends Error{type;constructor(e,t){super(e),this.type=t}}const Iq=async(e,t)=>{try{return await e()}catch(e){let r;throw r=Ke(e)&&e.response?.data&&function(e){return"code"in e&&"message"in e}(e.response.data)?e.response.data.message:e.message,new Oq(r,t)}},xq="passport_credentials",Cq="pkce_state",Mq="pkce_verifier";class Pq{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=sB(e).exp??0;return t>Date.now()/1e3+3600}catch(e){return!1}}clearCredentials(){localStorage.removeItem(xq)}savePKCEData(e){localStorage.setItem(Cq,e.state),localStorage.setItem(Mq,e.verifier)}getPKCEData(){const e=localStorage.getItem(Cq),t=localStorage.getItem(Mq);return e&&t?{state:e,verifier:t}:null}}function Nq(e){const{id_token:t,expired:r}=e;return!!r||function(e){if(!e)return!1;const t=sB(e),r=Math.floor(Date.now()/1e3);return t.exp<r}(t)}const Bq={headers:{"Content-Type":"application/x-www-form-urlencoded"}};function Dq(e){return new Promise((t=>{setTimeout(t,e)}))}class Fq{userManager;config;deviceCredentialsManager;logoutMode;constructor(e){this.config=e,this.userManager=new class{constructor(e){this._logger=new hB("UserManager"),this.settings=new qB(e),this._client=new class{constructor(e){this._logger=new hB("OidcClient"),this.settings=new RB(e),this.metadataService=new class{constructor(e){this._settings=e,this._logger=new hB("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new AB(["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 hB("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:CB;for(const r of e)MB.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 hB("ResponseValidator"),this._userInfoService=new class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new hB("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const r=bB.decode(e);return t.debug("JWT decoding successful"),r}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new AB(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 kB(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 wB(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 wB(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=bB.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){const e=bB.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 kB(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 hB("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 IB({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 xB(vB.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:IB.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 xB(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 xB(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 hB("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 OB({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")}}(vB.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 wB(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:OB.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"),OB.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 hB("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 hB("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new HB({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,t=!1){this._logger.create("callback"),HB.notifyOpener(e,t)}}(this.settings),this._iframeNavigator=new class{constructor(e){this._settings=e,this._logger=new hB("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new zB({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),zB.notifyParent(e,this._settings.iframeNotifyParentOrigin)}}(this.settings),this._events=new GB(this.settings),this._silentRenewService=new class{constructor(e){this._userManager=e,this._logger=new hB("SilentRenewService"),this._isStarted=!1,this._retryTimer=new gB("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 _B)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 hB("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 hB("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 PB({...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 wB)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 PB(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 wB({...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"),PB.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 TB,n=new SB({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 Pq,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=sB(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 Iq((async()=>{const e=await this.userManager.signinPopup({popupWindowFeatures:{width:410,height:450}});return Fq.mapOidcUserToDomainModel(e)}),kq.AUTHENTICATION_ERROR)}async loginCallback(){return Iq((async()=>this.userManager.signinPopupCallback()),kq.AUTHENTICATION_ERROR)}async loginWithDeviceFlow(){return Iq((async()=>{const e=await Fe.post(`${this.config.authenticationDomain}/oauth/device/code`,{client_id:this.config.oidcConfiguration.clientId,scope:this.config.oidcConfiguration.scope,audience:this.config.oidcConfiguration.audience},Bq);return{code:e.data.user_code,deviceCode:e.data.device_code,url:e.data.verification_uri_complete,interval:e.data.interval}}),kq.AUTHENTICATION_ERROR)}async connectImxDeviceFlow(e,t,r){return Iq((async()=>{const n=Date.now();for(;;){if(null!=r&&Date.now()-n>r)throw new Error("Timed out");await Dq(1e3*t);try{const t=await this.getDeviceFlowToken(e),r=Fq.mapDeviceTokenResponseToDomainUserModel(t);return r.imx?.ethAddress&&r.imx?.starkAddress&&r.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(t),r}catch(e){if(!Fe.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")}),kq.AUTHENTICATION_ERROR)}async getDeviceFlowToken(e){return(await Fe.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},Bq)).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=Fq.base64URLEncode((void 0)(32)),t=Fq.base64URLEncode(Fq.sha256(e)),r=Fq.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 Iq((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=Fq.mapDeviceTokenResponseToDomainUserModel(n);return i.imx?.ethAddress&&i.imx?.starkAddress&&i.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(n),i}),kq.AUTHENTICATION_ERROR)}async getPKCEToken(e,t){return(await Fe.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},Bq)).data}async connectImxWithCredentials(e){return Iq((async()=>{if(this.deviceCredentialsManager.areValid(e))return Fq.mapDeviceTokenResponseToDomainUserModel(e);const t=e?.refresh_token??null;if(t){return await this.refreshToken(t)}return null}),kq.AUTHENTICATION_ERROR)}async refreshToken(e){const t=(await Fe.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"refresh_token",refresh_token:e},Bq)).data;return Fq.mapDeviceTokenResponseToDomainUserModel(t)}async logout(){return Iq((async()=>"silent"===this.logoutMode?this.userManager.signoutSilent():this.userManager.signoutRedirect()),kq.LOGOUT_ERROR)}async logoutSilentCallback(e){return this.userManager.signoutSilentCallback(e)}async logoutDeviceFlow(){return Iq((async()=>{this.deviceCredentialsManager.clearCredentials()}),kq.LOGOUT_ERROR)}async loginSilent({forceRefresh:e}={forceRefresh:!1}){return Iq((async()=>this.getUser({forceRefresh:e})),kq.SILENT_LOGIN_ERROR)}async getWebUser({forceRefresh:e=!1}){if(e){const e=await this.userManager.signinSilent();return e?Fq.mapOidcUserToDomainModel(e):null}const t=await this.userManager.getUser();if(!t)return null;if(!Nq(t))return Fq.mapOidcUserToDomainModel(t);if(t.refresh_token){const e=await this.userManager.signinSilent();if(e)return Fq.mapOidcUserToDomainModel(e)}return null}async getUser({forceRefresh:e}={forceRefresh:!1}){return Iq((async()=>{const t=await this.getWebUser({forceRefresh:e});if(t)return t;const r=this.deviceCredentialsManager.getCredentials();return r?Fq.mapDeviceTokenResponseToDomainUserModel(r):null}),kq.NOT_LOGGED_IN_ERROR)}async getUserDeviceFlow(){return Iq((async()=>{const e=this.deviceCredentialsManager.getCredentials();return e?Fq.mapDeviceTokenResponseToDomainUserModel(e):null}),kq.NOT_LOGGED_IN_ERROR)}checkStoredDeviceFlowCredentials(){return this.deviceCredentialsManager.getCredentials()}}class Lq{config;magicClient;constructor(e){this.config=e}async login(e,t){return Iq((async()=>(this.magicClient=new KL(this.config.magicPublishableApiKey,{extensions:[new XL],network:t}),await this.magicClient.openid.loginWithOIDC({jwt:e,providerId:this.config.magicProviderId}),this.magicClient.rpcProvider)),kq.WALLET_CONNECTION_ERROR)}async logout(){this.magicClient?.user&&await this.magicClient.user.logout()}}const Uq=1e3,jq=3,qq=async(e,t)=>{const{retries:r=jq,interval:n=Uq,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)}))),qq(e,{retries:r-1,finalErr:i,finallyFn:a}))}finally{r<=0&&a()}var o};var zq,Hq;!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"}(zq||(zq={})),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"}(Hq||(Hq={}));class Gq extends Error{message;code;constructor(e,t){super(t),this.message=t,this.code=e}}const Vq="Transaction requires confirmation but this functionality is not supported in this environment. Please contact Immutable support if you need to enable this feature.",Kq=e=>zn.from(e).toString();class Wq{transactionAPI;messageAPI;confirmationScreen;imxEtherAddress;crossSdkBridgeEnabled;constructor({accessToken:e,confirmationScreen:t,imxEtherAddress:r,config:n}){const i=new Hj({accessToken:e,basePath:n.imxPublicApiDomain});this.confirmationScreen=t,this.transactionAPI=new zj(new Hj(i)),this.imxEtherAddress=r,this.crossSdkBridgeEnabled=n.crossSdkBridgeEnabled,this.messageAPI=new jj(i)}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 validate({payloadHash:e}){if(!(await qq((async()=>this.transactionAPI.getTransactionByID({transactionID:e,chainType:"starkex"})),{finallyFn:()=>{this.confirmationScreen.closeWindow()}})).data.id)throw new Error("Transaction doesn't exists");const t=await this.transactionAPI.evaluateTransaction({id:e,transactionEvaluationRequest:{chainType:"starkex"}}),{confirmationRequired:r}=t.data;if(r){if(this.crossSdkBridgeEnabled)throw new Error(Vq);if(!(await this.confirmationScreen.requestConfirmation(e,this.imxEtherAddress,Gj)).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?Kq(e.gasLimit):"0",target:e.to??Oa,value:e.value?Kq(e.value):"0",data:e.data?e.data.toString():"0x"})))}catch(e){const t=e instanceof Error?e.message:String(e);throw new Gq(Hq.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 Gq(Hq.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 Gq(Hq.TRANSACTION_REJECTED,Vq);if(a&&o){if(!(await this.confirmationScreen.requestConfirmation(o,this.imxEtherAddress,Vj,e)).confirmed)throw new Gq(Hq.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 Gq(Hq.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 Gq(Hq.TRANSACTION_REJECTED,Vq);if(i&&n){if(!(await this.confirmationScreen.requestMessageConfirmation(n)).confirmed)throw new Gq(Hq.TRANSACTION_REJECTED,"Signature rejected by user")}else this.confirmationScreen.closeWindow()}}var Xq,$q;!function(e){e.LOGGED_OUT="loggedOut"}(Xq||(Xq={})),function(e){e.PRODUCTION="mainnet",e.SANDBOX="goerli"}($q||($q={}));const Jq="ERC721";const Yq="ERC721";class Qq{user;starkSigner;immutableXClient;confirmationScreen;guardianClient;constructor({user:e,starkSigner:t,immutableXClient:r,confirmationScreen:n,config:i,passportEventEmitter:a}){this.user=e,this.starkSigner=t,this.immutableXClient=r,this.confirmationScreen=n,this.guardianClient=new Wq({accessToken:e.accessToken,confirmationScreen:n,imxEtherAddress:e.imx.ethAddress,config:i}),a.on(Xq.LOGGED_OUT,this.handleLogout)}handleLogout=()=>{this.user=void 0,this.starkSigner=void 0};checkIsLoggedIn(){if(void 0===this.user||void 0===this.starkSigner)throw new Oq("User has been logged out",kq.NOT_LOGGED_IN_ERROR)}async transfer(e){return this.checkIsLoggedIn(),async function({request:e,transfersApi:t,starkSigner:r,user:n,guardianClient:i}){return Iq(i.withDefaultConfirmationScreenTask((async()=>{const a=e.type===Yq?"1":e.amount,o={sender:n.imx.ethAddress,token:Xj(e),amount:a,receiver:e.receiver},s={Authorization:`Bearer ${n.accessToken}`},c=await t.getSignableTransferV1({getSignableTransferRequest:o},{headers:s});await i.validate({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}})),kq.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}registerOffchain(){throw new Oq("Operation not supported",kq.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOnchain(){throw new Oq("Operation not supported",kq.OPERATION_NOT_SUPPORTED_ERROR)}createOrder(e){return this.checkIsLoggedIn(),async function({starkSigner:e,user:t,request:r,ordersApi:n,guardianClient:i}){return Iq(i.withDefaultConfirmationScreenTask((async()=>{const{ethAddress:a}=t.imx,o=r.sell.type===Jq?"1":r.sell.amount,s=r.buy.type===Jq?"1":r.buy.amount,c={Authorization:`Bearer ${t.accessToken}`},u={user:a,amount_buy:s,token_buy:Xj(r.buy),amount_sell:o,token_sell:Xj(r.sell),fees:r.fees,split_fees:!0,expiration_timestamp:r.expiration_timestamp},f=await n.getSignableOrder({getSignableOrderRequestV3:u},{headers:c});await i.validate({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}})),kq.CREATE_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}cancelOrder(e){return this.checkIsLoggedIn(),async function({user:e,starkSigner:t,request:r,ordersApi:n,guardianClient:i}){return Iq(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.validate({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}})),kq.CANCEL_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}createTrade(e){return this.checkIsLoggedIn(),async function({request:e,tradesApi:t,user:r,starkSigner:n,guardianClient:i}){return Iq(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.validate({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})),kq.CREATE_TRADE_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,tradesApi:this.immutableXClient.tradesApi,guardianClient:this.guardianClient})}batchNftTransfer(e){return this.checkIsLoggedIn(),async function({user:e,starkSigner:t,request:r,transfersApi:n,guardianClient:i}){return Iq(i.withConfirmationScreenTask({width:480,height:784})((async()=>{const{ethAddress:a}=e.imx,o={sender_ether_key:a,signable_requests:r.map((e=>({amount:"1",token:Xj({type:Yq,tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver})))},s={Authorization:`Bearer ${e.accessToken}`},c=await n.getSignableTransfer({getSignableTransferRequestV2:o},{headers:s});await i.validate({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}})),kq.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}exchangeTransfer(e){return this.checkIsLoggedIn(),async function({user:e,starkSigner:t,request:r,exchangesApi:n}){return Iq((async()=>{const{ethAddress:i}=e.imx,a=r.amount,o=await n.getExchangeSignableTransfer({id:r.transactionID,getSignableTransferRequest:{sender:i,token:Xj(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}}),kq.EXCHANGE_TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,exchangesApi:this.immutableXClient.exchangeApi})}deposit(e){throw new Oq("Operation not supported",kq.OPERATION_NOT_SUPPORTED_ERROR)}prepareWithdrawal(e){throw new Oq("Operation not supported",kq.OPERATION_NOT_SUPPORTED_ERROR)}completeWithdrawal(e,t){throw new Oq("Operation not supported",kq.OPERATION_NOT_SUPPORTED_ERROR)}getAddress(){return this.checkIsLoggedIn(),Promise.resolve(this.user.imx.ethAddress)}}class Zq{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(){const e=await this.authManager.login();return 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 Oq("Failed to initialise",kq.WALLET_CONNECTION_ERROR);const t=await this.magicAdapter.login(e.idToken,this.config.network),r=new Qp(t).getSigner(),n=await(async e=>Iq((async()=>Rx(await zN(e))),kq.WALLET_CONNECTION_ERROR))(r);if(!e.imx?.ethAddress){const t=await this.registerStarkEx(r,n,e.accessToken);return new Qq({user:t,starkSigner:n,immutableXClient:this.immutableXClient,confirmationScreen:this.confirmationScreen,config:this.config,passportEventEmitter:this.passportEventEmitter})}return new Qq({user:e,starkSigner:n,immutableXClient:this.immutableXClient,confirmationScreen:this.confirmationScreen,config:this.config,passportEventEmitter:this.passportEventEmitter})}async registerStarkEx(e,t,r){return Iq((async()=>{await async function({ethSigner:e,starkSigner:t,usersApi:r},n){return Iq((async()=>{const i=await e.getAddress(),a=await t.getAddress(),o=await r.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:i,stark_key:a}}),{signable_message:s,payload_hash:c}=o.data,u=await Wj(s,e),f=await t.signMessage(c);return(await r.registerPassportUser({authorization:`Bearer ${n}`,registerPassportUserRequest:{eth_signature:u,ether_key:i,stark_signature:f,stark_key:a}})).statusText}),kq.USER_REGISTRATION_ERROR)}({ethSigner:e,starkSigner:t,usersApi:this.immutableXClient.usersApi},r);return await qq((async()=>{const e=await this.authManager.loginSilent({forceRefresh:!0});return!!e?.imx?e:Promise.reject(new Error("user wallet addresses not exist"))}))}),kq.REFRESH_TOKEN_ERROR)}}const ez=(e,t,r)=>{const n=t.map((t=>!e[t]&&t)).filter((e=>e)).join(", ");if(""!==n){throw new Oq(r?`${r} - ${n} cannot be null`:`${n} cannot be null`,kq.INVALID_CONFIGURATION)}};class tz{network;authenticationDomain;passportDomain;imxPublicApiDomain;magicPublishableApiKey;magicProviderId;oidcConfiguration;baseConfig;zkEvmRpcUrl;relayerUrl;multiRollupConfig;crossSdkBridgeEnabled;constructor({baseConfig:e,overrides:r,crossSdkBridgeEnabled:n,...i}){if(ez(i,["clientId","logoutRedirectUri","redirectUri"]),this.oidcConfiguration=i,this.baseConfig=e,this.crossSdkBridgeEnabled=n||!1,r)ez(r,["network","authenticationDomain","passportDomain","magicPublishableApiKey","magicProviderId","zkEvmRpcUrl","relayerUrl","imxPublicApiDomain","indexerMrBasePath","orderBookMrBasePath","passportMrBasePath"],"overrides"),this.network=r.network,this.authenticationDomain=r.authenticationDomain,this.passportDomain=r.passportDomain,this.imxPublicApiDomain=r.imxPublicApiDomain,this.magicPublishableApiKey=r.magicPublishableApiKey,this.magicProviderId=r.magicProviderId,this.zkEvmRpcUrl=r.zkEvmRpcUrl,this.relayerUrl=r.relayerUrl,this.multiRollupConfig={indexer:Ut({basePath:r.indexerMrBasePath}),orderBook:Ut({basePath:r.orderBookMrBasePath}),passport:Ut({basePath:r.passportMrBasePath})};else switch(e.environment){case t.PRODUCTION:this.network=$q.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=jt();break;case t.SANDBOX:default:this.network=$q.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=qt()}}}var rz;!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"}(rz||(rz={}));const nz="imx_passport_confirmation";class iz{config;confirmationWindow;constructor(e){this.config=e}requestConfirmation(e,t,r,n){return new Promise(((i,a)=>{const o=({data:e,origin:t})=>{if(t===this.config.passportDomain&&e.eventType===nz)switch(e.messageType){case rz.CONFIRMATION_WINDOW_READY:break;case rz.TRANSACTION_CONFIRMED:i({confirmed:!0});break;case rz.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===Gj?`${this.config.passportDomain}/transaction-confirmation/transaction?transactionId=${e}&imxEtherAddress=${t}&chainType=starkex`:`${this.config.passportDomain}/transaction-confirmation/zkevm?transactionId=${e}&imxEtherAddress=${t}&chainType=evm&chainId=${n}`,this.showConfirmationScreen(s,o,i)}))}requestMessageConfirmation(e){return new Promise(((t,r)=>{const n=({data:e,origin:n})=>{if(n===this.config.passportDomain&&e.eventType===nz)switch(e.messageType){case rz.CONFIRMATION_WINDOW_READY:break;case rz.MESSAGE_CONFIRMED:t({confirmed:!0});break;case rz.MESSAGE_REJECTED:r(new Error("Message rejected"));break;default:r(new Error("Unsupported message type"))}};if(!this.confirmationWindow)return void t({confirmed:!1});window.addEventListener("message",n);const i=`${this.config.passportDomain}/transaction-confirmation/zkevm/message?messageID=${e}`;this.showConfirmationScreen(i,n,t)}))}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.config.passportDomain}/transaction-confirmation/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.config.passportDomain}/transaction-confirmation/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===nz&&(window.removeEventListener("message",n),r.remove(),i.messageType===rz.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 az,oz;!function(e){e.PENDING="PENDING",e.SUBMITTED="SUBMITTED",e.SUCCESSFUL="SUCCESSFUL",e.REVERTED="REVERTED",e.FAILED="FAILED"}(az||(az={})),function(e){e.ACCOUNTS_CHANGED="accountsChanged"}(oz||(oz={}));class sz{emitter=new y_;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 cz=(e,t,r)=>cm(["string","uint256","address","bytes32"],["",e,t,r]),uz=async(e,t,r,n,i)=>{const a=e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit??xa,target:e.to??Oa,value:e.value??xa,data:e.data??[]})));const o=function(e,t){return $i(vo.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=wn($i(cz(r,n,o))),c=await i.signMessage(s),u=Rq({threshold:1,signers:[{weight:1,signature:`${c}02`}]}),f=new Ss($j.mainModule.abi);return f.encodeFunctionData(f.getFunction("execute"),[a,t,u])},fz=async(e,t,r,n,i)=>{const a={...e.types};delete a.EIP712Domain;const o=bs.hash(e.domain,a,e.message),s=wn($i(cz(r,n,o))),c=`${await i.signMessage(s)}02`,{signers:u}=(e=>Sq(`0000${e}`))(t);return Rq({threshold:2,signers:[...u,{weight:1,signature:c}]})},dz=e=>`eip155:${e}`;class lz{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:dz(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:dz(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:dz(r)}]},{result:i}=await this.postToRelayer(n);return i}}const hz=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,t.network);if(!i.zkEvm){const r=await async function({authManager:e,config:t,magicProvider:r,multiRollupApiClients:n,accessToken:i}){const a=new Qp(r).getSigner(),o=await a.getAddress(),s=await Wj("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 Gq(Hq.INTERNAL_ERROR,`Failed to create counterfactual address: ${e}`)}let u;if(t.crossSdkBridgeEnabled){const t=e.checkStoredDeviceFlowCredentials();if(!t||!t.refresh_token)throw new Gq(Hq.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 Gq(Hq.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}},pz=({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 Gq(Hq.INVALID_PARAMS,'eth_sendTransaction requires a "to" field');const{chainId:s}=await r.ready,c=zn.from(s),u=new Qp(t).getSigner(),f=await(async(e,t)=>{const r=await e.send("eth_getCode",[t,"latest"]);if(r&&"0x"!==r)return new cd(t,$j.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 uz([d],f,c,a.zkEvm.ethAddress,u),h=(await n.imGetFeeOptions(a.zkEvm.ethAddress,l)).find((e=>"IMX"===e.tokenSymbol));if(!h)throw new Error("Failed to retrieve fees for IMX token");const p={nonce:f,to:h.recipientAddress,value:h.tokenPrice,revertOnError:!0};await i.validateEVMTransaction({chainId:dz(s),nonce:Kq(f),user:a,metaTransactions:[d,p]});const m=await uz([d,p],f,c,a.zkEvm.ethAddress,u),b=await n.ethSendTransaction(a.zkEvm.ethAddress,m),y=await qq((async()=>{const e=await n.imGetTransactionByHash(b);if(e.status===az.PENDING)throw new Error;return e}),{retries:30,interval:1e3,finalErr:new Gq(Hq.RPC_SERVER_ERROR,"transaction hash not generated in time")});if(![az.SUBMITTED,az.SUCCESSFUL].includes(y.status)){let e=`Transaction failed to submit with status ${y.status}.`;throw y.statusMessage&&(e+=` Error message: ${y.statusMessage}`),new Gq(Hq.RPC_SERVER_ERROR,e)}return y.hash})),mz=["types","domain","primaryType","message"],bz=(e,t)=>{let r;if("string"==typeof e)try{r=JSON.parse(e)}catch(e){throw new Gq(Hq.INVALID_PARAMS,`Failed to parse typed data JSON: ${e}`)}else{if("object"!=typeof e)throw new Gq(Hq.INVALID_PARAMS,`Invalid typed data argument: ${e}`);r=e}if(!(e=>mz.every((t=>t in e)))(r))throw new Gq(Hq.INVALID_PARAMS,`Invalid typed data argument. The following properties are required: ${mz.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 Gq(Hq.INVALID_PARAMS,`Invalid chainId, expected ${t}`);return r};class yz{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,this.jsonRpcProvider=new Jh(this.config.zkEvmRpcUrl),this.multiRollupApiClients=i,this.eventEmitter=new sz,a.on(Xq.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(oz.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 hz({authManager:this.authManager,config:this.config,magicAdapter:this.magicAdapter,multiRollupApiClients:this.multiRollupApiClients});return this.user=t,this.magicProvider=e,this.relayerClient=new lz({config:this.config,jsonRpcProvider:this.jsonRpcProvider,user:this.user}),this.guardianClient=new Wq({accessToken:this.user.accessToken,confirmationScreen:this.confirmationScreen,imxEtherAddress:this.user.zkEvm.ethAddress,config:this.config}),this.eventEmitter.emit(oz.ACCOUNTS_CHANGED,[this.user.zkEvm.ethAddress]),[this.user.zkEvm.ethAddress]}case"eth_sendTransaction":if(!this.isLoggedIn())throw new Gq(zq.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");return pz({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 Gq(zq.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 Gq(Hq.INVALID_PARAMS,`${t} requires an address and a typed data JSON`);const{chainId:u}=await n.ready,f=bz(c,u);await a.validateMessage({chainID:String(u),payload:f,user:o});const d=await i.imSignTypedData(s,f),l=new Qp(r).getSigner();return fz(f,d,zn.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 Gq(zq.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 Gq?e:e instanceof Error?new Gq(Hq.INTERNAL_ERROR,e.message):new Gq(Hq.INTERNAL_ERROR,"Internal error"),{id:t,jsonrpc:r,error:n}}}async request(e){try{return this.performRequest(e)}catch(e){if(e instanceof Gq)throw e;if(e instanceof Error)throw new Gq(Hq.INTERNAL_ERROR,e.message);throw new Gq(Hq.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 Gq(Hq.INVALID_REQUEST,"Invalid request")}on(e,t){this.eventEmitter.on(e,t)}removeListener(e,t){this.eventEmitter.removeListener(e,t)}}var gz=Object.freeze({__proto__:null,JsonRpcError:Gq,get Networks(){return $q},Passport:class{authManager;config;confirmationScreen;immutableXClient;magicAdapter;multiRollupApiClients;passportImxProviderFactory;passportEventEmitter;constructor(e){this.config=new tz(e),this.authManager=new Fq(this.config),this.magicAdapter=new Lq(this.config),this.confirmationScreen=new iz(this.config),this.immutableXClient=e.overrides?.immutableXClient||new WN({baseConfig:e.baseConfig}),this.multiRollupApiClients=new Ft(this.config.multiRollupConfig),this.passportEventEmitter=new sz,this.passportImxProviderFactory=new Zq({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 loginWithDeviceFlow(){return this.authManager.loginWithDeviceFlow()}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===$q.PRODUCTION)throw new Error("EVM is not supported on production network");return new yz({passportEventEmitter:this.passportEventEmitter,authManager:this.authManager,magicAdapter:this.magicAdapter,config:this.config,confirmationScreen:this.confirmationScreen,multiRollupApiClients:this.multiRollupApiClients})}async loginCallback(){return this.authManager.loginCallback()}async logout(){await this.authManager.logout(),await this.confirmationScreen.logout(),await this.magicAdapter.logout(),this.passportEventEmitter.emit(Xq.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:Oq,get ProviderErrorCode(){return zq},get ProviderEvent(){return oz},get RpcErrorCode(){return Hq}}),vz=Jt("object"==typeof self?self.FormData:window.FormData),wz={},_z={},Ez=Yt(gq),Tz=Yt(Am),Az={},Sz=Yt(Rs),Rz=Yt(ba),kz=Yt(Ao),Oz=Yt(pd),Iz=Yt(Bn),xz=Yt(ys),Cz=Yt(Gd),Mz=Yt(kl),Pz=Yt(Ji),Nz=Yt(hn),Bz=Yt(wd),Dz=Yt(dm),Fz=Yt(Jd),Lz=Yt(gi),Uz=Yt(aa),jz=Yt(Of),qz=Yt(lo),zz=Yt(Kf),Hz=Yt(vm),Gz=Yt(Pl),Vz=Yt(Yl);!function(e){var t=$t&&$t.__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=$t&&$t.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=$t&&$t.__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=Sz;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=Rz;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(kz);e.base64=o;var s=Oz;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var c=Iz;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=Cz;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=Mz;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return d.getJsonWalletAddress}});var l=Pz;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return l.keccak256}});var h=Nz;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return h.Logger}});var p=Bz;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=Dz;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=Fz;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return b.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return b.shuffled}});var y=Lz;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(Uz);e.RLP=g;var v=jz;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=qz;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 _=zz;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=Hz;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=Gz;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return T.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return T.verifyTypedData}});var A=Vz;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=Bz;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return S.SupportedAlgorithm}});var R=qz;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return R.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return R.Utf8ErrorReason}})}(Az);var Kz={};Object.defineProperty(Kz,"__esModule",{value:!0}),Kz.DomainRegistryABI=void 0;Kz.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 Wz={};Object.defineProperty(Wz,"__esModule",{value:!0}),Wz.SeaportABIv14=void 0;Wz.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 Xz={};!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=Tz;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"}(Xz);var $z={},Jz={};Object.defineProperty(Jz,"__esModule",{value:!0}),Jz.ERC20ABI=void 0;Jz.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 Yz={};Object.defineProperty(Yz,"__esModule",{value:!0}),Yz.ERC721ABI=void 0;Yz.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 Qz,Zz={},eH={};function tH(){if(Qz)return eH;Qz=1,Object.defineProperty(eH,"__esModule",{value:!0}),eH.getItemToCriteriaMap=eH.generateCriteriaResolvers=void 0;const e=Xz,t=iH();eH.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 eH.getItemToCriteriaMap=(e,r)=>{const n=[...r];return e.reduce(((e,r)=>((0,t.isCriteriaItem)(r.itemType)&&e.set(r,n.shift()),e)),new Map)},eH}var rH,nH={};function iH(){return rH||(rH=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=Tz,r=Xz,n=tH(),i=nH;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)}}(Zz)),Zz}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findGcd=e.gcd=void 0;const t=Tz;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}}(nH);var aH={};!function(e){var t=$t&&$t.__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=Az;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)}(aH);var oH=$t&&$t.__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($z,"__esModule",{value:!0}),$z.getApprovalActions=$z.approvedItemAmount=void 0;const sH=Tz,cH=Jz,uH=Yz,fH=Xz,dH=iH(),lH=aH;$z.approvedItemAmount=(e,t,r,n)=>oH(void 0,void 0,void 0,(function*(){if((0,dH.isErc721Item)(t.itemType)||(0,dH.isErc1155Item)(t.itemType)){return new sH.Contract(t.token,uH.ERC721ABI,n).isApprovedForAll(e,r).then((e=>e?fH.MAX_INT:sH.BigNumber.from(0)))}if(t.itemType===fH.ItemType.ERC20){return new sH.Contract(t.token,cH.ERC20ABI,n).allowance(e,r)}return fH.MAX_INT})),$z.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,dH.isErc1155Item)(i);if((0,dH.isErc721Item)(i)||s){const o=new sH.Contract(e,uH.ERC721ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,operator:n,transactionMethods:(0,lH.getTransactionMethods)(o.connect(r),t&&!s?"approve":"setApprovalForAll",[n,!(t&&!s)||a])}}{const s=new sH.Contract(e,cH.ERC20ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,transactionMethods:(0,lH.getTransactionMethods)(s.connect(r),"approve",[n,t?o:fH.MAX_INT]),operator:n}}}))};var hH={},pH={},mH={};Object.defineProperty(mH,"__esModule",{value:!0}),mH.ERC1155ABI=void 0;mH.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 bH=$t&&$t.__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(pH,"__esModule",{value:!0}),pH.balanceOf=void 0;const yH=Tz,gH=mH,vH=Jz,wH=Yz,_H=Xz,EH=iH();pH.balanceOf=(e,t,r,n)=>bH(void 0,void 0,void 0,(function*(){if((0,EH.isErc721Item)(t.itemType)){const i=new yH.Contract(t.token,wH.ERC721ABI,r);return t.itemType===_H.ItemType.ERC721_WITH_CRITERIA?n?i.ownerOf(n.identifier).then((t=>yH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase())))):i.balanceOf(e):i.ownerOf(t.identifierOrCriteria).then((t=>yH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase()))))}if((0,EH.isErc1155Item)(t.itemType)){const i=new yH.Contract(t.token,gH.ERC1155ABI,r);if(t.itemType===_H.ItemType.ERC1155_WITH_CRITERIA){if(!n){const e=yH.BigNumber.from(t.startAmount),r=yH.BigNumber.from(t.endAmount);return e.gt(r)?e:r}return i.balanceOf(e,n.identifier)}return i.balanceOf(e,t.identifierOrCriteria)}if((0,EH.isErc20Item)(t.itemType)){return new yH.Contract(t.token,vH.ERC20ABI,r).balanceOf(e)}return r.getBalance(e)})),function(e){var t=$t&&$t.__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=Tz,n=Xz,i=$z,a=pH,o=tH(),s=iH(),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}}(hH);var TH,AH={},SH={},RH={},kH={},OH={exports:{}},IH={exports:{}};function xH(){return TH||(TH=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}()}(IH)),IH.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())}(OH);var CH=OH.exports,MH={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}()}(MH);var PH,NH=MH.exports,BH={},DH={exports:{}},FH={exports:{}};function LH(){return PH||(PH=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())}(FH)),FH.exports}var UH,jH={exports:{}};function qH(){return UH||(UH=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())}(jH)),jH.exports}var zH,HH={exports:{}};function GH(){return zH||(zH=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())}(HH)),HH.exports}var VH,KH={exports:{}};function WH(){return VH||(VH=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())}(KH)),KH.exports}var XH,$H={exports:{}};function JH(){return XH||(XH=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())}($H)),$H.exports}var YH,QH={exports:{}};function ZH(){return YH||(YH=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())}(QH)),QH.exports}var eG,tG={exports:{}};var rG,nG={exports:{}};function iG(){return rG||(rG=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 K=u[V];if(V<16)var W=K.high=0|e[t+2*V],X=K.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;W=(W=(W=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),K.high=W,K.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))+W+((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(),LH())}(nG)),nG.exports}var aG,oG={exports:{}};var sG,cG={exports:{}};function uG(){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(),LH())}(cG)),cG.exports}var fG,dG={exports:{}};var lG,hG={exports:{}};function pG(){return lG||(lG=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())}(hG)),hG.exports}var mG,bG={exports:{}};var yG,gG={exports:{}};function vG(){return yG||(yG=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(),ZH(),pG())}(gG)),gG.exports}var wG,_G={exports:{}};function EG(){return wG||(wG=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(),vG())}(_G)),_G.exports}var TG,AG={exports:{}};function SG(){return TG||(TG=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(),EG())}(AG)),AG.exports}var RG,kG={exports:{}};function OG(){return RG||(RG=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(),EG())}(kG)),kG.exports}var IG,xG={exports:{}};function CG(){return IG||(IG=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
|
-
*/x8.exports=function(){if(N8)return C8;N8=1;var e=B8,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 C8.Fragment=r,C8.jsx=o,C8.jsxs=o,C8}();var D8=x8.exports;function F8(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var L8,U8,j8,q8,z8={};F8(z8,"WidgetTheme",(()=>L8)),F8(z8,"CheckoutWidgetTagNames",(()=>j8)),(U8=L8||(L8={})).LIGHT="light",U8.DARK="dark",(q8=j8||(j8={})).CONNECT="imtbl-connect",q8.WALLET="imtbl-wallet",q8.SWAP="imtbl-swap",q8.BRIDGE="imtbl-bridge",q8.ONRAMP="imtbl-onramp";const H8=()=>!1,G8=()=>"0.24.
|
|
66
|
+
*/x8.exports=function(){if(N8)return C8;N8=1;var e=B8,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 C8.Fragment=r,C8.jsx=o,C8.jsxs=o,C8}();var D8=x8.exports;function F8(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var L8,U8,j8,q8,z8={};F8(z8,"WidgetTheme",(()=>L8)),F8(z8,"CheckoutWidgetTagNames",(()=>j8)),(U8=L8||(L8={})).LIGHT="light",U8.DARK="dark",(q8=j8||(j8={})).CONNECT="imtbl-connect",q8.WALLET="imtbl-wallet",q8.SWAP="imtbl-swap",q8.BRIDGE="imtbl-bridge",q8.ONRAMP="imtbl-onramp";const H8=()=>!1,G8=()=>"0.24.1";function V8(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 K8(e,t){e.setAttribute("widgetconfig",JSON.stringify(t))}function W8(e){void 0!==window?window.ImtblCheckoutWidgetConfig=JSON.stringify(e):console.error("missing window object: please run Checkout client side")}function X8(e){if(void 0===document)return void console.error("missing document object: please run Checkout client side");const t=function(e){const t=G8();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`;H8()&&(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 $8,J8;F8({},"IMTBLWidgetEvents",(()=>$8)),(J8=$8||($8={})).IMTBL_CONNECT_WIDGET_EVENT="imtbl-connect-widget",J8.IMTBL_WALLET_WIDGET_EVENT="imtbl-wallet-widget",J8.IMTBL_SWAP_WIDGET_EVENT="imtbl-swap-widget",J8.IMTBL_BRIDGE_WIDGET_EVENT="imtbl-bridge-widget",J8.IMTBL_ONRAMP_WIDGET_EVENT="imtbl-onramp-widget",J8.IMTBL_PRIMARY_REVENUE_WIDGET_EVENT="imtbl-primary-revenue-widget";var Y8,Q8;F8({},"ConnectEventType",(()=>Y8)),(Q8=Y8||(Y8={})).CLOSE_WIDGET="close-widget",Q8.SUCCESS="success",Q8.FAILURE="failure";var Z8,e4;F8({},"WalletEventType",(()=>Z8)),(e4=Z8||(Z8={})).CLOSE_WIDGET="close-widget",e4.NETWORK_SWITCH="network-switch",e4.DISCONNECT_WALLET="disconnect-wallet";var t4,r4;F8({},"SwapEventType",(()=>t4)),(r4=t4||(t4={})).CLOSE_WIDGET="close-widget",r4.SUCCESS="success",r4.FAILURE="failure",r4.REJECTED="rejected";var n4,i4;F8({},"PrimaryRevenueEventType",(()=>n4)),(i4=n4||(n4={})).CLOSE_WIDGET="close-widget",i4.SUCCESS="success",i4.FAILURE="failure",i4.REJECTED="rejected";var a4,o4;F8({},"BridgeEventType",(()=>a4)),(o4=a4||(a4={})).CLOSE_WIDGET="close-widget",o4.SUCCESS="success",o4.FAILURE="failure";var s4,c4;F8({},"OrchestrationEventType",(()=>s4)),(c4=s4||(s4={})).REQUEST_CONNECT="request-connect",c4.REQUEST_WALLET="request-wallet",c4.REQUEST_SWAP="request-swap",c4.REQUEST_BRIDGE="request-bridge",c4.REQUEST_ONRAMP="request-onramp";var u4,f4;F8({},"OnRampEventType",(()=>u4)),(f4=u4||(u4={})).CLOSE_WIDGET="close-widget",f4.SUCCESS="success",f4.FAILURE="failure";function d4(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 l4(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"))}};n=window.setInterval(i,10),i()}function h4(e){const{walletProvider:t,fromContractAddress:r,amount:n,provider:i,passport:a}=e;B8.useEffect((()=>{i&&d4(j8.BRIDGE,i),a&&l4(j8.BRIDGE,a)}),[i,a]);const o=window.ImtblCheckoutWidgetConfig;return D8.jsx("imtbl-bridge",{widgetConfig:o,walletProvider:t,fromContractAddress:r??"",amount:n??""})}F8({},"BridgeReact",(()=>h4));function p4({passport:e}){const t=window.ImtblCheckoutWidgetConfig;return B8.useEffect((()=>{e&&l4(j8.CONNECT,e)}),[e]),D8.jsx("imtbl-connect",{widgetConfig:t})}F8({},"ConnectReact",(()=>p4));function m4(e){const{walletProvider:t,fromContractAddress:r,amount:n,toContractAddress:i,provider:a,passport:o}=e;B8.useEffect((()=>{a&&d4(j8.SWAP,a),o&&l4(j8.SWAP,o)}),[a,o]);const s=window.ImtblCheckoutWidgetConfig;return D8.jsx("imtbl-swap",{widgetConfig:s,walletProvider:t,fromContractAddress:r??"",toContractAddress:i??"",amount:n??""})}F8({},"SwapReact",(()=>m4));function b4(e){const{walletProvider:t,provider:r,passport:n}=e;B8.useEffect((()=>{r&&d4(j8.WALLET,r),n&&l4(j8.WALLET,n)}),[r,n]);const i=window.ImtblCheckoutWidgetConfig;return D8.jsx("imtbl-wallet",{widgetConfig:i,walletProvider:t})}F8({},"WalletReact",(()=>b4));function y4(e){const{walletProvider:t,amount:r,provider:n,passport:i,contractAddress:a}=e;B8.useEffect((()=>{n&&d4(j8.ONRAMP,n),i&&l4(j8.ONRAMP,i)}),[n,i]);const o=window.ImtblCheckoutWidgetConfig;return D8.jsx("imtbl-onramp",{widgetConfig:o,walletProvider:t,amount:r??"",contractAddress:a??""})}F8({},"OnRampReact",(()=>y4));var g4=Object.freeze({__proto__:null,get BridgeEventType(){return a4},BridgeReact:h4,get CheckoutWidgetTagNames(){return j8},CheckoutWidgets:function(e){void 0!==window?void 0!==document?(X8(e||{}),W8(e||{})):console.error("missing document object: please run Checkout client side"):console.error("missing window object: please run Checkout client side")},get ConnectEventType(){return Y8},ConnectReact:p4,get IMTBLWidgetEvents(){return $8},get OnRampEventType(){return u4},OnRampReact:y4,get OrchestrationEventType(){return s4},get PrimaryRevenueEventType(){return n4},get SwapEventType(){return t4},SwapReact:m4,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(j8).forEach((t=>{const r=document.getElementsByTagName(t);if(r)for(const t of r){K8(t,{...V8(t)||{},...e})}})),W8({...t,...e})},get WalletEventType(){return Z8},WalletReact:b4,get WidgetTheme(){return L8}});e.blockchainData=Xt,e.checkoutSdk=I8,e.checkoutWidgets=g4,e.config=n,e.immutablexClient=XN,e.orderbook=dW,e.passport=gz,e.provider=KW}));
|
|
67
67
|
//# sourceMappingURL=index.browser.js.map
|