@imtbl/sdk 0.22.3 → 0.23.0-alpha

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.
@@ -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"),A=u("URLSearchParams");function T(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={};T(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:A,isTypedArray:O,isFileList:E,forEach:T,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]&&T(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(T(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 T(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 Ae(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 Te=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(Te(e),Te(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=[Ae.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=Ae.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}}}},_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)}}};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}}}},At=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 Tt extends et{listNFTOwners(e,t){return At(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)))}},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)))}},MetadataApiFp:_t,NFTContractType:{Erc721:"ERC721"},NativeItemItemTypeEnum:{Native:"NATIVE"},NftOwnersApi:Tt,NftOwnersApiAxiosParamCreator:Et,NftOwnersApiFactory:function(e,t,r){const n=At(e);return{listNFTOwners:(e,i,a,o,s,c)=>n.listNFTOwners(e,i,a,o,s,c).then((e=>e(r,t)))}},NftOwnersApiFp:At,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 Tt(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.22.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.22.3"},Gt=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...t||{},...Ht}}};return new Dt.Configuration(r)},Vt=()=>Gt({basePath:"https://api.sandbox.immutable.com"});class Kt{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=Vt();break;case t.PRODUCTION:this.apiConfig=Gt({basePath:"https://indexer-mr.imtbl.com"});break;default:this.apiConfig=Vt()}}}function Wt(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 Xt{config;activities;chains;collections;nfts;nftOwners;tokens;constructor(e){this.config=new Kt(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)}async listActivities(e){return await this.activities.listActivities(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async getActivity(e){return await this.activities.getActivity(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listChains(e){return await this.chains.listChains(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listCollections(e){return await this.collections.listCollections(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listCollectionsByNFTOwner(e){return await this.collections.listCollectionsByNFTOwner(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async getCollection(e){return await this.collections.getCollection(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async getNFT(e){return await this.nfts.getNFT(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listNFTs(e){return await this.nfts.listNFTs(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listTokens(e){return await this.tokens.listERC20Tokens(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async getToken(e){return await this.tokens.getERC20Token(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}}var $t=Object.freeze({__proto__:null,APIError:zt,BlockchainData:Xt}),Jt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Yt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Qt(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 Zt={exports:{}},er="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},tr=[],rr=[],nr="undefined"!=typeof Uint8Array?Uint8Array:Array,ir=!1;function ar(){ir=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)tr[t]=e[t],rr[e.charCodeAt(t)]=t;rr["-".charCodeAt(0)]=62,rr["_".charCodeAt(0)]=63}function or(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(tr[(i=n)>>18&63]+tr[i>>12&63]+tr[i>>6&63]+tr[63&i]);return a.join("")}function sr(e){var t;ir||ar();for(var r=e.length,n=r%3,i="",a=[],o=16383,s=0,c=r-n;s<c;s+=o)a.push(or(e,s,s+o>c?c:s+o));return 1===n?(t=e[r-1],i+=tr[t>>2],i+=tr[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=tr[t>>10],i+=tr[t>>4&63],i+=tr[t<<2&63],i+="="),a.push(i),a.join("")}function cr(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 ur(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 fr={}.toString,dr=Array.isArray||function(e){return"[object Array]"==fr.call(e)};mr.TYPED_ARRAY_SUPPORT=void 0===er.TYPED_ARRAY_SUPPORT||er.TYPED_ARRAY_SUPPORT;var lr=hr();function hr(){return mr.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function pr(e,t){if(hr()<t)throw new RangeError("Invalid typed array length");return mr.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=mr.prototype:(null===e&&(e=new mr(t)),e.length=t),e}function mr(e,t,r){if(!(mr.TYPED_ARRAY_SUPPORT||this instanceof mr))return new mr(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 gr(this,e)}return br(this,e,t,r)}function br(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);mr.TYPED_ARRAY_SUPPORT?(e=t).__proto__=mr.prototype:e=vr(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!mr.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Er(t,r);e=pr(e,n);var i=e.write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(_r(t)){var r=0|wr(t.length);return 0===(e=pr(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?pr(e,0):vr(e,t);if("Buffer"===t.type&&dr(t.data))return vr(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function yr(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 gr(e,t){if(yr(t),e=pr(e,t<0?0:0|wr(t)),!mr.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function vr(e,t){var r=t.length<0?0:0|wr(t.length);e=pr(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function wr(e){if(e>=hr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hr().toString(16)+" bytes");return 0|e}function _r(e){return!(null==e||!e._isBuffer)}function Er(e,t){if(_r(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 $r(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Jr(e).length;default:if(n)return $r(e).length;t=(""+t).toLowerCase(),n=!0}}function Ar(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 Lr(this,t,r);case"utf8":case"utf-8":return Nr(this,t,r);case"ascii":return Dr(this,t,r);case"latin1":case"binary":return Fr(this,t,r);case"base64":return Pr(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ur(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 Sr(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=mr.from(t,n)),_r(t))return 0===t.length?-1:Rr(e,t,r,n,i);if("number"==typeof t)return t&=255,mr.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Rr(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Rr(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 kr(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 Or(e,t,r,n){return Yr($r(t,e.length-r),e,r,n)}function Ir(e,t,r,n){return Yr(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function xr(e,t,r,n){return Ir(e,t,r,n)}function Cr(e,t,r,n){return Yr(Jr(t),e,r,n)}function Mr(e,t,r,n){return Yr(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 Pr(e,t,r){return 0===t&&r===e.length?sr(e):sr(e.slice(t,r))}function Nr(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<=Br)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Br));return r}(n)}mr.poolSize=8192,mr._augment=function(e){return e.__proto__=mr.prototype,e},mr.from=function(e,t,r){return br(null,e,t,r)},mr.TYPED_ARRAY_SUPPORT&&(mr.prototype.__proto__=Uint8Array.prototype,mr.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&mr[Symbol.species]),mr.alloc=function(e,t,r){return function(e,t,r,n){return yr(t),t<=0?pr(e,t):void 0!==r?"string"==typeof n?pr(e,t).fill(r,n):pr(e,t).fill(r):pr(e,t)}(null,e,t,r)},mr.allocUnsafe=function(e){return gr(null,e)},mr.allocUnsafeSlow=function(e){return gr(null,e)},mr.isBuffer=Qr,mr.compare=function(e,t){if(!_r(e)||!_r(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},mr.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}},mr.concat=function(e,t){if(!dr(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return mr.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=mr.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!_r(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},mr.byteLength=Er,mr.prototype._isBuffer=!0,mr.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},mr.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},mr.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},mr.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Nr(this,0,e):Ar.apply(this,arguments)},mr.prototype.equals=function(e){if(!_r(e))throw new TypeError("Argument must be a Buffer");return this===e||0===mr.compare(this,e)},mr.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+">"},mr.prototype.compare=function(e,t,r,n,i){if(!_r(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},mr.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},mr.prototype.indexOf=function(e,t,r){return Sr(this,e,t,r,!0)},mr.prototype.lastIndexOf=function(e,t,r){return Sr(this,e,t,r,!1)},mr.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 kr(this,e,t,r);case"utf8":case"utf-8":return Or(this,e,t,r);case"ascii":return Ir(this,e,t,r);case"latin1":case"binary":return xr(this,e,t,r);case"base64":return Cr(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mr(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},mr.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Br=4096;function Dr(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 Fr(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 Lr(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+=Xr(e[a]);return i}function Ur(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 jr(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 qr(e,t,r,n,i,a){if(!_r(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 zr(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 Hr(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 Gr(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 Vr(e,t,r,n,i){return i||Gr(e,0,r,4),ur(e,t,r,n,23,4),r+4}function Kr(e,t,r,n,i){return i||Gr(e,0,r,8),ur(e,t,r,n,52,8),r+8}mr.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),mr.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=mr.prototype;else{var i=t-e;r=new mr(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},mr.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||jr(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},mr.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||jr(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},mr.prototype.readUInt8=function(e,t){return t||jr(e,1,this.length),this[e]},mr.prototype.readUInt16LE=function(e,t){return t||jr(e,2,this.length),this[e]|this[e+1]<<8},mr.prototype.readUInt16BE=function(e,t){return t||jr(e,2,this.length),this[e]<<8|this[e+1]},mr.prototype.readUInt32LE=function(e,t){return t||jr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},mr.prototype.readUInt32BE=function(e,t){return t||jr(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},mr.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||jr(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},mr.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||jr(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},mr.prototype.readInt8=function(e,t){return t||jr(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},mr.prototype.readInt16LE=function(e,t){t||jr(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},mr.prototype.readInt16BE=function(e,t){t||jr(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},mr.prototype.readInt32LE=function(e,t){return t||jr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},mr.prototype.readInt32BE=function(e,t){return t||jr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},mr.prototype.readFloatLE=function(e,t){return t||jr(e,4,this.length),cr(this,e,!0,23,4)},mr.prototype.readFloatBE=function(e,t){return t||jr(e,4,this.length),cr(this,e,!1,23,4)},mr.prototype.readDoubleLE=function(e,t){return t||jr(e,8,this.length),cr(this,e,!0,52,8)},mr.prototype.readDoubleBE=function(e,t){return t||jr(e,8,this.length),cr(this,e,!1,52,8)},mr.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||qr(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},mr.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||qr(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},mr.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,1,255,0),mr.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},mr.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,2,65535,0),mr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):zr(this,e,t,!0),t+2},mr.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,2,65535,0),mr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):zr(this,e,t,!1),t+2},mr.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,4,4294967295,0),mr.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Hr(this,e,t,!0),t+4},mr.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,4,4294967295,0),mr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Hr(this,e,t,!1),t+4},mr.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);qr(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},mr.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);qr(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},mr.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,1,127,-128),mr.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},mr.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,2,32767,-32768),mr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):zr(this,e,t,!0),t+2},mr.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,2,32767,-32768),mr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):zr(this,e,t,!1),t+2},mr.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,4,2147483647,-2147483648),mr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Hr(this,e,t,!0),t+4},mr.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),mr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Hr(this,e,t,!1),t+4},mr.prototype.writeFloatLE=function(e,t,r){return Vr(this,e,t,!0,r)},mr.prototype.writeFloatBE=function(e,t,r){return Vr(this,e,t,!1,r)},mr.prototype.writeDoubleLE=function(e,t,r){return Kr(this,e,t,!0,r)},mr.prototype.writeDoubleBE=function(e,t,r){return Kr(this,e,t,!1,r)},mr.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||!mr.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},mr.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&&!mr.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=_r(e)?e:$r(new mr(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var Wr=/[^+\/0-9A-Za-z-_]/g;function Xr(e){return e<16?"0"+e.toString(16):e.toString(16)}function $r(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 Jr(e){return function(e){var t,r,n,i,a,o;ir||ar();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 nr(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=rr[e.charCodeAt(t)]<<18|rr[e.charCodeAt(t+1)]<<12|rr[e.charCodeAt(t+2)]<<6|rr[e.charCodeAt(t+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=255&i;return 2===a?(i=rr[e.charCodeAt(t)]<<2|rr[e.charCodeAt(t+1)]>>4,o[c++]=255&i):1===a&&(i=rr[e.charCodeAt(t)]<<10|rr[e.charCodeAt(t+1)]<<4|rr[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(Wr,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Yr(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 Qr(e){return null!=e&&(!!e._isBuffer||Zr(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Zr(e.slice(0,0))}(e))}function Zr(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var en=Qt(Object.freeze({__proto__:null,Buffer:mr,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),mr.alloc(+e)},isBuffer:Qr,kMaxLength:lr}));!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:en.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],A=8191&E,T=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(A,q),i=(i=Math.imul(A,z))+Math.imul(T,q)|0,a=Math.imul(T,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(A,G)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(T,G)|0,a=a+Math.imul(T,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(A,W)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,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(A,J)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(T,J)|0,a=a+Math.imul(T,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 Ae=(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)+(Ae>>>26)|0,Ae&=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(A,Z)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(T,Z)|0,a=a+Math.imul(T,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 Te=(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)+(Te>>>26)|0,Te&=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(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(T,re)|0,a=a+Math.imul(T,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(A,ae)|0,i=(i=i+Math.imul(A,oe)|0)+Math.imul(T,ae)|0,a=a+Math.imul(T,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(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(T,ce)|0,a=a+Math.imul(T,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(A,de)|0,i=(i=i+Math.imul(A,le)|0)+Math.imul(T,de)|0,a=a+Math.imul(T,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(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,me)|0)+Math.imul(T,pe)|0))<<13)|0;u=((a=a+Math.imul(T,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]=Ae,c[8]=Te,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 T(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 A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}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(A,v),A.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 A}return g[e]=t,t},T.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},T.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")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},T.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},T.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)},T.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(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},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var 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},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},n(S,T),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,Jt)}(Zt);var tn=Zt.exports,rn=Yt(tn);let nn=!1,an=!1;const on={debug:1,default:2,info:2,warning:3,error:4,off:5};let sn=on.default,cn=null;const un=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 fn,dn;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(fn||(fn={})),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"}(dn||(dn={}));const ln="0123456789abcdef";let hn=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==on[r]&&this.throwArgumentError("invalid log level name","logLevel",e),sn>on[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(an)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+=ln[t[e]>>4],r+=ln[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 dn.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 dn.CALL_EXCEPTION:case dn.INSUFFICIENT_FUNDS:case dn.MISSING_NEW:case dn.NONCE_EXPIRED:case dn.REPLACEMENT_UNDERPRICED:case dn.TRANSACTION_REPLACED:case dn.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){un&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:un})}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 cn||(cn=new e("logger/5.7.0")),cn}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),nn){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}an=!!t,nn=!!r}static setLogLevel(t){const r=on[t.toLowerCase()];null!=r?sn=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};hn.errors=dn,hn.levels=fn;var pn=Object.freeze({__proto__:null,get ErrorCode(){return dn},get LogLevel(){return fn},Logger:hn});const mn=new hn("bytes/5.7.0");function bn(e){return!!e.toHexString}function yn(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return yn(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function gn(e){return Sn(e)&&!(e.length%2)||wn(e)}function vn(e){return"number"==typeof e&&e==e&&e%1==0}function wn(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!vn(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!vn(r)||r<0||r>=256)return!1}return!0}function _n(e,t){if(t||(t={}),"number"==typeof e){mn.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),yn(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),bn(e)&&(e=e.toHexString()),Sn(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":mn.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 yn(new Uint8Array(n))}return wn(e)?yn(new Uint8Array(e)):mn.throwArgumentError("invalid arrayify value","value",e)}function En(e){const t=e.map((e=>_n(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),yn(n)}function An(e){let t=_n(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=_n(e)).length>t&&mn.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),yn(r)}function Sn(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Rn="0123456789abcdef";function kn(e,t){if(t||(t={}),"number"==typeof e){mn.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Rn[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),bn(e))return e.toHexString();if(Sn(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":mn.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(wn(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Rn[(240&n)>>4]+Rn[15&n]}return t}return mn.throwArgumentError("invalid hexlify value","value",e)}function On(e){if("string"!=typeof e)e=kn(e);else if(!Sn(e)||e.length%2)return null;return(e.length-2)/2}function In(e,t,r){return"string"!=typeof e?e=kn(e):(!Sn(e)||e.length%2)&&mn.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function xn(e){let t="0x";return e.forEach((e=>{t+=kn(e).substring(2)})),t}function Cn(e){const t=Mn(kn(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function Mn(e){"string"!=typeof e&&(e=kn(e)),Sn(e)||mn.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 Pn(e,t){for("string"!=typeof e?e=kn(e):Sn(e)||mn.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&mn.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Nn(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(gn(e)){let r=_n(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=kn(r.slice(0,32)),t.s=kn(r.slice(32,64))):65===r.length?(t.r=kn(r.slice(0,32)),t.s=kn(r.slice(32,64)),t.v=r[64]):mn.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:mn.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=kn(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(_n(t._vs),32);t._vs=kn(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&mn.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=kn(r);null==t.s?t.s=i:t.s!==i&&mn.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?mn.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&&mn.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Sn(t.r)?t.r=Pn(t.r,32):mn.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Sn(t.s)?t.s=Pn(t.s,32):mn.throwArgumentError("signature missing or invalid s","signature",e);const r=_n(t.s);r[0]>=128&&mn.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=kn(r);t._vs&&(Sn(t._vs)||mn.throwArgumentError("signature invalid _vs","signature",e),t._vs=Pn(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&mn.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Bn(e){return kn(En([(e=Nn(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var Dn=Object.freeze({__proto__:null,arrayify:_n,concat:En,hexConcat:xn,hexDataLength:On,hexDataSlice:In,hexStripZeros:Mn,hexValue:Cn,hexZeroPad:Pn,hexlify:kn,isBytes:wn,isBytesLike:gn,isHexString:Sn,joinSignature:Bn,splitSignature:Nn,stripZeros:An,zeroPad:Tn});const Fn="bignumber/5.7.0";var Ln=rn.BN;const Un=new hn(Fn),jn={},qn=9007199254740991;let zn=!1,Hn=class e{constructor(e,t){e!==jn&&Un.throwError("cannot call constructor directly; use BigNumber.from",hn.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Vn(Kn(this).fromTwos(e))}toTwos(e){return Vn(Kn(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Vn(Kn(this).add(Kn(e)))}sub(e){return Vn(Kn(this).sub(Kn(e)))}div(t){return e.from(t).isZero()&&Wn("division-by-zero","div"),Vn(Kn(this).div(Kn(t)))}mul(e){return Vn(Kn(this).mul(Kn(e)))}mod(e){const t=Kn(e);return t.isNeg()&&Wn("division-by-zero","mod"),Vn(Kn(this).umod(t))}pow(e){const t=Kn(e);return t.isNeg()&&Wn("negative-power","pow"),Vn(Kn(this).pow(t))}and(e){const t=Kn(e);return(this.isNegative()||t.isNeg())&&Wn("unbound-bitwise-result","and"),Vn(Kn(this).and(t))}or(e){const t=Kn(e);return(this.isNegative()||t.isNeg())&&Wn("unbound-bitwise-result","or"),Vn(Kn(this).or(t))}xor(e){const t=Kn(e);return(this.isNegative()||t.isNeg())&&Wn("unbound-bitwise-result","xor"),Vn(Kn(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Wn("negative-width","mask"),Vn(Kn(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Wn("negative-width","shl"),Vn(Kn(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Wn("negative-width","shr"),Vn(Kn(this).shrn(e))}eq(e){return Kn(this).eq(Kn(e))}lt(e){return Kn(this).lt(Kn(e))}lte(e){return Kn(this).lte(Kn(e))}gt(e){return Kn(this).gt(Kn(e))}gte(e){return Kn(this).gte(Kn(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Kn(this).isZero()}toNumber(){try{return Kn(this).toNumber()}catch(e){Wn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Un.throwError("this platform does not support BigInt",hn.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?zn||(zn=!0,Un.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Un.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",hn.errors.UNEXPECTED_ARGUMENT,{}):Un.throwError("BigNumber.toString does not accept parameters",hn.errors.UNEXPECTED_ARGUMENT,{})),Kn(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(jn,Gn(t)):t.match(/^-?[0-9]+$/)?new e(jn,Gn(new Ln(t))):Un.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Wn("underflow","BigNumber.from",t),(t>=qn||t<=-qn)&&Wn("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(wn(r))return e.from(kn(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&&(Sn(t)||"-"===t[0]&&Sn(t.substring(1))))return e.from(t)}return Un.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Gn(e){if("string"!=typeof e)return Gn(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Un.throwArgumentError("invalid hex","value",e),"0x00"===(e=Gn(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 Vn(e){return Hn.from(Gn(e))}function Kn(e){const t=Hn.from(e).toHexString();return"-"===t[0]?new Ln("-"+t.substring(3),16):new Ln(t.substring(2),16)}function Wn(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Un.throwError(e,hn.errors.NUMERIC_FAULT,n)}const Xn=new hn(Fn),$n={},Jn=Hn.from(0),Yn=Hn.from(-1);function Qn(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),Xn.throwError(e,hn.errors.NUMERIC_FAULT,i)}let Zn="0";for(;Zn.length<256;)Zn+=Zn;function ei(e){if("number"!=typeof e)try{e=Hn.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Zn.substring(0,e):Xn.throwArgumentError("invalid decimal size","decimals",e)}function ti(e,t){null==t&&(t=0);const r=ei(t),n=(e=Hn.from(e)).lt(Jn);n&&(e=e.mul(Yn));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 ri(e,t){null==t&&(t=0);const r=ei(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Xn.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&Xn.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Xn.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&&Qn("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=Hn.from(a),c=Hn.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(Yn)),u}class ni{constructor(e,t,r,n){e!==$n&&Xn.throwError("cannot use FixedFormat constructor; use FixedFormat.from",hn.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=ei(n),Object.freeze(this)}static from(e){if(e instanceof ni)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||Xn.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&&Xn.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&&Xn.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Xn.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new ni($n,t,r,n)}}class ii{constructor(e,t,r,n){e!==$n&&Xn.throwError("cannot use FixedNumber constructor; use FixedNumber.from",hn.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&&Xn.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ri(this._value,this.format.decimals),r=ri(e._value,e.format.decimals);return ii.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ri(this._value,this.format.decimals),r=ri(e._value,e.format.decimals);return ii.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ri(this._value,this.format.decimals),r=ri(e._value,e.format.decimals);return ii.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ri(this._value,this.format.decimals),r=ri(e._value,e.format.decimals);return ii.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=ii.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(ai.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=ii.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(ai.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)&&Xn.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=ii.from("1"+Zn.substring(0,e),this.format),n=oi.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&&Xn.throwArgumentError("invalid byte width","width",e);return Pn(Hn.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return ii.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Hn.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Sn(e)||"bigint"==typeof e||wn(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),ii.fromString(ti(e,t),ni.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=ni.from(t),n=ri(e,r.decimals);!r.signed&&n.lt(Jn)&&Qn("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Pn(i,r.width/8));const a=ti(n,r.decimals);return new ii($n,i,a,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=ni.from(t);if(_n(e).length>r.width/8)throw new Error("overflow");let n=Hn.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),a=ti(n,r.decimals);return new ii($n,i,a,r)}static from(e,t){if("string"==typeof e)return ii.fromString(e,t);if(wn(e))return ii.fromBytes(e,t);try{return ii.fromValue(e,0,t)}catch(e){if(e.code!==hn.errors.INVALID_ARGUMENT)throw e}return Xn.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const ai=ii.from(1),oi=ii.from("0.5");var si=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 ci=new hn("properties/5.7.0");function ui(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function fi(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 di(e){return si(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 li(e,t){e&&"object"==typeof e||ci.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||ci.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function hi(e){const t={};for(const r in e)t[r]=e[r];return t}const pi={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function mi(e){if(null==e||pi[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(!mi(n))return!1}return!0}return ci.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function bi(e){if(mi(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>yi(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&ui(t,r,yi(n))}return t}return ci.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function yi(e){return bi(e)}let gi=class{constructor(e){for(const t in e)this[t]=yi(e[t])}};var vi=Object.freeze({__proto__:null,Description:gi,checkProperties:li,deepCopy:yi,defineReadOnly:ui,getStatic:fi,resolveProperties:di,shallowCopy:hi});const wi="abi/5.7.0",_i=new hn(wi),Ei={};let Ai={calldata:!0,memory:!0,storage:!0},Ti={calldata:!0,memory:!0};function Si(e,t){if("bytes"===e||"string"===e){if(Ai[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Ti[t])return!0;return(Ai[t]||"payable"===t)&&_i.throwArgumentError("invalid modifier","name",t),!1}function Ri(e,t){for(let r in t)ui(e,r,t[r])}const ki=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Oi=new RegExp(/^(.*)\[([0-9]*)\]$/);let Ii=class e{constructor(t,r){t!==Ei&&_i.throwError("use fromString",hn.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Ri(this,r);let n=this.type.match(Oi);Ri(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=ki.sighash),ki[e]||_i.throwArgumentError("invalid format type","format",e),e===ki.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!==ki.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===ki.full?", ":",")+")"):t+=this.type,e!==ki.sighash&&(!0===this.indexed&&(t+=" indexed"),e===ki.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(Ei,{name:t.name||null,type:ji(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){_i.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=ji(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=""),Si(o.type,o.name)&&(o.name=""),o.type=ji(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=""),Si(o.type,o.name)&&(o.name=""),o.type=ji(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=ji(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=""):Si(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&&_i.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=""):Si(o.type,o.name)&&(o.name=""),a.type=ji(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 xi(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&&_i.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>Ii.fromString(e,t)))}let Ci=class e{constructor(e,t){e!==Ei&&_i.throwError("use a static from method",hn.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Ri(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 Fi.fromObject(t);case"event":return Mi.fromObject(t);case"constructor":return Di.fromObject(t);case"error":return Ui.fromObject(t);case"fallback":case"receive":return null}return _i.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]?Mi.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Fi.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Di.fromString(e.trim()):"error"===e.split(" ")[0]?Ui.fromString(e.substring(5).trim()):_i.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}},Mi=class e extends Ci{format(e){if(e||(e=ki.sighash),ki[e]||_i.throwArgumentError("invalid format type","format",e),e===ki.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!==ki.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===ki.full?", ":",")+") ",e!==ki.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&&_i.throwArgumentError("invalid event object","value",t);const r={name:zi(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Ii.fromObject):[],type:"event"};return new e(Ei,r)}static fromString(t){let r=t.match(Hi);r||_i.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:_i.warn("unknown modifier: "+e)}})),e.fromObject({name:r[1].trim(),anonymous:n,inputs:xi(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}};function Pi(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&_i.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||_i.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Hn.from(r[1]),r[0]):e}function Ni(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 Bi(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&&_i.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&_i.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||_i.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&&_i.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&&_i.throwArgumentError("unable to determine stateMutability","value",e),t}let Di=class e extends Ci{format(e){if(e||(e=ki.sighash),ki[e]||_i.throwArgumentError("invalid format type","format",e),e===ki.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===ki.sighash&&_i.throwError("cannot format a constructor for sighash",hn.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===ki.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&&_i.throwArgumentError("invalid constructor object","value",t);let r=Bi(t);r.constant&&_i.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Ii.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Hn.from(t.gas):null};return new e(Ei,n)}static fromString(t){let r={type:"constructor"},n=(t=Pi(t,r)).match(Hi);return n&&"constructor"===n[1].trim()||_i.throwArgumentError("invalid constructor string","value",t),r.inputs=xi(n[2].trim(),!1),Ni(n[3].trim(),r),e.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}},Fi=class e extends Di{format(e){if(e||(e=ki.sighash),ki[e]||_i.throwArgumentError("invalid format type","format",e),e===ki.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!==ki.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===ki.full?", ":",")+") ",e!==ki.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&&_i.throwArgumentError("invalid function object","value",t);let r=Bi(t);const n={type:t.type,name:zi(t.name),constant:r.constant,inputs:t.inputs?t.inputs.map(Ii.fromObject):[],outputs:t.outputs?t.outputs.map(Ii.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Hn.from(t.gas):null};return new e(Ei,n)}static fromString(t){let r={type:"function"},n=(t=Pi(t,r)).split(" returns ");n.length>2&&_i.throwArgumentError("invalid function string","value",t);let i=n[0].match(Hi);if(i||_i.throwArgumentError("invalid function signature","value",t),r.name=i[1].trim(),r.name&&zi(r.name),r.inputs=xi(i[2],!1),Ni(i[3].trim(),r),n.length>1){let e=n[1].match(Hi);""==e[1].trim()&&""==e[3].trim()||_i.throwArgumentError("unexpected tokens","value",t),r.outputs=xi(e[2],!1)}else r.outputs=[];return e.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}};function Li(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||_i.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}let Ui=class e extends Ci{format(e){if(e||(e=ki.sighash),ki[e]||_i.throwArgumentError("invalid format type","format",e),e===ki.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==ki.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===ki.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&&_i.throwArgumentError("invalid error object","value",t);const r={type:t.type,name:zi(t.name),inputs:t.inputs?t.inputs.map(Ii.fromObject):[]};return Li(new e(Ei,r))}static fromString(t){let r={type:"error"},n=t.match(Hi);return n||_i.throwArgumentError("invalid error signature","value",t),r.name=n[1].trim(),r.name&&zi(r.name),r.inputs=xi(n[2],!1),Li(e.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}};function ji(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const qi=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function zi(e){return e&&e.match(qi)||_i.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Hi=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Gi=new hn(wi);function Vi(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 Ki=class{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Gi.throwArgumentError(e,this.localName,t)}},Wi=class{constructor(e){ui(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return xn(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(En(e._data))}writeBytes(e){let t=_n(e);const r=t.length%this.wordSize;return r&&(t=En([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=_n(Hn.from(e));return t.length>this.wordSize&&Gi.throwError("value out-of-bounds",hn.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=En([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 Xi={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"),A=u("URLSearchParams");function T(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={};T(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:A,isTypedArray:O,isFileList:E,forEach:T,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]&&T(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(T(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 T(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 Ae(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 Te=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(Te(e),Te(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=[Ae.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=Ae.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}}}},_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)}}};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}}}},At=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 Tt extends et{listNFTOwners(e,t){return At(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)))}},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)))}},MetadataApiFp:_t,NFTContractType:{Erc721:"ERC721"},NativeItemItemTypeEnum:{Native:"NATIVE"},NftOwnersApi:Tt,NftOwnersApiAxiosParamCreator:Et,NftOwnersApiFactory:function(e,t,r){const n=At(e);return{listNFTOwners:(e,i,a,o,s,c)=>n.listNFTOwners(e,i,a,o,s,c).then((e=>e(r,t)))}},NftOwnersApiFp:At,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 Tt(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.23.0-alpha"},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.23.0-alpha"},Gt=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...t||{},...Ht}}};return new Dt.Configuration(r)},Vt=()=>Gt({basePath:"https://api.sandbox.immutable.com"});class Kt{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=Vt();break;case t.PRODUCTION:this.apiConfig=Gt({basePath:"https://indexer-mr.imtbl.com"});break;default:this.apiConfig=Vt()}}}function Wt(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 Xt{config;activities;chains;collections;nfts;nftOwners;tokens;constructor(e){this.config=new Kt(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)}async listActivities(e){return await this.activities.listActivities(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async getActivity(e){return await this.activities.getActivity(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listChains(e){return await this.chains.listChains(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listCollections(e){return await this.collections.listCollections(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listCollectionsByNFTOwner(e){return await this.collections.listCollectionsByNFTOwner(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async getCollection(e){return await this.collections.getCollection(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async getNFT(e){return await this.nfts.getNFT(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listNFTs(e){return await this.nfts.listNFTs(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async listTokens(e){return await this.tokens.listERC20Tokens(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}async getToken(e){return await this.tokens.getERC20Token(e).then((e=>e.data)).catch((e=>{throw Wt(e)}))}}var $t=Object.freeze({__proto__:null,APIError:zt,BlockchainData:Xt}),Jt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Yt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Qt(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 Zt={exports:{}},er="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},tr=[],rr=[],nr="undefined"!=typeof Uint8Array?Uint8Array:Array,ir=!1;function ar(){ir=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)tr[t]=e[t],rr[e.charCodeAt(t)]=t;rr["-".charCodeAt(0)]=62,rr["_".charCodeAt(0)]=63}function or(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(tr[(i=n)>>18&63]+tr[i>>12&63]+tr[i>>6&63]+tr[63&i]);return a.join("")}function sr(e){var t;ir||ar();for(var r=e.length,n=r%3,i="",a=[],o=16383,s=0,c=r-n;s<c;s+=o)a.push(or(e,s,s+o>c?c:s+o));return 1===n?(t=e[r-1],i+=tr[t>>2],i+=tr[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=tr[t>>10],i+=tr[t>>4&63],i+=tr[t<<2&63],i+="="),a.push(i),a.join("")}function cr(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 ur(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 fr={}.toString,dr=Array.isArray||function(e){return"[object Array]"==fr.call(e)};mr.TYPED_ARRAY_SUPPORT=void 0===er.TYPED_ARRAY_SUPPORT||er.TYPED_ARRAY_SUPPORT;var lr=hr();function hr(){return mr.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function pr(e,t){if(hr()<t)throw new RangeError("Invalid typed array length");return mr.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=mr.prototype:(null===e&&(e=new mr(t)),e.length=t),e}function mr(e,t,r){if(!(mr.TYPED_ARRAY_SUPPORT||this instanceof mr))return new mr(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 gr(this,e)}return br(this,e,t,r)}function br(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);mr.TYPED_ARRAY_SUPPORT?(e=t).__proto__=mr.prototype:e=vr(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!mr.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Er(t,r);e=pr(e,n);var i=e.write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(_r(t)){var r=0|wr(t.length);return 0===(e=pr(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?pr(e,0):vr(e,t);if("Buffer"===t.type&&dr(t.data))return vr(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function yr(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 gr(e,t){if(yr(t),e=pr(e,t<0?0:0|wr(t)),!mr.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function vr(e,t){var r=t.length<0?0:0|wr(t.length);e=pr(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function wr(e){if(e>=hr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hr().toString(16)+" bytes");return 0|e}function _r(e){return!(null==e||!e._isBuffer)}function Er(e,t){if(_r(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 $r(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Jr(e).length;default:if(n)return $r(e).length;t=(""+t).toLowerCase(),n=!0}}function Ar(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 Lr(this,t,r);case"utf8":case"utf-8":return Nr(this,t,r);case"ascii":return Dr(this,t,r);case"latin1":case"binary":return Fr(this,t,r);case"base64":return Pr(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ur(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 Sr(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=mr.from(t,n)),_r(t))return 0===t.length?-1:Rr(e,t,r,n,i);if("number"==typeof t)return t&=255,mr.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Rr(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Rr(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 kr(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 Or(e,t,r,n){return Yr($r(t,e.length-r),e,r,n)}function Ir(e,t,r,n){return Yr(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function xr(e,t,r,n){return Ir(e,t,r,n)}function Cr(e,t,r,n){return Yr(Jr(t),e,r,n)}function Mr(e,t,r,n){return Yr(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 Pr(e,t,r){return 0===t&&r===e.length?sr(e):sr(e.slice(t,r))}function Nr(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<=Br)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Br));return r}(n)}mr.poolSize=8192,mr._augment=function(e){return e.__proto__=mr.prototype,e},mr.from=function(e,t,r){return br(null,e,t,r)},mr.TYPED_ARRAY_SUPPORT&&(mr.prototype.__proto__=Uint8Array.prototype,mr.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&mr[Symbol.species]),mr.alloc=function(e,t,r){return function(e,t,r,n){return yr(t),t<=0?pr(e,t):void 0!==r?"string"==typeof n?pr(e,t).fill(r,n):pr(e,t).fill(r):pr(e,t)}(null,e,t,r)},mr.allocUnsafe=function(e){return gr(null,e)},mr.allocUnsafeSlow=function(e){return gr(null,e)},mr.isBuffer=Qr,mr.compare=function(e,t){if(!_r(e)||!_r(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},mr.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}},mr.concat=function(e,t){if(!dr(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return mr.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=mr.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!_r(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},mr.byteLength=Er,mr.prototype._isBuffer=!0,mr.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},mr.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},mr.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},mr.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Nr(this,0,e):Ar.apply(this,arguments)},mr.prototype.equals=function(e){if(!_r(e))throw new TypeError("Argument must be a Buffer");return this===e||0===mr.compare(this,e)},mr.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+">"},mr.prototype.compare=function(e,t,r,n,i){if(!_r(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},mr.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},mr.prototype.indexOf=function(e,t,r){return Sr(this,e,t,r,!0)},mr.prototype.lastIndexOf=function(e,t,r){return Sr(this,e,t,r,!1)},mr.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 kr(this,e,t,r);case"utf8":case"utf-8":return Or(this,e,t,r);case"ascii":return Ir(this,e,t,r);case"latin1":case"binary":return xr(this,e,t,r);case"base64":return Cr(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mr(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},mr.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Br=4096;function Dr(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 Fr(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 Lr(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+=Xr(e[a]);return i}function Ur(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 jr(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 qr(e,t,r,n,i,a){if(!_r(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 zr(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 Hr(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 Gr(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 Vr(e,t,r,n,i){return i||Gr(e,0,r,4),ur(e,t,r,n,23,4),r+4}function Kr(e,t,r,n,i){return i||Gr(e,0,r,8),ur(e,t,r,n,52,8),r+8}mr.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),mr.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=mr.prototype;else{var i=t-e;r=new mr(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},mr.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||jr(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},mr.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||jr(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},mr.prototype.readUInt8=function(e,t){return t||jr(e,1,this.length),this[e]},mr.prototype.readUInt16LE=function(e,t){return t||jr(e,2,this.length),this[e]|this[e+1]<<8},mr.prototype.readUInt16BE=function(e,t){return t||jr(e,2,this.length),this[e]<<8|this[e+1]},mr.prototype.readUInt32LE=function(e,t){return t||jr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},mr.prototype.readUInt32BE=function(e,t){return t||jr(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},mr.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||jr(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},mr.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||jr(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},mr.prototype.readInt8=function(e,t){return t||jr(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},mr.prototype.readInt16LE=function(e,t){t||jr(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},mr.prototype.readInt16BE=function(e,t){t||jr(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},mr.prototype.readInt32LE=function(e,t){return t||jr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},mr.prototype.readInt32BE=function(e,t){return t||jr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},mr.prototype.readFloatLE=function(e,t){return t||jr(e,4,this.length),cr(this,e,!0,23,4)},mr.prototype.readFloatBE=function(e,t){return t||jr(e,4,this.length),cr(this,e,!1,23,4)},mr.prototype.readDoubleLE=function(e,t){return t||jr(e,8,this.length),cr(this,e,!0,52,8)},mr.prototype.readDoubleBE=function(e,t){return t||jr(e,8,this.length),cr(this,e,!1,52,8)},mr.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||qr(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},mr.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||qr(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},mr.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,1,255,0),mr.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},mr.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,2,65535,0),mr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):zr(this,e,t,!0),t+2},mr.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,2,65535,0),mr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):zr(this,e,t,!1),t+2},mr.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,4,4294967295,0),mr.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Hr(this,e,t,!0),t+4},mr.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,4,4294967295,0),mr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Hr(this,e,t,!1),t+4},mr.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);qr(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},mr.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);qr(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},mr.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,1,127,-128),mr.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},mr.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,2,32767,-32768),mr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):zr(this,e,t,!0),t+2},mr.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,2,32767,-32768),mr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):zr(this,e,t,!1),t+2},mr.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,4,2147483647,-2147483648),mr.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Hr(this,e,t,!0),t+4},mr.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||qr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),mr.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Hr(this,e,t,!1),t+4},mr.prototype.writeFloatLE=function(e,t,r){return Vr(this,e,t,!0,r)},mr.prototype.writeFloatBE=function(e,t,r){return Vr(this,e,t,!1,r)},mr.prototype.writeDoubleLE=function(e,t,r){return Kr(this,e,t,!0,r)},mr.prototype.writeDoubleBE=function(e,t,r){return Kr(this,e,t,!1,r)},mr.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||!mr.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},mr.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&&!mr.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=_r(e)?e:$r(new mr(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var Wr=/[^+\/0-9A-Za-z-_]/g;function Xr(e){return e<16?"0"+e.toString(16):e.toString(16)}function $r(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 Jr(e){return function(e){var t,r,n,i,a,o;ir||ar();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 nr(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=rr[e.charCodeAt(t)]<<18|rr[e.charCodeAt(t+1)]<<12|rr[e.charCodeAt(t+2)]<<6|rr[e.charCodeAt(t+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=255&i;return 2===a?(i=rr[e.charCodeAt(t)]<<2|rr[e.charCodeAt(t+1)]>>4,o[c++]=255&i):1===a&&(i=rr[e.charCodeAt(t)]<<10|rr[e.charCodeAt(t+1)]<<4|rr[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(Wr,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Yr(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 Qr(e){return null!=e&&(!!e._isBuffer||Zr(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Zr(e.slice(0,0))}(e))}function Zr(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var en=Qt(Object.freeze({__proto__:null,Buffer:mr,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),mr.alloc(+e)},isBuffer:Qr,kMaxLength:lr}));!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:en.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],A=8191&E,T=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(A,q),i=(i=Math.imul(A,z))+Math.imul(T,q)|0,a=Math.imul(T,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(A,G)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(T,G)|0,a=a+Math.imul(T,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(A,W)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,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(A,J)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(T,J)|0,a=a+Math.imul(T,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 Ae=(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)+(Ae>>>26)|0,Ae&=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(A,Z)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(T,Z)|0,a=a+Math.imul(T,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 Te=(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)+(Te>>>26)|0,Te&=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(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(T,re)|0,a=a+Math.imul(T,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(A,ae)|0,i=(i=i+Math.imul(A,oe)|0)+Math.imul(T,ae)|0,a=a+Math.imul(T,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(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(T,ce)|0,a=a+Math.imul(T,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(A,de)|0,i=(i=i+Math.imul(A,le)|0)+Math.imul(T,de)|0,a=a+Math.imul(T,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(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,me)|0)+Math.imul(T,pe)|0))<<13)|0;u=((a=a+Math.imul(T,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]=Ae,c[8]=Te,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 T(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 A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}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(A,v),A.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 A}return g[e]=t,t},T.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},T.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")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},T.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},T.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)},T.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(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},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var 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},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},n(S,T),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,Jt)}(Zt);var tn=Zt.exports,rn=Yt(tn);let nn=!1,an=!1;const on={debug:1,default:2,info:2,warning:3,error:4,off:5};let sn=on.default,cn=null;const un=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 fn,dn;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(fn||(fn={})),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"}(dn||(dn={}));const ln="0123456789abcdef";let hn=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==on[r]&&this.throwArgumentError("invalid log level name","logLevel",e),sn>on[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(an)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+=ln[t[e]>>4],r+=ln[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 dn.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 dn.CALL_EXCEPTION:case dn.INSUFFICIENT_FUNDS:case dn.MISSING_NEW:case dn.NONCE_EXPIRED:case dn.REPLACEMENT_UNDERPRICED:case dn.TRANSACTION_REPLACED:case dn.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){un&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:un})}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 cn||(cn=new e("logger/5.7.0")),cn}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),nn){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}an=!!t,nn=!!r}static setLogLevel(t){const r=on[t.toLowerCase()];null!=r?sn=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};hn.errors=dn,hn.levels=fn;var pn=Object.freeze({__proto__:null,get ErrorCode(){return dn},get LogLevel(){return fn},Logger:hn});const mn=new hn("bytes/5.7.0");function bn(e){return!!e.toHexString}function yn(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return yn(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function gn(e){return Sn(e)&&!(e.length%2)||wn(e)}function vn(e){return"number"==typeof e&&e==e&&e%1==0}function wn(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!vn(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!vn(r)||r<0||r>=256)return!1}return!0}function _n(e,t){if(t||(t={}),"number"==typeof e){mn.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),yn(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),bn(e)&&(e=e.toHexString()),Sn(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":mn.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 yn(new Uint8Array(n))}return wn(e)?yn(new Uint8Array(e)):mn.throwArgumentError("invalid arrayify value","value",e)}function En(e){const t=e.map((e=>_n(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),yn(n)}function An(e){let t=_n(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=_n(e)).length>t&&mn.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),yn(r)}function Sn(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Rn="0123456789abcdef";function kn(e,t){if(t||(t={}),"number"==typeof e){mn.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Rn[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),bn(e))return e.toHexString();if(Sn(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":mn.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(wn(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Rn[(240&n)>>4]+Rn[15&n]}return t}return mn.throwArgumentError("invalid hexlify value","value",e)}function On(e){if("string"!=typeof e)e=kn(e);else if(!Sn(e)||e.length%2)return null;return(e.length-2)/2}function In(e,t,r){return"string"!=typeof e?e=kn(e):(!Sn(e)||e.length%2)&&mn.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function xn(e){let t="0x";return e.forEach((e=>{t+=kn(e).substring(2)})),t}function Cn(e){const t=Mn(kn(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function Mn(e){"string"!=typeof e&&(e=kn(e)),Sn(e)||mn.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 Pn(e,t){for("string"!=typeof e?e=kn(e):Sn(e)||mn.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&mn.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Nn(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(gn(e)){let r=_n(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=kn(r.slice(0,32)),t.s=kn(r.slice(32,64))):65===r.length?(t.r=kn(r.slice(0,32)),t.s=kn(r.slice(32,64)),t.v=r[64]):mn.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:mn.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=kn(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(_n(t._vs),32);t._vs=kn(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&mn.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=kn(r);null==t.s?t.s=i:t.s!==i&&mn.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?mn.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&&mn.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Sn(t.r)?t.r=Pn(t.r,32):mn.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Sn(t.s)?t.s=Pn(t.s,32):mn.throwArgumentError("signature missing or invalid s","signature",e);const r=_n(t.s);r[0]>=128&&mn.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=kn(r);t._vs&&(Sn(t._vs)||mn.throwArgumentError("signature invalid _vs","signature",e),t._vs=Pn(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&mn.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Bn(e){return kn(En([(e=Nn(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var Dn=Object.freeze({__proto__:null,arrayify:_n,concat:En,hexConcat:xn,hexDataLength:On,hexDataSlice:In,hexStripZeros:Mn,hexValue:Cn,hexZeroPad:Pn,hexlify:kn,isBytes:wn,isBytesLike:gn,isHexString:Sn,joinSignature:Bn,splitSignature:Nn,stripZeros:An,zeroPad:Tn});const Fn="bignumber/5.7.0";var Ln=rn.BN;const Un=new hn(Fn),jn={},qn=9007199254740991;let zn=!1,Hn=class e{constructor(e,t){e!==jn&&Un.throwError("cannot call constructor directly; use BigNumber.from",hn.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Vn(Kn(this).fromTwos(e))}toTwos(e){return Vn(Kn(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Vn(Kn(this).add(Kn(e)))}sub(e){return Vn(Kn(this).sub(Kn(e)))}div(t){return e.from(t).isZero()&&Wn("division-by-zero","div"),Vn(Kn(this).div(Kn(t)))}mul(e){return Vn(Kn(this).mul(Kn(e)))}mod(e){const t=Kn(e);return t.isNeg()&&Wn("division-by-zero","mod"),Vn(Kn(this).umod(t))}pow(e){const t=Kn(e);return t.isNeg()&&Wn("negative-power","pow"),Vn(Kn(this).pow(t))}and(e){const t=Kn(e);return(this.isNegative()||t.isNeg())&&Wn("unbound-bitwise-result","and"),Vn(Kn(this).and(t))}or(e){const t=Kn(e);return(this.isNegative()||t.isNeg())&&Wn("unbound-bitwise-result","or"),Vn(Kn(this).or(t))}xor(e){const t=Kn(e);return(this.isNegative()||t.isNeg())&&Wn("unbound-bitwise-result","xor"),Vn(Kn(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Wn("negative-width","mask"),Vn(Kn(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Wn("negative-width","shl"),Vn(Kn(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Wn("negative-width","shr"),Vn(Kn(this).shrn(e))}eq(e){return Kn(this).eq(Kn(e))}lt(e){return Kn(this).lt(Kn(e))}lte(e){return Kn(this).lte(Kn(e))}gt(e){return Kn(this).gt(Kn(e))}gte(e){return Kn(this).gte(Kn(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Kn(this).isZero()}toNumber(){try{return Kn(this).toNumber()}catch(e){Wn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Un.throwError("this platform does not support BigInt",hn.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?zn||(zn=!0,Un.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Un.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",hn.errors.UNEXPECTED_ARGUMENT,{}):Un.throwError("BigNumber.toString does not accept parameters",hn.errors.UNEXPECTED_ARGUMENT,{})),Kn(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(jn,Gn(t)):t.match(/^-?[0-9]+$/)?new e(jn,Gn(new Ln(t))):Un.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Wn("underflow","BigNumber.from",t),(t>=qn||t<=-qn)&&Wn("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(wn(r))return e.from(kn(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&&(Sn(t)||"-"===t[0]&&Sn(t.substring(1))))return e.from(t)}return Un.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Gn(e){if("string"!=typeof e)return Gn(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Un.throwArgumentError("invalid hex","value",e),"0x00"===(e=Gn(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 Vn(e){return Hn.from(Gn(e))}function Kn(e){const t=Hn.from(e).toHexString();return"-"===t[0]?new Ln("-"+t.substring(3),16):new Ln(t.substring(2),16)}function Wn(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Un.throwError(e,hn.errors.NUMERIC_FAULT,n)}const Xn=new hn(Fn),$n={},Jn=Hn.from(0),Yn=Hn.from(-1);function Qn(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),Xn.throwError(e,hn.errors.NUMERIC_FAULT,i)}let Zn="0";for(;Zn.length<256;)Zn+=Zn;function ei(e){if("number"!=typeof e)try{e=Hn.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Zn.substring(0,e):Xn.throwArgumentError("invalid decimal size","decimals",e)}function ti(e,t){null==t&&(t=0);const r=ei(t),n=(e=Hn.from(e)).lt(Jn);n&&(e=e.mul(Yn));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 ri(e,t){null==t&&(t=0);const r=ei(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Xn.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&Xn.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Xn.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&&Qn("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=Hn.from(a),c=Hn.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(Yn)),u}class ni{constructor(e,t,r,n){e!==$n&&Xn.throwError("cannot use FixedFormat constructor; use FixedFormat.from",hn.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=ei(n),Object.freeze(this)}static from(e){if(e instanceof ni)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||Xn.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&&Xn.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&&Xn.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Xn.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new ni($n,t,r,n)}}class ii{constructor(e,t,r,n){e!==$n&&Xn.throwError("cannot use FixedNumber constructor; use FixedNumber.from",hn.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&&Xn.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ri(this._value,this.format.decimals),r=ri(e._value,e.format.decimals);return ii.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ri(this._value,this.format.decimals),r=ri(e._value,e.format.decimals);return ii.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ri(this._value,this.format.decimals),r=ri(e._value,e.format.decimals);return ii.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ri(this._value,this.format.decimals),r=ri(e._value,e.format.decimals);return ii.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=ii.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(ai.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=ii.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(ai.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)&&Xn.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=ii.from("1"+Zn.substring(0,e),this.format),n=oi.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&&Xn.throwArgumentError("invalid byte width","width",e);return Pn(Hn.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return ii.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Hn.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Sn(e)||"bigint"==typeof e||wn(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),ii.fromString(ti(e,t),ni.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=ni.from(t),n=ri(e,r.decimals);!r.signed&&n.lt(Jn)&&Qn("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Pn(i,r.width/8));const a=ti(n,r.decimals);return new ii($n,i,a,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=ni.from(t);if(_n(e).length>r.width/8)throw new Error("overflow");let n=Hn.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),a=ti(n,r.decimals);return new ii($n,i,a,r)}static from(e,t){if("string"==typeof e)return ii.fromString(e,t);if(wn(e))return ii.fromBytes(e,t);try{return ii.fromValue(e,0,t)}catch(e){if(e.code!==hn.errors.INVALID_ARGUMENT)throw e}return Xn.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const ai=ii.from(1),oi=ii.from("0.5");var si=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 ci=new hn("properties/5.7.0");function ui(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function fi(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 di(e){return si(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 li(e,t){e&&"object"==typeof e||ci.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||ci.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function hi(e){const t={};for(const r in e)t[r]=e[r];return t}const pi={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function mi(e){if(null==e||pi[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(!mi(n))return!1}return!0}return ci.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function bi(e){if(mi(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>yi(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&ui(t,r,yi(n))}return t}return ci.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function yi(e){return bi(e)}let gi=class{constructor(e){for(const t in e)this[t]=yi(e[t])}};var vi=Object.freeze({__proto__:null,Description:gi,checkProperties:li,deepCopy:yi,defineReadOnly:ui,getStatic:fi,resolveProperties:di,shallowCopy:hi});const wi="abi/5.7.0",_i=new hn(wi),Ei={};let Ai={calldata:!0,memory:!0,storage:!0},Ti={calldata:!0,memory:!0};function Si(e,t){if("bytes"===e||"string"===e){if(Ai[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Ti[t])return!0;return(Ai[t]||"payable"===t)&&_i.throwArgumentError("invalid modifier","name",t),!1}function Ri(e,t){for(let r in t)ui(e,r,t[r])}const ki=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Oi=new RegExp(/^(.*)\[([0-9]*)\]$/);let Ii=class e{constructor(t,r){t!==Ei&&_i.throwError("use fromString",hn.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Ri(this,r);let n=this.type.match(Oi);Ri(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=ki.sighash),ki[e]||_i.throwArgumentError("invalid format type","format",e),e===ki.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!==ki.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===ki.full?", ":",")+")"):t+=this.type,e!==ki.sighash&&(!0===this.indexed&&(t+=" indexed"),e===ki.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(Ei,{name:t.name||null,type:ji(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){_i.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=ji(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=""),Si(o.type,o.name)&&(o.name=""),o.type=ji(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=""),Si(o.type,o.name)&&(o.name=""),o.type=ji(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=ji(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=""):Si(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&&_i.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=""):Si(o.type,o.name)&&(o.name=""),a.type=ji(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 xi(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&&_i.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>Ii.fromString(e,t)))}let Ci=class e{constructor(e,t){e!==Ei&&_i.throwError("use a static from method",hn.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Ri(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 Fi.fromObject(t);case"event":return Mi.fromObject(t);case"constructor":return Di.fromObject(t);case"error":return Ui.fromObject(t);case"fallback":case"receive":return null}return _i.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]?Mi.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Fi.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Di.fromString(e.trim()):"error"===e.split(" ")[0]?Ui.fromString(e.substring(5).trim()):_i.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}},Mi=class e extends Ci{format(e){if(e||(e=ki.sighash),ki[e]||_i.throwArgumentError("invalid format type","format",e),e===ki.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!==ki.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===ki.full?", ":",")+") ",e!==ki.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&&_i.throwArgumentError("invalid event object","value",t);const r={name:zi(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Ii.fromObject):[],type:"event"};return new e(Ei,r)}static fromString(t){let r=t.match(Hi);r||_i.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:_i.warn("unknown modifier: "+e)}})),e.fromObject({name:r[1].trim(),anonymous:n,inputs:xi(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}};function Pi(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&_i.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||_i.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Hn.from(r[1]),r[0]):e}function Ni(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 Bi(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&&_i.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&_i.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||_i.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&&_i.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&&_i.throwArgumentError("unable to determine stateMutability","value",e),t}let Di=class e extends Ci{format(e){if(e||(e=ki.sighash),ki[e]||_i.throwArgumentError("invalid format type","format",e),e===ki.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===ki.sighash&&_i.throwError("cannot format a constructor for sighash",hn.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===ki.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&&_i.throwArgumentError("invalid constructor object","value",t);let r=Bi(t);r.constant&&_i.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Ii.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Hn.from(t.gas):null};return new e(Ei,n)}static fromString(t){let r={type:"constructor"},n=(t=Pi(t,r)).match(Hi);return n&&"constructor"===n[1].trim()||_i.throwArgumentError("invalid constructor string","value",t),r.inputs=xi(n[2].trim(),!1),Ni(n[3].trim(),r),e.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}},Fi=class e extends Di{format(e){if(e||(e=ki.sighash),ki[e]||_i.throwArgumentError("invalid format type","format",e),e===ki.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!==ki.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===ki.full?", ":",")+") ",e!==ki.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&&_i.throwArgumentError("invalid function object","value",t);let r=Bi(t);const n={type:t.type,name:zi(t.name),constant:r.constant,inputs:t.inputs?t.inputs.map(Ii.fromObject):[],outputs:t.outputs?t.outputs.map(Ii.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Hn.from(t.gas):null};return new e(Ei,n)}static fromString(t){let r={type:"function"},n=(t=Pi(t,r)).split(" returns ");n.length>2&&_i.throwArgumentError("invalid function string","value",t);let i=n[0].match(Hi);if(i||_i.throwArgumentError("invalid function signature","value",t),r.name=i[1].trim(),r.name&&zi(r.name),r.inputs=xi(i[2],!1),Ni(i[3].trim(),r),n.length>1){let e=n[1].match(Hi);""==e[1].trim()&&""==e[3].trim()||_i.throwArgumentError("unexpected tokens","value",t),r.outputs=xi(e[2],!1)}else r.outputs=[];return e.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}};function Li(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||_i.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}let Ui=class e extends Ci{format(e){if(e||(e=ki.sighash),ki[e]||_i.throwArgumentError("invalid format type","format",e),e===ki.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==ki.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===ki.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&&_i.throwArgumentError("invalid error object","value",t);const r={type:t.type,name:zi(t.name),inputs:t.inputs?t.inputs.map(Ii.fromObject):[]};return Li(new e(Ei,r))}static fromString(t){let r={type:"error"},n=t.match(Hi);return n||_i.throwArgumentError("invalid error signature","value",t),r.name=n[1].trim(),r.name&&zi(r.name),r.inputs=xi(n[2],!1),Li(e.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}};function ji(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const qi=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function zi(e){return e&&e.match(qi)||_i.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Hi=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Gi=new hn(wi);function Vi(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 Ki=class{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Gi.throwArgumentError(e,this.localName,t)}},Wi=class{constructor(e){ui(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return xn(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(En(e._data))}writeBytes(e){let t=_n(e);const r=t.length%this.wordSize;return r&&(t=En([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=_n(Hn.from(e));return t.length>this.wordSize&&Gi.throwError("value out-of-bounds",hn.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=En([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 Xi={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
- */uM=fM,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=ex:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&uM.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=[],A=0;A<w.length;++A)for(var T=w[A],S=T.bits,R=0;R<S.length;++R){var k=T.name+"_"+S[R];if(E.push(k),_[k]=T.createMethod(S[R],T.padding),"sha3"!==T.name){var O=T.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,A,T,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,A=e[48]<<14|e[49]>>>18,T=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^~_&A,e[5]=w^~E&T,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]=_^~A&m,e[7]=E^~T&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]=A^~m&y,e[9]=T^~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)uM.exports=_;else for(A=0;A<E.length;++A)r[E[A]]=_[E[A]]}();var dM=fM.exports;function lM(e){return"0x"+dM.keccak_256(_n(e))}let hM=!1,pM=!1;const mM={debug:1,default:2,info:2,warning:3,error:4,off:5};let bM=mM.default,yM=null;const gM=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 vM,wM;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(vM||(vM={})),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"}(wM||(wM={}));const _M="0123456789abcdef";let EM=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==mM[r]&&this.throwArgumentError("invalid log level name","logLevel",e),bM>mM[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(pM)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+=_M[t[e]>>4],r+=_M[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 wM.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 wM.CALL_EXCEPTION:case wM.INSUFFICIENT_FUNDS:case wM.MISSING_NEW:case wM.NONCE_EXPIRED:case wM.REPLACEMENT_UNDERPRICED:case wM.TRANSACTION_REPLACED:case wM.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){gM&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:gM})}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 yM||(yM=new e("logger/5.7.0")),yM}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),hM){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}pM=!!t,hM=!!r}static setLogLevel(t){const r=mM[t.toLowerCase()];null!=r?bM=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};EM.errors=wM,EM.levels=vM;var AM=rn.BN;const TM=new EM("bignumber/5.7.0"),SM={};let RM=!1,kM=class e{constructor(e,t){e!==SM&&TM.throwError("cannot call constructor directly; use BigNumber.from",EM.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return IM(xM(this).fromTwos(e))}toTwos(e){return IM(xM(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return IM(xM(this).add(xM(e)))}sub(e){return IM(xM(this).sub(xM(e)))}div(t){return e.from(t).isZero()&&CM("division-by-zero","div"),IM(xM(this).div(xM(t)))}mul(e){return IM(xM(this).mul(xM(e)))}mod(e){const t=xM(e);return t.isNeg()&&CM("division-by-zero","mod"),IM(xM(this).umod(t))}pow(e){const t=xM(e);return t.isNeg()&&CM("negative-power","pow"),IM(xM(this).pow(t))}and(e){const t=xM(e);return(this.isNegative()||t.isNeg())&&CM("unbound-bitwise-result","and"),IM(xM(this).and(t))}or(e){const t=xM(e);return(this.isNegative()||t.isNeg())&&CM("unbound-bitwise-result","or"),IM(xM(this).or(t))}xor(e){const t=xM(e);return(this.isNegative()||t.isNeg())&&CM("unbound-bitwise-result","xor"),IM(xM(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&CM("negative-width","mask"),IM(xM(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&CM("negative-width","shl"),IM(xM(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&CM("negative-width","shr"),IM(xM(this).shrn(e))}eq(e){return xM(this).eq(xM(e))}lt(e){return xM(this).lt(xM(e))}lte(e){return xM(this).lte(xM(e))}gt(e){return xM(this).gt(xM(e))}gte(e){return xM(this).gte(xM(e))}isNegative(){return"-"===this._hex[0]}isZero(){return xM(this).isZero()}toNumber(){try{return xM(this).toNumber()}catch(e){CM("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return TM.throwError("this platform does not support BigInt",EM.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?RM||(RM=!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()",EM.errors.UNEXPECTED_ARGUMENT,{}):TM.throwError("BigNumber.toString does not accept parameters",EM.errors.UNEXPECTED_ARGUMENT,{})),xM(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(SM,OM(t)):t.match(/^-?[0-9]+$/)?new e(SM,OM(new AM(t))):TM.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&CM("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&CM("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(wn(r))return e.from(kn(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&&(Sn(t)||"-"===t[0]&&Sn(t.substring(1))))return e.from(t)}return TM.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function OM(e){if("string"!=typeof e)return OM(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&TM.throwArgumentError("invalid hex","value",e),"0x00"===(e=OM(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 IM(e){return kM.from(OM(e))}function xM(e){const t=kM.from(e).toHexString();return"-"===t[0]?new AM("-"+t.substring(3),16):new AM(t.substring(2),16)}function CM(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),TM.throwError(e,EM.errors.NUMERIC_FAULT,n)}const MM=new EM("bignumber/5.7.0"),PM={},NM=kM.from(0),BM=kM.from(-1);function DM(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),MM.throwError(e,EM.errors.NUMERIC_FAULT,i)}let FM="0";for(;FM.length<256;)FM+=FM;function LM(e){if("number"!=typeof e)try{e=kM.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+FM.substring(0,e):MM.throwArgumentError("invalid decimal size","decimals",e)}function UM(e,t){null==t&&(t=0);const r=LM(t),n=(e=kM.from(e)).lt(NM);n&&(e=e.mul(BM));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 jM(e,t){null==t&&(t=0);const r=LM(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||MM.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&MM.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&MM.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&&DM("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=kM.from(a),c=kM.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(BM)),u}let qM=class e{constructor(e,t,r,n){e!==PM&&MM.throwError("cannot use FixedFormat constructor; use FixedFormat.from",EM.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=LM(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||MM.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&&MM.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&&MM.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&MM.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(PM,r,n,i)}},zM=class e{constructor(e,t,r,n){e!==PM&&MM.throwError("cannot use FixedNumber constructor; use FixedNumber.from",EM.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&&MM.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(t){this._checkFormat(t);const r=jM(this._value,this.format.decimals),n=jM(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=jM(this._value,this.format.decimals),n=jM(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=jM(this._value,this.format.decimals),n=jM(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=jM(this._value,this.format.decimals),n=jM(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(HM.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(HM.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)&&MM.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=e.from("1"+FM.substring(0,t),this.format),i=GM.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&&MM.throwArgumentError("invalid byte width","width",e);return Pn(kM.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&&(kM.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Sn(e)||"bigint"==typeof e||wn(e))}(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(UM(t,r),qM.from(n))}static fromString(t,r){null==r&&(r="fixed");const n=qM.from(r),i=jM(t,n.decimals);!n.signed&&i.lt(NM)&&DM("unsigned value cannot be negative","overflow","value",t);let a=null;n.signed?a=i.toTwos(n.width).toHexString():(a=i.toHexString(),a=Pn(a,n.width/8));const o=UM(i,n.decimals);return new e(PM,a,o,n)}static fromBytes(t,r){null==r&&(r="fixed");const n=qM.from(r);if(_n(t).length>n.width/8)throw new Error("overflow");let i=kM.from(t);n.signed&&(i=i.fromTwos(n.width));const a=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=UM(i,n.decimals);return new e(PM,a,o,n)}static from(t,r){if("string"==typeof t)return e.fromString(t,r);if(wn(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(t){if(t.code!==EM.errors.INVALID_ARGUMENT)throw t}return MM.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}};const HM=zM.from(1),GM=zM.from("0.5"),VM=new EM("strings/5.7.0");var KM,WM;function XM(e,t=KM.current){t!=KM.current&&(VM.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 _n(r)}function $M(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 JM(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 YM(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 QM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?YM(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ZM(e,t,r){return eP.apply(this,arguments)}function eP(){return(eP=ZI(ix.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return ix.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 QM({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=QM(QM({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=lM(XM(JSON.stringify(o))),e.next=6,cx(s,t);case 6:return c=e.sent,u=QM(QM({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 tP(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 rP(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 nP(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)?nP(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 nP(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 iP(e){return aP.apply(this,arguments)}function aP(){return(aP=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return ix.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:tP(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,cx(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 oP(e){return sP.apply(this,arguments)}function sP(){return(sP=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return ix.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:tP({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,cx(u,r);case 13:f=e.sent,d=[],l=rP(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"}(KM||(KM={})),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"}(WM||(WM={})),JM("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))),$M("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"),$M("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"),$M("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})),JM("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 cP=new EM("units/5.7.0"),uP=["wei","kwei","mwei","gwei","szabo","finney","ether"];function fP(e,t){if("string"!=typeof e&&cP.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=uP.indexOf(t);-1!==e&&(t=3*e)}return jM(e,null!=t?t:18)}function dP(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 lP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dP(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function hP(e,t,r,n,i,a,o){return pP.apply(this,arguments)}function pP(){return(pP=ZI(ix.mark((function e(t,r,n,i,a,o,s){var c,u,f;return ix.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,sM(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(lP(lP({},f),{},{value:r})));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mP(e,t,r,n,i,a){return bP.apply(this,arguments)}function bP(){return(bP=ZI(ix.mark((function e(t,r,n,i,a,o){var s;return ix.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(lP(lP({},s),{},{value:r})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yP(e,t,r,n,i,a){return gP.apply(this,arguments)}function gP(){return(gP=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u,f,d,l,h,p,m,b,y;return ix.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=fP(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=jI.connect(o.ethConfiguration.coreContractAddress,t),y=JI.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,aM(p,y);case 19:if(e.sent){e.next=24;break}return e.abrupt("return",hP(t,u,h,p,m,b,i));case 24:return e.abrupt("return",mP(t,u,h,p,m,b));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vP(e,t,r,n,i,a){return wP.apply(this,arguments)}function wP(){return(wP=ZI(ix.mark((function e(t,r,n,i,a,o){var s;return ix.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 _P(e,t,r,n,i,a,o){return EP.apply(this,arguments)}function EP(){return(EP=ZI(ix.mark((function e(t,r,n,i,a,o,s){var c,u,f;return ix.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,sM(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 AP(e,t,r,n,i,a,o){return TP.apply(this,arguments)}function TP(){return(TP=ZI(ix.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,A;return ix.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=fP(r.amount,0),h=BI.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,_=kM.from(b.data.amount),E=jI.connect(s.ethConfiguration.coreContractAddress,t),A=JI.connect(s.ethConfiguration.registrationContractAddress,t),e.next=30,aM(v,A);case 30:if(e.sent){e.next=35;break}return e.abrupt("return",_P(t,_,g,v,w,E,i));case 35:return e.abrupt("return",vP(t,_,g,v,w,E));case 36:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function SP(e,t,r,n,i,a){return RP.apply(this,arguments)}function RP(){return(RP=ZI(ix.mark((function e(t,r,n,i,a,o){var s;return ix.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 kP(e,t,r,n,i,a){return OP.apply(this,arguments)}function OP(){return(OP=ZI(ix.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 ix.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=jI.connect(o.ethConfiguration.coreContractAddress,t),b=JI.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,aM(h,b);case 19:return y=e.sent,g=FI.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,sM(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",SP(t,r.tokenId,l,h,p,m));case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var IP=function(e){if(void 0!==e)return e;throw new Error("undefined field exception")};function xP(e){return CP.apply(this,arguments)}function CP(){return(CP=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p;return ix.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=tP(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,lx(c,r);case 19:return d=e.sent,l=d.ethAddress,h=d.ethSignature,e.next=24,i.createWithdrawal({createWithdrawalRequest:{stark_key:IP(o.data.stark_key),amount:a,asset_id:IP(o.data.asset_id),vault_id:IP(o.data.vault_id),nonce:IP(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 MP(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 PP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?MP(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function NP(e,t,r,n){return BP.apply(this,arguments)}function BP(){return(BP=ZI(ix.mark((function e(t,r,n,i){var a;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.encodeAsset({assetType:t,encodeAssetRequest:{token:PP({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 DP(e,t,r,n,i){return FP.apply(this,arguments)}function FP(){return(FP=ZI(ix.mark((function e(t,r,n,i,a){var o,s,c;return ix.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,sM(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 LP(e,t,r,n){return UP.apply(this,arguments)}function UP(){return(UP=ZI(ix.mark((function e(t,r,n,i){var a;return ix.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 jP(e,t,r,n,i,a){return qP.apply(this,arguments)}function qP(){return(qP=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,NP("asset","ERC20",i,{token_address:n.tokenAddress});case 2:return s=e.sent,c=jI.connect(o.ethConfiguration.coreContractAddress,t),u=JI.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,aM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",DP(t,s.asset_type,r,u,a));case 12:return e.abrupt("return",LP(t,s.asset_type,r,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zP(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 HP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zP(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function GP(e,t,r,n,i){return VP.apply(this,arguments)}function VP(){return(VP=ZI(ix.mark((function e(t,r,n,i,a){var o;return ix.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 KP(e,t,r,n,i,a){return WP.apply(this,arguments)}function WP(){return(WP=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u;return ix.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,sM(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 XP(e){var t=e.data.id,r=e.data.blueprint||"";return Sb(rb("{".concat(t,"}:{").concat(r,"}")))}function $P(e,t,r,n,i,a){return JP.apply(this,arguments)}function JP(){return(JP=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u,f;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,NP("mintable-asset","ERC721",i,HP({id:n.data.id,token_address:n.data.tokenAddress},n.data.blueprint&&{blueprint:n.data.blueprint}));case 2:return s=e.sent,c=XP(n),u=jI.connect(o.ethConfiguration.coreContractAddress,t),f=JI.connect(o.ethConfiguration.registrationContractAddress,t),e.next=8,aM(r,f);case 8:if(e.sent){e.next=13;break}return e.abrupt("return",KP(t,s.asset_type,r,c,f,a));case 13:return e.abrupt("return",GP(t,s.asset_type,r,c,u));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function YP(e,t,r,n,i,a){return QP.apply(this,arguments)}function QP(){return(QP=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u;return ix.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,sM(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 ZP(e,t,r,n,i){return eN.apply(this,arguments)}function eN(){return(eN=ZI(ix.mark((function e(t,r,n,i,a){var o;return ix.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 tN(e,t,r,n,i,a){return rN.apply(this,arguments)}function rN(){return(rN=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,NP("asset","ERC721",i,{token_id:n.tokenId,token_address:n.tokenAddress});case 2:return s=e.sent,c=jI.connect(o.ethConfiguration.coreContractAddress,t),u=JI.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,aM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",YP(t,s.asset_type,r,n.tokenId,u,a));case 12:return e.abrupt("return",ZP(t,s.asset_type,r,n.tokenId,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nN(e,t,r,n,i,a,o){return iN.apply(this,arguments)}function iN(){return(iN=ZI(ix.mark((function e(t,r,n,i,a,o,s){var c,u;return ix.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 $P(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 tN(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 aN(e,t,r,n,i){return oN.apply(this,arguments)}function oN(){return(oN=ZI(ix.mark((function e(t,r,n,i,a){var o,s,c;return ix.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,sM(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 sN(e,t,r,n){return cN.apply(this,arguments)}function cN(){return(cN=ZI(ix.mark((function e(t,r,n,i){var a;return ix.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 uN(e,t,r,n,i){return fN.apply(this,arguments)}function fN(){return(fN=ZI(ix.mark((function e(t,r,n,i,a){var o,s,c;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,NP("asset","ETH",n);case 2:return o=e.sent,s=jI.connect(a.ethConfiguration.coreContractAddress,t),c=JI.connect(a.ethConfiguration.registrationContractAddress,t),e.next=7,aM(r,c);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",aN(t,o.asset_type,r,c,i));case 12:return e.abrupt("return",sN(t,o.asset_type,r,s));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function dN(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 lN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dN(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function hN(e){return pN.apply(this,arguments)}function pN(){return(pN=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return ix.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:tP(i.buy),amount_sell:s,token_sell:tP(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,cx(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",lN({},g.data));case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mN(e){return bN.apply(this,arguments)}function bN(){return(bN=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return ix.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,cx(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 yN(e){return gN.apply(this,arguments)}function gN(){return(gN=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return ix.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,cx(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 vN(e){return wN.apply(this,arguments)}function wN(){return(wN=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return ix.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:tP(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,cx(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 _N(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 EN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_N(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var AN=function(){function e(t){xI(this,e),this.config=t;var r=t.apiConfiguration;this.config=t,this.depositsApi=new nC(r),this.encodingApi=new sC(r),this.mintsApi=new AC(r),this.ordersApi=new CC(r),this.tokensApi=new UC(r),this.tradesApi=new HC(r),this.transfersApi=new WC(r),this.usersApi=new YC(r),this.withdrawalsApi=new tM(r),this.projectsApi=new BC(r),this.collectionsApi=new Zx(r),this.metadataApi=new mC(r),this.metadataRefreshesApi=new vC(r),this.exchangesApi=new dC(r)}var t,r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g,v,w,_,E,A,T,S,R,k,O;return MI(e,[{key:"isChainValid",value:function(e){return e===this.config.ethConfiguration.chainID}},{key:"validateChain",value:(O=ZI(ix.mark((function e(t){var r;return ix.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=ZI(ix.mark((function e(t){return ix.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",nM(EN(EN({},t),{},{usersApi:this.usersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"isRegisteredOnchain",value:(R=ZI(ix.mark((function e(t){var r,n;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return r=JI.connect(this.config.ethConfiguration.registrationContractAddress,t.ethSigner),e.next=5,t.starkSigner.getAddress();case 5:return n=e.sent,e.abrupt("return",aM(n,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"mint",value:(S=ZI(ix.mark((function e(t,r){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",ZM(t,r,this.mintsApi));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"transfer",value:(T=ZI(ix.mark((function e(t,r){return ix.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(EN(EN({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"exchangeTransfer",value:(A=ZI(ix.mark((function e(t,r){return ix.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",vN(EN(EN({},t),{},{request:r,exchangesApi:this.exchangesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"batchNftTransfer",value:(E=ZI(ix.mark((function e(t,r){return ix.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",oP(EN(EN({},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:(_=ZI(ix.mark((function e(t,r){return ix.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=ZI(ix.mark((function e(t,r){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",yP(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=ZI(ix.mark((function e(t,r){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",AP(t,r,this.depositsApi,this.usersApi,this.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=ZI(ix.mark((function e(t,r){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",kP(t,r,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=ZI(ix.mark((function e(t,r){return ix.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",xP(EN(EN(EN({},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=ZI(ix.mark((function e(t,r){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",uN(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=ZI(ix.mark((function e(t,r,n){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",jP(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=ZI(ix.mark((function e(t,r,n){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",nN(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=ZI(ix.mark((function e(t,r){return ix.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",hN(EN(EN({},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=ZI(ix.mark((function e(t,r){return ix.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",mN(EN(EN({},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=ZI(ix.mark((function e(t,r){return ix.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",yN(EN(EN({},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=ZI(ix.mark((function e(t,r){var n;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r){var n;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n,i,a){var o;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r){var n;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n){var i;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n){var i;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n,i){var a;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n,i){var a,o;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n,i){var a,o;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r){var n,i;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r){var n,i;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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){GI(r,Ix(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=qI(e);if(t){var i=qI(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return WI(this,r)}}(r);function r(e){var n,i=e.code,a=e.details,o=e.message;return xI(this,r),(n=t.call(this,o)).code=i,n.details=a,n}return MI(r)}();function SN(e){if(II.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 RN=function(){function e(t){xI(this,e),this.depositsApi=new nC(t.apiConfiguration),this.mintsApi=new AC(t.apiConfiguration),this.ordersApi=new CC(t.apiConfiguration),this.tokensApi=new UC(t.apiConfiguration),this.tradesApi=new HC(t.apiConfiguration),this.transfersApi=new WC(t.apiConfiguration),this.exchangeApi=new dC(t.apiConfiguration),this.usersApi=new YC(t.apiConfiguration),this.withdrawalsApi=new tM(t.apiConfiguration),this.balanceApi=new $x(t.apiConfiguration),this.assetApi=new Vx(t.apiConfiguration),this.collectionApi=new Zx(t.apiConfiguration),this.metadataApi=new mC(t.apiConfiguration),this.metadataRefreshesApi=new vC(t.apiConfiguration),this.nftCheckoutPrimaryApi=new kC(t.apiConfiguration),this.projectsApi=new BC(t.apiConfiguration),this.workflows=new AN(t)}var t,r,n;return MI(e,[{key:"deposit",value:function(e,t){return this.workflows.deposit(e,t).catch((function(e){throw SN(e)}))}},{key:"getDeposit",value:function(e){return this.depositsApi.getDeposit(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listDeposits",value:function(e){return this.depositsApi.listDeposits(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"registerOffchain",value:function(e){return this.workflows.registerOffchain(e).catch((function(e){throw SN(e)}))}},{key:"isRegisteredOnchain",value:function(e){return this.workflows.isRegisteredOnchain(e).catch((function(e){throw SN(e)}))}},{key:"getUser",value:function(e){return this.usersApi.getUsers({user:e}).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"getAsset",value:function(e){return this.assetApi.getAsset(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listAssets",value:function(e){return this.assetApi.listAssets(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"createCollection",value:function(e,t){return this.workflows.createCollection(e,t).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"getCollection",value:function(e){return this.collectionApi.getCollection(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listCollectionFilters",value:function(e){return this.collectionApi.listCollectionFilters(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listCollections",value:function(e){return this.collectionApi.listCollections(e).then((function(e){return e.data})).catch((function(e){throw SN(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 SN(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 SN(e)}))}},{key:"getMetadataSchema",value:function(e){return this.metadataApi.getMetadataSchema(e).then((function(e){return e.data})).catch((function(e){throw SN(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 SN(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 SN(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 SN(e)}))}},{key:"getMetadataRefreshResults",value:function(e,t){return this.workflows.getMetadataRefreshResults(e,t).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"createMetadataRefresh",value:function(e,t){return this.workflows.createMetadataRefresh(e,t).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"createProject",value:(n=ZI(ix.mark((function e(t,r){return ix.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 SN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getProject",value:(r=ZI(ix.mark((function e(t,r){return ix.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 SN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getProjects",value:(t=ZI(ix.mark((function e(t,r,n,i,a){return ix.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 SN(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 SN(e)}))}},{key:"listBalances",value:function(e){return this.balanceApi.listBalances(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"getMint",value:function(e){return this.mintsApi.getMint(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listMints",value:function(e){return this.mintsApi.listMints(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"mint",value:function(e,t){return this.workflows.mint(e,t).catch((function(e){throw SN(e)}))}},{key:"listWithdrawals",value:function(e){return this.withdrawalsApi.listWithdrawals(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"getWithdrawal",value:function(e){return this.withdrawalsApi.getWithdrawal(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"prepareWithdrawal",value:function(e,t){return this.workflows.prepareWithdrawal(e,t).catch((function(e){throw SN(e)}))}},{key:"completeWithdrawal",value:function(e,t,r){return this.workflows.completeWithdrawal(e,t,r).catch((function(e){throw SN(e)}))}},{key:"getOrder",value:function(e){return this.ordersApi.getOrderV3(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listOrders",value:function(e){return this.ordersApi.listOrdersV3(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"createOrder",value:function(e,t){return this.workflows.createOrder(e,t).catch((function(e){throw SN(e)}))}},{key:"cancelOrder",value:function(e,t){return this.workflows.cancelOrder(e,t).catch((function(e){throw SN(e)}))}},{key:"getTrade",value:function(e){return this.tradesApi.getTrade(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listTrades",value:function(e){return this.tradesApi.listTradesV3(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"createTrade",value:function(e,t){return this.workflows.createTrade(e,t).catch((function(e){throw SN(e)}))}},{key:"getToken",value:function(e){return this.tokensApi.getToken(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listTokens",value:function(e){return this.tokensApi.listTokens(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"getTransfer",value:function(e){return this.transfersApi.getTransfer(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listTransfers",value:function(e){return this.transfersApi.listTransfers(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"transfer",value:function(e,t){return this.workflows.transfer(e,t).catch((function(e){throw SN(e)}))}},{key:"batchNftTransfer",value:function(e,t){return this.workflows.batchNftTransfer(e,t).catch((function(e){throw SN(e)}))}},{key:"createExchange",value:function(e){return this.exchangeApi.createExchange(e).catch((function(e){throw SN(e)}))}},{key:"getExchange",value:function(e){return this.exchangeApi.getExchange(e).catch((function(e){throw SN(e)}))}},{key:"getExchanges",value:function(e){return this.exchangeApi.getExchanges(e).catch((function(e){throw SN(e)}))}},{key:"exchangeTransfer",value:function(e,t){return this.workflows.exchangeTransfer(e,t).catch((function(e){throw SN(e)}))}},{key:"createNftPrimary",value:function(e){return this.nftCheckoutPrimaryApi.createNftPrimary(e).catch((function(e){throw SN(e)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(e){return this.nftCheckoutPrimaryApi.getCurrenciesNFTCheckoutPrimary(e).catch((function(e){throw SN(e)}))}},{key:"getNftPrimaryTransaction",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransaction(e).catch((function(e){throw SN(e)}))}},{key:"getNftPrimaryTransactions",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransactions(e).catch((function(e){throw SN(e)}))}}]),e}();function kN(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 ON(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kN(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var IN={"x-sdk-version":"imx-core-sdk-ts-".concat("2.0.2")},xN=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&&(IN["x-sdk-version"]=o),a=ON(ON({},a||{}),IN),{apiConfiguration:new rM({basePath:i,baseOptions:{headers:a}}),ethConfiguration:{coreContractAddress:t,registrationContractAddress:r,chainID:n}}},CN={get PRODUCTION(){return xN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"})},get SANDBOX(){return xN({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"})},createConfig:xN},MN=new rn("08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f",16);new Ob.ec(new Ob.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:MN.toString("hex"),hash:Lu.sha256,gRed:!1,g:["1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca","5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"]}));var PN=function(){var e=new rn("1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000",16);return e.sub(e.mod(MN))};function NN(e,t){return new rn(Lu.sha256().update(Jm(Eb(e)+gb(nb(t),2))).digest("hex"),16)}function BN(e){for(var t=PN(),r=NN(e.toString("hex",64),0),n=0;r.gte(t);n++)r=NN(r.toString("hex"),n);return r.umod(MN).toString("hex")}function DN(e){for(var t=PN(),r=NN(e.toString("hex",64),0),n=1;r.gte(t);n++)r=NN(r.toString("hex"),n);return r.umod(MN).toString("hex")}function FN(e){var t=PN();return NN(e.toString("hex",64),0).gte(t)}function LN(e){return UN.apply(this,arguments)}function UN(){return(UN=ZI(ix.mark((function e(t){var r,n;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=new RN(CN.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 jN(e,t){var r=Gk.hdkey.fromMasterSeed(Buffer.from(e.slice(2),"hex")).derivePath(t).getWallet().getPrivateKey();return new rn(r)}function qN(e,t,r){return zN.apply(this,arguments)}function zN(){return(zN=ZI(ix.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=jN(t,r),a=DN(i),FN(i)){e.next=4;break}return e.abrupt("return",a);case 4:return e.next=6,LN(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 rn(Eb(o.starkPublicKey),16),e.next=14,kx(a).getAddress();case 14:if(c=e.sent,!s.eq(new rn(Eb(c),16))){e.next=17;break}return e.abrupt("return",a);case 17:return u=BN(i),e.next=20,kx(u).getAddress();case 20:if(c=e.sent,!s.eq(new rn(Eb(c),16))){e.next=23;break}return e.abrupt("return",u);case 23:return f=Sx(t,r),d=Tx(f),e.next=27,kx(d).getAddress();case 27:if(c=e.sent,!s.eq(new rn(Eb(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 HN(e){return GN.apply(this,arguments)}function GN(){return(GN=ZI(ix.mark((function e(t){var r,n,i,a,o;return ix.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=Nn(n).s,a=Ex("starkex","immutablex",r,"1"),e.next=10,qN(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)}EM.errors.INSUFFICIENT_FUNDS,EM.errors.NONCE_EXPIRED,EM.errors.REPLACEMENT_UNDERPRICED;const VN=({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n})=>CN.createConfig({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n,sdkVersion:"ts-immutable-sdk-0.22.3"}),KN=()=>VN({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"});class WN{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=KN();break;case t.PRODUCTION:this.immutableXConfig=VN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"});break;default:this.immutableXConfig=KN()}}}class XN{immutableX;depositsApi;mintsApi;ordersApi;tokensApi;tradesApi;transfersApi;exchangeApi;nftCheckoutPrimaryApi;usersApi;withdrawalsApi;balanceApi;assetApi;collectionApi;metadataApi;metadataRefreshesApi;projectsApi;constructor(e){const t=new WN(e);this.immutableX=new RN(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 $N=Object.freeze({__proto__:null,IMXError:TN,ImmutableXClient:XN,imxClientCreateStarkSigner:kx,imxClientGenerateLegacyStarkPrivateKey:HN});var JN={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!==Jt&&Jt.crypto&&(r=Jt.crypto),!r)try{r=Db}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}()}(JN);var YN=JN.exports,QN=Yt(YN),ZN={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}(YN)}(ZN);var eB=Yt(ZN.exports),tB={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}(YN)}(tB);var rB=Yt(tB.exports),nB={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(YN)}(nB);var iB=Yt(nB.exports);function aB(e){this.message=e}aB.prototype=new Error,aB.prototype.name="InvalidCharacterError";var oB="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new aB("'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 sB(e){this.message=e}function cB(e,t){if("string"!=typeof e)throw new sB("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(oB(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 oB(t)}}(e.split(".")[r]))}catch(e){throw new sB("Invalid token specified: "+e.message)}}sB.prototype=new Error,sB.prototype.name="InvalidTokenError";var uB,fB,dB,lB={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},hB=(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))(hB||{});(dB=hB||(hB={})).reset=function(){uB=3,fB=lB},dB.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");uB=e},dB.setLogger=function(e){fB=e};var pB=class{constructor(e){this._name=e}debug(...e){uB>=4&&fB.debug(pB._format(this._name,this._method),...e)}info(...e){uB>=3&&fB.info(pB._format(this._name,this._method),...e)}warn(...e){uB>=2&&fB.warn(pB._format(this._name,this._method),...e)}error(...e){uB>=1&&fB.error(pB._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 pB(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){const r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){uB>=4&&fB.debug(pB._format(e),...t)}static info(e,...t){uB>=3&&fB.info(pB._format(e),...t)}static warn(e,...t){uB>=2&&fB.warn(pB._format(e),...t)}static error(e,...t){uB>=1&&fB.error(pB._format(e),...t)}};hB.reset();var mB=class{static _randomWord(){return QN.lib.WordArray.random(1).words[0]}static generateUUIDv4(){const e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^mB._randomWord()&15>>+e/4).toString(16)));return e.replace(/-/g,"")}static generateCodeVerifier(){return mB.generateUUIDv4()+mB.generateUUIDv4()+mB.generateUUIDv4()}static generateCodeChallenge(e){try{const t=eB(e);return rB.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw pB.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const r=iB.parse([e,t].join(":"));return rB.stringify(r)}},bB=class{constructor(e){this._name=e,this._logger=new pB(`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)}},yB=class{static decode(e){try{return cB(e)}catch(e){throw pB.error("JwtUtils.decode",e),e}}},gB=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(",")}},vB=class extends bB{constructor(){super(...arguments),this._logger=new pB(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-vB.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=vB.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=vB.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)}},wB=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))}},_B=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 pB.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}},EB=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},AB=class{constructor(e){this._logger=new pB("AccessTokenEvents"),this._expiringTimer=new vB("Access token expiring"),this._expiredTimer=new vB("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 pB("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]}},SB=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new pB("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 EB("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 _B(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 _B(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)}))}},RB=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new pB("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}},kB=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:A="OP",mergeClaims:T=!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=A,this.mergeClaims=!!T,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 RB({store:e})}this.refreshTokenAllowedScope=x,this.extraQueryParams=C,this.extraTokenParams=M,this.extraHeaders=P}},OB=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new pB("TokenClient"),this._jsonService=new SB(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=mB.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=mB.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=mB.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")}},IB=class{constructor(e){this.id=e.id||mB.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=vB.getEpochTime(),this.request_type=e.request_type}toStorageString(){return new pB("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})}static fromStorageString(e){return pB.createStatic("State","fromStorageString"),new IB(JSON.parse(e))}static async clearStaleState(e,t){const r=pB.createStatic("State","clearStaleState"),n=vB.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=IB.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))}}},xB=class extends IB{constructor(e){super(e),!0===e.code_verifier?this.code_verifier=mB.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=mB.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 pB("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){pB.createStatic("SigninState","fromStorageString");const t=JSON.parse(e);return new xB(t)}},CB=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-vB.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+vB.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},MB=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],PB=["sub","iss","aud","exp","iat"],NB=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-vB.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+vB.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 pB("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 pB.createStatic("User","fromStorageString"),new NB(JSON.parse(e))}},BB="oidc-client",DB=class{constructor(){this._abort=new bB("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)===BB){try{const r=wB.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:BB,url:t,keepOpen:r},n)}},FB={location:!1,toolbar:!1,height:640},LB="_blank",UB=60,jB=2,qB=10,zB=class extends kB{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:n=FB,popupWindowTarget:i=LB,redirectMethod:a="assign",redirectTarget:o="self",iframeNotifyParentOrigin:s=e.iframeNotifyParentOrigin,iframeScriptOrigin:c=e.iframeScriptOrigin,silent_redirect_uri:u=e.redirect_uri,silentRequestTimeoutInSeconds:f=qB,automaticSilentRenew:d=!0,validateSubOnSilentRenew:l=!0,includeIdTokenInSilentRenew:h=!1,monitorSession:p=!1,monitorAnonymousSession:m=!1,checkSessionIntervalInSeconds:b=jB,query_status_response_type:y="code",stopCheckSessionOnError:g=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:w=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=UB,userStore:A}=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,A)this.userStore=A;else{const e="undefined"!=typeof window?window.sessionStorage:new TB;this.userStore=new RB({store:e})}}},HB=class extends DB{constructor({silentRequestTimeoutInSeconds:e=qB}){super(),this._logger=new pB("IFrameWindow"),this._timeoutInSeconds=e,this._frame=HB.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 EB("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)}},GB=class extends DB{constructor({popupWindowTarget:e=LB,popupWindowFeatures:t={}}){super(),this._logger=new pB("PopupWindow");const r=gB.center({...FB,...t});this._window=window.open(void 0,e,gB.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)}},VB=class extends AB{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new pB("UserManagerEvents"),this._userLoaded=new bB("User loaded"),this._userUnloaded=new bB("User unloaded"),this._silentRenewError=new bB("Silent renew error"),this._userSignedIn=new bB("User signed in"),this._userSignedOut=new bB("User signed out"),this._userSessionChanged=new bB("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()}},KB=(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))(KB||{}),WB=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(WB||{}),XB=(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))(XB||{}),$B=(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))($B||{}),JB=(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))(JB||{}),YB=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(YB||{}),QB=(e=>(e.Harmony="HARMONY",e))(QB||{}),ZB=Object.create,eD=Object.defineProperty,tD=Object.defineProperties,rD=Object.getOwnPropertyDescriptor,nD=Object.getOwnPropertyDescriptors,iD=Object.getOwnPropertyNames,aD=Object.getOwnPropertySymbols,oD=Object.getPrototypeOf,sD=Object.prototype.hasOwnProperty,cD=Object.prototype.propertyIsEnumerable,uD=(e,t,r)=>t in e?eD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fD=(e,t)=>{for(var r in t||(t={}))sD.call(t,r)&&uD(e,r,t[r]);if(aD)for(var r of aD(t))cD.call(t,r)&&uD(e,r,t[r]);return e},dD=(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())})),lD=((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 hD={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},pD="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},mD=pD,bD=function(e){let t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=hD,n=(t=e.exports={}).re=[],i=t.src=[],a=t.t={},o=0,s=(e,t,r)=>{let s=o++;mD(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*$")})),yD=/^[0-9]+$/,gD=(e,t)=>{let r=yD.test(e),n=yD.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},vD={compareIdentifiers:gD,rcompareIdentifiers:(e,t)=>gD(t,e)},{MAX_LENGTH:wD,MAX_SAFE_INTEGER:_D}=hD,{re:ED,t:AD}=bD,{compareIdentifiers:TD}=vD,SD=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof SD){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>wD)throw new TypeError(`version is longer than ${wD} characters`);mD("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?ED[AD.LOOSE]:ED[AD.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>_D||this.major<0)throw new TypeError("Invalid major version");if(this.minor>_D||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>_D||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<_D)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(mD("SemVer.compare",this.version,this.options,e),!(e instanceof SD)){if("string"==typeof e&&e===this.version)return 0;e=new SD(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof SD||(e=new SD(e,this.options)),TD(this.major,e.major)||TD(this.minor,e.minor)||TD(this.patch,e.patch)}comparePre(e){if(e instanceof SD||(e=new SD(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(mD("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 SD||(e=new SD(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(mD("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}},RD=(e,t,r)=>new SD(e,r).compare(new SD(t,r)),kD=(e,t,r)=>0===RD(e,t,r),OD=(e,t,r)=>0!==RD(e,t,r),ID=(e,t,r)=>RD(e,t,r)>0,xD=(e,t,r)=>RD(e,t,r)>=0,CD=(e,t,r)=>RD(e,t,r)<0,MD=(e,t,r)=>RD(e,t,r)<=0,PD=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return kD(e,r,n);case"!=":return OD(e,r,n);case">":return ID(e,r,n);case">=":return xD(e,r,n);case"<":return CD(e,r,n);case"<=":return MD(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},ND=Symbol("SemVer ANY"),BD=class{static get ANY(){return ND}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof BD){if(e.loose===!!t.loose)return e;e=e.value}mD("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===ND?this.value="":this.value=this.operator+this.semver.version,mD("comp",this)}parse(e){let t=this.options.loose?DD[FD.COMPARATORLOOSE]:DD[FD.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 SD(r[2],this.options.loose):this.semver=ND}toString(){return this.value}test(e){if(mD("Comparator.test",e,this.options.loose),this.semver===ND||e===ND)return!0;if("string"==typeof e)try{e=new SD(e,this.options)}catch(e){return!1}return PD(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof BD))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new LD(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new LD(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=PD(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),s=PD(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||i&&a||o||s}},{re:DD,t:FD}=bD,LD=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof LD)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new LD(e.raw,t);if(e instanceof BD)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?UD[jD.HYPHENRANGELOOSE]:UD[jD.HYPHENRANGE];e=e.replace(r,tF(this.options.includePrerelease)),mD("hyphen replace",e),e=e.replace(UD[jD.COMPARATORTRIM],qD),mD("comparator trim",e,UD[jD.COMPARATORTRIM]),e=(e=(e=e.replace(UD[jD.TILDETRIM],zD)).replace(UD[jD.CARETTRIM],HD)).split(/\s+/).join(" ");let n=t?UD[jD.COMPARATORLOOSE]:UD[jD.COMPARATOR];return e.split(" ").map((e=>VD(e,this.options))).join(" ").split(/\s+/).map((e=>eF(e,this.options))).filter(this.options.loose?e=>!!e.match(n):()=>!0).map((e=>new BD(e,this.options)))}intersects(e,t){if(!(e instanceof LD))throw new TypeError("a Range is required");return this.set.some((r=>GD(r,t)&&e.set.some((e=>GD(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 SD(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(rF(this.set[t],e,this.options))return!0;return!1}},{re:UD,t:jD,comparatorTrimReplace:qD,tildeTrimReplace:zD,caretTrimReplace:HD}=bD,GD=(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},VD=(e,t)=>(mD("comp",e,t),e=$D(e,t),mD("caret",e),e=WD(e,t),mD("tildes",e),e=YD(e,t),mD("xrange",e),e=ZD(e,t),mD("stars",e),e),KD=e=>!e||"x"===e.toLowerCase()||"*"===e,WD=(e,t)=>e.trim().split(/\s+/).map((e=>XD(e,t))).join(" "),XD=(e,t)=>{let r=t.loose?UD[jD.TILDELOOSE]:UD[jD.TILDE];return e.replace(r,((t,r,n,i,a)=>{let o;return mD("tilde",e,t,r,n,i,a),KD(r)?o="":KD(n)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:KD(i)?o=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(mD("replaceTilde pr",a),o=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):o=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,mD("tilde return",o),o}))},$D=(e,t)=>e.trim().split(/\s+/).map((e=>JD(e,t))).join(" "),JD=(e,t)=>{mD("caret",e,t);let r=t.loose?UD[jD.CARETLOOSE]:UD[jD.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,o)=>{let s;return mD("caret",e,t,r,i,a,o),KD(r)?s="":KD(i)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:KD(a)?s="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:o?(mD("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`):(mD("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`),mD("caret return",s),s}))},YD=(e,t)=>(mD("replaceXRanges",e,t),e.split(/\s+/).map((e=>QD(e,t))).join(" ")),QD=(e,t)=>{e=e.trim();let r=t.loose?UD[jD.XRANGELOOSE]:UD[jD.XRANGE];return e.replace(r,((r,n,i,a,o,s)=>{mD("xRange",e,r,n,i,a,o,s);let c=KD(i),u=c||KD(a),f=u||KD(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`),mD("xRange return",r),r}))},ZD=(e,t)=>(mD("replaceStars",e,t),e.trim().replace(UD[jD.STAR],"")),eF=(e,t)=>(mD("replaceGTE0",e,t),e.trim().replace(UD[t.includePrerelease?jD.GTE0PRE:jD.GTE0],"")),tF=e=>(t,r,n,i,a,o,s,c,u,f,d,l,h)=>`${r=KD(n)?"":KD(i)?`>=${n}.0.0${e?"-0":""}`:KD(a)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=KD(u)?"":KD(f)?`<${+u+1}.0.0-0`:KD(d)?`<${u}.${+f+1}.0-0`:l?`<=${u}.${f}.${d}-${l}`:e?`<${u}.${f}.${+d+1}-0`:`<=${c}`}`.trim(),rF=(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(mD(e[r].semver),e[r].semver!==BD.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},nF=(e,t,r)=>{try{t=new LD(t,r)}catch(e){return!1}return t.test(e)},{MAX_LENGTH:iF}=hD,{re:aF,t:oF}=bD,sF=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof SD)return e;if("string"!=typeof e||e.length>iF||!(t.loose?aF[oF.LOOSE]:aF[oF.FULL]).test(e))return null;try{return new SD(e,t)}catch(e){return null}},{re:cF,t:uF}=bD,fF=(e,t)=>{if(e instanceof SD)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=cF[uF.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),cF[uF.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;cF[uF.COERCERTL].lastIndex=-1}else r=e.match(cF[uF.COERCE]);return null===r?null:sF(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function dF(e){return String.fromCharCode(parseInt(e.slice(1),16))}function lF(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function hF(e){return function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,dF))}(JSON.stringify(e))}function pF(e){return JSON.parse(function(e){return decodeURIComponent(Array.from(atob(e),lF).join(""))}(e))}function mF(e){return void 0===e}function bF(e){return function(e){return null===e}(e)||mF(e)}function yF(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var gF={};var vF={"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"},wF=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,wF.prototype)}},_F=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!bF(e)&&"number"==typeof e&&Object.values(XB).includes(e)}(t)?t:XB.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(null==e?void 0:e.data)||void 0,Object.setPrototypeOf(this,_F.prototype)}},EF=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},AF=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,AF.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 SF(){return new wF(KB.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function RF(){return new wF(KB.MalformedResponse,"Response from the Magic iframe is malformed.")}function kF(e){return new wF(KB.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 OF(e){let t=`Some extensions are incompatible with \`${gF.sdkName}@${gF.version}\`:`;return e.filter((e=>void 0!==e.compat&&null!==e.compat)).forEach((e=>{let r=e.compat[gF.sdkName];"string"==typeof r?t+=`\n - Extension \`${e.name}\` supports version(s) \`${r}\``:r||(t+=`\n - Extension \`${e.name}\` does not support ${gF.platform} environments.`)})),new wF(KB.IncompatibleExtensions,t)}function IF(e){return new wF(KB.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 xF(){return new EF(WB.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 \`${gF.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}var CF=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function MF(){return CF.next().value}var PF=Symbol("Payload pre-processed by Magic SDK");function NF(e){return Object.defineProperty(e,PF,{value:!0,enumerable:!1}),e}function BF(e){var t,r,n;return function(e){return!!e[PF]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=MF(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],NF(e)),e}function DF(e,t=[]){return NF({params:t,method:e,jsonrpc:"2.0",id:MF()})}var FF=class{constructor(e){e instanceof FF?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):function(e){return!bF(e)&&!(mF(e.jsonrpc)||mF(e.id)||mF(e.result)&&mF(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}}},LF=((e,t,r)=>(r=null!=e?ZB(oD(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of iD(t))!sD.call(e,i)&&i!==r&&eD(e,i,{get:()=>t[i],enumerable:!(n=rD(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:eD(r,"default",{value:e,enumerable:!0}),e)))(lD()),UF=class extends LF.default{};function jF(){let e=new UF;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var qF=Symbol("isPromiEvent");function zF(e){return!!e[qF]}function HF(e){let t=GF(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=jF(),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,{[qF]:!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 GF(e){return new Promise(((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)}))}var VF,KF=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(YB.MAGIC_HANDLE_REQUEST,BF(e)),r=HF(((e,r)=>{t.then((t=>{if(n(),t.hasError)r(new _F(t.payload.error));else{if(!t.hasResult)throw RF();e(t.payload.result)}})).catch((e=>{n(),r(e)}))})),n=this.overlay.on(JB.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=DF($B.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}},WF=class extends KF{loginWithMagicLink(e){let{email:t,showUI:r=!0,redirectURI:n}=e,i=DF(this.sdk.testMode?$B.LoginWithMagicLinkTestMode:$B.LoginWithMagicLink,[{email:t,showUI:r,redirectURI:n}]);return this.request(i)}loginWithSMS(e){let{phoneNumber:t}=e,r=DF(this.sdk.testMode?$B.LoginWithSmsTestMode:$B.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r}=e,n=DF(this.sdk.testMode?$B.LoginWithEmailOTPTestMode:$B.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"===gF.platform){t=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let r=DF(this.sdk.testMode?$B.LoginWithCredentialTestMode:$B.LoginWithCredential,[t]);return this.request(r)}},XF={};function $F(e){return(...t)=>dD(this,null,(function*(){return VF||(VF=yield gF.configureStorage()),yield VF.ready(),VF[e](...t)}))}((e,t)=>{for(var r in t)eD(e,r,{get:t[r],enumerable:!0})})(XF,{clear:()=>ZF,getItem:()=>JF,iterate:()=>nL,key:()=>tL,keys:()=>rL,length:()=>eL,removeItem:()=>QF,setItem:()=>YF});var JF=$F("getItem"),YF=$F("setItem"),QF=$F("removeItem"),ZF=$F("clear"),eL=$F("length"),tL=$F("key"),rL=$F("keys"),nL=$F("iterate");function iL(){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 aL="STORE_KEY_PRIVATE_KEY",oL="STORE_KEY_PUBLIC_JWK",sL="ECDSA",cL="P-256",uL={name:sL,namedCurve:cL},fL={name:sL,namedCurve:cL};function dL(){QF(oL),QF(aL)}function lL(){return dD(this,null,(function*(){let e=yield function(){return dD(this,null,(function*(){if(function(){let e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return(yield JF(oL))||(yield function(){return dD(this,null,(function*(){let e=null,{subtle:t}=window.crypto,r=yield t.generateKey(uL,!0,["sign"]),n=yield t.exportKey("jwk",r.privateKey);e=yield t.exportKey("jwk",r.publicKey);let i=yield t.importKey("jwk",n,fL,!1,["sign"]);yield YF(aL,i),yield YF(oL,e)}))}()),JF(oL);console.info("webcrypto is not supported")}))}();if(!e)return void console.info("unable to create public key or webcrypto is unsupported");let{subtle:t}=window.crypto,r=yield JF(aL);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:iL()},i={typ:"dpop+jwt",alg:"ES256",jwk:e},a=hL(JSON.stringify(i)),o=hL(JSON.stringify(n)),s=function(e){return(new TextEncoder).encode(e)}(`${a}.${o}`),c={name:sL,hash:{name:"SHA-256"}},u=function(e){let t="";return e.forEach((e=>{t+=String.fromCharCode(e)})),pL(t)}(new Uint8Array(yield t.sign(c,r,s)));return`${a}.${o}.${u}`}))}function hL(e){return pL(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}(e))}function pL(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var mL=class extends KF{getIdToken(e){let t=DF(this.sdk.testMode?$B.GetIdTokenTestMode:$B.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=DF(this.sdk.testMode?$B.GenerateIdTokenTestMode:$B.GenerateIdToken,[e]);return this.request(t)}getMetadata(){let e=DF(this.sdk.testMode?$B.GetMetadataTestMode:$B.GetMetadata);return this.request(e)}updateEmail(e){let{email:t,showUI:r=!0}=e,n=DF(this.sdk.testMode?$B.UpdateEmailTestMode:$B.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}isLoggedIn(){let e=DF(this.sdk.testMode?$B.IsLoggedInTestMode:$B.IsLoggedIn);return this.request(e)}logout(){dL();let e=DF(this.sdk.testMode?$B.LogoutTestMode:$B.Logout);return this.request(e)}showSettings(){let e=DF(this.sdk.testMode?$B.UserSettingsTestMode:$B.UserSettings);return this.request(e)}updatePhoneNumber(){let e=DF(this.sdk.testMode?$B.UpdatePhoneNumberTestMode:$B.UpdatePhoneNumber);return this.request(e)}recoverAccount(e){let t=DF(this.sdk.testMode?$B.RecoverAccountTestMode:$B.RecoverAccount,[e]);return this.request(t)}},bL=class extends KF{connectWithUI(){let e=DF($B.RequestAccounts);return this.request(e)}showUI(){let e=DF($B.ShowUI);return this.request(e)}getInfo(){let e=DF($B.GetInfo);return this.request(e)}requestUserInfoWithUI(e){let t=DF($B.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}disconnect(){dL();let e=DF($B.Disconnect);return this.request(e)}},{createBoundEmitterMethod:yL,createChainingEmitterMethod:gL}=jF(),vL=class extends KF{constructor(){super(...arguments),this.isMagic=!0,this.on=gL("on",this),this.once=gL("once",this),this.addListener=gL("addListener",this),this.off=gL("off",this),this.removeListener=gL("removeListener",this),this.removeAllListeners=gL("removeAllListeners",this),this.emit=yL("emit"),this.eventNames=yL("eventNames"),this.listeners=yL("listeners"),this.listenerCount=yL("listenerCount")}sendAsync(e,t){if(!t)throw IF({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(YB.MAGIC_HANDLE_REQUEST,e.map((e=>{let t=BF(e);return this.prefixPayloadMethodForTestMode(t),t}))).then((e=>{t(null,e.map((e=>((e,t)=>tD(e,nD(t)))(fD({},e.payload),{error:e.hasError?new _F(e.payload.error):null}))))}));else{let r=BF(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(YB.MAGIC_HANDLE_REQUEST,r).then((e=>{t(e.hasError?new _F(e.payload.error):null,e.payload)}))}}send(e,t){if("string"==typeof e){let r=DF(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new EF(WB.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 FF(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=DF("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 wL(e,t){return t?new URL(e,t):new URL(e)}var _L=["request","overlay","sdk"];function EL(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==KF.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var AL=class extends KF{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:HF,isPromiEvent:zF,encodeJSON:hF,decodeJSON:pF,createJsonRpcRequestPayload:DF,standardizeJsonRpcRequestPayload:BF,storage:XF};let e=[this,...EL(this)];_L.forEach((t=>{let r=e.map((e=>Object.getOwnPropertyDescriptor(e,t))),n=r.findIndex((e=>!!e)),i=n>0,a=r[n];a&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:a,isPrototypeField:i}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw kF(t)}}))}))}init(e){this.__is_initialized__||(_L.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 AF(this,e,t,r)}},TL=class extends AL{};TL.Internal=class extends AL{},TL.Anonymous="anonymous extension";var SL=class extends KF{purchase(e){let t=DF($B.NFTPurchase,[e]);return this.request(t)}};function RL(e){return!e.compat||null==e.compat[gF.sdkName]||("string"==typeof e.compat[gF.sdkName]?nF(fF(gF.version),e.compat[gF.sdkName]):!!e.compat[gF.sdkName])}function kL(e){var t;let r=null!=(t=null==e?void 0:e.extensions)?t:[],n={},i=[];if(Array.isArray(r)?r.forEach((e=>{RL(e)?(e.init(this),(e.name||e.name!==TL.Anonymous)&&(this[e.name]=e),e instanceof TL.Internal&&(yF(e.config)||(n[e.name]=e.config))):i.push(e)})):Object.keys(r).forEach((e=>{if(RL(r[e])){r[e].init(this);let t=r[e];this[e]=t,t instanceof TL.Internal&&(yF(t.config)||(n[r[e].name]=t.config))}else i.push(r[e])})),i.length)throw OF(i);return n}var OL=class{constructor(e,t){var r;if(this.apiKey=e,!e)throw SF();"react-native"===gF.platform&&(null==t?void 0:t.endpoint)&&xF().log();let{defaultEndpoint:n,version:i}=gF;this.testMode=!(null==t||!t.testMode),this.endpoint=wL(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new WF(this),this.user=new mL(this),this.wallet=new bL(this),this.nft=new SL(this),this.rpcProvider=new vL(this);let a=kL.call(this,t);this.parameters=hF(fD({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:wL(this.endpoint).host,sdk:vF[gF.sdkName],version:i,ext:yF(a)?void 0:a,locale:(null==t?void 0:t.locale)||"en_US"},gF.bundleId?{bundleId:gF.bundleId}:{}))}get overlay(){if(!OL.__overlays__.has(this.parameters)){let e=new gF.ViewController(this.endpoint,this.parameters);e.init(),OL.__overlays__.set(this.parameters,e)}return OL.__overlays__.get(this.parameters)}preload(){return dD(this,null,(function*(){yield this.overlay.ready}))}},IL=OL;function xL(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 FF(i).applyResult(t.data.response.result).applyError(t.data.response.error)}}return{}}IL.__overlays__=new Map;var CL=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return dD(this,null,(function*(){return GF((r=>dD(this,null,(function*(){yield this.ready;let n=[],i=Array.isArray(t)?t.map((e=>e.id)):[],a=yield function(e,t){return dD(this,null,(function*(){let r,n=yield JF("rt");if("web"===gF.platform)try{r=yield lL()}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(JB.MAGIC_HANDLE_RESPONSE,(e=>a=>{let{id:o,response:s}=xL(t,a);(function(e){dD(this,null,(function*(){!e.data.rt||(yield YF("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(JB.MAGIC_OVERLAY_READY,(()=>e()))}))}listen(){this.on(JB.MAGIC_HIDE_OVERLAY,(()=>{this.hideOverlay()})),this.on(JB.MAGIC_SHOW_OVERLAY,(()=>{this.showOverlay()}))}},ML=Object.create,PL=Object.defineProperty,NL=Object.getOwnPropertyDescriptor,BL=Object.getOwnPropertyNames,DL=Object.getPrototypeOf,FL=Object.prototype.hasOwnProperty,LL=(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')})),UL=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),jL=(e,t,r)=>(r=null!=e?ML(DL(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of BL(t))!FL.call(e,i)&&i!==r&&PL(e,i,{get:()=>t[i],enumerable:!(n=NL(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:PL(r,"default",{value:e,enumerable:!0}),e)),qL=(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())})),zL=UL(((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 LL&&LL;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 LL&&LL,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 A(e){return _(e,!0)}function T(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),A(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,T(e)?A(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,T(r,t._defaultConfig.version)?A(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)}))})),HL=UL(((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})}))})),GL=jL(zL()),VL=jL(HL()),KL={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var WL=function(e,t){return Object.assign(gF,t),e}(IL,{platform:"web",sdkName:"magic-sdk",version:"13.6.2",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends CL{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 EF(WB.DuplicateIframe,"Duplicate iframes found.").log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=wL(this.endpoint).host,t.title="Secure Modal",t.src=wL(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(let[t,r]of Object.entries(KL))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 qL(this,null,(function*(){let e=yield this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}))}hideOverlay(){return qL(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 qL(this,null,(function*(){let t=yield this.iframe;if(!t||!t.contentWindow)throw new wF(KB.ModalNotReady,"Modal is not ready.");t.contentWindow.postMessage(e,this.endpoint)}))}},configureStorage:()=>qL(void 0,null,(function*(){let e=GL.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(VL),yield e.setDriver([GL.default.INDEXEDDB,GL.default.LOCALSTORAGE,VL._driver]),e}))}),XL=(e=>(e.LoginWithOIDC="magic_auth_login_with_oidc",e))(XL||{}),$L=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 JL(e,t){return function(){return e.apply(t,arguments)}}const{toString:YL}=Object.prototype,{getPrototypeOf:QL}=Object,ZL=(e=>t=>{const r=YL.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),eU=e=>(e=e.toLowerCase(),t=>ZL(t)===e),tU=e=>t=>typeof t===e,{isArray:rU}=Array,nU=tU("undefined");const iU=eU("ArrayBuffer");const aU=tU("string"),oU=tU("function"),sU=tU("number"),cU=e=>null!==e&&"object"==typeof e,uU=e=>{if("object"!==ZL(e))return!1;const t=QL(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},fU=eU("Date"),dU=eU("File"),lU=eU("Blob"),hU=eU("FileList"),pU=eU("URLSearchParams");function mU(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),rU(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 bU(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 yU="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,gU=e=>!nU(e)&&e!==yU;const vU=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&QL(Uint8Array)),wU=eU("HTMLFormElement"),_U=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),EU=eU("RegExp"),AU=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};mU(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},TU="abcdefghijklmnopqrstuvwxyz",SU="0123456789",RU={DIGIT:SU,ALPHA:TU,ALPHA_DIGIT:TU+TU.toUpperCase()+SU};const kU=eU("AsyncFunction");var OU={isArray:rU,isArrayBuffer:iU,isBuffer:function(e){return null!==e&&!nU(e)&&null!==e.constructor&&!nU(e.constructor)&&oU(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||oU(e.append)&&("formdata"===(t=ZL(e))||"object"===t&&oU(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&iU(e.buffer),t},isString:aU,isNumber:sU,isBoolean:e=>!0===e||!1===e,isObject:cU,isPlainObject:uU,isUndefined:nU,isDate:fU,isFile:dU,isBlob:lU,isRegExp:EU,isFunction:oU,isStream:e=>cU(e)&&oU(e.pipe),isURLSearchParams:pU,isTypedArray:vU,isFileList:hU,forEach:mU,merge:function e(){const{caseless:t}=gU(this)&&this||{},r={},n=(n,i)=>{const a=t&&bU(r,i)||i;uU(r[a])&&uU(n)?r[a]=e(r[a],n):uU(n)?r[a]=e({},n):rU(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&mU(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(mU(t,((t,n)=>{r&&oU(t)?e[n]=JL(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&&QL(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:ZL,kindOfTest:eU,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(rU(e))return e;let t=e.length;if(!sU(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:wU,hasOwnProperty:_U,hasOwnProp:_U,reduceDescriptors:AU,freezeMethods:e=>{AU(e,((t,r)=>{if(oU(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];oU(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 rU(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:bU,global:yU,isContextDefined:gU,ALPHABET:RU,generateString:(e=16,t=RU.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&oU(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(cU(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=rU(e)?[]:{};return mU(e,((e,t)=>{const a=r(e,n+1);!nU(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:kU,isThenable:e=>e&&(cU(e)||oU(e))&&oU(e.then)&&oU(e.catch)};function IU(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)}OU.inherits(IU,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:OU.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const xU=IU.prototype,CU={};["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=>{CU[e]={value:e}})),Object.defineProperties(IU,CU),Object.defineProperty(xU,"isAxiosError",{value:!0}),IU.from=(e,t,r,n,i,a)=>{const o=Object.create(xU);return OU.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),IU.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function MU(e){return OU.isPlainObject(e)||OU.isArray(e)}function PU(e){return OU.endsWith(e,"[]")?e.slice(0,-2):e}function NU(e,t,r){return e?e.concat(t).map((function(e,t){return e=PU(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const BU=OU.toFlatObject(OU,{},null,(function(e){return/^is[A-Z]/.test(e)}));function DU(e,t,r){if(!OU.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=OU.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!OU.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&OU.isSpecCompliantForm(t);if(!OU.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(OU.isDate(e))return e.toISOString();if(!s&&OU.isBlob(e))throw new IU("Blob is not supported. Use a Buffer instead.");return OU.isArrayBuffer(e)||OU.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(OU.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(OU.isArray(e)&&function(e){return OU.isArray(e)&&!e.some(MU)}(e)||(OU.isFileList(e)||OU.endsWith(r,"[]"))&&(s=OU.toArray(e)))return r=PU(r),s.forEach((function(e,n){!OU.isUndefined(e)&&null!==e&&t.append(!0===o?NU([r],n,a):null===o?r:r+"[]",c(e))})),!1;return!!MU(e)||(t.append(NU(i,r,a),c(e)),!1)}const f=[],d=Object.assign(BU,{defaultVisitor:u,convertValue:c,isVisitable:MU});if(!OU.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!OU.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),OU.forEach(r,(function(r,a){!0===(!(OU.isUndefined(r)||null===r)&&i.call(t,r,OU.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),f.pop()}}(e),t}function FU(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function LU(e,t){this._pairs=[],e&&DU(e,this,t)}const UU=LU.prototype;function jU(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qU(e,t,r){if(!t)return e;const n=r&&r.encode||jU,i=r&&r.serialize;let a;if(a=i?i(t,r):OU.isURLSearchParams(t)?t.toString():new LU(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}UU.append=function(e,t){this._pairs.push([e,t])},UU.toString=function(e){const t=e?function(t){return e.call(this,t,FU)}:FU;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var zU=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){OU.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},HU={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var GU={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:LU,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 VU(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&OU.isArray(n)?n.length:a,s)return OU.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&OU.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&OU.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(OU.isFormData(e)&&OU.isFunction(e.entries)){const r={};return OU.forEachEntry(e,((e,n)=>{t(function(e){return OU.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const KU={"Content-Type":void 0};const WU={transitional:HU,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=OU.isObject(e);i&&OU.isHTMLForm(e)&&(e=new FormData(e));if(OU.isFormData(e))return n&&n?JSON.stringify(VU(e)):e;if(OU.isArrayBuffer(e)||OU.isBuffer(e)||OU.isStream(e)||OU.isFile(e)||OU.isBlob(e))return e;if(OU.isArrayBufferView(e))return e.buffer;if(OU.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 DU(e,new GU.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return GU.isNode&&OU.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=OU.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return DU(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(OU.isString(e))try{return(t||JSON.parse)(e),OU.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||WU.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&OU.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 IU.from(e,IU.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:GU.classes.FormData,Blob:GU.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};OU.forEach(["delete","get","head"],(function(e){WU.headers[e]={}})),OU.forEach(["post","put","patch"],(function(e){WU.headers[e]=OU.merge(KU)}));var XU=WU;const $U=OU.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 JU=Symbol("internals");function YU(e){return e&&String(e).trim().toLowerCase()}function QU(e){return!1===e||null==e?e:OU.isArray(e)?e.map(QU):String(e)}function ZU(e,t,r,n,i){return OU.isFunction(n)?n.call(this,t,r):(i&&(t=r),OU.isString(t)?OU.isString(n)?-1!==t.indexOf(n):OU.isRegExp(n)?n.test(t):void 0:void 0)}class ej{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=YU(t);if(!i)throw new Error("header name must be a non-empty string");const a=OU.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=QU(e))}const a=(e,t)=>OU.forEach(e,((e,r)=>i(e,r,t)));return OU.isPlainObject(e)||e instanceof this.constructor?a(e,t):OU.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]&&$U[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=YU(e)){const r=OU.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(OU.isFunction(t))return t.call(this,e,r);if(OU.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=YU(e)){const r=OU.findKey(this,e);return!(!r||void 0===this[r]||t&&!ZU(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=YU(e)){const i=OU.findKey(r,e);!i||t&&!ZU(0,r[i],i,t)||(delete r[i],n=!0)}}return OU.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&&!ZU(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return OU.forEach(this,((n,i)=>{const a=OU.findKey(r,i);if(a)return t[a]=QU(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]=QU(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return OU.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&OU.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[JU]=this[JU]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=YU(e);t[n]||(!function(e,t){const r=OU.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 OU.isArray(e)?e.forEach(n):n(e),this}}ej.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),OU.freezeMethods(ej.prototype),OU.freezeMethods(ej);var tj=ej;function rj(e,t){const r=this||XU,n=t||r,i=tj.from(n.headers);let a=n.data;return OU.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function nj(e){return!(!e||!e.__CANCEL__)}function ij(e,t,r){IU.call(this,null==e?"canceled":e,IU.ERR_CANCELED,t,r),this.name="CanceledError"}OU.inherits(ij,IU,{__CANCEL__:!0});var aj=GU.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),OU.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),OU.isString(n)&&o.push("path="+n),OU.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 oj(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 sj=GU.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=OU.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function cj(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 uj="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=tj.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}OU.isFormData(n)&&(GU.isStandardBrowserEnv||GU.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=oj(e.baseURL,e.url);function f(){if(!c)return;const n=tj.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new IU("Request failed with status code "+r.status,[IU.ERR_BAD_REQUEST,IU.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(),qU(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 IU("Request aborted",IU.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new IU("Network Error",IU.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||HU;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new IU(t,n.clarifyTimeoutError?IU.ETIMEDOUT:IU.ECONNABORTED,e,c)),c=null},GU.isStandardBrowserEnv){const t=(e.withCredentials||sj(u))&&e.xsrfCookieName&&aj.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&OU.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),OU.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",cj(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",cj(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{c&&(r(!t||t.type?new ij(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===GU.protocols.indexOf(d)?r(new IU("Unsupported protocol "+d+":",IU.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const fj={http:null,xhr:uj};OU.forEach(fj,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var dj=e=>{e=OU.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=OU.isString(r)?fj[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new IU(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(OU.hasOwnProp(fj,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!OU.isFunction(n))throw new TypeError("adapter is not a function");return n};function lj(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ij(null,e)}function hj(e){lj(e),e.headers=tj.from(e.headers),e.data=rj.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return dj(e.adapter||XU.adapter)(e).then((function(t){return lj(e),t.data=rj.call(e,e.transformResponse,t),t.headers=tj.from(t.headers),t}),(function(t){return nj(t)||(lj(e),t&&t.response&&(t.response.data=rj.call(e,e.transformResponse,t.response),t.response.headers=tj.from(t.response.headers))),Promise.reject(t)}))}const pj=e=>e instanceof tj?e.toJSON():e;function mj(e,t){t=t||{};const r={};function n(e,t,r){return OU.isPlainObject(e)&&OU.isPlainObject(t)?OU.merge.call({caseless:r},e,t):OU.isPlainObject(t)?OU.merge({},t):OU.isArray(t)?t.slice():t}function i(e,t,r){return OU.isUndefined(t)?OU.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!OU.isUndefined(t))return n(void 0,t)}function o(e,t){return OU.isUndefined(t)?OU.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(pj(e),pj(t),!0)};return OU.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||i,o=a(e[n],t[n],n);OU.isUndefined(o)&&a!==s||(r[n]=o)})),r}const bj="1.4.0",yj={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{yj[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const gj={};yj.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 IU(n(i," has been removed"+(t?" in "+t:"")),IU.ERR_DEPRECATED);return t&&!gj[i]&&(gj[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 vj={assertOptions:function(e,t,r){if("object"!=typeof e)throw new IU("options must be an object",IU.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 IU("option "+a+" must be "+r,IU.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new IU("Unknown option "+a,IU.ERR_BAD_OPTION)}},validators:yj};const wj=vj.validators;class _j{constructor(e){this.defaults=e,this.interceptors={request:new zU,response:new zU}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=mj(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&vj.assertOptions(r,{silentJSONParsing:wj.transitional(wj.boolean),forcedJSONParsing:wj.transitional(wj.boolean),clarifyTimeoutError:wj.transitional(wj.boolean)},!1),null!=n&&(OU.isFunction(n)?t.paramsSerializer={serialize:n}:vj.assertOptions(n,{encode:wj.function,serialize:wj.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&OU.merge(i.common,i[t.method]),a&&OU.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=tj.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=[hj.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=hj.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 qU(oj((e=mj(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}OU.forEach(["delete","get","head","options"],(function(e){_j.prototype[e]=function(t,r){return this.request(mj(r||{},{method:e,url:t,data:(r||{}).data}))}})),OU.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(mj(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}_j.prototype[e]=t(),_j.prototype[e+"Form"]=t(!0)}));var Ej=_j;class Aj{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 ij(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 Aj((function(t){e=t}));return{token:t,cancel:e}}}var Tj=Aj;const Sj={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(Sj).forEach((([e,t])=>{Sj[t]=e}));var Rj=Sj;const kj=function e(t){const r=new Ej(t),n=JL(Ej.prototype.request,r);return OU.extend(n,Ej.prototype,r,{allOwnKeys:!0}),OU.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(mj(t,r))},n}(XU);kj.Axios=Ej,kj.CanceledError=ij,kj.CancelToken=Tj,kj.isCancel=nj,kj.VERSION=bj,kj.toFormData=DU,kj.AxiosError=IU,kj.Cancel=kj.CanceledError,kj.all=function(e){return Promise.all(e)},kj.spread=function(e){return function(t){return e.apply(null,t)}},kj.isAxiosError=function(e){return OU.isObject(e)&&!0===e.isAxiosError},kj.mergeConfig=mj,kj.AxiosHeaders=tj,kj.formToJSON=e=>VU(OU.isHTMLForm(e)?new FormData(e):e),kj.HttpStatusCode=Rj,kj.default=kj;var Oj=kj;const Ij="https://guardian.sandbox.imtbl.com".replace(/\/+$/,"");class xj{basePath;axios;configuration;constructor(e,t=Ij,r=Oj){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Cj extends Error{field;name="RequiredError";constructor(e,t){super(t),this.field=e}}const Mj="https://example.com",Pj=function(e,t,r){if(null==r)throw new Cj(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Nj=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 Bj(e,t,r=""){"object"==typeof t?Array.isArray(t)?t.forEach((t=>Bj(e,t,r))):Object.keys(t).forEach((n=>Bj(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t)}const Dj=function(e,...t){const r=new URLSearchParams(e.search);Bj(r,t),e.search=r.toString()},Fj=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||""},Lj=function(e){return e.pathname+e.search+e.hash},Uj=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||a)+e.url};return i.request(o)}},jj=function(e){const t=function(e){return{approvePendingMessage:async(t,r={})=>{Pj("approvePendingMessage","messageID",t);const n="/guardian/v1/messages/{messageID}/approve".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,Mj);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...r},s={};await Nj(s,e),Dj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:Lj(i),options:o}},evaluateMessage:async(t,r={})=>{Pj("evaluateMessage","messageEvaluationRequest",t);const n=new URL("/guardian/v1/messages/evaluate",Mj);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...r},o={};await Nj(o,e),o["Content-Type"]="application/json",Dj(n,{});let s=i&&i.headers?i.headers:{};return a.headers={...o,...s,...r.headers},a.data=Fj(t,a,e),{url:Lj(n),options:a}},getMessageByID:async(t,r={})=>{Pj("getMessageByID","messageID",t);const n="/guardian/v1/messages/{messageID}".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,Mj);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...r},s={};await Nj(s,e),Dj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:Lj(i),options:o}}}}(e);return{async approvePendingMessage(r,n){const i=await t.approvePendingMessage(r,n);return Uj(i,Oj,Ij,e)},async evaluateMessage(r,n){const i=await t.evaluateMessage(r,n);return Uj(i,Oj,Ij,e)},async getMessageByID(r,n){const i=await t.getMessageByID(r,n);return Uj(i,Oj,Ij,e)}}};class qj extends xj{approvePendingMessage(e,t){return jj(this.configuration).approvePendingMessage(e.messageID,t).then((e=>e(this.axios,this.basePath)))}evaluateMessage(e,t){return jj(this.configuration).evaluateMessage(e.messageEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getMessageByID(e,t){return jj(this.configuration).getMessageByID(e.messageID,t).then((e=>e(this.axios,this.basePath)))}}const zj=function(e){const t=function(e){return{approvePendingTransaction:async(t,r,n={})=>{Pj("approvePendingTransaction","payloadHash",t),Pj("approvePendingTransaction","transactionApprovalRequest",r);const i="/guardian/v1/transactions/{payloadHash}/approve".replace("{payloadHash}",encodeURIComponent(String(t))),a=new URL(i,Mj);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Nj(c,e),c["Content-Type"]="application/json",Dj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=Fj(r,s,e),{url:Lj(a),options:s}},evaluateTransaction:async(t,r,n={})=>{Pj("evaluateTransaction","id",t),Pj("evaluateTransaction","transactionEvaluationRequest",r);const i="/guardian/v1/transactions/{id}/evaluate".replace("{id}",encodeURIComponent(String(t))),a=new URL(i,Mj);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Nj(c,e),c["Content-Type"]="application/json",Dj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=Fj(r,s,e),{url:Lj(a),options:s}},getTransactionByID:async(t,r,n,i={})=>{Pj("getTransactionByID","transactionID",t),Pj("getTransactionByID","chainType",r);const a="/guardian/v1/transactions/{transactionID}".replace("{transactionID}",encodeURIComponent(String(t))),o=new URL(a,Mj);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i},u={},f={};await Nj(u,e),void 0!==r&&(f.chainType=r),void 0!==n&&(f.chainID=n),Dj(o,f);let d=s&&s.headers?s.headers:{};return c.headers={...u,...d,...i.headers},{url:Lj(o),options:c}}}}(e);return{async approvePendingTransaction(r,n,i){const a=await t.approvePendingTransaction(r,n,i);return Uj(a,Oj,Ij,e)},async evaluateTransaction(r,n,i){const a=await t.evaluateTransaction(r,n,i);return Uj(a,Oj,Ij,e)},async getTransactionByID(r,n,i,a){const o=await t.getTransactionByID(r,n,i,a);return Uj(o,Oj,Ij,e)}}};class Hj extends xj{approvePendingTransaction(e,t){return zj(this.configuration).approvePendingTransaction(e.payloadHash,e.transactionApprovalRequest,t).then((e=>e(this.axios,this.basePath)))}evaluateTransaction(e,t){return zj(this.configuration).evaluateTransaction(e.id,e.transactionEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionByID(e,t){return zj(this.configuration).getTransactionByID(e.transactionID,e.chainType,e.chainID,t).then((e=>e(this.axios,this.basePath)))}}class Gj{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 Vj="starkex",Kj="evm";function Wj(e){const t=-1!==new rn(e,16).cmp(new rn(27))?new rn(e,16).sub(new rn(27)).toNumber():new rn(e,16).toNumber();return e.trim()?t:void 0}async function Xj(e,t){const r=function(e,t=64){const r=Eb(e);return{r:new rn(r.substring(0,t),"hex"),s:new rn(r.substring(t,2*t),"hex"),recoveryParam:Wj(r.substring(2*t,2*t+2))}}(await t.signMessage(e));return Tb(wb((n=r).r.toString(16),64)+wb(n.s.toString(16),64)+wb(n.recoveryParam?.toString(16)||"",2));var n}function $j(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 Jj={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 Yj(){return Yj=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},Yj.apply(this,arguments)}var Qj;!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"}(Qj||(Qj={}));function Zj(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=Yj({},this.config,e),this.config.logLevel){case"DEBUG":this.logLevel=Qj.DEBUG;break;case"INFO":default:this.logLevel=Qj.INFO;break;case"WARN":this.logLevel=Qj.WARN;break;case"ERROR":this.logLevel=Qj.ERROR;break;case"DISABLED":this.logLevel=Qj.DISABLED}void 0===this.config.silence&&(this.config.silence=!1)}debug(e,...t){!0!==this.config.silence&&this.logLevel===Qj.DEBUG&&console.log(e,...t)}info(e,...t){!0!==this.config.silence&&this.logLevel<=Qj.INFO&&console.log(e,...t)}warn(e,...t){!0!==this.config.silence&&this.logLevel<=Qj.WARN&&(console.warn(e,...t),this.config.onwarn&&this.config.onwarn(e,t))}error(e,...t){!0!==this.config.silence&&this.logLevel<=Qj.ERROR&&(console.error(e,...t),this.config.onerror&&this.config.onerror(e,t))}}({logLevel:"INFO",silence:!0});const eq=(e=0,t=Number.MAX_SAFE_INTEGER)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function tq(){return tq=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},tq.apply(this,arguments)}const rq=(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),nq=e=>rq(iq(e)),iq=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},aq=(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 oq;!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"}(oq||(oq={}));const sq=e=>aq("https://${network}-indexer.sequence.app",{network:e}),cq=e=>aq("https://${network}-relayer.sequence.app",{network:e}),uq=e=>aq("https://nodes.sequence.app/${network}",{network:e}),fq={[oq.MAINNET]:{chainId:oq.MAINNET,name:"mainnet",title:"Ethereum",blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[oq.ROPSTEN]:{chainId:oq.ROPSTEN,name:"ropsten",title:"Ropsten",testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[oq.RINKEBY]:{chainId:oq.RINKEBY,name:"rinkeby",title:"Rinkeby",testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",disabled:!0},[oq.GOERLI]:{chainId:oq.GOERLI,name:"goerli",title:"Goerli",testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[oq.KOVAN]:{chainId:oq.KOVAN,name:"kovan",title:"Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"}},[oq.POLYGON]:{chainId:oq.POLYGON,name:"polygon",title:"Polygon",blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"}},[oq.POLYGON_MUMBAI]:{chainId:oq.POLYGON_MUMBAI,name:"mumbai",title:"Polygon Mumbai",testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"}},[oq.POLYGON_ZKEVM]:{chainId:oq.POLYGON_ZKEVM,name:"polygon-zkevm",title:"Polygon zkEVM",blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"}},[oq.BSC]:{chainId:oq.BSC,name:"bsc",title:"BNB Smart Chain",blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"}},[oq.BSC_TESTNET]:{chainId:oq.BSC_TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"}},[oq.OPTIMISM]:{chainId:oq.OPTIMISM,name:"optimism",title:"Optimism",blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"}},[oq.OPTIMISM_TESTNET]:{chainId:oq.OPTIMISM_TESTNET,name:"optimism-testnet",title:"Optimistic Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Optimism Testnet)",rootUrl:"https://kovan-optimistic.etherscan.io/"}},[oq.ARBITRUM]:{chainId:oq.ARBITRUM,name:"arbitrum",title:"Arbitrum One",blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"}},[oq.ARBITRUM_GOERLI]:{chainId:oq.ARBITRUM_GOERLI,name:"arbitrum-goerli",title:"Arbitrum Goerli",testnet:!0,blockExplorer:{name:"Arbiscan (Testnet)",rootUrl:"https://testnet.arbiscan.io/"}},[oq.ARBITRUM_NOVA]:{chainId:oq.ARBITRUM_NOVA,name:"arbitrum-nova",title:"Arbitrum Nova",blockExplorer:{name:"Nova Explorer",rootUrl:"https://nova-explorer.arbitrum.io/"}},[oq.AVALANCHE]:{chainId:oq.AVALANCHE,name:"avalanche",title:"Avalanche",blockExplorer:{name:"Snowtrace",rootUrl:"https://snowtrace.io/"}},[oq.AVALANCHE_TESTNET]:{chainId:oq.AVALANCHE_TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://testnet.snowtrace.io/"}},[oq.FANTOM]:{chainId:oq.FANTOM,name:"fantom",title:"Fantom",blockExplorer:{name:"FTMScan",rootUrl:"https://ftmscan.com/"}},[oq.FANTOM_TESTNET]:{chainId:oq.FANTOM_TESTNET,name:"fantom-testnet",title:"Fantom Testnet",testnet:!0,blockExplorer:{name:"FTMScan (Testnet)",rootUrl:"https://testnet.ftmscan.com/"}},[oq.GNOSIS]:{chainId:oq.GNOSIS,name:"gnosis",title:"Gnosis Chain",blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"}},[oq.AURORA]:{chainId:oq.AURORA,name:"aurora",title:"Aurora",blockExplorer:{name:"Aurora Explorer",rootUrl:"https://aurorascan.dev/"}},[oq.AURORA_TESTNET]:{chainId:oq.AURORA_TESTNET,name:"aurora-testnet",title:"Aurora Testnet",blockExplorer:{name:"Aurora Explorer (Testnet)",rootUrl:"https://testnet.aurorascan.dev/"}},[oq.BASE_GOERLI]:{chainId:oq.BASE_GOERLI,name:"base-goerli",title:"Base Goerli",blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"}}};nq([tq({},fq[oq.MAINNET],{rpcUrl:uq("mainnet"),relayer:{url:cq("mainnet")},indexerUrl:sq("mainnet")}),tq({},fq[oq.POLYGON],{rpcUrl:uq("polygon"),relayer:{url:cq("polygon")},indexerUrl:sq("polygon"),isDefaultChain:!0,isAuthChain:!0}),tq({},fq[oq.BSC],{rpcUrl:uq("bsc"),indexerUrl:sq("bsc"),relayer:{url:cq("bsc")}}),tq({},fq[oq.AVALANCHE],{rpcUrl:uq("avalanche"),indexerUrl:sq("avalanche"),relayer:{url:cq("avalanche")}}),tq({},fq[oq.ARBITRUM],{rpcUrl:uq("arbitrum"),indexerUrl:sq("arbitrum"),relayer:{url:cq("arbitrum")}}),tq({},fq[oq.ARBITRUM_NOVA],{rpcUrl:uq("arbitrum-nova"),indexerUrl:sq("arbitrum-nova"),relayer:{url:cq("arbitrum-nova")}}),tq({},fq[oq.OPTIMISM],{rpcUrl:uq("optimism"),indexerUrl:sq("optimism"),relayer:{url:cq("optimism")}}),tq({},fq[oq.POLYGON_ZKEVM],{rpcUrl:uq("polygon-zkevm"),indexerUrl:sq("polygon-zkevm"),relayer:{url:cq("polygon-zkevm")}}),tq({},fq[oq.GNOSIS],{rpcUrl:uq("gnosis"),indexerUrl:sq("gnosis"),relayer:{url:cq("gnosis")}})]),nq([tq({},fq[oq.RINKEBY],{rpcUrl:uq("rinkeby"),relayer:{url:cq("rinkeby")},indexerUrl:sq("rinkeby")}),tq({},fq[oq.GOERLI],{rpcUrl:uq("goerli"),relayer:{url:cq("goerli")},indexerUrl:sq("goerli")}),tq({},fq[oq.POLYGON_MUMBAI],{rpcUrl:uq("mumbai"),relayer:{url:cq("mumbai")},indexerUrl:sq("mumbai"),isDefaultChain:!0,isAuthChain:!0}),tq({},fq[oq.BSC_TESTNET],{rpcUrl:uq("bsc-testnet"),relayer:{url:cq("bsc-testnet")},indexerUrl:sq("bsc-testnet")}),tq({},fq[oq.ARBITRUM_GOERLI],{rpcUrl:uq("arbitrum-goerli"),relayer:{url:cq("arbitrum-goerli")},indexerUrl:sq("arbitrum-goerli")}),tq({},fq[oq.BASE_GOERLI],{rpcUrl:uq("base-goerli"),relayer:{url:cq("base-goerli")},indexerUrl:sq("base-goerli")})]);const dq="2.0";function lq(){return lq=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},lq.apply(this,arguments)}let hq;function pq(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"}(hq||(hq={}));const mq={batchSize:50,timeWindow:50,contract:"0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E",verbose:!1};let bq=class e{constructor(t){var r=this;if(this.batchableJsonRpcMethods=[hq.ethCall,hq.ethGetCode,hq.ethGetBalance],this.multicallInterface=new Rs(Jj.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]=pq(t,(e=>{try{if(e.next!==n)return!1;switch(e.request.method){case hq.ethCall:if(e.request.params[0].from||e.request.params[0].gasPrice||e.request.params[0].value)return!1;case hq.ethGetBalance:case hq.ethGetCode:const t=function(e){if(void 0===e)return"latest";switch(e){case"earliest":case"latest":case"pending":return e}return Hn.from(e)}(e.request.params[1]);if(void 0===i&&(i=t),!function(e,t){return e===t||(Hn.isBigNumber(e)?!!Hn.isBigNumber(t)&&e.eq(t):!Hn.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 hq.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 hq.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 hq.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]=pq(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=eq(),u=await async function(e,t){try{return await e}catch(e){return t instanceof Function?t(e):t}}(Zj(n)({id:c,jsonrpc:dq,method:hq.ethCall,params:[{to:r.options.contract,value:0,data:s},Hn.isBigNumber(i)?i.toNumber():i]}),(e=>({jsonrpc:dq,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 hq.ethCall:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:f[1][t]});break;case hq.ethGetCode:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:wo.decode(["bytes"],f[1][t])[0]});break;case hq.ethGetBalance:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:wo.decode(["uint256"],f[1][t])[0]})}else r.forward(e)}))},this.options=t?lq({},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}};bq.DefaultOptions=lq({},mq);const yq=["getNetwork","getBlockNumber","getGasPrice","getTransactionCount","getStorageAt","sendTransaction","estimateGas","getBlock","getTransaction","getTransactionReceipt","getLogs","emit","litenerCount","addListener","removeListener","waitForTransaction","detectNetwork","getBlockWithTransactions"];var gq=Object.freeze({__proto__:null,ProxyMethods:yq,MulticallProvider:class extends Lh{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 Bh(r,n.address,n.name):null}return t.getResolver(await e)},this.next=async function(e,t){try{switch(e.method){case hq.ethCall:r.callback(e,t,await r.provider.call(e.params[0],e.params[1]));break;case hq.ethGetCode:r.callback(e,t,await r.provider.getCode(e.params[0],e.params[1]));break;case hq.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=bq.isMulticall(t)?t:new bq(t),yq.forEach((t=>{void 0!==e[t]&&(this[t]=(...r)=>e[t](...r))}))}callback(e,t,r,n){t(n,{jsonrpc:dq,id:e.id,result:r,error:n})}async call(e,t){return this.rpcCall(hq.ethCall,e,t)}async getCode(e,t){return this.rpcCall(hq.ethGetCode,e,t)}async getBalance(e,t){return this.rpcCall(hq.ethGetBalance,e,t)}async rpcCall(e,...t){const r=eq();return(await Zj(this.multicall.handle)(this.next,{jsonrpc:dq,id:r,method:e,params:t})).result}},MulticallExternalProvider:class{constructor(e,t){if(this.provider=e,this.multicall=void 0,this.multicall=bq.isMulticall(t)?t:new bq(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=bq.isMulticall(e)?e:new bq(e);return(e,n)=>r.handle(t,e,n)}}),vq=Object.freeze({__proto__:null,Multicall:bq,providers:gq});let wq,_q;try{wq=localStorage}catch(e){const t=new Map;wq={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 Eq(e){return void 0!==e.address&&!function(e){return Aq(e)||Tq(e)||Sq(e)}(e)}function Aq(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 Sq(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"}(_q||(_q={}));const Rq=e=>{if("string"!=typeof e)return e;const t=e.replace("0x",""),r=Hn.from(`0x${t.slice(0,4)}`).toNumber(),n=[];for(let e=4;e<t.length;){const r=Hn.from(t.slice(e,e+2)).toNumber();e+=2;const i=Hn.from(`0x${t.slice(e,e+2)}`).toNumber();switch(e+=2,r){case _q.Address:const r=la(t.slice(e,e+40));e+=40,n.push({weight:i,address:r});break;case _q.EOA:const a=_n(`0x${t.slice(e,e+132)}`);e+=132;const o=Nn(a.slice(0,65)),s=o.r,c=o.s,u=o.v,f=Hn.from(a[a.length-1]).toNumber();n.push({weight:i,signature:a,r:s,s:c,v:u,t:f});break;case _q.Full:const d=la(t.slice(e,e+40));e+=40;const l=Hn.from(`0x${t.slice(e,e+4)}`).mul(2).toNumber();e+=4;const h=_n(`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}},kq=e=>{if("string"==typeof e)return kq(Rq(e));const t=e.signers.map((e=>{if(Eq(e))return um(["uint8","uint8","address"],[_q.Address,e.weight,e.address]);if(Tq(e))return um(["uint8","uint8","bytes32","bytes32","uint8","uint8"],[_q.EOA,e.weight,e.r,e.s,e.v,e.t]);if(Sq(e)){const t=_n(e.signature).length;return um(["uint8","uint8","address","uint16","bytes"],[_q.Full,e.weight,e.address,t,e.signature])}if(Aq(e))return um(["uint8","uint8","bytes"],[_q.EOA,e.weight,e.signature]);throw Error("Unkwnown signature part type")}));return um(["uint16",...Array(t.length).fill("bytes")],[e.threshold,...t])};var Oq;!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"}(Oq||(Oq={}));class Iq extends Error{type;constructor(e,t){super(e),this.type=t}}const xq=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 Iq(r,t)}},Cq="passport_credentials",Mq="pkce_state",Pq="pkce_verifier";class Nq{saveCredentials(e){if(!this.areValid(e))throw Error("Invalid credentials.");localStorage.setItem(Cq,JSON.stringify(e))}getCredentials(){const e=localStorage.getItem(Cq);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=cB(e).exp??0;return t>Date.now()/1e3+3600}catch(e){return!1}}clearCredentials(){localStorage.removeItem(Cq)}savePKCEData(e){localStorage.setItem(Mq,e.state),localStorage.setItem(Pq,e.verifier)}getPKCEData(){const e=localStorage.getItem(Mq),t=localStorage.getItem(Pq);return e&&t?{state:e,verifier:t}:null}}function Bq(e){const{id_token:t,expired:r}=e;return!!r||function(e){if(!e)return!1;const t=cB(e),r=Math.floor(Date.now()/1e3);return t.exp<r}(t)}const Dq={headers:{"Content-Type":"application/x-www-form-urlencoded"}};function Fq(e){return new Promise((t=>{setTimeout(t,e)}))}class Lq{userManager;config;deviceCredentialsManager;logoutMode;constructor(e){this.config=e,this.userManager=new class{constructor(e){this._logger=new pB("UserManager"),this.settings=new zB(e),this._client=new class{constructor(e){this._logger=new pB("OidcClient"),this.settings=new kB(e),this.metadataService=new class{constructor(e){this._settings=e,this._logger=new pB("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new SB(["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 pB("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:MB;for(const r of e)PB.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 pB("ResponseValidator"),this._userInfoService=new class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new pB("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const r=yB.decode(e);return t.debug("JWT decoding successful"),r}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new SB(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 OB(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 _B(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 _B(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=yB.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){const e=yB.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 OB(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 pB("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 xB({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 A=E.state;return await this.settings.stateStore.set(A.id,A.toStorageString()),E}async readSigninResponseState(e,t=!1){const r=this._logger.create("readSigninResponseState"),n=new CB(wB.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:xB.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 CB(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 CB(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 pB("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 IB({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")}}(wB.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 _B(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:IB.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"),IB.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 pB("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 pB("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new GB({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,t=!1){this._logger.create("callback"),GB.notifyOpener(e,t)}}(this.settings),this._iframeNavigator=new class{constructor(e){this._settings=e,this._logger=new pB("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new HB({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),HB.notifyParent(e,this._settings.iframeNotifyParentOrigin)}}(this.settings),this._events=new VB(this.settings),this._silentRenewService=new class{constructor(e){this._userManager=e,this._logger=new pB("SilentRenewService"),this._isStarted=!1,this._retryTimer=new vB("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 EB)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 pB("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 pB("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 NB({...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 _B)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 NB(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 _B({...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"),NB.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 RB({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 Nq,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=cB(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 xq((async()=>{const e=await this.userManager.signinPopup({popupWindowFeatures:{width:410,height:450}});return Lq.mapOidcUserToDomainModel(e)}),Oq.AUTHENTICATION_ERROR)}async loginCallback(){return xq((async()=>this.userManager.signinPopupCallback()),Oq.AUTHENTICATION_ERROR)}async loginWithDeviceFlow(){return xq((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},Dq);return{code:e.data.user_code,deviceCode:e.data.device_code,url:e.data.verification_uri_complete,interval:e.data.interval}}),Oq.AUTHENTICATION_ERROR)}async connectImxDeviceFlow(e,t,r){return xq((async()=>{const n=Date.now();for(;;){if(null!=r&&Date.now()-n>r)throw new Error("Timed out");await Fq(1e3*t);try{const t=await this.getDeviceFlowToken(e),r=Lq.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")}),Oq.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},Dq)).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=Lq.base64URLEncode((void 0)(32)),t=Lq.base64URLEncode(Lq.sha256(e)),r=Lq.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 xq((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=Lq.mapDeviceTokenResponseToDomainUserModel(n);return i.imx?.ethAddress&&i.imx?.starkAddress&&i.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(n),i}),Oq.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},Dq)).data}async connectImxWithCredentials(e){return xq((async()=>{if(this.deviceCredentialsManager.areValid(e))return Lq.mapDeviceTokenResponseToDomainUserModel(e);const t=e?.refresh_token??null;if(t){return await this.refreshToken(t)}return null}),Oq.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},Dq)).data;return Lq.mapDeviceTokenResponseToDomainUserModel(t)}async logout(){return xq((async()=>"silent"===this.logoutMode?this.userManager.signoutSilent():this.userManager.signoutRedirect()),Oq.LOGOUT_ERROR)}async logoutSilentCallback(e){return this.userManager.signoutSilentCallback(e)}async logoutDeviceFlow(){return xq((async()=>{this.deviceCredentialsManager.clearCredentials()}),Oq.LOGOUT_ERROR)}async loginSilent(){return xq((async()=>this.getUser()),Oq.SILENT_LOGIN_ERROR)}async getWebUser(){const e=await this.userManager.getUser();if(!e)return null;if(!Bq(e))return Lq.mapOidcUserToDomainModel(e);if(e.refresh_token){const e=await this.userManager.signinSilent();if(e)return Lq.mapOidcUserToDomainModel(e)}return null}async getUser(){return xq((async()=>{const e=await this.getWebUser();if(e)return e;const t=this.deviceCredentialsManager.getCredentials();return t?Lq.mapDeviceTokenResponseToDomainUserModel(t):null}),Oq.NOT_LOGGED_IN_ERROR)}async getUserDeviceFlow(){return xq((async()=>{const e=this.deviceCredentialsManager.getCredentials();return e?Lq.mapDeviceTokenResponseToDomainUserModel(e):null}),Oq.NOT_LOGGED_IN_ERROR)}checkStoredDeviceFlowCredentials(){return this.deviceCredentialsManager.getCredentials()}}class Uq{config;magicClient;constructor(e){this.config=e}async login(e,t){return xq((async()=>(this.magicClient=new WL(this.config.magicPublishableApiKey,{extensions:[new $L],network:t}),await this.magicClient.openid.loginWithOIDC({jwt:e,providerId:this.config.magicProviderId}),this.magicClient.rpcProvider)),Oq.WALLET_CONNECTION_ERROR)}async logout(){this.magicClient?.user&&await this.magicClient.user.logout()}}const jq=1e3,qq=3,zq=async(e,t)=>{const{retries:r=qq,interval:n=jq,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)}))),zq(e,{retries:r-1,finalErr:i,finallyFn:a}))}finally{r<=0&&a()}var o};var Hq,Gq;!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"}(Hq||(Hq={})),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"}(Gq||(Gq={}));class Vq extends Error{message;code;constructor(e,t){super(t),this.message=t,this.code=e}}const Kq="Transaction requires confirmation but this functionality is not supported in this environment. Please contact Immutable support if you need to enable this feature.",Wq=e=>Hn.from(e).toString();class Xq{transactionAPI;messageAPI;confirmationScreen;imxEtherAddress;crossSdkBridgeEnabled;constructor({accessToken:e,confirmationScreen:t,imxEtherAddress:r,config:n}){const i=new Gj({accessToken:e,basePath:n.imxPublicApiDomain});this.confirmationScreen=t,this.transactionAPI=new Hj(new Gj(i)),this.imxEtherAddress=r,this.crossSdkBridgeEnabled=n.crossSdkBridgeEnabled,this.messageAPI=new qj(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 zq((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(Kq);if(!(await this.confirmationScreen.requestConfirmation(e,this.imxEtherAddress,Vj)).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?Wq(e.gasLimit):"0",target:e.to??Ia,value:e.value?Wq(e.value):"0",data:e.data?e.data.toString():"0x"})))}catch(e){const t=e instanceof Error?e.message:String(e);throw new Vq(Gq.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 Vq(Gq.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 Vq(Gq.TRANSACTION_REJECTED,Kq);if(a&&o){if(!(await this.confirmationScreen.requestConfirmation(o,this.imxEtherAddress,Kj,e)).confirmed)throw new Vq(Gq.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 Vq(Gq.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 Vq(Gq.TRANSACTION_REJECTED,Kq);if(i&&n){if(!(await this.confirmationScreen.requestMessageConfirmation(n)).confirmed)throw new Vq(Gq.TRANSACTION_REJECTED,"Signature rejected by user")}else this.confirmationScreen.closeWindow()}}var $q,Jq;!function(e){e.LOGGED_OUT="loggedOut"}($q||($q={})),function(e){e.PRODUCTION="mainnet",e.SANDBOX="goerli"}(Jq||(Jq={}));const Yq="ERC721";const Qq="ERC721";class Zq{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 Xq({accessToken:e.accessToken,confirmationScreen:n,imxEtherAddress:e.imx.ethAddress,config:i}),a.on($q.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 Iq("User has been logged out",Oq.NOT_LOGGED_IN_ERROR)}async transfer(e){return this.checkIsLoggedIn(),async function({request:e,transfersApi:t,starkSigner:r,user:n,guardianClient:i}){return xq(i.withDefaultConfirmationScreenTask((async()=>{const a=e.type===Qq?"1":e.amount,o={sender:n.imx.ethAddress,token:$j(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}})),Oq.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}registerOffchain(){throw new Iq("Operation not supported",Oq.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOnchain(){throw new Iq("Operation not supported",Oq.OPERATION_NOT_SUPPORTED_ERROR)}createOrder(e){return this.checkIsLoggedIn(),async function({starkSigner:e,user:t,request:r,ordersApi:n,guardianClient:i}){return xq(i.withDefaultConfirmationScreenTask((async()=>{const{ethAddress:a}=t.imx,o=r.sell.type===Yq?"1":r.sell.amount,s=r.buy.type===Yq?"1":r.buy.amount,c={Authorization:`Bearer ${t.accessToken}`},u={user:a,amount_buy:s,token_buy:$j(r.buy),amount_sell:o,token_sell:$j(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}})),Oq.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 xq(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}})),Oq.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 xq(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})),Oq.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 xq(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:$j({type:Qq,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}})),Oq.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 xq((async()=>{const{ethAddress:i}=e.imx,a=r.amount,o=await n.getExchangeSignableTransfer({id:r.transactionID,getSignableTransferRequest:{sender:i,token:$j(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}}),Oq.EXCHANGE_TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,exchangesApi:this.immutableXClient.exchangeApi})}deposit(e){throw new Iq("Operation not supported",Oq.OPERATION_NOT_SUPPORTED_ERROR)}prepareWithdrawal(e){throw new Iq("Operation not supported",Oq.OPERATION_NOT_SUPPORTED_ERROR)}completeWithdrawal(e,t){throw new Iq("Operation not supported",Oq.OPERATION_NOT_SUPPORTED_ERROR)}getAddress(){return this.checkIsLoggedIn(),Promise.resolve(this.user.imx.ethAddress)}}class ez{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 Iq("Failed to initialise",Oq.WALLET_CONNECTION_ERROR);const t=await this.magicAdapter.login(e.idToken,this.config.network),r=new Zp(t).getSigner(),n=await(async e=>xq((async()=>kx(await HN(e))),Oq.WALLET_CONNECTION_ERROR))(r);if(!e.imx?.ethAddress){const t=await this.registerStarkEx(r,n,e.accessToken);return new Zq({user:t,starkSigner:n,immutableXClient:this.immutableXClient,confirmationScreen:this.confirmationScreen,config:this.config,passportEventEmitter:this.passportEventEmitter})}return new Zq({user:e,starkSigner:n,immutableXClient:this.immutableXClient,confirmationScreen:this.confirmationScreen,config:this.config,passportEventEmitter:this.passportEventEmitter})}async registerStarkEx(e,t,r){return xq((async()=>{await async function({ethSigner:e,starkSigner:t,usersApi:r},n){return xq((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 Xj(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}),Oq.USER_REGISTRATION_ERROR)}({ethSigner:e,starkSigner:t,usersApi:this.immutableXClient.usersApi},r);return await zq((async()=>{const e=await this.authManager.loginSilent();return!!e?.imx?e:Promise.reject(new Error("user wallet addresses not exist"))}))}),Oq.REFRESH_TOKEN_ERROR)}}const tz=(e,t,r)=>{const n=t.map((t=>!e[t]&&t)).filter((e=>e)).join(", ");if(""!==n){throw new Iq(r?`${r} - ${n} cannot be null`:`${n} cannot be null`,Oq.INVALID_CONFIGURATION)}};class rz{network;authenticationDomain;passportDomain;imxPublicApiDomain;magicPublishableApiKey;magicProviderId;oidcConfiguration;baseConfig;zkEvmRpcUrl;relayerUrl;multiRollupConfig;crossSdkBridgeEnabled;constructor({baseConfig:e,overrides:r,crossSdkBridgeEnabled:n,...i}){if(tz(i,["clientId","logoutRedirectUri","redirectUri"]),this.oidcConfiguration=i,this.baseConfig=e,this.crossSdkBridgeEnabled=n||!1,r)tz(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=Jq.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=Jq.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 nz;!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"}(nz||(nz={}));const iz="imx_passport_confirmation";class az{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===iz)switch(e.messageType){case nz.CONFIRMATION_WINDOW_READY:break;case nz.TRANSACTION_CONFIRMED:i({confirmed:!0});break;case nz.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===Vj?`${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===iz)switch(e.messageType){case nz.CONFIRMATION_WINDOW_READY:break;case nz.MESSAGE_CONFIRMED:t({confirmed:!0});break;case nz.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===iz&&(window.removeEventListener("message",n),r.remove(),i.messageType===nz.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 oz,sz;!function(e){e.PENDING="PENDING",e.SUBMITTED="SUBMITTED",e.SUCCESSFUL="SUCCESSFUL",e.REVERTED="REVERTED",e.FAILED="FAILED"}(oz||(oz={})),function(e){e.ACCOUNTS_CHANGED="accountsChanged"}(sz||(sz={}));class cz{emitter=new g_;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 uz=(e,t,r)=>um(["string","uint256","address","bytes32"],["",e,t,r]),fz=async(e,t,r,n,i)=>{const a=e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit??Ca,target:e.to??Ia,value:e.value??Ca,data:e.data??[]})));const o=function(e,t){return Ji(wo.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=_n(Ji(uz(r,n,o))),c=await i.signMessage(s),u=kq({threshold:1,signers:[{weight:1,signature:`${c}02`}]}),f=new Rs(Jj.mainModule.abi);return f.encodeFunctionData(f.getFunction("execute"),[a,t,u])},dz=async(e,t,r,n,i)=>{const a={...e.types};delete a.EIP712Domain;const o=ys.hash(e.domain,a,e.message),s=_n(Ji(uz(r,n,o))),c=`${await i.signMessage(s)}02`,{signers:u}=(e=>Rq(`0000${e}`))(t);return kq({threshold:2,signers:[...u,{weight:1,signature:c}]})},lz=e=>`eip155:${e}`;class hz{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:lz(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:lz(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:lz(r)}]},{result:i}=await this.postToRelayer(n);return i}}const pz=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 Zp(r).getSigner(),o=await a.getAddress(),s=await Xj("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 Vq(Gq.INTERNAL_ERROR,`Failed to create counterfactual address: ${e}`)}let u;if(t.crossSdkBridgeEnabled){const t=e.checkStoredDeviceFlowCredentials();if(!t||!t.refresh_token)throw new Vq(Gq.INTERNAL_ERROR,"Cross SDK bridge: Failed to refresh user details");u=await e.refreshToken(t.refresh_token)}else u=await e.loginSilent();if(!u?.zkEvm)throw new Vq(Gq.INTERNAL_ERROR,"Failed to refresh user details");return u}({authManager:e,config:t,magicProvider:a,multiRollupApiClients:n,accessToken:i.accessToken});return{user:r,magicProvider:a}}return{user:i,magicProvider:a}},mz=({params:e,magicProvider:t,jsonRpcProvider:r,relayerClient:n,guardianClient:i,user:a})=>i.withConfirmationScreen({width:480,height:520})((async()=>{const o=e[0];if(!o.to)throw new Vq(Gq.INVALID_PARAMS,'eth_sendTransaction requires a "to" field');const{chainId:s}=await r.ready,c=Hn.from(s),u=new Zp(t).getSigner(),f=await(async(e,t)=>{const r=await e.send("eth_getCode",[t,"latest"]);if(r&&"0x"!==r)return new ud(t,Jj.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 fz([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:lz(s),nonce:Wq(f),user:a,metaTransactions:[d,p]});const m=await fz([d,p],f,c,a.zkEvm.ethAddress,u),b=await n.ethSendTransaction(a.zkEvm.ethAddress,m),y=await zq((async()=>{const e=await n.imGetTransactionByHash(b);if(e.status===oz.PENDING)throw new Error;return e}),{retries:30,interval:1e3,finalErr:new Vq(Gq.RPC_SERVER_ERROR,"transaction hash not generated in time")});if(![oz.SUBMITTED,oz.SUCCESSFUL].includes(y.status)){let e=`Transaction failed to submit with status ${y.status}.`;throw y.statusMessage&&(e+=` Error message: ${y.statusMessage}`),new Vq(Gq.RPC_SERVER_ERROR,e)}return y.hash})),bz=["types","domain","primaryType","message"],yz=(e,t)=>{let r;if("string"==typeof e)try{r=JSON.parse(e)}catch(e){throw new Vq(Gq.INVALID_PARAMS,`Failed to parse typed data JSON: ${e}`)}else{if("object"!=typeof e)throw new Vq(Gq.INVALID_PARAMS,`Invalid typed data argument: ${e}`);r=e}if(!(e=>bz.every((t=>t in e)))(r))throw new Vq(Gq.INVALID_PARAMS,`Invalid typed data argument. The following properties are required: ${bz.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 Vq(Gq.INVALID_PARAMS,`Invalid chainId, expected ${t}`);return r};class gz{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 Yh(this.config.zkEvmRpcUrl),this.multiRollupApiClients=i,this.eventEmitter=new cz,a.on($q.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(sz.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 pz({authManager:this.authManager,config:this.config,magicAdapter:this.magicAdapter,multiRollupApiClients:this.multiRollupApiClients});return this.user=t,this.magicProvider=e,this.relayerClient=new hz({config:this.config,jsonRpcProvider:this.jsonRpcProvider,user:this.user}),this.guardianClient=new Xq({accessToken:this.user.accessToken,confirmationScreen:this.confirmationScreen,imxEtherAddress:this.user.zkEvm.ethAddress,config:this.config}),this.eventEmitter.emit(sz.ACCOUNTS_CHANGED,[this.user.zkEvm.ethAddress]),[this.user.zkEvm.ethAddress]}case"eth_sendTransaction":if(!this.isLoggedIn())throw new Vq(Hq.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");return mz({params:e.params||[],magicProvider:this.magicProvider,guardianClient:this.guardianClient,jsonRpcProvider:this.jsonRpcProvider,relayerClient:this.relayerClient,user:this.user});case"eth_accounts":return this.isLoggedIn()?[this.user.zkEvm.ethAddress]:[];case"eth_signTypedData":case"eth_signTypedData_v4":if(!this.isLoggedIn())throw new Vq(Hq.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 Vq(Gq.INVALID_PARAMS,`${t} requires an address and a typed data JSON`);const{chainId:u}=await n.ready,f=yz(c,u);await a.validateMessage({chainID:String(u),payload:f,user:o});const d=await i.imSignTypedData(s,f),l=new Zp(r).getSigner();return dz(f,d,Hn.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 Vq(Hq.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 Vq?e:e instanceof Error?new Vq(Gq.INTERNAL_ERROR,e.message):new Vq(Gq.INTERNAL_ERROR,"Internal error"),{id:t,jsonrpc:r,error:n}}}async request(e){try{return this.performRequest(e)}catch(e){if(e instanceof Vq)throw e;if(e instanceof Error)throw new Vq(Gq.INTERNAL_ERROR,e.message);throw new Vq(Gq.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 Vq(Gq.INVALID_REQUEST,"Invalid request")}on(e,t){this.eventEmitter.on(e,t)}removeListener(e,t){this.eventEmitter.removeListener(e,t)}}var vz=Object.freeze({__proto__:null,JsonRpcError:Vq,get Networks(){return Jq},Passport:class{authManager;config;confirmationScreen;immutableXClient;magicAdapter;multiRollupApiClients;passportImxProviderFactory;passportEventEmitter;constructor(e){this.config=new rz(e),this.authManager=new Lq(this.config),this.magicAdapter=new Uq(this.config),this.confirmationScreen=new az(this.config),this.immutableXClient=e.overrides?.immutableXClient||new XN({baseConfig:e.baseConfig}),this.multiRollupApiClients=new Ft(this.config.multiRollupConfig),this.passportEventEmitter=new cz,this.passportImxProviderFactory=new ez({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===Jq.PRODUCTION)throw new Error("EVM is not supported on production network");return new gz({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($q.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:Iq,get ProviderErrorCode(){return Hq},get ProviderEvent(){return sz},get RpcErrorCode(){return Gq}}),wz=Yt("object"==typeof self?self.FormData:window.FormData),_z={},Ez={},Az=Qt(vq),Tz=Qt(Sm),Sz={},Rz=Qt(ks),kz=Qt(ya),Oz=Qt(So),Iz=Qt(md),xz=Qt(Dn),Cz=Qt(gs),Mz=Qt(Vd),Pz=Qt(Ol),Nz=Qt(Yi),Bz=Qt(pn),Dz=Qt(_d),Fz=Qt(lm),Lz=Qt(Yd),Uz=Qt(vi),jz=Qt(oa),qz=Qt(If),zz=Qt(ho),Hz=Qt(Wf),Gz=Qt(wm),Vz=Qt(Nl),Kz=Qt(Ql);!function(e){var t=Jt&&Jt.__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=Jt&&Jt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=Jt&&Jt.__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=Rz;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=kz;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(Oz);e.base64=o;var s=Iz;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var c=xz;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=Cz;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=Mz;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=Pz;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return d.getJsonWalletAddress}});var l=Nz;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return l.keccak256}});var h=Bz;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return h.Logger}});var p=Dz;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=Fz;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=Lz;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return b.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return b.shuffled}});var y=Uz;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(jz);e.RLP=g;var v=qz;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=zz;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 _=Hz;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=Gz;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 A=Vz;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return A.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return A.verifyTypedData}});var T=Kz;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return T._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return T.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return T.poll}});var S=Dz;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return S.SupportedAlgorithm}});var R=zz;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return R.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return R.Utf8ErrorReason}})}(Sz);var Wz={};Object.defineProperty(Wz,"__esModule",{value:!0}),Wz.DomainRegistryABI=void 0;Wz.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 Xz={};Object.defineProperty(Xz,"__esModule",{value:!0}),Xz.SeaportABIv14=void 0;Xz.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 $z={};!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"}($z);var Jz={},Yz={};Object.defineProperty(Yz,"__esModule",{value:!0}),Yz.ERC20ABI=void 0;Yz.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 Qz={};Object.defineProperty(Qz,"__esModule",{value:!0}),Qz.ERC721ABI=void 0;Qz.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 Zz,eH={},tH={};function rH(){if(Zz)return tH;Zz=1,Object.defineProperty(tH,"__esModule",{value:!0}),tH.getItemToCriteriaMap=tH.generateCriteriaResolvers=void 0;const e=$z,t=aH();tH.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 tH.getItemToCriteriaMap=(e,r)=>{const n=[...r];return e.reduce(((e,r)=>((0,t.isCriteriaItem)(r.itemType)&&e.set(r,n.shift()),e)),new Map)},tH}var nH,iH={};function aH(){return nH||(nH=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=$z,n=rH(),i=iH;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)}}(eH)),eH}!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}}(iH);var oH={};!function(e){var t=Jt&&Jt.__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=Sz;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)}(oH);var sH=Jt&&Jt.__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(Jz,"__esModule",{value:!0}),Jz.getApprovalActions=Jz.approvedItemAmount=void 0;const cH=Tz,uH=Yz,fH=Qz,dH=$z,lH=aH(),hH=oH;Jz.approvedItemAmount=(e,t,r,n)=>sH(void 0,void 0,void 0,(function*(){if((0,lH.isErc721Item)(t.itemType)||(0,lH.isErc1155Item)(t.itemType)){return new cH.Contract(t.token,fH.ERC721ABI,n).isApprovedForAll(e,r).then((e=>e?dH.MAX_INT:cH.BigNumber.from(0)))}if(t.itemType===dH.ItemType.ERC20){return new cH.Contract(t.token,uH.ERC20ABI,n).allowance(e,r)}return dH.MAX_INT})),Jz.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,lH.isErc1155Item)(i);if((0,lH.isErc721Item)(i)||s){const o=new cH.Contract(e,fH.ERC721ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,operator:n,transactionMethods:(0,hH.getTransactionMethods)(o.connect(r),t&&!s?"approve":"setApprovalForAll",[n,!(t&&!s)||a])}}{const s=new cH.Contract(e,uH.ERC20ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,transactionMethods:(0,hH.getTransactionMethods)(s.connect(r),"approve",[n,t?o:dH.MAX_INT]),operator:n}}}))};var pH={},mH={},bH={};Object.defineProperty(bH,"__esModule",{value:!0}),bH.ERC1155ABI=void 0;bH.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 yH=Jt&&Jt.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(mH,"__esModule",{value:!0}),mH.balanceOf=void 0;const gH=Tz,vH=bH,wH=Yz,_H=Qz,EH=$z,AH=aH();mH.balanceOf=(e,t,r,n)=>yH(void 0,void 0,void 0,(function*(){if((0,AH.isErc721Item)(t.itemType)){const i=new gH.Contract(t.token,_H.ERC721ABI,r);return t.itemType===EH.ItemType.ERC721_WITH_CRITERIA?n?i.ownerOf(n.identifier).then((t=>gH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase())))):i.balanceOf(e):i.ownerOf(t.identifierOrCriteria).then((t=>gH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase()))))}if((0,AH.isErc1155Item)(t.itemType)){const i=new gH.Contract(t.token,vH.ERC1155ABI,r);if(t.itemType===EH.ItemType.ERC1155_WITH_CRITERIA){if(!n){const e=gH.BigNumber.from(t.startAmount),r=gH.BigNumber.from(t.endAmount);return e.gt(r)?e:r}return i.balanceOf(e,n.identifier)}return i.balanceOf(e,t.identifierOrCriteria)}if((0,AH.isErc20Item)(t.itemType)){return new gH.Contract(t.token,wH.ERC20ABI,r).balanceOf(e)}return r.getBalance(e)})),function(e){var t=Jt&&Jt.__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=$z,i=Jz,a=mH,o=rH(),s=aH(),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}}(pH);var TH,SH={},RH={},kH={},OH={},IH={exports:{}},xH={exports:{}};function CH(){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}()}(xH)),xH.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}(CH())}(IH);var MH=IH.exports,PH={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}()}(PH);var NH,BH=PH.exports,DH={},FH={exports:{}},LH={exports:{}};function UH(){return NH||(NH=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}(CH())}(LH)),LH.exports}var jH,qH={exports:{}};function zH(){return jH||(jH=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}(CH())}(qH)),qH.exports}var HH,GH={exports:{}};function VH(){return HH||(HH=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}(CH())}(GH)),GH.exports}var KH,WH={exports:{}};function XH(){return KH||(KH=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}(CH())}(WH)),WH.exports}var $H,JH={exports:{}};function YH(){return $H||($H=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],A=e[t+12],T=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,A,7,s[12]),x=u(x,k,O,I,T,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,T,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,A,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,T,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,A,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,A,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,T,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}(CH())}(JH)),JH.exports}var QH,ZH={exports:{}};function eG(){return QH||(QH=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}(CH())}(ZH)),ZH.exports}var tG,rG={exports:{}};var nG,iG={exports:{}};function aG(){return nG||(nG=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,A=f.high,T=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=A,j=T,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,Ae=H+ge+((de=G+ve)>>>0<G>>>0?1:0),Te=ye+me;H=q,G=z,q=U,z=j,U=F,j=L,F=B+(Ae=(Ae=(Ae=Ae+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=Ae+(be+pe+(Te>>>0<ye>>>0?1:0))+((x=de+Te|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),T=f.low=T+j,f.high=A+U+(T>>>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}(CH(),UH())}(iG)),iG.exports}var oG,sG={exports:{}};var cG,uG={exports:{}};function fG(){return cG||(cG=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,A=O.low,T=c[_];T<32?(h=E<<T|A>>>32-T,p=A<<T|E>>>32-T):(h=A<<T-32|E>>>64-T,p=E<<T-32|A>>>64-T);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}(CH(),UH())}(uG)),uG.exports}var dG,lG={exports:{}};var hG,pG={exports:{}};function mG(){return hG||(hG=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))}})}()}(CH())}(pG)),pG.exports}var bG,yG={exports:{}};var gG,vG={exports:{}};function wG(){return gG||(gG=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}(CH(),eG(),mG())}(vG)),vG.exports}var _G,EG={exports:{}};function AG(){return _G||(_G=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)}})}()}(CH(),wG())}(EG)),EG.exports}var TG,SG={exports:{}};function RG(){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}(CH(),AG())}(SG)),SG.exports}var kG,OG={exports:{}};function IG(){return kG||(kG=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}(CH(),AG())}(OG)),OG.exports}var xG,CG={exports:{}};function MG(){return xG||(xG=1,function(e,t){e.exports=function(e){
31
+ */uM=fM,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=ex:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&uM.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=[],A=0;A<w.length;++A)for(var T=w[A],S=T.bits,R=0;R<S.length;++R){var k=T.name+"_"+S[R];if(E.push(k),_[k]=T.createMethod(S[R],T.padding),"sha3"!==T.name){var O=T.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,A,T,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,A=e[48]<<14|e[49]>>>18,T=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^~_&A,e[5]=w^~E&T,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]=_^~A&m,e[7]=E^~T&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]=A^~m&y,e[9]=T^~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)uM.exports=_;else for(A=0;A<E.length;++A)r[E[A]]=_[E[A]]}();var dM=fM.exports;function lM(e){return"0x"+dM.keccak_256(_n(e))}let hM=!1,pM=!1;const mM={debug:1,default:2,info:2,warning:3,error:4,off:5};let bM=mM.default,yM=null;const gM=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 vM,wM;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(vM||(vM={})),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"}(wM||(wM={}));const _M="0123456789abcdef";let EM=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==mM[r]&&this.throwArgumentError("invalid log level name","logLevel",e),bM>mM[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(pM)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+=_M[t[e]>>4],r+=_M[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 wM.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 wM.CALL_EXCEPTION:case wM.INSUFFICIENT_FUNDS:case wM.MISSING_NEW:case wM.NONCE_EXPIRED:case wM.REPLACEMENT_UNDERPRICED:case wM.TRANSACTION_REPLACED:case wM.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){gM&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:gM})}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 yM||(yM=new e("logger/5.7.0")),yM}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),hM){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}pM=!!t,hM=!!r}static setLogLevel(t){const r=mM[t.toLowerCase()];null!=r?bM=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};EM.errors=wM,EM.levels=vM;var AM=rn.BN;const TM=new EM("bignumber/5.7.0"),SM={};let RM=!1,kM=class e{constructor(e,t){e!==SM&&TM.throwError("cannot call constructor directly; use BigNumber.from",EM.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return IM(xM(this).fromTwos(e))}toTwos(e){return IM(xM(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return IM(xM(this).add(xM(e)))}sub(e){return IM(xM(this).sub(xM(e)))}div(t){return e.from(t).isZero()&&CM("division-by-zero","div"),IM(xM(this).div(xM(t)))}mul(e){return IM(xM(this).mul(xM(e)))}mod(e){const t=xM(e);return t.isNeg()&&CM("division-by-zero","mod"),IM(xM(this).umod(t))}pow(e){const t=xM(e);return t.isNeg()&&CM("negative-power","pow"),IM(xM(this).pow(t))}and(e){const t=xM(e);return(this.isNegative()||t.isNeg())&&CM("unbound-bitwise-result","and"),IM(xM(this).and(t))}or(e){const t=xM(e);return(this.isNegative()||t.isNeg())&&CM("unbound-bitwise-result","or"),IM(xM(this).or(t))}xor(e){const t=xM(e);return(this.isNegative()||t.isNeg())&&CM("unbound-bitwise-result","xor"),IM(xM(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&CM("negative-width","mask"),IM(xM(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&CM("negative-width","shl"),IM(xM(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&CM("negative-width","shr"),IM(xM(this).shrn(e))}eq(e){return xM(this).eq(xM(e))}lt(e){return xM(this).lt(xM(e))}lte(e){return xM(this).lte(xM(e))}gt(e){return xM(this).gt(xM(e))}gte(e){return xM(this).gte(xM(e))}isNegative(){return"-"===this._hex[0]}isZero(){return xM(this).isZero()}toNumber(){try{return xM(this).toNumber()}catch(e){CM("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return TM.throwError("this platform does not support BigInt",EM.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?RM||(RM=!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()",EM.errors.UNEXPECTED_ARGUMENT,{}):TM.throwError("BigNumber.toString does not accept parameters",EM.errors.UNEXPECTED_ARGUMENT,{})),xM(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(SM,OM(t)):t.match(/^-?[0-9]+$/)?new e(SM,OM(new AM(t))):TM.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&CM("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&CM("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(wn(r))return e.from(kn(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&&(Sn(t)||"-"===t[0]&&Sn(t.substring(1))))return e.from(t)}return TM.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function OM(e){if("string"!=typeof e)return OM(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&TM.throwArgumentError("invalid hex","value",e),"0x00"===(e=OM(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 IM(e){return kM.from(OM(e))}function xM(e){const t=kM.from(e).toHexString();return"-"===t[0]?new AM("-"+t.substring(3),16):new AM(t.substring(2),16)}function CM(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),TM.throwError(e,EM.errors.NUMERIC_FAULT,n)}const MM=new EM("bignumber/5.7.0"),PM={},NM=kM.from(0),BM=kM.from(-1);function DM(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),MM.throwError(e,EM.errors.NUMERIC_FAULT,i)}let FM="0";for(;FM.length<256;)FM+=FM;function LM(e){if("number"!=typeof e)try{e=kM.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+FM.substring(0,e):MM.throwArgumentError("invalid decimal size","decimals",e)}function UM(e,t){null==t&&(t=0);const r=LM(t),n=(e=kM.from(e)).lt(NM);n&&(e=e.mul(BM));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 jM(e,t){null==t&&(t=0);const r=LM(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||MM.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&MM.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&MM.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&&DM("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=kM.from(a),c=kM.from(o);let u=s.mul(r).add(c);return n&&(u=u.mul(BM)),u}let qM=class e{constructor(e,t,r,n){e!==PM&&MM.throwError("cannot use FixedFormat constructor; use FixedFormat.from",EM.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=LM(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||MM.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&&MM.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&&MM.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&MM.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(PM,r,n,i)}},zM=class e{constructor(e,t,r,n){e!==PM&&MM.throwError("cannot use FixedNumber constructor; use FixedNumber.from",EM.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&&MM.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(t){this._checkFormat(t);const r=jM(this._value,this.format.decimals),n=jM(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=jM(this._value,this.format.decimals),n=jM(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=jM(this._value,this.format.decimals),n=jM(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=jM(this._value,this.format.decimals),n=jM(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(HM.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(HM.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)&&MM.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=e.from("1"+FM.substring(0,t),this.format),i=GM.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&&MM.throwArgumentError("invalid byte width","width",e);return Pn(kM.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&&(kM.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Sn(e)||"bigint"==typeof e||wn(e))}(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(UM(t,r),qM.from(n))}static fromString(t,r){null==r&&(r="fixed");const n=qM.from(r),i=jM(t,n.decimals);!n.signed&&i.lt(NM)&&DM("unsigned value cannot be negative","overflow","value",t);let a=null;n.signed?a=i.toTwos(n.width).toHexString():(a=i.toHexString(),a=Pn(a,n.width/8));const o=UM(i,n.decimals);return new e(PM,a,o,n)}static fromBytes(t,r){null==r&&(r="fixed");const n=qM.from(r);if(_n(t).length>n.width/8)throw new Error("overflow");let i=kM.from(t);n.signed&&(i=i.fromTwos(n.width));const a=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=UM(i,n.decimals);return new e(PM,a,o,n)}static from(t,r){if("string"==typeof t)return e.fromString(t,r);if(wn(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(t){if(t.code!==EM.errors.INVALID_ARGUMENT)throw t}return MM.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}};const HM=zM.from(1),GM=zM.from("0.5"),VM=new EM("strings/5.7.0");var KM,WM;function XM(e,t=KM.current){t!=KM.current&&(VM.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 _n(r)}function $M(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 JM(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 YM(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 QM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?YM(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ZM(e,t,r){return eP.apply(this,arguments)}function eP(){return(eP=ZI(ix.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return ix.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 QM({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=QM(QM({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=lM(XM(JSON.stringify(o))),e.next=6,cx(s,t);case 6:return c=e.sent,u=QM(QM({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 tP(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 rP(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 nP(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)?nP(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 nP(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 iP(e){return aP.apply(this,arguments)}function aP(){return(aP=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return ix.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:tP(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,cx(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 oP(e){return sP.apply(this,arguments)}function sP(){return(sP=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return ix.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:tP({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,cx(u,r);case 13:f=e.sent,d=[],l=rP(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"}(KM||(KM={})),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"}(WM||(WM={})),JM("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))),$M("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"),$M("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"),$M("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})),JM("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 cP=new EM("units/5.7.0"),uP=["wei","kwei","mwei","gwei","szabo","finney","ether"];function fP(e,t){if("string"!=typeof e&&cP.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=uP.indexOf(t);-1!==e&&(t=3*e)}return jM(e,null!=t?t:18)}function dP(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 lP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dP(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function hP(e,t,r,n,i,a,o){return pP.apply(this,arguments)}function pP(){return(pP=ZI(ix.mark((function e(t,r,n,i,a,o,s){var c,u,f;return ix.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,sM(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(lP(lP({},f),{},{value:r})));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mP(e,t,r,n,i,a){return bP.apply(this,arguments)}function bP(){return(bP=ZI(ix.mark((function e(t,r,n,i,a,o){var s;return ix.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(lP(lP({},s),{},{value:r})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yP(e,t,r,n,i,a){return gP.apply(this,arguments)}function gP(){return(gP=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u,f,d,l,h,p,m,b,y;return ix.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=fP(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=jI.connect(o.ethConfiguration.coreContractAddress,t),y=JI.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,aM(p,y);case 19:if(e.sent){e.next=24;break}return e.abrupt("return",hP(t,u,h,p,m,b,i));case 24:return e.abrupt("return",mP(t,u,h,p,m,b));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vP(e,t,r,n,i,a){return wP.apply(this,arguments)}function wP(){return(wP=ZI(ix.mark((function e(t,r,n,i,a,o){var s;return ix.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 _P(e,t,r,n,i,a,o){return EP.apply(this,arguments)}function EP(){return(EP=ZI(ix.mark((function e(t,r,n,i,a,o,s){var c,u,f;return ix.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,sM(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 AP(e,t,r,n,i,a,o){return TP.apply(this,arguments)}function TP(){return(TP=ZI(ix.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,A;return ix.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=fP(r.amount,0),h=BI.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,_=kM.from(b.data.amount),E=jI.connect(s.ethConfiguration.coreContractAddress,t),A=JI.connect(s.ethConfiguration.registrationContractAddress,t),e.next=30,aM(v,A);case 30:if(e.sent){e.next=35;break}return e.abrupt("return",_P(t,_,g,v,w,E,i));case 35:return e.abrupt("return",vP(t,_,g,v,w,E));case 36:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function SP(e,t,r,n,i,a){return RP.apply(this,arguments)}function RP(){return(RP=ZI(ix.mark((function e(t,r,n,i,a,o){var s;return ix.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 kP(e,t,r,n,i,a){return OP.apply(this,arguments)}function OP(){return(OP=ZI(ix.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 ix.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=jI.connect(o.ethConfiguration.coreContractAddress,t),b=JI.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,aM(h,b);case 19:return y=e.sent,g=FI.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,sM(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",SP(t,r.tokenId,l,h,p,m));case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var IP=function(e){if(void 0!==e)return e;throw new Error("undefined field exception")};function xP(e){return CP.apply(this,arguments)}function CP(){return(CP=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p;return ix.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=tP(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,lx(c,r);case 19:return d=e.sent,l=d.ethAddress,h=d.ethSignature,e.next=24,i.createWithdrawal({createWithdrawalRequest:{stark_key:IP(o.data.stark_key),amount:a,asset_id:IP(o.data.asset_id),vault_id:IP(o.data.vault_id),nonce:IP(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 MP(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 PP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?MP(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function NP(e,t,r,n){return BP.apply(this,arguments)}function BP(){return(BP=ZI(ix.mark((function e(t,r,n,i){var a;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.encodeAsset({assetType:t,encodeAssetRequest:{token:PP({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 DP(e,t,r,n,i){return FP.apply(this,arguments)}function FP(){return(FP=ZI(ix.mark((function e(t,r,n,i,a){var o,s,c;return ix.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,sM(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 LP(e,t,r,n){return UP.apply(this,arguments)}function UP(){return(UP=ZI(ix.mark((function e(t,r,n,i){var a;return ix.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 jP(e,t,r,n,i,a){return qP.apply(this,arguments)}function qP(){return(qP=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,NP("asset","ERC20",i,{token_address:n.tokenAddress});case 2:return s=e.sent,c=jI.connect(o.ethConfiguration.coreContractAddress,t),u=JI.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,aM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",DP(t,s.asset_type,r,u,a));case 12:return e.abrupt("return",LP(t,s.asset_type,r,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zP(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 HP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zP(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function GP(e,t,r,n,i){return VP.apply(this,arguments)}function VP(){return(VP=ZI(ix.mark((function e(t,r,n,i,a){var o;return ix.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 KP(e,t,r,n,i,a){return WP.apply(this,arguments)}function WP(){return(WP=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u;return ix.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,sM(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 XP(e){var t=e.data.id,r=e.data.blueprint||"";return Sb(rb("{".concat(t,"}:{").concat(r,"}")))}function $P(e,t,r,n,i,a){return JP.apply(this,arguments)}function JP(){return(JP=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u,f;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,NP("mintable-asset","ERC721",i,HP({id:n.data.id,token_address:n.data.tokenAddress},n.data.blueprint&&{blueprint:n.data.blueprint}));case 2:return s=e.sent,c=XP(n),u=jI.connect(o.ethConfiguration.coreContractAddress,t),f=JI.connect(o.ethConfiguration.registrationContractAddress,t),e.next=8,aM(r,f);case 8:if(e.sent){e.next=13;break}return e.abrupt("return",KP(t,s.asset_type,r,c,f,a));case 13:return e.abrupt("return",GP(t,s.asset_type,r,c,u));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function YP(e,t,r,n,i,a){return QP.apply(this,arguments)}function QP(){return(QP=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u;return ix.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,sM(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 ZP(e,t,r,n,i){return eN.apply(this,arguments)}function eN(){return(eN=ZI(ix.mark((function e(t,r,n,i,a){var o;return ix.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 tN(e,t,r,n,i,a){return rN.apply(this,arguments)}function rN(){return(rN=ZI(ix.mark((function e(t,r,n,i,a,o){var s,c,u;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,NP("asset","ERC721",i,{token_id:n.tokenId,token_address:n.tokenAddress});case 2:return s=e.sent,c=jI.connect(o.ethConfiguration.coreContractAddress,t),u=JI.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,aM(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",YP(t,s.asset_type,r,n.tokenId,u,a));case 12:return e.abrupt("return",ZP(t,s.asset_type,r,n.tokenId,c));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nN(e,t,r,n,i,a,o){return iN.apply(this,arguments)}function iN(){return(iN=ZI(ix.mark((function e(t,r,n,i,a,o,s){var c,u;return ix.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 $P(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 tN(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 aN(e,t,r,n,i){return oN.apply(this,arguments)}function oN(){return(oN=ZI(ix.mark((function e(t,r,n,i,a){var o,s,c;return ix.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,sM(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 sN(e,t,r,n){return cN.apply(this,arguments)}function cN(){return(cN=ZI(ix.mark((function e(t,r,n,i){var a;return ix.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 uN(e,t,r,n,i){return fN.apply(this,arguments)}function fN(){return(fN=ZI(ix.mark((function e(t,r,n,i,a){var o,s,c;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,NP("asset","ETH",n);case 2:return o=e.sent,s=jI.connect(a.ethConfiguration.coreContractAddress,t),c=JI.connect(a.ethConfiguration.registrationContractAddress,t),e.next=7,aM(r,c);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",aN(t,o.asset_type,r,c,i));case 12:return e.abrupt("return",sN(t,o.asset_type,r,s));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function dN(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 lN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dN(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function hN(e){return pN.apply(this,arguments)}function pN(){return(pN=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g;return ix.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:tP(i.buy),amount_sell:s,token_sell:tP(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,cx(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",lN({},g.data));case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mN(e){return bN.apply(this,arguments)}function bN(){return(bN=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return ix.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,cx(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 yN(e){return gN.apply(this,arguments)}function gN(){return(gN=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h;return ix.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,cx(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 vN(e){return wN.apply(this,arguments)}function wN(){return(wN=ZI(ix.mark((function e(t){var r,n,i,a,o,s,c,u,f,d,l,h,p,m,b;return ix.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:tP(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,cx(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 _N(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 EN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_N(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var AN=function(){function e(t){xI(this,e),this.config=t;var r=t.apiConfiguration;this.config=t,this.depositsApi=new nC(r),this.encodingApi=new sC(r),this.mintsApi=new AC(r),this.ordersApi=new CC(r),this.tokensApi=new UC(r),this.tradesApi=new HC(r),this.transfersApi=new WC(r),this.usersApi=new YC(r),this.withdrawalsApi=new tM(r),this.projectsApi=new BC(r),this.collectionsApi=new Zx(r),this.metadataApi=new mC(r),this.metadataRefreshesApi=new vC(r),this.exchangesApi=new dC(r)}var t,r,n,i,a,o,s,c,u,f,d,l,h,p,m,b,y,g,v,w,_,E,A,T,S,R,k,O;return MI(e,[{key:"isChainValid",value:function(e){return e===this.config.ethConfiguration.chainID}},{key:"validateChain",value:(O=ZI(ix.mark((function e(t){var r;return ix.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=ZI(ix.mark((function e(t){return ix.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",nM(EN(EN({},t),{},{usersApi:this.usersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"isRegisteredOnchain",value:(R=ZI(ix.mark((function e(t){var r,n;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return r=JI.connect(this.config.ethConfiguration.registrationContractAddress,t.ethSigner),e.next=5,t.starkSigner.getAddress();case 5:return n=e.sent,e.abrupt("return",aM(n,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"mint",value:(S=ZI(ix.mark((function e(t,r){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",ZM(t,r,this.mintsApi));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"transfer",value:(T=ZI(ix.mark((function e(t,r){return ix.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(EN(EN({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"exchangeTransfer",value:(A=ZI(ix.mark((function e(t,r){return ix.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",vN(EN(EN({},t),{},{request:r,exchangesApi:this.exchangesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"batchNftTransfer",value:(E=ZI(ix.mark((function e(t,r){return ix.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",oP(EN(EN({},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:(_=ZI(ix.mark((function e(t,r){return ix.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=ZI(ix.mark((function e(t,r){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",yP(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=ZI(ix.mark((function e(t,r){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",AP(t,r,this.depositsApi,this.usersApi,this.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=ZI(ix.mark((function e(t,r){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",kP(t,r,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=ZI(ix.mark((function e(t,r){return ix.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",xP(EN(EN(EN({},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=ZI(ix.mark((function e(t,r){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",uN(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=ZI(ix.mark((function e(t,r,n){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",jP(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=ZI(ix.mark((function e(t,r,n){return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",nN(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=ZI(ix.mark((function e(t,r){return ix.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",hN(EN(EN({},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=ZI(ix.mark((function e(t,r){return ix.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",mN(EN(EN({},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=ZI(ix.mark((function e(t,r){return ix.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",yN(EN(EN({},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=ZI(ix.mark((function e(t,r){var n;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r){var n;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n,i,a){var o;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r){var n;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n){var i;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n){var i;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n,i){var a;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n,i){var a,o;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r,n,i){var a,o;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r){var n,i;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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=ZI(ix.mark((function e(t,r){var n,i;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fx(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){GI(r,Ix(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=qI(e);if(t){var i=qI(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return WI(this,r)}}(r);function r(e){var n,i=e.code,a=e.details,o=e.message;return xI(this,r),(n=t.call(this,o)).code=i,n.details=a,n}return MI(r)}();function SN(e){if(II.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 RN=function(){function e(t){xI(this,e),this.depositsApi=new nC(t.apiConfiguration),this.mintsApi=new AC(t.apiConfiguration),this.ordersApi=new CC(t.apiConfiguration),this.tokensApi=new UC(t.apiConfiguration),this.tradesApi=new HC(t.apiConfiguration),this.transfersApi=new WC(t.apiConfiguration),this.exchangeApi=new dC(t.apiConfiguration),this.usersApi=new YC(t.apiConfiguration),this.withdrawalsApi=new tM(t.apiConfiguration),this.balanceApi=new $x(t.apiConfiguration),this.assetApi=new Vx(t.apiConfiguration),this.collectionApi=new Zx(t.apiConfiguration),this.metadataApi=new mC(t.apiConfiguration),this.metadataRefreshesApi=new vC(t.apiConfiguration),this.nftCheckoutPrimaryApi=new kC(t.apiConfiguration),this.projectsApi=new BC(t.apiConfiguration),this.workflows=new AN(t)}var t,r,n;return MI(e,[{key:"deposit",value:function(e,t){return this.workflows.deposit(e,t).catch((function(e){throw SN(e)}))}},{key:"getDeposit",value:function(e){return this.depositsApi.getDeposit(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listDeposits",value:function(e){return this.depositsApi.listDeposits(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"registerOffchain",value:function(e){return this.workflows.registerOffchain(e).catch((function(e){throw SN(e)}))}},{key:"isRegisteredOnchain",value:function(e){return this.workflows.isRegisteredOnchain(e).catch((function(e){throw SN(e)}))}},{key:"getUser",value:function(e){return this.usersApi.getUsers({user:e}).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"getAsset",value:function(e){return this.assetApi.getAsset(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listAssets",value:function(e){return this.assetApi.listAssets(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"createCollection",value:function(e,t){return this.workflows.createCollection(e,t).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"getCollection",value:function(e){return this.collectionApi.getCollection(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listCollectionFilters",value:function(e){return this.collectionApi.listCollectionFilters(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listCollections",value:function(e){return this.collectionApi.listCollections(e).then((function(e){return e.data})).catch((function(e){throw SN(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 SN(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 SN(e)}))}},{key:"getMetadataSchema",value:function(e){return this.metadataApi.getMetadataSchema(e).then((function(e){return e.data})).catch((function(e){throw SN(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 SN(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 SN(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 SN(e)}))}},{key:"getMetadataRefreshResults",value:function(e,t){return this.workflows.getMetadataRefreshResults(e,t).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"createMetadataRefresh",value:function(e,t){return this.workflows.createMetadataRefresh(e,t).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"createProject",value:(n=ZI(ix.mark((function e(t,r){return ix.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 SN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getProject",value:(r=ZI(ix.mark((function e(t,r){return ix.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 SN(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getProjects",value:(t=ZI(ix.mark((function e(t,r,n,i,a){return ix.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 SN(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 SN(e)}))}},{key:"listBalances",value:function(e){return this.balanceApi.listBalances(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"getMint",value:function(e){return this.mintsApi.getMint(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listMints",value:function(e){return this.mintsApi.listMints(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"mint",value:function(e,t){return this.workflows.mint(e,t).catch((function(e){throw SN(e)}))}},{key:"listWithdrawals",value:function(e){return this.withdrawalsApi.listWithdrawals(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"getWithdrawal",value:function(e){return this.withdrawalsApi.getWithdrawal(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"prepareWithdrawal",value:function(e,t){return this.workflows.prepareWithdrawal(e,t).catch((function(e){throw SN(e)}))}},{key:"completeWithdrawal",value:function(e,t,r){return this.workflows.completeWithdrawal(e,t,r).catch((function(e){throw SN(e)}))}},{key:"getOrder",value:function(e){return this.ordersApi.getOrderV3(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listOrders",value:function(e){return this.ordersApi.listOrdersV3(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"createOrder",value:function(e,t){return this.workflows.createOrder(e,t).catch((function(e){throw SN(e)}))}},{key:"cancelOrder",value:function(e,t){return this.workflows.cancelOrder(e,t).catch((function(e){throw SN(e)}))}},{key:"getTrade",value:function(e){return this.tradesApi.getTrade(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listTrades",value:function(e){return this.tradesApi.listTradesV3(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"createTrade",value:function(e,t){return this.workflows.createTrade(e,t).catch((function(e){throw SN(e)}))}},{key:"getToken",value:function(e){return this.tokensApi.getToken(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listTokens",value:function(e){return this.tokensApi.listTokens(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"getTransfer",value:function(e){return this.transfersApi.getTransfer(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"listTransfers",value:function(e){return this.transfersApi.listTransfers(e).then((function(e){return e.data})).catch((function(e){throw SN(e)}))}},{key:"transfer",value:function(e,t){return this.workflows.transfer(e,t).catch((function(e){throw SN(e)}))}},{key:"batchNftTransfer",value:function(e,t){return this.workflows.batchNftTransfer(e,t).catch((function(e){throw SN(e)}))}},{key:"createExchange",value:function(e){return this.exchangeApi.createExchange(e).catch((function(e){throw SN(e)}))}},{key:"getExchange",value:function(e){return this.exchangeApi.getExchange(e).catch((function(e){throw SN(e)}))}},{key:"getExchanges",value:function(e){return this.exchangeApi.getExchanges(e).catch((function(e){throw SN(e)}))}},{key:"exchangeTransfer",value:function(e,t){return this.workflows.exchangeTransfer(e,t).catch((function(e){throw SN(e)}))}},{key:"createNftPrimary",value:function(e){return this.nftCheckoutPrimaryApi.createNftPrimary(e).catch((function(e){throw SN(e)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(e){return this.nftCheckoutPrimaryApi.getCurrenciesNFTCheckoutPrimary(e).catch((function(e){throw SN(e)}))}},{key:"getNftPrimaryTransaction",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransaction(e).catch((function(e){throw SN(e)}))}},{key:"getNftPrimaryTransactions",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransactions(e).catch((function(e){throw SN(e)}))}}]),e}();function kN(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 ON(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kN(Object(r),!0).forEach((function(t){PI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var IN={"x-sdk-version":"imx-core-sdk-ts-".concat("2.0.2")},xN=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&&(IN["x-sdk-version"]=o),a=ON(ON({},a||{}),IN),{apiConfiguration:new rM({basePath:i,baseOptions:{headers:a}}),ethConfiguration:{coreContractAddress:t,registrationContractAddress:r,chainID:n}}},CN={get PRODUCTION(){return xN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"})},get SANDBOX(){return xN({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"})},createConfig:xN},MN=new rn("08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f",16);new Ob.ec(new Ob.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:MN.toString("hex"),hash:Lu.sha256,gRed:!1,g:["1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca","5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"]}));var PN=function(){var e=new rn("1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000",16);return e.sub(e.mod(MN))};function NN(e,t){return new rn(Lu.sha256().update(Jm(Eb(e)+gb(nb(t),2))).digest("hex"),16)}function BN(e){for(var t=PN(),r=NN(e.toString("hex",64),0),n=0;r.gte(t);n++)r=NN(r.toString("hex"),n);return r.umod(MN).toString("hex")}function DN(e){for(var t=PN(),r=NN(e.toString("hex",64),0),n=1;r.gte(t);n++)r=NN(r.toString("hex"),n);return r.umod(MN).toString("hex")}function FN(e){var t=PN();return NN(e.toString("hex",64),0).gte(t)}function LN(e){return UN.apply(this,arguments)}function UN(){return(UN=ZI(ix.mark((function e(t){var r,n;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=new RN(CN.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 jN(e,t){var r=Gk.hdkey.fromMasterSeed(Buffer.from(e.slice(2),"hex")).derivePath(t).getWallet().getPrivateKey();return new rn(r)}function qN(e,t,r){return zN.apply(this,arguments)}function zN(){return(zN=ZI(ix.mark((function e(t,r,n){var i,a,o,s,c,u,f,d;return ix.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=jN(t,r),a=DN(i),FN(i)){e.next=4;break}return e.abrupt("return",a);case 4:return e.next=6,LN(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 rn(Eb(o.starkPublicKey),16),e.next=14,kx(a).getAddress();case 14:if(c=e.sent,!s.eq(new rn(Eb(c),16))){e.next=17;break}return e.abrupt("return",a);case 17:return u=BN(i),e.next=20,kx(u).getAddress();case 20:if(c=e.sent,!s.eq(new rn(Eb(c),16))){e.next=23;break}return e.abrupt("return",u);case 23:return f=Sx(t,r),d=Tx(f),e.next=27,kx(d).getAddress();case 27:if(c=e.sent,!s.eq(new rn(Eb(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 HN(e){return GN.apply(this,arguments)}function GN(){return(GN=ZI(ix.mark((function e(t){var r,n,i,a,o;return ix.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=Nn(n).s,a=Ex("starkex","immutablex",r,"1"),e.next=10,qN(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)}EM.errors.INSUFFICIENT_FUNDS,EM.errors.NONCE_EXPIRED,EM.errors.REPLACEMENT_UNDERPRICED;const VN=({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n})=>CN.createConfig({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n,sdkVersion:"ts-immutable-sdk-0.23.0-alpha"}),KN=()=>VN({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"});class WN{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=KN();break;case t.PRODUCTION:this.immutableXConfig=VN({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"});break;default:this.immutableXConfig=KN()}}}class XN{immutableX;depositsApi;mintsApi;ordersApi;tokensApi;tradesApi;transfersApi;exchangeApi;nftCheckoutPrimaryApi;usersApi;withdrawalsApi;balanceApi;assetApi;collectionApi;metadataApi;metadataRefreshesApi;projectsApi;constructor(e){const t=new WN(e);this.immutableX=new RN(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 $N=Object.freeze({__proto__:null,IMXError:TN,ImmutableXClient:XN,imxClientCreateStarkSigner:kx,imxClientGenerateLegacyStarkPrivateKey:HN});var JN={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!==Jt&&Jt.crypto&&(r=Jt.crypto),!r)try{r=Db}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}()}(JN);var YN=JN.exports,QN=Yt(YN),ZN={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}(YN)}(ZN);var eB=Yt(ZN.exports),tB={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}(YN)}(tB);var rB=Yt(tB.exports),nB={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(YN)}(nB);var iB=Yt(nB.exports);function aB(e){this.message=e}aB.prototype=new Error,aB.prototype.name="InvalidCharacterError";var oB="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new aB("'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 sB(e){this.message=e}function cB(e,t){if("string"!=typeof e)throw new sB("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(oB(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 oB(t)}}(e.split(".")[r]))}catch(e){throw new sB("Invalid token specified: "+e.message)}}sB.prototype=new Error,sB.prototype.name="InvalidTokenError";var uB,fB,dB,lB={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},hB=(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))(hB||{});(dB=hB||(hB={})).reset=function(){uB=3,fB=lB},dB.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");uB=e},dB.setLogger=function(e){fB=e};var pB=class{constructor(e){this._name=e}debug(...e){uB>=4&&fB.debug(pB._format(this._name,this._method),...e)}info(...e){uB>=3&&fB.info(pB._format(this._name,this._method),...e)}warn(...e){uB>=2&&fB.warn(pB._format(this._name,this._method),...e)}error(...e){uB>=1&&fB.error(pB._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 pB(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){const r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){uB>=4&&fB.debug(pB._format(e),...t)}static info(e,...t){uB>=3&&fB.info(pB._format(e),...t)}static warn(e,...t){uB>=2&&fB.warn(pB._format(e),...t)}static error(e,...t){uB>=1&&fB.error(pB._format(e),...t)}};hB.reset();var mB=class{static _randomWord(){return QN.lib.WordArray.random(1).words[0]}static generateUUIDv4(){const e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^mB._randomWord()&15>>+e/4).toString(16)));return e.replace(/-/g,"")}static generateCodeVerifier(){return mB.generateUUIDv4()+mB.generateUUIDv4()+mB.generateUUIDv4()}static generateCodeChallenge(e){try{const t=eB(e);return rB.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw pB.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const r=iB.parse([e,t].join(":"));return rB.stringify(r)}},bB=class{constructor(e){this._name=e,this._logger=new pB(`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)}},yB=class{static decode(e){try{return cB(e)}catch(e){throw pB.error("JwtUtils.decode",e),e}}},gB=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(",")}},vB=class extends bB{constructor(){super(...arguments),this._logger=new pB(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-vB.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=vB.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=vB.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)}},wB=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))}},_B=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 pB.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}},EB=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},AB=class{constructor(e){this._logger=new pB("AccessTokenEvents"),this._expiringTimer=new vB("Access token expiring"),this._expiredTimer=new vB("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 pB("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]}},SB=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new pB("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 EB("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 _B(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 _B(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)}))}},RB=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new pB("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}},kB=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:A="OP",mergeClaims:T=!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=A,this.mergeClaims=!!T,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 RB({store:e})}this.refreshTokenAllowedScope=x,this.extraQueryParams=C,this.extraTokenParams=M,this.extraHeaders=P}},OB=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new pB("TokenClient"),this._jsonService=new SB(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=mB.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=mB.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=mB.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")}},IB=class{constructor(e){this.id=e.id||mB.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=vB.getEpochTime(),this.request_type=e.request_type}toStorageString(){return new pB("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})}static fromStorageString(e){return pB.createStatic("State","fromStorageString"),new IB(JSON.parse(e))}static async clearStaleState(e,t){const r=pB.createStatic("State","clearStaleState"),n=vB.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=IB.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))}}},xB=class extends IB{constructor(e){super(e),!0===e.code_verifier?this.code_verifier=mB.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=mB.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 pB("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){pB.createStatic("SigninState","fromStorageString");const t=JSON.parse(e);return new xB(t)}},CB=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-vB.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+vB.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},MB=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],PB=["sub","iss","aud","exp","iat"],NB=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-vB.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+vB.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 pB("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 pB.createStatic("User","fromStorageString"),new NB(JSON.parse(e))}},BB="oidc-client",DB=class{constructor(){this._abort=new bB("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)===BB){try{const r=wB.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:BB,url:t,keepOpen:r},n)}},FB={location:!1,toolbar:!1,height:640},LB="_blank",UB=60,jB=2,qB=10,zB=class extends kB{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:n=FB,popupWindowTarget:i=LB,redirectMethod:a="assign",redirectTarget:o="self",iframeNotifyParentOrigin:s=e.iframeNotifyParentOrigin,iframeScriptOrigin:c=e.iframeScriptOrigin,silent_redirect_uri:u=e.redirect_uri,silentRequestTimeoutInSeconds:f=qB,automaticSilentRenew:d=!0,validateSubOnSilentRenew:l=!0,includeIdTokenInSilentRenew:h=!1,monitorSession:p=!1,monitorAnonymousSession:m=!1,checkSessionIntervalInSeconds:b=jB,query_status_response_type:y="code",stopCheckSessionOnError:g=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:w=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=UB,userStore:A}=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,A)this.userStore=A;else{const e="undefined"!=typeof window?window.sessionStorage:new TB;this.userStore=new RB({store:e})}}},HB=class extends DB{constructor({silentRequestTimeoutInSeconds:e=qB}){super(),this._logger=new pB("IFrameWindow"),this._timeoutInSeconds=e,this._frame=HB.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 EB("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)}},GB=class extends DB{constructor({popupWindowTarget:e=LB,popupWindowFeatures:t={}}){super(),this._logger=new pB("PopupWindow");const r=gB.center({...FB,...t});this._window=window.open(void 0,e,gB.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)}},VB=class extends AB{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new pB("UserManagerEvents"),this._userLoaded=new bB("User loaded"),this._userUnloaded=new bB("User unloaded"),this._silentRenewError=new bB("Silent renew error"),this._userSignedIn=new bB("User signed in"),this._userSignedOut=new bB("User signed out"),this._userSessionChanged=new bB("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()}},KB=(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))(KB||{}),WB=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(WB||{}),XB=(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))(XB||{}),$B=(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))($B||{}),JB=(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))(JB||{}),YB=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(YB||{}),QB=(e=>(e.Harmony="HARMONY",e))(QB||{}),ZB=Object.create,eD=Object.defineProperty,tD=Object.defineProperties,rD=Object.getOwnPropertyDescriptor,nD=Object.getOwnPropertyDescriptors,iD=Object.getOwnPropertyNames,aD=Object.getOwnPropertySymbols,oD=Object.getPrototypeOf,sD=Object.prototype.hasOwnProperty,cD=Object.prototype.propertyIsEnumerable,uD=(e,t,r)=>t in e?eD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fD=(e,t)=>{for(var r in t||(t={}))sD.call(t,r)&&uD(e,r,t[r]);if(aD)for(var r of aD(t))cD.call(t,r)&&uD(e,r,t[r]);return e},dD=(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())})),lD=((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 hD={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},pD="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},mD=pD,bD=function(e){let t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=hD,n=(t=e.exports={}).re=[],i=t.src=[],a=t.t={},o=0,s=(e,t,r)=>{let s=o++;mD(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*$")})),yD=/^[0-9]+$/,gD=(e,t)=>{let r=yD.test(e),n=yD.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},vD={compareIdentifiers:gD,rcompareIdentifiers:(e,t)=>gD(t,e)},{MAX_LENGTH:wD,MAX_SAFE_INTEGER:_D}=hD,{re:ED,t:AD}=bD,{compareIdentifiers:TD}=vD,SD=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof SD){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>wD)throw new TypeError(`version is longer than ${wD} characters`);mD("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?ED[AD.LOOSE]:ED[AD.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>_D||this.major<0)throw new TypeError("Invalid major version");if(this.minor>_D||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>_D||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<_D)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(mD("SemVer.compare",this.version,this.options,e),!(e instanceof SD)){if("string"==typeof e&&e===this.version)return 0;e=new SD(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof SD||(e=new SD(e,this.options)),TD(this.major,e.major)||TD(this.minor,e.minor)||TD(this.patch,e.patch)}comparePre(e){if(e instanceof SD||(e=new SD(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(mD("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 SD||(e=new SD(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(mD("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}},RD=(e,t,r)=>new SD(e,r).compare(new SD(t,r)),kD=(e,t,r)=>0===RD(e,t,r),OD=(e,t,r)=>0!==RD(e,t,r),ID=(e,t,r)=>RD(e,t,r)>0,xD=(e,t,r)=>RD(e,t,r)>=0,CD=(e,t,r)=>RD(e,t,r)<0,MD=(e,t,r)=>RD(e,t,r)<=0,PD=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return kD(e,r,n);case"!=":return OD(e,r,n);case">":return ID(e,r,n);case">=":return xD(e,r,n);case"<":return CD(e,r,n);case"<=":return MD(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},ND=Symbol("SemVer ANY"),BD=class{static get ANY(){return ND}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof BD){if(e.loose===!!t.loose)return e;e=e.value}mD("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===ND?this.value="":this.value=this.operator+this.semver.version,mD("comp",this)}parse(e){let t=this.options.loose?DD[FD.COMPARATORLOOSE]:DD[FD.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 SD(r[2],this.options.loose):this.semver=ND}toString(){return this.value}test(e){if(mD("Comparator.test",e,this.options.loose),this.semver===ND||e===ND)return!0;if("string"==typeof e)try{e=new SD(e,this.options)}catch(e){return!1}return PD(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof BD))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new LD(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new LD(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=PD(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),s=PD(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||i&&a||o||s}},{re:DD,t:FD}=bD,LD=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof LD)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new LD(e.raw,t);if(e instanceof BD)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?UD[jD.HYPHENRANGELOOSE]:UD[jD.HYPHENRANGE];e=e.replace(r,tF(this.options.includePrerelease)),mD("hyphen replace",e),e=e.replace(UD[jD.COMPARATORTRIM],qD),mD("comparator trim",e,UD[jD.COMPARATORTRIM]),e=(e=(e=e.replace(UD[jD.TILDETRIM],zD)).replace(UD[jD.CARETTRIM],HD)).split(/\s+/).join(" ");let n=t?UD[jD.COMPARATORLOOSE]:UD[jD.COMPARATOR];return e.split(" ").map((e=>VD(e,this.options))).join(" ").split(/\s+/).map((e=>eF(e,this.options))).filter(this.options.loose?e=>!!e.match(n):()=>!0).map((e=>new BD(e,this.options)))}intersects(e,t){if(!(e instanceof LD))throw new TypeError("a Range is required");return this.set.some((r=>GD(r,t)&&e.set.some((e=>GD(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 SD(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(rF(this.set[t],e,this.options))return!0;return!1}},{re:UD,t:jD,comparatorTrimReplace:qD,tildeTrimReplace:zD,caretTrimReplace:HD}=bD,GD=(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},VD=(e,t)=>(mD("comp",e,t),e=$D(e,t),mD("caret",e),e=WD(e,t),mD("tildes",e),e=YD(e,t),mD("xrange",e),e=ZD(e,t),mD("stars",e),e),KD=e=>!e||"x"===e.toLowerCase()||"*"===e,WD=(e,t)=>e.trim().split(/\s+/).map((e=>XD(e,t))).join(" "),XD=(e,t)=>{let r=t.loose?UD[jD.TILDELOOSE]:UD[jD.TILDE];return e.replace(r,((t,r,n,i,a)=>{let o;return mD("tilde",e,t,r,n,i,a),KD(r)?o="":KD(n)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:KD(i)?o=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(mD("replaceTilde pr",a),o=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):o=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,mD("tilde return",o),o}))},$D=(e,t)=>e.trim().split(/\s+/).map((e=>JD(e,t))).join(" "),JD=(e,t)=>{mD("caret",e,t);let r=t.loose?UD[jD.CARETLOOSE]:UD[jD.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,o)=>{let s;return mD("caret",e,t,r,i,a,o),KD(r)?s="":KD(i)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:KD(a)?s="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:o?(mD("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`):(mD("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`),mD("caret return",s),s}))},YD=(e,t)=>(mD("replaceXRanges",e,t),e.split(/\s+/).map((e=>QD(e,t))).join(" ")),QD=(e,t)=>{e=e.trim();let r=t.loose?UD[jD.XRANGELOOSE]:UD[jD.XRANGE];return e.replace(r,((r,n,i,a,o,s)=>{mD("xRange",e,r,n,i,a,o,s);let c=KD(i),u=c||KD(a),f=u||KD(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`),mD("xRange return",r),r}))},ZD=(e,t)=>(mD("replaceStars",e,t),e.trim().replace(UD[jD.STAR],"")),eF=(e,t)=>(mD("replaceGTE0",e,t),e.trim().replace(UD[t.includePrerelease?jD.GTE0PRE:jD.GTE0],"")),tF=e=>(t,r,n,i,a,o,s,c,u,f,d,l,h)=>`${r=KD(n)?"":KD(i)?`>=${n}.0.0${e?"-0":""}`:KD(a)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=KD(u)?"":KD(f)?`<${+u+1}.0.0-0`:KD(d)?`<${u}.${+f+1}.0-0`:l?`<=${u}.${f}.${d}-${l}`:e?`<${u}.${f}.${+d+1}-0`:`<=${c}`}`.trim(),rF=(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(mD(e[r].semver),e[r].semver!==BD.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},nF=(e,t,r)=>{try{t=new LD(t,r)}catch(e){return!1}return t.test(e)},{MAX_LENGTH:iF}=hD,{re:aF,t:oF}=bD,sF=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof SD)return e;if("string"!=typeof e||e.length>iF||!(t.loose?aF[oF.LOOSE]:aF[oF.FULL]).test(e))return null;try{return new SD(e,t)}catch(e){return null}},{re:cF,t:uF}=bD,fF=(e,t)=>{if(e instanceof SD)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=cF[uF.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),cF[uF.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;cF[uF.COERCERTL].lastIndex=-1}else r=e.match(cF[uF.COERCE]);return null===r?null:sF(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function dF(e){return String.fromCharCode(parseInt(e.slice(1),16))}function lF(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function hF(e){return function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,dF))}(JSON.stringify(e))}function pF(e){return JSON.parse(function(e){return decodeURIComponent(Array.from(atob(e),lF).join(""))}(e))}function mF(e){return void 0===e}function bF(e){return function(e){return null===e}(e)||mF(e)}function yF(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var gF={};var vF={"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"},wF=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,wF.prototype)}},_F=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!bF(e)&&"number"==typeof e&&Object.values(XB).includes(e)}(t)?t:XB.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(null==e?void 0:e.data)||void 0,Object.setPrototypeOf(this,_F.prototype)}},EF=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},AF=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,AF.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 SF(){return new wF(KB.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function RF(){return new wF(KB.MalformedResponse,"Response from the Magic iframe is malformed.")}function kF(e){return new wF(KB.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 OF(e){let t=`Some extensions are incompatible with \`${gF.sdkName}@${gF.version}\`:`;return e.filter((e=>void 0!==e.compat&&null!==e.compat)).forEach((e=>{let r=e.compat[gF.sdkName];"string"==typeof r?t+=`\n - Extension \`${e.name}\` supports version(s) \`${r}\``:r||(t+=`\n - Extension \`${e.name}\` does not support ${gF.platform} environments.`)})),new wF(KB.IncompatibleExtensions,t)}function IF(e){return new wF(KB.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 xF(){return new EF(WB.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 \`${gF.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}var CF=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function MF(){return CF.next().value}var PF=Symbol("Payload pre-processed by Magic SDK");function NF(e){return Object.defineProperty(e,PF,{value:!0,enumerable:!1}),e}function BF(e){var t,r,n;return function(e){return!!e[PF]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=MF(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],NF(e)),e}function DF(e,t=[]){return NF({params:t,method:e,jsonrpc:"2.0",id:MF()})}var FF=class{constructor(e){e instanceof FF?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):function(e){return!bF(e)&&!(mF(e.jsonrpc)||mF(e.id)||mF(e.result)&&mF(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}}},LF=((e,t,r)=>(r=null!=e?ZB(oD(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of iD(t))!sD.call(e,i)&&i!==r&&eD(e,i,{get:()=>t[i],enumerable:!(n=rD(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:eD(r,"default",{value:e,enumerable:!0}),e)))(lD()),UF=class extends LF.default{};function jF(){let e=new UF;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var qF=Symbol("isPromiEvent");function zF(e){return!!e[qF]}function HF(e){let t=GF(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=jF(),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,{[qF]:!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 GF(e){return new Promise(((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)}))}var VF,KF=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(YB.MAGIC_HANDLE_REQUEST,BF(e)),r=HF(((e,r)=>{t.then((t=>{if(n(),t.hasError)r(new _F(t.payload.error));else{if(!t.hasResult)throw RF();e(t.payload.result)}})).catch((e=>{n(),r(e)}))})),n=this.overlay.on(JB.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=DF($B.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}},WF=class extends KF{loginWithMagicLink(e){let{email:t,showUI:r=!0,redirectURI:n}=e,i=DF(this.sdk.testMode?$B.LoginWithMagicLinkTestMode:$B.LoginWithMagicLink,[{email:t,showUI:r,redirectURI:n}]);return this.request(i)}loginWithSMS(e){let{phoneNumber:t}=e,r=DF(this.sdk.testMode?$B.LoginWithSmsTestMode:$B.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r}=e,n=DF(this.sdk.testMode?$B.LoginWithEmailOTPTestMode:$B.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"===gF.platform){t=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let r=DF(this.sdk.testMode?$B.LoginWithCredentialTestMode:$B.LoginWithCredential,[t]);return this.request(r)}},XF={};function $F(e){return(...t)=>dD(this,null,(function*(){return VF||(VF=yield gF.configureStorage()),yield VF.ready(),VF[e](...t)}))}((e,t)=>{for(var r in t)eD(e,r,{get:t[r],enumerable:!0})})(XF,{clear:()=>ZF,getItem:()=>JF,iterate:()=>nL,key:()=>tL,keys:()=>rL,length:()=>eL,removeItem:()=>QF,setItem:()=>YF});var JF=$F("getItem"),YF=$F("setItem"),QF=$F("removeItem"),ZF=$F("clear"),eL=$F("length"),tL=$F("key"),rL=$F("keys"),nL=$F("iterate");function iL(){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 aL="STORE_KEY_PRIVATE_KEY",oL="STORE_KEY_PUBLIC_JWK",sL="ECDSA",cL="P-256",uL={name:sL,namedCurve:cL},fL={name:sL,namedCurve:cL};function dL(){QF(oL),QF(aL)}function lL(){return dD(this,null,(function*(){let e=yield function(){return dD(this,null,(function*(){if(function(){let e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return(yield JF(oL))||(yield function(){return dD(this,null,(function*(){let e=null,{subtle:t}=window.crypto,r=yield t.generateKey(uL,!0,["sign"]),n=yield t.exportKey("jwk",r.privateKey);e=yield t.exportKey("jwk",r.publicKey);let i=yield t.importKey("jwk",n,fL,!1,["sign"]);yield YF(aL,i),yield YF(oL,e)}))}()),JF(oL);console.info("webcrypto is not supported")}))}();if(!e)return void console.info("unable to create public key or webcrypto is unsupported");let{subtle:t}=window.crypto,r=yield JF(aL);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:iL()},i={typ:"dpop+jwt",alg:"ES256",jwk:e},a=hL(JSON.stringify(i)),o=hL(JSON.stringify(n)),s=function(e){return(new TextEncoder).encode(e)}(`${a}.${o}`),c={name:sL,hash:{name:"SHA-256"}},u=function(e){let t="";return e.forEach((e=>{t+=String.fromCharCode(e)})),pL(t)}(new Uint8Array(yield t.sign(c,r,s)));return`${a}.${o}.${u}`}))}function hL(e){return pL(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}(e))}function pL(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var mL=class extends KF{getIdToken(e){let t=DF(this.sdk.testMode?$B.GetIdTokenTestMode:$B.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=DF(this.sdk.testMode?$B.GenerateIdTokenTestMode:$B.GenerateIdToken,[e]);return this.request(t)}getMetadata(){let e=DF(this.sdk.testMode?$B.GetMetadataTestMode:$B.GetMetadata);return this.request(e)}updateEmail(e){let{email:t,showUI:r=!0}=e,n=DF(this.sdk.testMode?$B.UpdateEmailTestMode:$B.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}isLoggedIn(){let e=DF(this.sdk.testMode?$B.IsLoggedInTestMode:$B.IsLoggedIn);return this.request(e)}logout(){dL();let e=DF(this.sdk.testMode?$B.LogoutTestMode:$B.Logout);return this.request(e)}showSettings(){let e=DF(this.sdk.testMode?$B.UserSettingsTestMode:$B.UserSettings);return this.request(e)}updatePhoneNumber(){let e=DF(this.sdk.testMode?$B.UpdatePhoneNumberTestMode:$B.UpdatePhoneNumber);return this.request(e)}recoverAccount(e){let t=DF(this.sdk.testMode?$B.RecoverAccountTestMode:$B.RecoverAccount,[e]);return this.request(t)}},bL=class extends KF{connectWithUI(){let e=DF($B.RequestAccounts);return this.request(e)}showUI(){let e=DF($B.ShowUI);return this.request(e)}getInfo(){let e=DF($B.GetInfo);return this.request(e)}requestUserInfoWithUI(e){let t=DF($B.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}disconnect(){dL();let e=DF($B.Disconnect);return this.request(e)}},{createBoundEmitterMethod:yL,createChainingEmitterMethod:gL}=jF(),vL=class extends KF{constructor(){super(...arguments),this.isMagic=!0,this.on=gL("on",this),this.once=gL("once",this),this.addListener=gL("addListener",this),this.off=gL("off",this),this.removeListener=gL("removeListener",this),this.removeAllListeners=gL("removeAllListeners",this),this.emit=yL("emit"),this.eventNames=yL("eventNames"),this.listeners=yL("listeners"),this.listenerCount=yL("listenerCount")}sendAsync(e,t){if(!t)throw IF({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(YB.MAGIC_HANDLE_REQUEST,e.map((e=>{let t=BF(e);return this.prefixPayloadMethodForTestMode(t),t}))).then((e=>{t(null,e.map((e=>((e,t)=>tD(e,nD(t)))(fD({},e.payload),{error:e.hasError?new _F(e.payload.error):null}))))}));else{let r=BF(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(YB.MAGIC_HANDLE_REQUEST,r).then((e=>{t(e.hasError?new _F(e.payload.error):null,e.payload)}))}}send(e,t){if("string"==typeof e){let r=DF(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new EF(WB.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 FF(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=DF("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 wL(e,t){return t?new URL(e,t):new URL(e)}var _L=["request","overlay","sdk"];function EL(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==KF.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var AL=class extends KF{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:HF,isPromiEvent:zF,encodeJSON:hF,decodeJSON:pF,createJsonRpcRequestPayload:DF,standardizeJsonRpcRequestPayload:BF,storage:XF};let e=[this,...EL(this)];_L.forEach((t=>{let r=e.map((e=>Object.getOwnPropertyDescriptor(e,t))),n=r.findIndex((e=>!!e)),i=n>0,a=r[n];a&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:a,isPrototypeField:i}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw kF(t)}}))}))}init(e){this.__is_initialized__||(_L.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 AF(this,e,t,r)}},TL=class extends AL{};TL.Internal=class extends AL{},TL.Anonymous="anonymous extension";var SL=class extends KF{purchase(e){let t=DF($B.NFTPurchase,[e]);return this.request(t)}};function RL(e){return!e.compat||null==e.compat[gF.sdkName]||("string"==typeof e.compat[gF.sdkName]?nF(fF(gF.version),e.compat[gF.sdkName]):!!e.compat[gF.sdkName])}function kL(e){var t;let r=null!=(t=null==e?void 0:e.extensions)?t:[],n={},i=[];if(Array.isArray(r)?r.forEach((e=>{RL(e)?(e.init(this),(e.name||e.name!==TL.Anonymous)&&(this[e.name]=e),e instanceof TL.Internal&&(yF(e.config)||(n[e.name]=e.config))):i.push(e)})):Object.keys(r).forEach((e=>{if(RL(r[e])){r[e].init(this);let t=r[e];this[e]=t,t instanceof TL.Internal&&(yF(t.config)||(n[r[e].name]=t.config))}else i.push(r[e])})),i.length)throw OF(i);return n}var OL=class{constructor(e,t){var r;if(this.apiKey=e,!e)throw SF();"react-native"===gF.platform&&(null==t?void 0:t.endpoint)&&xF().log();let{defaultEndpoint:n,version:i}=gF;this.testMode=!(null==t||!t.testMode),this.endpoint=wL(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new WF(this),this.user=new mL(this),this.wallet=new bL(this),this.nft=new SL(this),this.rpcProvider=new vL(this);let a=kL.call(this,t);this.parameters=hF(fD({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:wL(this.endpoint).host,sdk:vF[gF.sdkName],version:i,ext:yF(a)?void 0:a,locale:(null==t?void 0:t.locale)||"en_US"},gF.bundleId?{bundleId:gF.bundleId}:{}))}get overlay(){if(!OL.__overlays__.has(this.parameters)){let e=new gF.ViewController(this.endpoint,this.parameters);e.init(),OL.__overlays__.set(this.parameters,e)}return OL.__overlays__.get(this.parameters)}preload(){return dD(this,null,(function*(){yield this.overlay.ready}))}},IL=OL;function xL(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 FF(i).applyResult(t.data.response.result).applyError(t.data.response.error)}}return{}}IL.__overlays__=new Map;var CL=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return dD(this,null,(function*(){return GF((r=>dD(this,null,(function*(){yield this.ready;let n=[],i=Array.isArray(t)?t.map((e=>e.id)):[],a=yield function(e,t){return dD(this,null,(function*(){let r,n=yield JF("rt");if("web"===gF.platform)try{r=yield lL()}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(JB.MAGIC_HANDLE_RESPONSE,(e=>a=>{let{id:o,response:s}=xL(t,a);(function(e){dD(this,null,(function*(){!e.data.rt||(yield YF("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(JB.MAGIC_OVERLAY_READY,(()=>e()))}))}listen(){this.on(JB.MAGIC_HIDE_OVERLAY,(()=>{this.hideOverlay()})),this.on(JB.MAGIC_SHOW_OVERLAY,(()=>{this.showOverlay()}))}},ML=Object.create,PL=Object.defineProperty,NL=Object.getOwnPropertyDescriptor,BL=Object.getOwnPropertyNames,DL=Object.getPrototypeOf,FL=Object.prototype.hasOwnProperty,LL=(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')})),UL=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),jL=(e,t,r)=>(r=null!=e?ML(DL(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of BL(t))!FL.call(e,i)&&i!==r&&PL(e,i,{get:()=>t[i],enumerable:!(n=NL(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:PL(r,"default",{value:e,enumerable:!0}),e)),qL=(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())})),zL=UL(((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 LL&&LL;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 LL&&LL,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 A(e){return _(e,!0)}function T(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),A(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,T(e)?A(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,T(r,t._defaultConfig.version)?A(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)}))})),HL=UL(((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})}))})),GL=jL(zL()),VL=jL(HL()),KL={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var WL=function(e,t){return Object.assign(gF,t),e}(IL,{platform:"web",sdkName:"magic-sdk",version:"13.6.2",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends CL{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 EF(WB.DuplicateIframe,"Duplicate iframes found.").log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=wL(this.endpoint).host,t.title="Secure Modal",t.src=wL(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(let[t,r]of Object.entries(KL))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 qL(this,null,(function*(){let e=yield this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}))}hideOverlay(){return qL(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 qL(this,null,(function*(){let t=yield this.iframe;if(!t||!t.contentWindow)throw new wF(KB.ModalNotReady,"Modal is not ready.");t.contentWindow.postMessage(e,this.endpoint)}))}},configureStorage:()=>qL(void 0,null,(function*(){let e=GL.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(VL),yield e.setDriver([GL.default.INDEXEDDB,GL.default.LOCALSTORAGE,VL._driver]),e}))}),XL=(e=>(e.LoginWithOIDC="magic_auth_login_with_oidc",e))(XL||{}),$L=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 JL(e,t){return function(){return e.apply(t,arguments)}}const{toString:YL}=Object.prototype,{getPrototypeOf:QL}=Object,ZL=(e=>t=>{const r=YL.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),eU=e=>(e=e.toLowerCase(),t=>ZL(t)===e),tU=e=>t=>typeof t===e,{isArray:rU}=Array,nU=tU("undefined");const iU=eU("ArrayBuffer");const aU=tU("string"),oU=tU("function"),sU=tU("number"),cU=e=>null!==e&&"object"==typeof e,uU=e=>{if("object"!==ZL(e))return!1;const t=QL(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},fU=eU("Date"),dU=eU("File"),lU=eU("Blob"),hU=eU("FileList"),pU=eU("URLSearchParams");function mU(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),rU(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 bU(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 yU="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,gU=e=>!nU(e)&&e!==yU;const vU=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&QL(Uint8Array)),wU=eU("HTMLFormElement"),_U=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),EU=eU("RegExp"),AU=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};mU(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},TU="abcdefghijklmnopqrstuvwxyz",SU="0123456789",RU={DIGIT:SU,ALPHA:TU,ALPHA_DIGIT:TU+TU.toUpperCase()+SU};const kU=eU("AsyncFunction");var OU={isArray:rU,isArrayBuffer:iU,isBuffer:function(e){return null!==e&&!nU(e)&&null!==e.constructor&&!nU(e.constructor)&&oU(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||oU(e.append)&&("formdata"===(t=ZL(e))||"object"===t&&oU(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&iU(e.buffer),t},isString:aU,isNumber:sU,isBoolean:e=>!0===e||!1===e,isObject:cU,isPlainObject:uU,isUndefined:nU,isDate:fU,isFile:dU,isBlob:lU,isRegExp:EU,isFunction:oU,isStream:e=>cU(e)&&oU(e.pipe),isURLSearchParams:pU,isTypedArray:vU,isFileList:hU,forEach:mU,merge:function e(){const{caseless:t}=gU(this)&&this||{},r={},n=(n,i)=>{const a=t&&bU(r,i)||i;uU(r[a])&&uU(n)?r[a]=e(r[a],n):uU(n)?r[a]=e({},n):rU(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&mU(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(mU(t,((t,n)=>{r&&oU(t)?e[n]=JL(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&&QL(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:ZL,kindOfTest:eU,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(rU(e))return e;let t=e.length;if(!sU(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:wU,hasOwnProperty:_U,hasOwnProp:_U,reduceDescriptors:AU,freezeMethods:e=>{AU(e,((t,r)=>{if(oU(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];oU(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 rU(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:bU,global:yU,isContextDefined:gU,ALPHABET:RU,generateString:(e=16,t=RU.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&oU(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(cU(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=rU(e)?[]:{};return mU(e,((e,t)=>{const a=r(e,n+1);!nU(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:kU,isThenable:e=>e&&(cU(e)||oU(e))&&oU(e.then)&&oU(e.catch)};function IU(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)}OU.inherits(IU,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:OU.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const xU=IU.prototype,CU={};["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=>{CU[e]={value:e}})),Object.defineProperties(IU,CU),Object.defineProperty(xU,"isAxiosError",{value:!0}),IU.from=(e,t,r,n,i,a)=>{const o=Object.create(xU);return OU.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),IU.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function MU(e){return OU.isPlainObject(e)||OU.isArray(e)}function PU(e){return OU.endsWith(e,"[]")?e.slice(0,-2):e}function NU(e,t,r){return e?e.concat(t).map((function(e,t){return e=PU(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const BU=OU.toFlatObject(OU,{},null,(function(e){return/^is[A-Z]/.test(e)}));function DU(e,t,r){if(!OU.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=OU.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!OU.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&OU.isSpecCompliantForm(t);if(!OU.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(OU.isDate(e))return e.toISOString();if(!s&&OU.isBlob(e))throw new IU("Blob is not supported. Use a Buffer instead.");return OU.isArrayBuffer(e)||OU.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(OU.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(OU.isArray(e)&&function(e){return OU.isArray(e)&&!e.some(MU)}(e)||(OU.isFileList(e)||OU.endsWith(r,"[]"))&&(s=OU.toArray(e)))return r=PU(r),s.forEach((function(e,n){!OU.isUndefined(e)&&null!==e&&t.append(!0===o?NU([r],n,a):null===o?r:r+"[]",c(e))})),!1;return!!MU(e)||(t.append(NU(i,r,a),c(e)),!1)}const f=[],d=Object.assign(BU,{defaultVisitor:u,convertValue:c,isVisitable:MU});if(!OU.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!OU.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),OU.forEach(r,(function(r,a){!0===(!(OU.isUndefined(r)||null===r)&&i.call(t,r,OU.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),f.pop()}}(e),t}function FU(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function LU(e,t){this._pairs=[],e&&DU(e,this,t)}const UU=LU.prototype;function jU(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qU(e,t,r){if(!t)return e;const n=r&&r.encode||jU,i=r&&r.serialize;let a;if(a=i?i(t,r):OU.isURLSearchParams(t)?t.toString():new LU(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}UU.append=function(e,t){this._pairs.push([e,t])},UU.toString=function(e){const t=e?function(t){return e.call(this,t,FU)}:FU;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var zU=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){OU.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},HU={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var GU={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:LU,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 VU(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&OU.isArray(n)?n.length:a,s)return OU.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&OU.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&OU.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(OU.isFormData(e)&&OU.isFunction(e.entries)){const r={};return OU.forEachEntry(e,((e,n)=>{t(function(e){return OU.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const KU={"Content-Type":void 0};const WU={transitional:HU,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=OU.isObject(e);i&&OU.isHTMLForm(e)&&(e=new FormData(e));if(OU.isFormData(e))return n&&n?JSON.stringify(VU(e)):e;if(OU.isArrayBuffer(e)||OU.isBuffer(e)||OU.isStream(e)||OU.isFile(e)||OU.isBlob(e))return e;if(OU.isArrayBufferView(e))return e.buffer;if(OU.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 DU(e,new GU.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return GU.isNode&&OU.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=OU.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return DU(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(OU.isString(e))try{return(t||JSON.parse)(e),OU.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||WU.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&OU.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 IU.from(e,IU.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:GU.classes.FormData,Blob:GU.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};OU.forEach(["delete","get","head"],(function(e){WU.headers[e]={}})),OU.forEach(["post","put","patch"],(function(e){WU.headers[e]=OU.merge(KU)}));var XU=WU;const $U=OU.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 JU=Symbol("internals");function YU(e){return e&&String(e).trim().toLowerCase()}function QU(e){return!1===e||null==e?e:OU.isArray(e)?e.map(QU):String(e)}function ZU(e,t,r,n,i){return OU.isFunction(n)?n.call(this,t,r):(i&&(t=r),OU.isString(t)?OU.isString(n)?-1!==t.indexOf(n):OU.isRegExp(n)?n.test(t):void 0:void 0)}class ej{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=YU(t);if(!i)throw new Error("header name must be a non-empty string");const a=OU.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=QU(e))}const a=(e,t)=>OU.forEach(e,((e,r)=>i(e,r,t)));return OU.isPlainObject(e)||e instanceof this.constructor?a(e,t):OU.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]&&$U[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=YU(e)){const r=OU.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(OU.isFunction(t))return t.call(this,e,r);if(OU.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=YU(e)){const r=OU.findKey(this,e);return!(!r||void 0===this[r]||t&&!ZU(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=YU(e)){const i=OU.findKey(r,e);!i||t&&!ZU(0,r[i],i,t)||(delete r[i],n=!0)}}return OU.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&&!ZU(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return OU.forEach(this,((n,i)=>{const a=OU.findKey(r,i);if(a)return t[a]=QU(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]=QU(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return OU.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&OU.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[JU]=this[JU]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=YU(e);t[n]||(!function(e,t){const r=OU.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 OU.isArray(e)?e.forEach(n):n(e),this}}ej.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),OU.freezeMethods(ej.prototype),OU.freezeMethods(ej);var tj=ej;function rj(e,t){const r=this||XU,n=t||r,i=tj.from(n.headers);let a=n.data;return OU.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function nj(e){return!(!e||!e.__CANCEL__)}function ij(e,t,r){IU.call(this,null==e?"canceled":e,IU.ERR_CANCELED,t,r),this.name="CanceledError"}OU.inherits(ij,IU,{__CANCEL__:!0});var aj=GU.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),OU.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),OU.isString(n)&&o.push("path="+n),OU.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 oj(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 sj=GU.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=OU.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function cj(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 uj="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=tj.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}OU.isFormData(n)&&(GU.isStandardBrowserEnv||GU.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=oj(e.baseURL,e.url);function f(){if(!c)return;const n=tj.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new IU("Request failed with status code "+r.status,[IU.ERR_BAD_REQUEST,IU.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(),qU(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 IU("Request aborted",IU.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new IU("Network Error",IU.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||HU;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new IU(t,n.clarifyTimeoutError?IU.ETIMEDOUT:IU.ECONNABORTED,e,c)),c=null},GU.isStandardBrowserEnv){const t=(e.withCredentials||sj(u))&&e.xsrfCookieName&&aj.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&OU.forEach(i.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),OU.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",cj(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",cj(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{c&&(r(!t||t.type?new ij(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===GU.protocols.indexOf(d)?r(new IU("Unsupported protocol "+d+":",IU.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const fj={http:null,xhr:uj};OU.forEach(fj,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var dj=e=>{e=OU.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=OU.isString(r)?fj[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new IU(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(OU.hasOwnProp(fj,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!OU.isFunction(n))throw new TypeError("adapter is not a function");return n};function lj(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ij(null,e)}function hj(e){lj(e),e.headers=tj.from(e.headers),e.data=rj.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return dj(e.adapter||XU.adapter)(e).then((function(t){return lj(e),t.data=rj.call(e,e.transformResponse,t),t.headers=tj.from(t.headers),t}),(function(t){return nj(t)||(lj(e),t&&t.response&&(t.response.data=rj.call(e,e.transformResponse,t.response),t.response.headers=tj.from(t.response.headers))),Promise.reject(t)}))}const pj=e=>e instanceof tj?e.toJSON():e;function mj(e,t){t=t||{};const r={};function n(e,t,r){return OU.isPlainObject(e)&&OU.isPlainObject(t)?OU.merge.call({caseless:r},e,t):OU.isPlainObject(t)?OU.merge({},t):OU.isArray(t)?t.slice():t}function i(e,t,r){return OU.isUndefined(t)?OU.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!OU.isUndefined(t))return n(void 0,t)}function o(e,t){return OU.isUndefined(t)?OU.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(pj(e),pj(t),!0)};return OU.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=c[n]||i,o=a(e[n],t[n],n);OU.isUndefined(o)&&a!==s||(r[n]=o)})),r}const bj="1.4.0",yj={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{yj[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const gj={};yj.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 IU(n(i," has been removed"+(t?" in "+t:"")),IU.ERR_DEPRECATED);return t&&!gj[i]&&(gj[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 vj={assertOptions:function(e,t,r){if("object"!=typeof e)throw new IU("options must be an object",IU.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 IU("option "+a+" must be "+r,IU.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new IU("Unknown option "+a,IU.ERR_BAD_OPTION)}},validators:yj};const wj=vj.validators;class _j{constructor(e){this.defaults=e,this.interceptors={request:new zU,response:new zU}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=mj(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&vj.assertOptions(r,{silentJSONParsing:wj.transitional(wj.boolean),forcedJSONParsing:wj.transitional(wj.boolean),clarifyTimeoutError:wj.transitional(wj.boolean)},!1),null!=n&&(OU.isFunction(n)?t.paramsSerializer={serialize:n}:vj.assertOptions(n,{encode:wj.function,serialize:wj.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&OU.merge(i.common,i[t.method]),a&&OU.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=tj.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=[hj.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=hj.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 qU(oj((e=mj(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}OU.forEach(["delete","get","head","options"],(function(e){_j.prototype[e]=function(t,r){return this.request(mj(r||{},{method:e,url:t,data:(r||{}).data}))}})),OU.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(mj(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}_j.prototype[e]=t(),_j.prototype[e+"Form"]=t(!0)}));var Ej=_j;class Aj{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 ij(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 Aj((function(t){e=t}));return{token:t,cancel:e}}}var Tj=Aj;const Sj={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(Sj).forEach((([e,t])=>{Sj[t]=e}));var Rj=Sj;const kj=function e(t){const r=new Ej(t),n=JL(Ej.prototype.request,r);return OU.extend(n,Ej.prototype,r,{allOwnKeys:!0}),OU.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(mj(t,r))},n}(XU);kj.Axios=Ej,kj.CanceledError=ij,kj.CancelToken=Tj,kj.isCancel=nj,kj.VERSION=bj,kj.toFormData=DU,kj.AxiosError=IU,kj.Cancel=kj.CanceledError,kj.all=function(e){return Promise.all(e)},kj.spread=function(e){return function(t){return e.apply(null,t)}},kj.isAxiosError=function(e){return OU.isObject(e)&&!0===e.isAxiosError},kj.mergeConfig=mj,kj.AxiosHeaders=tj,kj.formToJSON=e=>VU(OU.isHTMLForm(e)?new FormData(e):e),kj.HttpStatusCode=Rj,kj.default=kj;var Oj=kj;const Ij="https://guardian.sandbox.imtbl.com".replace(/\/+$/,"");class xj{basePath;axios;configuration;constructor(e,t=Ij,r=Oj){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Cj extends Error{field;name="RequiredError";constructor(e,t){super(t),this.field=e}}const Mj="https://example.com",Pj=function(e,t,r){if(null==r)throw new Cj(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Nj=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 Bj(e,t,r=""){"object"==typeof t?Array.isArray(t)?t.forEach((t=>Bj(e,t,r))):Object.keys(t).forEach((n=>Bj(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t)}const Dj=function(e,...t){const r=new URLSearchParams(e.search);Bj(r,t),e.search=r.toString()},Fj=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||""},Lj=function(e){return e.pathname+e.search+e.hash},Uj=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||a)+e.url};return i.request(o)}},jj=function(e){const t=function(e){return{approvePendingMessage:async(t,r={})=>{Pj("approvePendingMessage","messageID",t);const n="/guardian/v1/messages/{messageID}/approve".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,Mj);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...r},s={};await Nj(s,e),Dj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:Lj(i),options:o}},evaluateMessage:async(t,r={})=>{Pj("evaluateMessage","messageEvaluationRequest",t);const n=new URL("/guardian/v1/messages/evaluate",Mj);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...r},o={};await Nj(o,e),o["Content-Type"]="application/json",Dj(n,{});let s=i&&i.headers?i.headers:{};return a.headers={...o,...s,...r.headers},a.data=Fj(t,a,e),{url:Lj(n),options:a}},getMessageByID:async(t,r={})=>{Pj("getMessageByID","messageID",t);const n="/guardian/v1/messages/{messageID}".replace("{messageID}",encodeURIComponent(String(t))),i=new URL(n,Mj);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...r},s={};await Nj(s,e),Dj(i,{});let c=a&&a.headers?a.headers:{};return o.headers={...s,...c,...r.headers},{url:Lj(i),options:o}}}}(e);return{async approvePendingMessage(r,n){const i=await t.approvePendingMessage(r,n);return Uj(i,Oj,Ij,e)},async evaluateMessage(r,n){const i=await t.evaluateMessage(r,n);return Uj(i,Oj,Ij,e)},async getMessageByID(r,n){const i=await t.getMessageByID(r,n);return Uj(i,Oj,Ij,e)}}};class qj extends xj{approvePendingMessage(e,t){return jj(this.configuration).approvePendingMessage(e.messageID,t).then((e=>e(this.axios,this.basePath)))}evaluateMessage(e,t){return jj(this.configuration).evaluateMessage(e.messageEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getMessageByID(e,t){return jj(this.configuration).getMessageByID(e.messageID,t).then((e=>e(this.axios,this.basePath)))}}const zj=function(e){const t=function(e){return{approvePendingTransaction:async(t,r,n={})=>{Pj("approvePendingTransaction","payloadHash",t),Pj("approvePendingTransaction","transactionApprovalRequest",r);const i="/guardian/v1/transactions/{payloadHash}/approve".replace("{payloadHash}",encodeURIComponent(String(t))),a=new URL(i,Mj);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Nj(c,e),c["Content-Type"]="application/json",Dj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=Fj(r,s,e),{url:Lj(a),options:s}},evaluateTransaction:async(t,r,n={})=>{Pj("evaluateTransaction","id",t),Pj("evaluateTransaction","transactionEvaluationRequest",r);const i="/guardian/v1/transactions/{id}/evaluate".replace("{id}",encodeURIComponent(String(t))),a=new URL(i,Mj);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},c={};await Nj(c,e),c["Content-Type"]="application/json",Dj(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...c,...u,...n.headers},s.data=Fj(r,s,e),{url:Lj(a),options:s}},getTransactionByID:async(t,r,n,i={})=>{Pj("getTransactionByID","transactionID",t),Pj("getTransactionByID","chainType",r);const a="/guardian/v1/transactions/{transactionID}".replace("{transactionID}",encodeURIComponent(String(t))),o=new URL(a,Mj);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...i},u={},f={};await Nj(u,e),void 0!==r&&(f.chainType=r),void 0!==n&&(f.chainID=n),Dj(o,f);let d=s&&s.headers?s.headers:{};return c.headers={...u,...d,...i.headers},{url:Lj(o),options:c}}}}(e);return{async approvePendingTransaction(r,n,i){const a=await t.approvePendingTransaction(r,n,i);return Uj(a,Oj,Ij,e)},async evaluateTransaction(r,n,i){const a=await t.evaluateTransaction(r,n,i);return Uj(a,Oj,Ij,e)},async getTransactionByID(r,n,i,a){const o=await t.getTransactionByID(r,n,i,a);return Uj(o,Oj,Ij,e)}}};class Hj extends xj{approvePendingTransaction(e,t){return zj(this.configuration).approvePendingTransaction(e.payloadHash,e.transactionApprovalRequest,t).then((e=>e(this.axios,this.basePath)))}evaluateTransaction(e,t){return zj(this.configuration).evaluateTransaction(e.id,e.transactionEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionByID(e,t){return zj(this.configuration).getTransactionByID(e.transactionID,e.chainType,e.chainID,t).then((e=>e(this.axios,this.basePath)))}}class Gj{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 Vj="starkex",Kj="evm";function Wj(e){const t=-1!==new rn(e,16).cmp(new rn(27))?new rn(e,16).sub(new rn(27)).toNumber():new rn(e,16).toNumber();return e.trim()?t:void 0}async function Xj(e,t){const r=function(e,t=64){const r=Eb(e);return{r:new rn(r.substring(0,t),"hex"),s:new rn(r.substring(t,2*t),"hex"),recoveryParam:Wj(r.substring(2*t,2*t+2))}}(await t.signMessage(e));return Tb(wb((n=r).r.toString(16),64)+wb(n.s.toString(16),64)+wb(n.recoveryParam?.toString(16)||"",2));var n}function $j(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 Jj={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 Yj(){return Yj=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},Yj.apply(this,arguments)}var Qj;!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"}(Qj||(Qj={}));function Zj(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=Yj({},this.config,e),this.config.logLevel){case"DEBUG":this.logLevel=Qj.DEBUG;break;case"INFO":default:this.logLevel=Qj.INFO;break;case"WARN":this.logLevel=Qj.WARN;break;case"ERROR":this.logLevel=Qj.ERROR;break;case"DISABLED":this.logLevel=Qj.DISABLED}void 0===this.config.silence&&(this.config.silence=!1)}debug(e,...t){!0!==this.config.silence&&this.logLevel===Qj.DEBUG&&console.log(e,...t)}info(e,...t){!0!==this.config.silence&&this.logLevel<=Qj.INFO&&console.log(e,...t)}warn(e,...t){!0!==this.config.silence&&this.logLevel<=Qj.WARN&&(console.warn(e,...t),this.config.onwarn&&this.config.onwarn(e,t))}error(e,...t){!0!==this.config.silence&&this.logLevel<=Qj.ERROR&&(console.error(e,...t),this.config.onerror&&this.config.onerror(e,t))}}({logLevel:"INFO",silence:!0});const eq=(e=0,t=Number.MAX_SAFE_INTEGER)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function tq(){return tq=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},tq.apply(this,arguments)}const rq=(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),nq=e=>rq(iq(e)),iq=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},aq=(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 oq;!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"}(oq||(oq={}));const sq=e=>aq("https://${network}-indexer.sequence.app",{network:e}),cq=e=>aq("https://${network}-relayer.sequence.app",{network:e}),uq=e=>aq("https://nodes.sequence.app/${network}",{network:e}),fq={[oq.MAINNET]:{chainId:oq.MAINNET,name:"mainnet",title:"Ethereum",blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[oq.ROPSTEN]:{chainId:oq.ROPSTEN,name:"ropsten",title:"Ropsten",testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[oq.RINKEBY]:{chainId:oq.RINKEBY,name:"rinkeby",title:"Rinkeby",testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",disabled:!0},[oq.GOERLI]:{chainId:oq.GOERLI,name:"goerli",title:"Goerli",testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[oq.KOVAN]:{chainId:oq.KOVAN,name:"kovan",title:"Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"}},[oq.POLYGON]:{chainId:oq.POLYGON,name:"polygon",title:"Polygon",blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"}},[oq.POLYGON_MUMBAI]:{chainId:oq.POLYGON_MUMBAI,name:"mumbai",title:"Polygon Mumbai",testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"}},[oq.POLYGON_ZKEVM]:{chainId:oq.POLYGON_ZKEVM,name:"polygon-zkevm",title:"Polygon zkEVM",blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"}},[oq.BSC]:{chainId:oq.BSC,name:"bsc",title:"BNB Smart Chain",blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"}},[oq.BSC_TESTNET]:{chainId:oq.BSC_TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"}},[oq.OPTIMISM]:{chainId:oq.OPTIMISM,name:"optimism",title:"Optimism",blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"}},[oq.OPTIMISM_TESTNET]:{chainId:oq.OPTIMISM_TESTNET,name:"optimism-testnet",title:"Optimistic Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Optimism Testnet)",rootUrl:"https://kovan-optimistic.etherscan.io/"}},[oq.ARBITRUM]:{chainId:oq.ARBITRUM,name:"arbitrum",title:"Arbitrum One",blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"}},[oq.ARBITRUM_GOERLI]:{chainId:oq.ARBITRUM_GOERLI,name:"arbitrum-goerli",title:"Arbitrum Goerli",testnet:!0,blockExplorer:{name:"Arbiscan (Testnet)",rootUrl:"https://testnet.arbiscan.io/"}},[oq.ARBITRUM_NOVA]:{chainId:oq.ARBITRUM_NOVA,name:"arbitrum-nova",title:"Arbitrum Nova",blockExplorer:{name:"Nova Explorer",rootUrl:"https://nova-explorer.arbitrum.io/"}},[oq.AVALANCHE]:{chainId:oq.AVALANCHE,name:"avalanche",title:"Avalanche",blockExplorer:{name:"Snowtrace",rootUrl:"https://snowtrace.io/"}},[oq.AVALANCHE_TESTNET]:{chainId:oq.AVALANCHE_TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://testnet.snowtrace.io/"}},[oq.FANTOM]:{chainId:oq.FANTOM,name:"fantom",title:"Fantom",blockExplorer:{name:"FTMScan",rootUrl:"https://ftmscan.com/"}},[oq.FANTOM_TESTNET]:{chainId:oq.FANTOM_TESTNET,name:"fantom-testnet",title:"Fantom Testnet",testnet:!0,blockExplorer:{name:"FTMScan (Testnet)",rootUrl:"https://testnet.ftmscan.com/"}},[oq.GNOSIS]:{chainId:oq.GNOSIS,name:"gnosis",title:"Gnosis Chain",blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"}},[oq.AURORA]:{chainId:oq.AURORA,name:"aurora",title:"Aurora",blockExplorer:{name:"Aurora Explorer",rootUrl:"https://aurorascan.dev/"}},[oq.AURORA_TESTNET]:{chainId:oq.AURORA_TESTNET,name:"aurora-testnet",title:"Aurora Testnet",blockExplorer:{name:"Aurora Explorer (Testnet)",rootUrl:"https://testnet.aurorascan.dev/"}},[oq.BASE_GOERLI]:{chainId:oq.BASE_GOERLI,name:"base-goerli",title:"Base Goerli",blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"}}};nq([tq({},fq[oq.MAINNET],{rpcUrl:uq("mainnet"),relayer:{url:cq("mainnet")},indexerUrl:sq("mainnet")}),tq({},fq[oq.POLYGON],{rpcUrl:uq("polygon"),relayer:{url:cq("polygon")},indexerUrl:sq("polygon"),isDefaultChain:!0,isAuthChain:!0}),tq({},fq[oq.BSC],{rpcUrl:uq("bsc"),indexerUrl:sq("bsc"),relayer:{url:cq("bsc")}}),tq({},fq[oq.AVALANCHE],{rpcUrl:uq("avalanche"),indexerUrl:sq("avalanche"),relayer:{url:cq("avalanche")}}),tq({},fq[oq.ARBITRUM],{rpcUrl:uq("arbitrum"),indexerUrl:sq("arbitrum"),relayer:{url:cq("arbitrum")}}),tq({},fq[oq.ARBITRUM_NOVA],{rpcUrl:uq("arbitrum-nova"),indexerUrl:sq("arbitrum-nova"),relayer:{url:cq("arbitrum-nova")}}),tq({},fq[oq.OPTIMISM],{rpcUrl:uq("optimism"),indexerUrl:sq("optimism"),relayer:{url:cq("optimism")}}),tq({},fq[oq.POLYGON_ZKEVM],{rpcUrl:uq("polygon-zkevm"),indexerUrl:sq("polygon-zkevm"),relayer:{url:cq("polygon-zkevm")}}),tq({},fq[oq.GNOSIS],{rpcUrl:uq("gnosis"),indexerUrl:sq("gnosis"),relayer:{url:cq("gnosis")}})]),nq([tq({},fq[oq.RINKEBY],{rpcUrl:uq("rinkeby"),relayer:{url:cq("rinkeby")},indexerUrl:sq("rinkeby")}),tq({},fq[oq.GOERLI],{rpcUrl:uq("goerli"),relayer:{url:cq("goerli")},indexerUrl:sq("goerli")}),tq({},fq[oq.POLYGON_MUMBAI],{rpcUrl:uq("mumbai"),relayer:{url:cq("mumbai")},indexerUrl:sq("mumbai"),isDefaultChain:!0,isAuthChain:!0}),tq({},fq[oq.BSC_TESTNET],{rpcUrl:uq("bsc-testnet"),relayer:{url:cq("bsc-testnet")},indexerUrl:sq("bsc-testnet")}),tq({},fq[oq.ARBITRUM_GOERLI],{rpcUrl:uq("arbitrum-goerli"),relayer:{url:cq("arbitrum-goerli")},indexerUrl:sq("arbitrum-goerli")}),tq({},fq[oq.BASE_GOERLI],{rpcUrl:uq("base-goerli"),relayer:{url:cq("base-goerli")},indexerUrl:sq("base-goerli")})]);const dq="2.0";function lq(){return lq=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},lq.apply(this,arguments)}let hq;function pq(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"}(hq||(hq={}));const mq={batchSize:50,timeWindow:50,contract:"0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E",verbose:!1};let bq=class e{constructor(t){var r=this;if(this.batchableJsonRpcMethods=[hq.ethCall,hq.ethGetCode,hq.ethGetBalance],this.multicallInterface=new Rs(Jj.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]=pq(t,(e=>{try{if(e.next!==n)return!1;switch(e.request.method){case hq.ethCall:if(e.request.params[0].from||e.request.params[0].gasPrice||e.request.params[0].value)return!1;case hq.ethGetBalance:case hq.ethGetCode:const t=function(e){if(void 0===e)return"latest";switch(e){case"earliest":case"latest":case"pending":return e}return Hn.from(e)}(e.request.params[1]);if(void 0===i&&(i=t),!function(e,t){return e===t||(Hn.isBigNumber(e)?!!Hn.isBigNumber(t)&&e.eq(t):!Hn.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 hq.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 hq.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 hq.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]=pq(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=eq(),u=await async function(e,t){try{return await e}catch(e){return t instanceof Function?t(e):t}}(Zj(n)({id:c,jsonrpc:dq,method:hq.ethCall,params:[{to:r.options.contract,value:0,data:s},Hn.isBigNumber(i)?i.toNumber():i]}),(e=>({jsonrpc:dq,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 hq.ethCall:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:f[1][t]});break;case hq.ethGetCode:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:wo.decode(["bytes"],f[1][t])[0]});break;case hq.ethGetBalance:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:wo.decode(["uint256"],f[1][t])[0]})}else r.forward(e)}))},this.options=t?lq({},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}};bq.DefaultOptions=lq({},mq);const yq=["getNetwork","getBlockNumber","getGasPrice","getTransactionCount","getStorageAt","sendTransaction","estimateGas","getBlock","getTransaction","getTransactionReceipt","getLogs","emit","litenerCount","addListener","removeListener","waitForTransaction","detectNetwork","getBlockWithTransactions"];var gq=Object.freeze({__proto__:null,ProxyMethods:yq,MulticallProvider:class extends Lh{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 Bh(r,n.address,n.name):null}return t.getResolver(await e)},this.next=async function(e,t){try{switch(e.method){case hq.ethCall:r.callback(e,t,await r.provider.call(e.params[0],e.params[1]));break;case hq.ethGetCode:r.callback(e,t,await r.provider.getCode(e.params[0],e.params[1]));break;case hq.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=bq.isMulticall(t)?t:new bq(t),yq.forEach((t=>{void 0!==e[t]&&(this[t]=(...r)=>e[t](...r))}))}callback(e,t,r,n){t(n,{jsonrpc:dq,id:e.id,result:r,error:n})}async call(e,t){return this.rpcCall(hq.ethCall,e,t)}async getCode(e,t){return this.rpcCall(hq.ethGetCode,e,t)}async getBalance(e,t){return this.rpcCall(hq.ethGetBalance,e,t)}async rpcCall(e,...t){const r=eq();return(await Zj(this.multicall.handle)(this.next,{jsonrpc:dq,id:r,method:e,params:t})).result}},MulticallExternalProvider:class{constructor(e,t){if(this.provider=e,this.multicall=void 0,this.multicall=bq.isMulticall(t)?t:new bq(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=bq.isMulticall(e)?e:new bq(e);return(e,n)=>r.handle(t,e,n)}}),vq=Object.freeze({__proto__:null,Multicall:bq,providers:gq});let wq,_q;try{wq=localStorage}catch(e){const t=new Map;wq={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 Eq(e){return void 0!==e.address&&!function(e){return Aq(e)||Tq(e)||Sq(e)}(e)}function Aq(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 Sq(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"}(_q||(_q={}));const Rq=e=>{if("string"!=typeof e)return e;const t=e.replace("0x",""),r=Hn.from(`0x${t.slice(0,4)}`).toNumber(),n=[];for(let e=4;e<t.length;){const r=Hn.from(t.slice(e,e+2)).toNumber();e+=2;const i=Hn.from(`0x${t.slice(e,e+2)}`).toNumber();switch(e+=2,r){case _q.Address:const r=la(t.slice(e,e+40));e+=40,n.push({weight:i,address:r});break;case _q.EOA:const a=_n(`0x${t.slice(e,e+132)}`);e+=132;const o=Nn(a.slice(0,65)),s=o.r,c=o.s,u=o.v,f=Hn.from(a[a.length-1]).toNumber();n.push({weight:i,signature:a,r:s,s:c,v:u,t:f});break;case _q.Full:const d=la(t.slice(e,e+40));e+=40;const l=Hn.from(`0x${t.slice(e,e+4)}`).mul(2).toNumber();e+=4;const h=_n(`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}},kq=e=>{if("string"==typeof e)return kq(Rq(e));const t=e.signers.map((e=>{if(Eq(e))return um(["uint8","uint8","address"],[_q.Address,e.weight,e.address]);if(Tq(e))return um(["uint8","uint8","bytes32","bytes32","uint8","uint8"],[_q.EOA,e.weight,e.r,e.s,e.v,e.t]);if(Sq(e)){const t=_n(e.signature).length;return um(["uint8","uint8","address","uint16","bytes"],[_q.Full,e.weight,e.address,t,e.signature])}if(Aq(e))return um(["uint8","uint8","bytes"],[_q.EOA,e.weight,e.signature]);throw Error("Unkwnown signature part type")}));return um(["uint16",...Array(t.length).fill("bytes")],[e.threshold,...t])};var Oq;!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"}(Oq||(Oq={}));class Iq extends Error{type;constructor(e,t){super(e),this.type=t}}const xq=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 Iq(r,t)}},Cq="passport_credentials",Mq="pkce_state",Pq="pkce_verifier";class Nq{saveCredentials(e){if(!this.areValid(e))throw Error("Invalid credentials.");localStorage.setItem(Cq,JSON.stringify(e))}getCredentials(){const e=localStorage.getItem(Cq);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=cB(e).exp??0;return t>Date.now()/1e3+3600}catch(e){return!1}}clearCredentials(){localStorage.removeItem(Cq)}savePKCEData(e){localStorage.setItem(Mq,e.state),localStorage.setItem(Pq,e.verifier)}getPKCEData(){const e=localStorage.getItem(Mq),t=localStorage.getItem(Pq);return e&&t?{state:e,verifier:t}:null}}function Bq(e){const{id_token:t,expired:r}=e;return!!r||function(e){if(!e)return!1;const t=cB(e),r=Math.floor(Date.now()/1e3);return t.exp<r}(t)}const Dq={headers:{"Content-Type":"application/x-www-form-urlencoded"}};function Fq(e){return new Promise((t=>{setTimeout(t,e)}))}class Lq{userManager;config;deviceCredentialsManager;logoutMode;constructor(e){this.config=e,this.userManager=new class{constructor(e){this._logger=new pB("UserManager"),this.settings=new zB(e),this._client=new class{constructor(e){this._logger=new pB("OidcClient"),this.settings=new kB(e),this.metadataService=new class{constructor(e){this._settings=e,this._logger=new pB("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new SB(["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 pB("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:MB;for(const r of e)PB.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 pB("ResponseValidator"),this._userInfoService=new class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new pB("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const r=yB.decode(e);return t.debug("JWT decoding successful"),r}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new SB(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 OB(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 _B(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 _B(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=yB.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){const e=yB.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 OB(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 pB("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 xB({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 A=E.state;return await this.settings.stateStore.set(A.id,A.toStorageString()),E}async readSigninResponseState(e,t=!1){const r=this._logger.create("readSigninResponseState"),n=new CB(wB.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:xB.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 CB(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 CB(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 pB("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 IB({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")}}(wB.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 _B(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:IB.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"),IB.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 pB("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 pB("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new GB({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,t=!1){this._logger.create("callback"),GB.notifyOpener(e,t)}}(this.settings),this._iframeNavigator=new class{constructor(e){this._settings=e,this._logger=new pB("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new HB({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),HB.notifyParent(e,this._settings.iframeNotifyParentOrigin)}}(this.settings),this._events=new VB(this.settings),this._silentRenewService=new class{constructor(e){this._userManager=e,this._logger=new pB("SilentRenewService"),this._isStarted=!1,this._retryTimer=new vB("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 EB)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 pB("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 pB("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 NB({...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 _B)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 NB(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 _B({...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"),NB.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 RB({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 Nq,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=cB(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 xq((async()=>{const e=await this.userManager.signinPopup({popupWindowFeatures:{width:410,height:450}});return Lq.mapOidcUserToDomainModel(e)}),Oq.AUTHENTICATION_ERROR)}async loginCallback(){return xq((async()=>this.userManager.signinPopupCallback()),Oq.AUTHENTICATION_ERROR)}async loginWithDeviceFlow(){return xq((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},Dq);return{code:e.data.user_code,deviceCode:e.data.device_code,url:e.data.verification_uri_complete,interval:e.data.interval}}),Oq.AUTHENTICATION_ERROR)}async connectImxDeviceFlow(e,t,r){return xq((async()=>{const n=Date.now();for(;;){if(null!=r&&Date.now()-n>r)throw new Error("Timed out");await Fq(1e3*t);try{const t=await this.getDeviceFlowToken(e),r=Lq.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")}),Oq.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},Dq)).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=Lq.base64URLEncode((void 0)(32)),t=Lq.base64URLEncode(Lq.sha256(e)),r=Lq.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 xq((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=Lq.mapDeviceTokenResponseToDomainUserModel(n);return i.imx?.ethAddress&&i.imx?.starkAddress&&i.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(n),i}),Oq.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},Dq)).data}async connectImxWithCredentials(e){return xq((async()=>{if(this.deviceCredentialsManager.areValid(e))return Lq.mapDeviceTokenResponseToDomainUserModel(e);const t=e?.refresh_token??null;if(t){return await this.refreshToken(t)}return null}),Oq.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},Dq)).data;return Lq.mapDeviceTokenResponseToDomainUserModel(t)}async logout(){return xq((async()=>"silent"===this.logoutMode?this.userManager.signoutSilent():this.userManager.signoutRedirect()),Oq.LOGOUT_ERROR)}async logoutSilentCallback(e){return this.userManager.signoutSilentCallback(e)}async logoutDeviceFlow(){return xq((async()=>{this.deviceCredentialsManager.clearCredentials()}),Oq.LOGOUT_ERROR)}async loginSilent(){return xq((async()=>this.getUser()),Oq.SILENT_LOGIN_ERROR)}async getWebUser(){const e=await this.userManager.getUser();if(!e)return null;if(!Bq(e))return Lq.mapOidcUserToDomainModel(e);if(e.refresh_token){const e=await this.userManager.signinSilent();if(e)return Lq.mapOidcUserToDomainModel(e)}return null}async getUser(){return xq((async()=>{const e=await this.getWebUser();if(e)return e;const t=this.deviceCredentialsManager.getCredentials();return t?Lq.mapDeviceTokenResponseToDomainUserModel(t):null}),Oq.NOT_LOGGED_IN_ERROR)}async getUserDeviceFlow(){return xq((async()=>{const e=this.deviceCredentialsManager.getCredentials();return e?Lq.mapDeviceTokenResponseToDomainUserModel(e):null}),Oq.NOT_LOGGED_IN_ERROR)}checkStoredDeviceFlowCredentials(){return this.deviceCredentialsManager.getCredentials()}}class Uq{config;magicClient;constructor(e){this.config=e}async login(e,t){return xq((async()=>(this.magicClient=new WL(this.config.magicPublishableApiKey,{extensions:[new $L],network:t}),await this.magicClient.openid.loginWithOIDC({jwt:e,providerId:this.config.magicProviderId}),this.magicClient.rpcProvider)),Oq.WALLET_CONNECTION_ERROR)}async logout(){this.magicClient?.user&&await this.magicClient.user.logout()}}const jq=1e3,qq=3,zq=async(e,t)=>{const{retries:r=qq,interval:n=jq,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)}))),zq(e,{retries:r-1,finalErr:i,finallyFn:a}))}finally{r<=0&&a()}var o};var Hq,Gq;!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"}(Hq||(Hq={})),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"}(Gq||(Gq={}));class Vq extends Error{message;code;constructor(e,t){super(t),this.message=t,this.code=e}}const Kq="Transaction requires confirmation but this functionality is not supported in this environment. Please contact Immutable support if you need to enable this feature.",Wq=e=>Hn.from(e).toString();class Xq{transactionAPI;messageAPI;confirmationScreen;imxEtherAddress;crossSdkBridgeEnabled;constructor({accessToken:e,confirmationScreen:t,imxEtherAddress:r,config:n}){const i=new Gj({accessToken:e,basePath:n.imxPublicApiDomain});this.confirmationScreen=t,this.transactionAPI=new Hj(new Gj(i)),this.imxEtherAddress=r,this.crossSdkBridgeEnabled=n.crossSdkBridgeEnabled,this.messageAPI=new qj(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 zq((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(Kq);if(!(await this.confirmationScreen.requestConfirmation(e,this.imxEtherAddress,Vj)).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?Wq(e.gasLimit):"0",target:e.to??Ia,value:e.value?Wq(e.value):"0",data:e.data?e.data.toString():"0x"})))}catch(e){const t=e instanceof Error?e.message:String(e);throw new Vq(Gq.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 Vq(Gq.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 Vq(Gq.TRANSACTION_REJECTED,Kq);if(a&&o){if(!(await this.confirmationScreen.requestConfirmation(o,this.imxEtherAddress,Kj,e)).confirmed)throw new Vq(Gq.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 Vq(Gq.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 Vq(Gq.TRANSACTION_REJECTED,Kq);if(i&&n){if(!(await this.confirmationScreen.requestMessageConfirmation(n)).confirmed)throw new Vq(Gq.TRANSACTION_REJECTED,"Signature rejected by user")}else this.confirmationScreen.closeWindow()}}var $q,Jq;!function(e){e.LOGGED_OUT="loggedOut"}($q||($q={})),function(e){e.PRODUCTION="mainnet",e.SANDBOX="goerli"}(Jq||(Jq={}));const Yq="ERC721";const Qq="ERC721";class Zq{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 Xq({accessToken:e.accessToken,confirmationScreen:n,imxEtherAddress:e.imx.ethAddress,config:i}),a.on($q.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 Iq("User has been logged out",Oq.NOT_LOGGED_IN_ERROR)}async transfer(e){return this.checkIsLoggedIn(),async function({request:e,transfersApi:t,starkSigner:r,user:n,guardianClient:i}){return xq(i.withDefaultConfirmationScreenTask((async()=>{const a=e.type===Qq?"1":e.amount,o={sender:n.imx.ethAddress,token:$j(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}})),Oq.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}registerOffchain(){throw new Iq("Operation not supported",Oq.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOnchain(){throw new Iq("Operation not supported",Oq.OPERATION_NOT_SUPPORTED_ERROR)}createOrder(e){return this.checkIsLoggedIn(),async function({starkSigner:e,user:t,request:r,ordersApi:n,guardianClient:i}){return xq(i.withDefaultConfirmationScreenTask((async()=>{const{ethAddress:a}=t.imx,o=r.sell.type===Yq?"1":r.sell.amount,s=r.buy.type===Yq?"1":r.buy.amount,c={Authorization:`Bearer ${t.accessToken}`},u={user:a,amount_buy:s,token_buy:$j(r.buy),amount_sell:o,token_sell:$j(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}})),Oq.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 xq(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}})),Oq.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 xq(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})),Oq.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 xq(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:$j({type:Qq,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}})),Oq.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 xq((async()=>{const{ethAddress:i}=e.imx,a=r.amount,o=await n.getExchangeSignableTransfer({id:r.transactionID,getSignableTransferRequest:{sender:i,token:$j(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}}),Oq.EXCHANGE_TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,exchangesApi:this.immutableXClient.exchangeApi})}deposit(e){throw new Iq("Operation not supported",Oq.OPERATION_NOT_SUPPORTED_ERROR)}prepareWithdrawal(e){throw new Iq("Operation not supported",Oq.OPERATION_NOT_SUPPORTED_ERROR)}completeWithdrawal(e,t){throw new Iq("Operation not supported",Oq.OPERATION_NOT_SUPPORTED_ERROR)}getAddress(){return this.checkIsLoggedIn(),Promise.resolve(this.user.imx.ethAddress)}}class ez{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 Iq("Failed to initialise",Oq.WALLET_CONNECTION_ERROR);const t=await this.magicAdapter.login(e.idToken,this.config.network),r=new Zp(t).getSigner(),n=await(async e=>xq((async()=>kx(await HN(e))),Oq.WALLET_CONNECTION_ERROR))(r);if(!e.imx?.ethAddress){const t=await this.registerStarkEx(r,n,e.accessToken);return new Zq({user:t,starkSigner:n,immutableXClient:this.immutableXClient,confirmationScreen:this.confirmationScreen,config:this.config,passportEventEmitter:this.passportEventEmitter})}return new Zq({user:e,starkSigner:n,immutableXClient:this.immutableXClient,confirmationScreen:this.confirmationScreen,config:this.config,passportEventEmitter:this.passportEventEmitter})}async registerStarkEx(e,t,r){return xq((async()=>{await async function({ethSigner:e,starkSigner:t,usersApi:r},n){return xq((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 Xj(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}),Oq.USER_REGISTRATION_ERROR)}({ethSigner:e,starkSigner:t,usersApi:this.immutableXClient.usersApi},r);return await zq((async()=>{const e=await this.authManager.loginSilent();return!!e?.imx?e:Promise.reject(new Error("user wallet addresses not exist"))}))}),Oq.REFRESH_TOKEN_ERROR)}}const tz=(e,t,r)=>{const n=t.map((t=>!e[t]&&t)).filter((e=>e)).join(", ");if(""!==n){throw new Iq(r?`${r} - ${n} cannot be null`:`${n} cannot be null`,Oq.INVALID_CONFIGURATION)}};class rz{network;authenticationDomain;passportDomain;imxPublicApiDomain;magicPublishableApiKey;magicProviderId;oidcConfiguration;baseConfig;zkEvmRpcUrl;relayerUrl;multiRollupConfig;crossSdkBridgeEnabled;constructor({baseConfig:e,overrides:r,crossSdkBridgeEnabled:n,...i}){if(tz(i,["clientId","logoutRedirectUri","redirectUri"]),this.oidcConfiguration=i,this.baseConfig=e,this.crossSdkBridgeEnabled=n||!1,r)tz(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=Jq.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=Jq.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 nz;!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"}(nz||(nz={}));const iz="imx_passport_confirmation";class az{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===iz)switch(e.messageType){case nz.CONFIRMATION_WINDOW_READY:break;case nz.TRANSACTION_CONFIRMED:i({confirmed:!0});break;case nz.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===Vj?`${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===iz)switch(e.messageType){case nz.CONFIRMATION_WINDOW_READY:break;case nz.MESSAGE_CONFIRMED:t({confirmed:!0});break;case nz.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===iz&&(window.removeEventListener("message",n),r.remove(),i.messageType===nz.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 oz,sz;!function(e){e.PENDING="PENDING",e.SUBMITTED="SUBMITTED",e.SUCCESSFUL="SUCCESSFUL",e.REVERTED="REVERTED",e.FAILED="FAILED"}(oz||(oz={})),function(e){e.ACCOUNTS_CHANGED="accountsChanged"}(sz||(sz={}));class cz{emitter=new g_;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 uz=(e,t,r)=>um(["string","uint256","address","bytes32"],["",e,t,r]),fz=async(e,t,r,n,i)=>{const a=e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit??Ca,target:e.to??Ia,value:e.value??Ca,data:e.data??[]})));const o=function(e,t){return Ji(wo.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=_n(Ji(uz(r,n,o))),c=await i.signMessage(s),u=kq({threshold:1,signers:[{weight:1,signature:`${c}02`}]}),f=new Rs(Jj.mainModule.abi);return f.encodeFunctionData(f.getFunction("execute"),[a,t,u])},dz=async(e,t,r,n,i)=>{const a={...e.types};delete a.EIP712Domain;const o=ys.hash(e.domain,a,e.message),s=_n(Ji(uz(r,n,o))),c=`${await i.signMessage(s)}02`,{signers:u}=(e=>Rq(`0000${e}`))(t);return kq({threshold:2,signers:[...u,{weight:1,signature:c}]})},lz=e=>`eip155:${e}`;class hz{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:lz(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:lz(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:lz(r)}]},{result:i}=await this.postToRelayer(n);return i}}const pz=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 Zp(r).getSigner(),o=await a.getAddress(),s=await Xj("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 Vq(Gq.INTERNAL_ERROR,`Failed to create counterfactual address: ${e}`)}let u;if(t.crossSdkBridgeEnabled){const t=e.checkStoredDeviceFlowCredentials();if(!t||!t.refresh_token)throw new Vq(Gq.INTERNAL_ERROR,"Cross SDK bridge: Failed to refresh user details");u=await e.refreshToken(t.refresh_token)}else u=await e.loginSilent();if(!u?.zkEvm)throw new Vq(Gq.INTERNAL_ERROR,"Failed to refresh user details");return u}({authManager:e,config:t,magicProvider:a,multiRollupApiClients:n,accessToken:i.accessToken});return{user:r,magicProvider:a}}return{user:i,magicProvider:a}},mz=({params:e,magicProvider:t,jsonRpcProvider:r,relayerClient:n,guardianClient:i,user:a})=>i.withConfirmationScreen({width:480,height:520})((async()=>{const o=e[0];if(!o.to)throw new Vq(Gq.INVALID_PARAMS,'eth_sendTransaction requires a "to" field');const{chainId:s}=await r.ready,c=Hn.from(s),u=new Zp(t).getSigner(),f=await(async(e,t)=>{const r=await e.send("eth_getCode",[t,"latest"]);if(r&&"0x"!==r)return new ud(t,Jj.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 fz([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:lz(s),nonce:Wq(f),user:a,metaTransactions:[d,p]});const m=await fz([d,p],f,c,a.zkEvm.ethAddress,u),b=await n.ethSendTransaction(a.zkEvm.ethAddress,m),y=await zq((async()=>{const e=await n.imGetTransactionByHash(b);if(e.status===oz.PENDING)throw new Error;return e}),{retries:30,interval:1e3,finalErr:new Vq(Gq.RPC_SERVER_ERROR,"transaction hash not generated in time")});if(![oz.SUBMITTED,oz.SUCCESSFUL].includes(y.status)){let e=`Transaction failed to submit with status ${y.status}.`;throw y.statusMessage&&(e+=` Error message: ${y.statusMessage}`),new Vq(Gq.RPC_SERVER_ERROR,e)}return y.hash})),bz=["types","domain","primaryType","message"],yz=(e,t)=>{let r;if("string"==typeof e)try{r=JSON.parse(e)}catch(e){throw new Vq(Gq.INVALID_PARAMS,`Failed to parse typed data JSON: ${e}`)}else{if("object"!=typeof e)throw new Vq(Gq.INVALID_PARAMS,`Invalid typed data argument: ${e}`);r=e}if(!(e=>bz.every((t=>t in e)))(r))throw new Vq(Gq.INVALID_PARAMS,`Invalid typed data argument. The following properties are required: ${bz.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 Vq(Gq.INVALID_PARAMS,`Invalid chainId, expected ${t}`);return r};class gz{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 Yh(this.config.zkEvmRpcUrl),this.multiRollupApiClients=i,this.eventEmitter=new cz,a.on($q.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(sz.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 pz({authManager:this.authManager,config:this.config,magicAdapter:this.magicAdapter,multiRollupApiClients:this.multiRollupApiClients});return this.user=t,this.magicProvider=e,this.relayerClient=new hz({config:this.config,jsonRpcProvider:this.jsonRpcProvider,user:this.user}),this.guardianClient=new Xq({accessToken:this.user.accessToken,confirmationScreen:this.confirmationScreen,imxEtherAddress:this.user.zkEvm.ethAddress,config:this.config}),this.eventEmitter.emit(sz.ACCOUNTS_CHANGED,[this.user.zkEvm.ethAddress]),[this.user.zkEvm.ethAddress]}case"eth_sendTransaction":if(!this.isLoggedIn())throw new Vq(Hq.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");return mz({params:e.params||[],magicProvider:this.magicProvider,guardianClient:this.guardianClient,jsonRpcProvider:this.jsonRpcProvider,relayerClient:this.relayerClient,user:this.user});case"eth_accounts":return this.isLoggedIn()?[this.user.zkEvm.ethAddress]:[];case"eth_signTypedData":case"eth_signTypedData_v4":if(!this.isLoggedIn())throw new Vq(Hq.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 Vq(Gq.INVALID_PARAMS,`${t} requires an address and a typed data JSON`);const{chainId:u}=await n.ready,f=yz(c,u);await a.validateMessage({chainID:String(u),payload:f,user:o});const d=await i.imSignTypedData(s,f),l=new Zp(r).getSigner();return dz(f,d,Hn.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 Vq(Hq.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 Vq?e:e instanceof Error?new Vq(Gq.INTERNAL_ERROR,e.message):new Vq(Gq.INTERNAL_ERROR,"Internal error"),{id:t,jsonrpc:r,error:n}}}async request(e){try{return this.performRequest(e)}catch(e){if(e instanceof Vq)throw e;if(e instanceof Error)throw new Vq(Gq.INTERNAL_ERROR,e.message);throw new Vq(Gq.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 Vq(Gq.INVALID_REQUEST,"Invalid request")}on(e,t){this.eventEmitter.on(e,t)}removeListener(e,t){this.eventEmitter.removeListener(e,t)}}var vz=Object.freeze({__proto__:null,JsonRpcError:Vq,get Networks(){return Jq},Passport:class{authManager;config;confirmationScreen;immutableXClient;magicAdapter;multiRollupApiClients;passportImxProviderFactory;passportEventEmitter;constructor(e){this.config=new rz(e),this.authManager=new Lq(this.config),this.magicAdapter=new Uq(this.config),this.confirmationScreen=new az(this.config),this.immutableXClient=e.overrides?.immutableXClient||new XN({baseConfig:e.baseConfig}),this.multiRollupApiClients=new Ft(this.config.multiRollupConfig),this.passportEventEmitter=new cz,this.passportImxProviderFactory=new ez({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===Jq.PRODUCTION)throw new Error("EVM is not supported on production network");return new gz({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($q.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:Iq,get ProviderErrorCode(){return Hq},get ProviderEvent(){return sz},get RpcErrorCode(){return Gq}}),wz=Yt("object"==typeof self?self.FormData:window.FormData),_z={},Ez={},Az=Qt(vq),Tz=Qt(Sm),Sz={},Rz=Qt(ks),kz=Qt(ya),Oz=Qt(So),Iz=Qt(md),xz=Qt(Dn),Cz=Qt(gs),Mz=Qt(Vd),Pz=Qt(Ol),Nz=Qt(Yi),Bz=Qt(pn),Dz=Qt(_d),Fz=Qt(lm),Lz=Qt(Yd),Uz=Qt(vi),jz=Qt(oa),qz=Qt(If),zz=Qt(ho),Hz=Qt(Wf),Gz=Qt(wm),Vz=Qt(Nl),Kz=Qt(Ql);!function(e){var t=Jt&&Jt.__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=Jt&&Jt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=Jt&&Jt.__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=Rz;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=kz;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(Oz);e.base64=o;var s=Iz;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var c=xz;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=Cz;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=Mz;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=Pz;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return d.getJsonWalletAddress}});var l=Nz;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return l.keccak256}});var h=Bz;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return h.Logger}});var p=Dz;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=Fz;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=Lz;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return b.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return b.shuffled}});var y=Uz;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(jz);e.RLP=g;var v=qz;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=zz;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 _=Hz;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=Gz;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 A=Vz;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return A.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return A.verifyTypedData}});var T=Kz;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return T._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return T.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return T.poll}});var S=Dz;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return S.SupportedAlgorithm}});var R=zz;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return R.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return R.Utf8ErrorReason}})}(Sz);var Wz={};Object.defineProperty(Wz,"__esModule",{value:!0}),Wz.DomainRegistryABI=void 0;Wz.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 Xz={};Object.defineProperty(Xz,"__esModule",{value:!0}),Xz.SeaportABIv14=void 0;Xz.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 $z={};!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"}($z);var Jz={},Yz={};Object.defineProperty(Yz,"__esModule",{value:!0}),Yz.ERC20ABI=void 0;Yz.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 Qz={};Object.defineProperty(Qz,"__esModule",{value:!0}),Qz.ERC721ABI=void 0;Qz.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 Zz,eH={},tH={};function rH(){if(Zz)return tH;Zz=1,Object.defineProperty(tH,"__esModule",{value:!0}),tH.getItemToCriteriaMap=tH.generateCriteriaResolvers=void 0;const e=$z,t=aH();tH.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 tH.getItemToCriteriaMap=(e,r)=>{const n=[...r];return e.reduce(((e,r)=>((0,t.isCriteriaItem)(r.itemType)&&e.set(r,n.shift()),e)),new Map)},tH}var nH,iH={};function aH(){return nH||(nH=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=$z,n=rH(),i=iH;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)}}(eH)),eH}!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}}(iH);var oH={};!function(e){var t=Jt&&Jt.__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=Sz;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)}(oH);var sH=Jt&&Jt.__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(Jz,"__esModule",{value:!0}),Jz.getApprovalActions=Jz.approvedItemAmount=void 0;const cH=Tz,uH=Yz,fH=Qz,dH=$z,lH=aH(),hH=oH;Jz.approvedItemAmount=(e,t,r,n)=>sH(void 0,void 0,void 0,(function*(){if((0,lH.isErc721Item)(t.itemType)||(0,lH.isErc1155Item)(t.itemType)){return new cH.Contract(t.token,fH.ERC721ABI,n).isApprovedForAll(e,r).then((e=>e?dH.MAX_INT:cH.BigNumber.from(0)))}if(t.itemType===dH.ItemType.ERC20){return new cH.Contract(t.token,uH.ERC20ABI,n).allowance(e,r)}return dH.MAX_INT})),Jz.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,lH.isErc1155Item)(i);if((0,lH.isErc721Item)(i)||s){const o=new cH.Contract(e,fH.ERC721ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,operator:n,transactionMethods:(0,hH.getTransactionMethods)(o.connect(r),t&&!s?"approve":"setApprovalForAll",[n,!(t&&!s)||a])}}{const s=new cH.Contract(e,uH.ERC20ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,transactionMethods:(0,hH.getTransactionMethods)(s.connect(r),"approve",[n,t?o:dH.MAX_INT]),operator:n}}}))};var pH={},mH={},bH={};Object.defineProperty(bH,"__esModule",{value:!0}),bH.ERC1155ABI=void 0;bH.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 yH=Jt&&Jt.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(mH,"__esModule",{value:!0}),mH.balanceOf=void 0;const gH=Tz,vH=bH,wH=Yz,_H=Qz,EH=$z,AH=aH();mH.balanceOf=(e,t,r,n)=>yH(void 0,void 0,void 0,(function*(){if((0,AH.isErc721Item)(t.itemType)){const i=new gH.Contract(t.token,_H.ERC721ABI,r);return t.itemType===EH.ItemType.ERC721_WITH_CRITERIA?n?i.ownerOf(n.identifier).then((t=>gH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase())))):i.balanceOf(e):i.ownerOf(t.identifierOrCriteria).then((t=>gH.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase()))))}if((0,AH.isErc1155Item)(t.itemType)){const i=new gH.Contract(t.token,vH.ERC1155ABI,r);if(t.itemType===EH.ItemType.ERC1155_WITH_CRITERIA){if(!n){const e=gH.BigNumber.from(t.startAmount),r=gH.BigNumber.from(t.endAmount);return e.gt(r)?e:r}return i.balanceOf(e,n.identifier)}return i.balanceOf(e,t.identifierOrCriteria)}if((0,AH.isErc20Item)(t.itemType)){return new gH.Contract(t.token,wH.ERC20ABI,r).balanceOf(e)}return r.getBalance(e)})),function(e){var t=Jt&&Jt.__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=$z,i=Jz,a=mH,o=rH(),s=aH(),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}}(pH);var TH,SH={},RH={},kH={},OH={},IH={exports:{}},xH={exports:{}};function CH(){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}()}(xH)),xH.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}(CH())}(IH);var MH=IH.exports,PH={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}()}(PH);var NH,BH=PH.exports,DH={},FH={exports:{}},LH={exports:{}};function UH(){return NH||(NH=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}(CH())}(LH)),LH.exports}var jH,qH={exports:{}};function zH(){return jH||(jH=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}(CH())}(qH)),qH.exports}var HH,GH={exports:{}};function VH(){return HH||(HH=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}(CH())}(GH)),GH.exports}var KH,WH={exports:{}};function XH(){return KH||(KH=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}(CH())}(WH)),WH.exports}var $H,JH={exports:{}};function YH(){return $H||($H=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],A=e[t+12],T=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,A,7,s[12]),x=u(x,k,O,I,T,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,T,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,A,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,T,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,A,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,A,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,T,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}(CH())}(JH)),JH.exports}var QH,ZH={exports:{}};function eG(){return QH||(QH=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}(CH())}(ZH)),ZH.exports}var tG,rG={exports:{}};var nG,iG={exports:{}};function aG(){return nG||(nG=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,A=f.high,T=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=A,j=T,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,Ae=H+ge+((de=G+ve)>>>0<G>>>0?1:0),Te=ye+me;H=q,G=z,q=U,z=j,U=F,j=L,F=B+(Ae=(Ae=(Ae=Ae+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=Ae+(be+pe+(Te>>>0<ye>>>0?1:0))+((x=de+Te|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),T=f.low=T+j,f.high=A+U+(T>>>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}(CH(),UH())}(iG)),iG.exports}var oG,sG={exports:{}};var cG,uG={exports:{}};function fG(){return cG||(cG=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,A=O.low,T=c[_];T<32?(h=E<<T|A>>>32-T,p=A<<T|E>>>32-T):(h=A<<T-32|E>>>64-T,p=E<<T-32|A>>>64-T);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}(CH(),UH())}(uG)),uG.exports}var dG,lG={exports:{}};var hG,pG={exports:{}};function mG(){return hG||(hG=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))}})}()}(CH())}(pG)),pG.exports}var bG,yG={exports:{}};var gG,vG={exports:{}};function wG(){return gG||(gG=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}(CH(),eG(),mG())}(vG)),vG.exports}var _G,EG={exports:{}};function AG(){return _G||(_G=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)}})}()}(CH(),wG())}(EG)),EG.exports}var TG,SG={exports:{}};function RG(){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}(CH(),AG())}(SG)),SG.exports}var kG,OG={exports:{}};function IG(){return kG||(kG=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}(CH(),AG())}(OG)),OG.exports}var xG,CG={exports:{}};function MG(){return xG||(xG=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
- */R8.exports=function(){if(x8)return k8;x8=1;var e=C8,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 k8.Fragment=r,k8.jsx=o,k8.jsxs=o,k8}();var M8=R8.exports;function P8(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}const N8=()=>"0.22.3";var B8,D8;P8({},"IMTBLWidgetEvents",(()=>B8)),(D8=B8||(B8={})).IMTBL_CONNECT_WIDGET_EVENT="imtbl-connect-widget",D8.IMTBL_WALLET_WIDGET_EVENT="imtbl-wallet-widget",D8.IMTBL_SWAP_WIDGET_EVENT="imtbl-swap-widget",D8.IMTBL_BRIDGE_WIDGET_EVENT="imtbl-bridge-widget",D8.IMTBL_ONRAMP_WIDGET_EVENT="imtbl-onramp-widget",D8.IMTBL_PRIMARY_REVENUE_WIDGET_EVENT="imtbl-primary-revenue-widget";var F8,L8;P8({},"ConnectEventType",(()=>F8)),(L8=F8||(F8={})).CLOSE_WIDGET="close-widget",L8.SUCCESS="success",L8.FAILURE="failure";var U8,j8;P8({},"WalletEventType",(()=>U8)),(j8=U8||(U8={})).CLOSE_WIDGET="close-widget",j8.NETWORK_SWITCH="network-switch",j8.DISCONNECT_WALLET="disconnect-wallet";var q8,z8;P8({},"SwapEventType",(()=>q8)),(z8=q8||(q8={})).CLOSE_WIDGET="close-widget",z8.SUCCESS="success",z8.FAILURE="failure",z8.REJECTED="rejected";var H8,G8;P8({},"PrimaryRevenueEventType",(()=>H8)),(G8=H8||(H8={})).CLOSE_WIDGET="close-widget",G8.SUCCESS="success",G8.FAILURE="failure",G8.REJECTED="rejected";var V8,K8;P8({},"BridgeEventType",(()=>V8)),(K8=V8||(V8={})).CLOSE_WIDGET="close-widget",K8.SUCCESS="success",K8.FAILURE="failure";var W8,X8;P8({},"OrchestrationEventType",(()=>W8)),(X8=W8||(W8={})).REQUEST_CONNECT="request-connect",X8.REQUEST_WALLET="request-wallet",X8.REQUEST_SWAP="request-swap",X8.REQUEST_BRIDGE="request-bridge",X8.REQUEST_ONRAMP="request-onramp";var $8,J8;P8({},"OnRampEventType",(()=>$8)),(J8=$8||($8={})).CLOSE_WIDGET="close-widget",J8.SUCCESS="success",J8.FAILURE="failure";var Y8,Q8,Z8,e4,t4={};P8(t4,"WidgetTheme",(()=>Y8)),P8(t4,"CheckoutWidgetTagNames",(()=>Z8)),(Q8=Y8||(Y8={})).LIGHT="light",Q8.DARK="dark",(e4=Z8||(Z8={})).CONNECT="imtbl-connect",e4.WALLET="imtbl-wallet",e4.SWAP="imtbl-swap",e4.BRIDGE="imtbl-bridge",e4.ONRAMP="imtbl-onramp";function r4(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 n4(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 i4(e){const{walletProvider:t,fromContractAddress:r,amount:n,provider:i,passport:a}=e;C8.useEffect((()=>{i&&r4(Z8.BRIDGE,i),a&&n4(Z8.BRIDGE,a)}),[i,a]);const o=window.ImtblCheckoutWidgetConfig;return M8.jsx("imtbl-bridge",{widgetConfig:o,walletProvider:t,fromContractAddress:r??"",amount:n??""})}P8({},"BridgeReact",(()=>i4));function a4({passport:e}){const t=window.ImtblCheckoutWidgetConfig;return C8.useEffect((()=>{e&&n4(Z8.CONNECT,e)}),[e]),M8.jsx("imtbl-connect",{widgetConfig:t})}P8({},"ConnectReact",(()=>a4));function o4(e){const{walletProvider:t,fromContractAddress:r,amount:n,toContractAddress:i,provider:a,passport:o}=e;C8.useEffect((()=>{a&&r4(Z8.SWAP,a),o&&n4(Z8.SWAP,o)}),[a,o]);const s=window.ImtblCheckoutWidgetConfig;return M8.jsx("imtbl-swap",{widgetConfig:s,walletProvider:t,fromContractAddress:r??"",toContractAddress:i??"",amount:n??""})}P8({},"SwapReact",(()=>o4));function s4(e){const{walletProvider:t,provider:r,passport:n}=e;C8.useEffect((()=>{r&&r4(Z8.WALLET,r),n&&n4(Z8.WALLET,n)}),[r,n]);const i=window.ImtblCheckoutWidgetConfig;return M8.jsx("imtbl-wallet",{widgetConfig:i,walletProvider:t})}P8({},"WalletReact",(()=>s4));function c4(e){const{walletProvider:t,amount:r,provider:n,passport:i,contractAddress:a}=e;C8.useEffect((()=>{n&&r4(Z8.ONRAMP,n),i&&n4(Z8.ONRAMP,i)}),[n,i]);const o=window.ImtblCheckoutWidgetConfig;return M8.jsx("imtbl-onramp",{widgetConfig:o,walletProvider:t,amount:r??"",contractAddress:a??""})}P8({},"OnRampReact",(()=>c4));var u4=Object.freeze({__proto__:null,get BridgeEventType(){return V8},BridgeReact:i4,get CheckoutWidgetTagNames(){return Z8},CheckoutWidgets: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");const t=document.createElement("script"),r=function(e){const t=N8();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);let n=`https://cdn.jsdelivr.net/npm/@imtbl/sdk@${r}/dist/browser/checkout.js`;t.setAttribute("src",n),document.head.appendChild(t),window.ImtblCheckoutWidgetConfig=JSON.stringify(e)},get ConnectEventType(){return F8},ConnectReact:a4,get IMTBLWidgetEvents(){return B8},get OnRampEventType(){return $8},OnRampReact:c4,get OrchestrationEventType(){return W8},get PrimaryRevenueEventType(){return H8},get SwapEventType(){return q8},SwapReact:o4,UpdateConfig:function(e){void 0!==window?window.ImtblCheckoutWidgetConfig=JSON.stringify(e):console.error("missing document object: please run Checkout client side")},get WalletEventType(){return U8},WalletReact:s4,get WidgetTheme(){return Y8}});e.blockchainData=$t,e.checkoutSdk=S8,e.checkoutWidgets=u4,e.config=n,e.immutablexClient=$N,e.orderbook=lW,e.passport=vz,e.provider=WW}));
66
+ */R8.exports=function(){if(x8)return k8;x8=1;var e=C8,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 k8.Fragment=r,k8.jsx=o,k8.jsxs=o,k8}();var M8=R8.exports;function P8(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var N8,B8,D8,F8,L8={};P8(L8,"WidgetTheme",(()=>N8)),P8(L8,"CheckoutWidgetTagNames",(()=>D8)),(B8=N8||(N8={})).LIGHT="light",B8.DARK="dark",(F8=D8||(D8={})).CONNECT="imtbl-connect",F8.WALLET="imtbl-wallet",F8.SWAP="imtbl-swap",F8.BRIDGE="imtbl-bridge",F8.ONRAMP="imtbl-onramp";const U8=()=>!1,j8=()=>"0.23.0-alpha";function q8(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 z8(e,t){e.setAttribute("widgetconfig",JSON.stringify(t))}function H8(e){void 0!==window?window.ImtblCheckoutWidgetConfig=JSON.stringify(e):console.error("missing window object: please run Checkout client side")}function G8(e){if(void 0===document)return void console.error("missing document object: please run Checkout client side");const t=function(e){const t=j8();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`;U8()&&(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 V8,K8;P8({},"IMTBLWidgetEvents",(()=>V8)),(K8=V8||(V8={})).IMTBL_CONNECT_WIDGET_EVENT="imtbl-connect-widget",K8.IMTBL_WALLET_WIDGET_EVENT="imtbl-wallet-widget",K8.IMTBL_SWAP_WIDGET_EVENT="imtbl-swap-widget",K8.IMTBL_BRIDGE_WIDGET_EVENT="imtbl-bridge-widget",K8.IMTBL_ONRAMP_WIDGET_EVENT="imtbl-onramp-widget",K8.IMTBL_PRIMARY_REVENUE_WIDGET_EVENT="imtbl-primary-revenue-widget";var W8,X8;P8({},"ConnectEventType",(()=>W8)),(X8=W8||(W8={})).CLOSE_WIDGET="close-widget",X8.SUCCESS="success",X8.FAILURE="failure";var $8,J8;P8({},"WalletEventType",(()=>$8)),(J8=$8||($8={})).CLOSE_WIDGET="close-widget",J8.NETWORK_SWITCH="network-switch",J8.DISCONNECT_WALLET="disconnect-wallet";var Y8,Q8;P8({},"SwapEventType",(()=>Y8)),(Q8=Y8||(Y8={})).CLOSE_WIDGET="close-widget",Q8.SUCCESS="success",Q8.FAILURE="failure",Q8.REJECTED="rejected";var Z8,e4;P8({},"PrimaryRevenueEventType",(()=>Z8)),(e4=Z8||(Z8={})).CLOSE_WIDGET="close-widget",e4.SUCCESS="success",e4.FAILURE="failure",e4.REJECTED="rejected";var t4,r4;P8({},"BridgeEventType",(()=>t4)),(r4=t4||(t4={})).CLOSE_WIDGET="close-widget",r4.SUCCESS="success",r4.FAILURE="failure";var n4,i4;P8({},"OrchestrationEventType",(()=>n4)),(i4=n4||(n4={})).REQUEST_CONNECT="request-connect",i4.REQUEST_WALLET="request-wallet",i4.REQUEST_SWAP="request-swap",i4.REQUEST_BRIDGE="request-bridge",i4.REQUEST_ONRAMP="request-onramp";var a4,o4;P8({},"OnRampEventType",(()=>a4)),(o4=a4||(a4={})).CLOSE_WIDGET="close-widget",o4.SUCCESS="success",o4.FAILURE="failure";function s4(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 c4(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 u4(e){const{walletProvider:t,fromContractAddress:r,amount:n,provider:i,passport:a}=e;C8.useEffect((()=>{i&&s4(D8.BRIDGE,i),a&&c4(D8.BRIDGE,a)}),[i,a]);const o=window.ImtblCheckoutWidgetConfig;return M8.jsx("imtbl-bridge",{widgetConfig:o,walletProvider:t,fromContractAddress:r??"",amount:n??""})}P8({},"BridgeReact",(()=>u4));function f4({passport:e}){const t=window.ImtblCheckoutWidgetConfig;return C8.useEffect((()=>{e&&c4(D8.CONNECT,e)}),[e]),M8.jsx("imtbl-connect",{widgetConfig:t})}P8({},"ConnectReact",(()=>f4));function d4(e){const{walletProvider:t,fromContractAddress:r,amount:n,toContractAddress:i,provider:a,passport:o}=e;C8.useEffect((()=>{a&&s4(D8.SWAP,a),o&&c4(D8.SWAP,o)}),[a,o]);const s=window.ImtblCheckoutWidgetConfig;return M8.jsx("imtbl-swap",{widgetConfig:s,walletProvider:t,fromContractAddress:r??"",toContractAddress:i??"",amount:n??""})}P8({},"SwapReact",(()=>d4));function l4(e){const{walletProvider:t,provider:r,passport:n}=e;C8.useEffect((()=>{r&&s4(D8.WALLET,r),n&&c4(D8.WALLET,n)}),[r,n]);const i=window.ImtblCheckoutWidgetConfig;return M8.jsx("imtbl-wallet",{widgetConfig:i,walletProvider:t})}P8({},"WalletReact",(()=>l4));function h4(e){const{walletProvider:t,amount:r,provider:n,passport:i,contractAddress:a}=e;C8.useEffect((()=>{n&&s4(D8.ONRAMP,n),i&&c4(D8.ONRAMP,i)}),[n,i]);const o=window.ImtblCheckoutWidgetConfig;return M8.jsx("imtbl-onramp",{widgetConfig:o,walletProvider:t,amount:r??"",contractAddress:a??""})}P8({},"OnRampReact",(()=>h4));var p4=Object.freeze({__proto__:null,get BridgeEventType(){return t4},BridgeReact:u4,get CheckoutWidgetTagNames(){return D8},CheckoutWidgets:function(e){void 0!==window?void 0!==document?(G8(e||{}),H8(e||{})):console.error("missing document object: please run Checkout client side"):console.error("missing window object: please run Checkout client side")},get ConnectEventType(){return W8},ConnectReact:f4,get IMTBLWidgetEvents(){return V8},get OnRampEventType(){return a4},OnRampReact:h4,get OrchestrationEventType(){return n4},get PrimaryRevenueEventType(){return Z8},get SwapEventType(){return Y8},SwapReact:d4,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(D8).forEach((t=>{const r=document.getElementsByTagName(t);if(r)for(const t of r){z8(t,{...q8(t)||{},...e})}})),H8({...t,...e})},get WalletEventType(){return $8},WalletReact:l4,get WidgetTheme(){return N8}});e.blockchainData=$t,e.checkoutSdk=S8,e.checkoutWidgets=p4,e.config=n,e.immutablexClient=$N,e.orderbook=lW,e.passport=vz,e.provider=WW}));
67
67
  //# sourceMappingURL=index.browser.js.map